author | Ted Campbell <tcampbell@mozilla.com> |
Wed, 14 Mar 2018 16:55:14 -0400 | |
changeset 431687 | cf5e7017ffdc1ebc32f564f95de1ca91bf7a5795 |
parent 431686 | 4c42d90e56a6e6364ca0ed9de11aaa79ea2f4706 |
child 431688 | c13d9e177361e3968314503b474ef0479d004d8a |
push id | 34451 |
push user | ebalazs@mozilla.com |
push date | Thu, 16 Aug 2018 09:25:15 +0000 |
treeherder | mozilla-central@161817e6d127 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | waldo |
bugs | 1483275 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -121,17 +121,17 @@ FindReservedWord(JSLinearString* str) JS::AutoCheckCannotGC nogc; return str->hasLatin1Chars() ? FindReservedWord(str->latin1Chars(nogc), str->length()) : FindReservedWord(str->twoByteChars(nogc), str->length()); } template <typename CharT> static bool -IsIdentifier(const CharT* chars, size_t length) +IsIdentifierImpl(const CharT* chars, size_t length) { using namespace js; if (length == 0) return false; if (!unicode::IsIdentifierStart(char16_t(*chars))) return false; @@ -165,17 +165,17 @@ GetSingleCodePoint(const char16_t** p, c return codePoint; } static bool IsIdentifierMaybeNonBMP(const char16_t* chars, size_t length) { using namespace js; - if (IsIdentifier(chars, length)) + if (IsIdentifierImpl(chars, length)) return true; if (length == 0) return false; const char16_t* p = chars; const char16_t* end = chars + length; uint32_t codePoint; @@ -198,30 +198,30 @@ namespace js { namespace frontend { bool IsIdentifier(JSLinearString* str) { JS::AutoCheckCannotGC nogc; MOZ_ASSERT(str); if (str->hasLatin1Chars()) - return ::IsIdentifier(str->latin1Chars(nogc), str->length()); + return ::IsIdentifierImpl(str->latin1Chars(nogc), str->length()); return ::IsIdentifierMaybeNonBMP(str->twoByteChars(nogc), str->length()); } bool IsIdentifier(const char* chars, size_t length) { - return ::IsIdentifier(chars, length); + return ::IsIdentifierImpl(chars, length); } bool IsIdentifier(const char16_t* chars, size_t length) { - return ::IsIdentifier(chars, length); + return ::IsIdentifierImpl(chars, length); } bool IsKeyword(JSLinearString* str) { if (const ReservedWordInfo* rw = FindReservedWord(str)) return TokenKindIsKeyword(rw->tokentype);
--- a/js/src/irregexp/RegExpInterpreter.cpp +++ b/js/src/irregexp/RegExpInterpreter.cpp @@ -494,15 +494,17 @@ irregexp::InterpretCode(JSContext* cx, c break; } default: MOZ_CRASH("Bad bytecode"); } } } +#undef BYTECODE + template RegExpRunStatus irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const Latin1Char* chars, size_t current, size_t length, MatchPairs* matches, size_t* endIndex); template RegExpRunStatus irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const char16_t* chars, size_t current, size_t length, MatchPairs* matches, size_t* endIndex);
--- a/js/src/jit/BaselineCacheIRCompiler.cpp +++ b/js/src/jit/BaselineCacheIRCompiler.cpp @@ -462,17 +462,17 @@ BaselineCacheIRCompiler::emitGuardXrayEx if (hasExpando) { masm.branchTestObject(Assembler::NotEqual, holderAddress, failure->label()); masm.unboxObject(holderAddress, scratch); masm.branchTestObject(Assembler::NotEqual, expandoAddress, failure->label()); masm.unboxObject(expandoAddress, scratch); // Unwrap the expando before checking its shape. masm.loadPtr(Address(scratch, ProxyObject::offsetOfReservedSlots()), scratch); - masm.unboxObject(Address(scratch, detail::ProxyReservedSlots::offsetOfPrivateSlot()), scratch); + masm.unboxObject(Address(scratch, js::detail::ProxyReservedSlots::offsetOfPrivateSlot()), scratch); masm.loadPtr(shapeWrapperAddress, scratch2.ref()); LoadShapeWrapperContents(masm, scratch2.ref(), scratch2.ref(), failure->label()); masm.branchTestObjShape(Assembler::NotEqual, scratch, *scratch2, *scratch3, scratch, failure->label()); // The reserved slots on the expando should all be in fixed slots. Address protoAddress(scratch, NativeObject::getFixedSlotOffset(GetXrayJitInfo()->expandoProtoSlot)); @@ -2042,17 +2042,17 @@ BaselineCacheIRCompiler::emitLoadDOMExpa AutoScratchRegister scratch(allocator, masm); ValueOperand output = allocator.defineValueRegister(masm, reader.valOperandId()); FailurePath* failure; if (!addFailurePath(&failure)) return false; masm.loadPtr(Address(obj, ProxyObject::offsetOfReservedSlots()), scratch); - Address expandoAddr(scratch, detail::ProxyReservedSlots::offsetOfPrivateSlot()); + Address expandoAddr(scratch, js::detail::ProxyReservedSlots::offsetOfPrivateSlot()); // Load the ExpandoAndGeneration* in the output scratch register and guard // it matches the proxy's ExpandoAndGeneration. masm.loadPtr(expandoAndGenerationAddr, output.scratchReg()); masm.branchPrivatePtr(Assembler::NotEqual, expandoAddr, output.scratchReg(), failure->label()); // Guard expandoAndGeneration->generation matches the expected generation. masm.branch64(Assembler::NotEqual,
--- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -270,45 +270,45 @@ static const ClassOps ArrayBufferObjectC nullptr, /* mayResolve */ ArrayBufferObject::finalize, nullptr, /* call */ nullptr, /* hasInstance */ nullptr, /* construct */ ArrayBufferObject::trace, }; -static const JSFunctionSpec static_functions[] = { +static const JSFunctionSpec arraybuffer_functions[] = { JS_FN("isView", ArrayBufferObject::fun_isView, 1, 0), JS_FS_END }; -static const JSPropertySpec static_properties[] = { +static const JSPropertySpec arraybuffer_properties[] = { JS_SELF_HOSTED_SYM_GET(species, "ArrayBufferSpecies", 0), JS_PS_END }; -static const JSFunctionSpec prototype_functions[] = { +static const JSFunctionSpec arraybuffer_proto_functions[] = { JS_SELF_HOSTED_FN("slice", "ArrayBufferSlice", 2, 0), JS_FS_END }; -static const JSPropertySpec prototype_properties[] = { +static const JSPropertySpec arraybuffer_proto_properties[] = { JS_PSG("byteLength", ArrayBufferObject::byteLengthGetter, 0), JS_STRING_SYM_PS(toStringTag, "ArrayBuffer", JSPROP_READONLY), JS_PS_END }; static const ClassSpec ArrayBufferObjectClassSpec = { GenericCreateConstructor<ArrayBufferObject::class_constructor, 1, gc::AllocKind::FUNCTION>, CreateArrayBufferPrototype, - static_functions, - static_properties, - prototype_functions, - prototype_properties + arraybuffer_functions, + arraybuffer_properties, + arraybuffer_proto_functions, + arraybuffer_proto_properties }; static const ClassExtension ArrayBufferObjectClassExtension = { nullptr, /* weakmapKeyDelegateOp */ ArrayBufferObject::objectMoved }; const Class ArrayBufferObject::class_ = {
--- a/js/src/vm/ErrorReporting.cpp +++ b/js/src/vm/ErrorReporting.cpp @@ -50,16 +50,23 @@ js::CompileError::throwError(JSContext* // compilation errors. The exception will remain pending, and so long // as the non-top-level "load", "eval", or "compile" native function // returns false, the top-level reporter will eventually receive the // uncaught exception report. ErrorToException(cx, this, nullptr, nullptr); } bool +js::ReportExceptionClosure::operator()(JSContext* cx) +{ + cx->setPendingException(exn_); + return false; +} + +bool js::ReportCompileWarning(JSContext* cx, ErrorMetadata&& metadata, UniquePtr<JSErrorNotes> notes, unsigned flags, unsigned errorNumber, va_list args) { // On the main thread, report the error immediately. When compiling off // thread, save the error so that the thread finishing the parse can report // it later. CompileError tempErr; CompileError* err = &tempErr; @@ -119,44 +126,21 @@ js::ReportCompileError(JSContext* cx, Er { return; } if (!cx->helperThread()) err->throwError(cx); } -namespace { - -class MOZ_STACK_CLASS ReportExceptionClosure - : public js::ScriptEnvironmentPreparer::Closure -{ - public: - explicit ReportExceptionClosure(HandleValue& exn) - : exn_(exn) - { - } - - bool operator()(JSContext* cx) override - { - cx->setPendingException(exn_); - return false; - } - - private: - HandleValue& exn_; -}; - -} // anonymous namespace - void js::ReportErrorToGlobal(JSContext* cx, Handle<GlobalObject*> global, HandleValue error) { MOZ_ASSERT(!cx->isExceptionPending()); #ifdef DEBUG // No assertSameCompartment version that doesn't take JSContext... if (error.isObject()) { AssertSameCompartment(global, &error.toObject()); } #endif // DEBUG - ReportExceptionClosure report(error); + js::ReportExceptionClosure report(error); PrepareScriptEnvironmentAndInvoke(cx, global, report); }
--- a/js/src/vm/ErrorReporting.h +++ b/js/src/vm/ErrorReporting.h @@ -7,16 +7,17 @@ #ifndef vm_ErrorReporting_h #define vm_ErrorReporting_h #include "mozilla/Move.h" #include <stdarg.h> #include "jsapi.h" // for JSErrorNotes, JSErrorReport +#include "jsfriendapi.h" // for ScriptEnvironmentPreparer #include "js/UniquePtr.h" // for UniquePtr #include "js/Utility.h" // for UniqueTwoByteChars namespace js { /** * Metadata for a compilation error (or warning) at a particular offset, or at @@ -63,16 +64,28 @@ struct ErrorMetadata }; class CompileError : public JSErrorReport { public: void throwError(JSContext* cx); }; +class MOZ_STACK_CLASS ReportExceptionClosure final + : public ScriptEnvironmentPreparer::Closure +{ + JS::HandleValue exn_; + + public: + explicit ReportExceptionClosure(JS::HandleValue exn) + : exn_(exn) { } + + bool operator()(JSContext* cx) override; +}; + /** Send a JSErrorReport to the warningReporter callback. */ extern void CallWarningReporter(JSContext* cx, JSErrorReport* report); /** * Report a compile error during script processing prior to execution of the * script. */
--- a/js/src/vm/JSContext.cpp +++ b/js/src/vm/JSContext.cpp @@ -1048,36 +1048,16 @@ InternalEnqueuePromiseJobCallback(JSCont JS::JobQueueMayNotBeEmpty(cx); if (!cx->jobQueue->append(job)) { ReportOutOfMemory(cx); return false; } return true; } -namespace { -class MOZ_STACK_CLASS ReportExceptionClosure : public ScriptEnvironmentPreparer::Closure -{ - public: - explicit ReportExceptionClosure(HandleValue exn) - : exn_(exn) - { - } - - bool operator()(JSContext* cx) override - { - cx->setPendingException(exn_); - return false; - } - - private: - HandleValue exn_; -}; -} // anonymous namespace - JS_FRIEND_API(bool) js::UseInternalJobQueues(JSContext* cx) { // Internal job queue handling must be set up very early. Self-hosting // initialization is as good a marker for that as any. MOZ_RELEASE_ASSERT(!cx->runtime()->hasInitializedSelfHosting(), "js::UseInternalJobQueues must be called early during runtime startup."); MOZ_ASSERT(!cx->jobQueue); @@ -1170,17 +1150,17 @@ js::RunJobs(JSContext* cx) RootedValue exn(cx); if (cx->getPendingException(&exn)) { /* * Clear the exception, because * PrepareScriptEnvironmentAndInvoke will assert that we don't * have one. */ cx->clearPendingException(); - ReportExceptionClosure reportExn(exn); + js::ReportExceptionClosure reportExn(exn); PrepareScriptEnvironmentAndInvoke(cx, cx->global(), reportExn); } } } } cx->drainingJobQueue = false;
--- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -319,23 +319,23 @@ RegExpObject::initIgnoringLastIndex(JSAt void RegExpObject::initAndZeroLastIndex(JSAtom* source, RegExpFlag flags, JSContext* cx) { initIgnoringLastIndex(source, flags); zeroLastIndex(cx); } static MOZ_ALWAYS_INLINE bool -IsLineTerminator(const JS::Latin1Char c) +IsRegExpLineTerminator(const JS::Latin1Char c) { return c == '\n' || c == '\r'; } static MOZ_ALWAYS_INLINE bool -IsLineTerminator(const char16_t c) +IsRegExpLineTerminator(const char16_t c) { return c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029; } static MOZ_ALWAYS_INLINE bool AppendEscapedLineTerminator(StringBuffer& sb, const JS::Latin1Char c) { switch (c) { @@ -417,17 +417,17 @@ EscapeRegExpPattern(StringBuffer& sb, co } if (!sb.append('\\')) return false; } else if (ch == '[') { inBrackets = true; } } - if (IsLineTerminator(ch)) { + if (IsRegExpLineTerminator(ch)) { // There's LineTerminator that needs escaping. if (sb.empty()) { // This is the first char we've seen that needs escaping, // copy everything up to this point. if (!SetupBuffer(sb, oldChars, oldLen, it)) return false; } if (!previousCharacterWasBackslash) {
--- a/js/src/vm/SharedArrayObject.cpp +++ b/js/src/vm/SharedArrayObject.cpp @@ -365,43 +365,43 @@ static const ClassOps SharedArrayBufferO nullptr, /* mayResolve */ SharedArrayBufferObject::Finalize, nullptr, /* call */ nullptr, /* hasInstance */ nullptr, /* construct */ nullptr, /* trace */ }; -static const JSFunctionSpec static_functions[] = { +static const JSFunctionSpec sharedarrray_functions[] = { JS_FS_END }; -static const JSPropertySpec static_properties[] = { +static const JSPropertySpec sharedarrray_properties[] = { JS_SELF_HOSTED_SYM_GET(species, "SharedArrayBufferSpecies", 0), JS_PS_END }; -static const JSFunctionSpec prototype_functions[] = { +static const JSFunctionSpec sharedarray_proto_functions[] = { JS_SELF_HOSTED_FN("slice", "SharedArrayBufferSlice", 2, 0), JS_FS_END }; -static const JSPropertySpec prototype_properties[] = { +static const JSPropertySpec sharedarray_proto_properties[] = { JS_PSG("byteLength", SharedArrayBufferObject::byteLengthGetter, 0), JS_STRING_SYM_PS(toStringTag, "SharedArrayBuffer", JSPROP_READONLY), JS_PS_END }; static const ClassSpec SharedArrayBufferObjectClassSpec = { GenericCreateConstructor<SharedArrayBufferObject::class_constructor, 1, gc::AllocKind::FUNCTION>, CreateSharedArrayBufferPrototype, - static_functions, - static_properties, - prototype_functions, - prototype_properties + sharedarrray_functions, + sharedarrray_properties, + sharedarray_proto_functions, + sharedarray_proto_properties }; const Class SharedArrayBufferObject::class_ = { "SharedArrayBuffer", JSCLASS_DELAY_METADATA_BUILDER | JSCLASS_HAS_RESERVED_SLOTS(SharedArrayBufferObject::RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_SharedArrayBuffer) | JSCLASS_BACKGROUND_FINALIZE,