Changeset 208950 in webkit
- Timestamp:
- Nov 21, 2016 9:19:30 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r208939 r208950 1 2016-11-21 Mark Lam <mark.lam@apple.com> 2 3 Fix exception scope verification failures in *Executable.cpp files. 4 https://bugs.webkit.org/show_bug.cgi?id=164996 5 6 Reviewed by Darin Adler. 7 8 * runtime/DirectEvalExecutable.cpp: 9 (JSC::DirectEvalExecutable::create): 10 * runtime/IndirectEvalExecutable.cpp: 11 (JSC::IndirectEvalExecutable::create): 12 * runtime/ProgramExecutable.cpp: 13 (JSC::ProgramExecutable::initializeGlobalProperties): 14 * runtime/ScriptExecutable.cpp: 15 (JSC::ScriptExecutable::prepareForExecutionImpl): 16 1 17 2016-11-20 Zan Dobersek <zdobersek@igalia.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp
r208712 r208950 48 48 49 49 UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->createLocalEvalCodeBlock(exec, executable, variablesUnderTDZ); 50 ASSERT(!!scope.exception() == !unlinkedEvalCode); 50 51 if (!unlinkedEvalCode) 51 52 return 0; -
trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp
r208712 r208950 48 48 49 49 UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->createGlobalEvalCodeBlock(exec, executable); 50 ASSERT(!!scope.exception() == !unlinkedEvalCode); 50 51 if (!unlinkedEvalCode) 51 52 return 0; -
trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp
r208761 r208950 29 29 #include "CodeBlock.h" 30 30 #include "Debugger.h" 31 #include "Exception.h" 31 32 #include "JIT.h" 32 33 #include "JSCInlines.h" … … 73 74 JSObject* ProgramExecutable::initializeGlobalProperties(VM& vm, CallFrame* callFrame, JSScope* scope) 74 75 { 76 auto throwScope = DECLARE_THROW_SCOPE(vm); 75 77 RELEASE_ASSERT(scope); 76 78 JSGlobalObject* globalObject = scope->globalObject(); … … 78 80 ASSERT(&globalObject->vm() == &vm); 79 81 80 JSObject* exception = 0;82 JSObject* exception = nullptr; 81 83 UnlinkedProgramCodeBlock* unlinkedCodeBlock = globalObject->createProgramCodeBlock(callFrame, this, &exception); 82 if ( exception)84 if (UNLIKELY(exception)) 83 85 return exception; 84 86 … … 99 101 // It's an error to introduce a shadow. 100 102 for (auto& entry : lexicalDeclarations) { 101 if (globalObject->hasProperty(exec, entry.key.get())) { 103 bool hasProperty = globalObject->hasProperty(exec, entry.key.get()); 104 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 105 if (hasProperty) { 102 106 // The ES6 spec says that just RestrictedGlobalProperty can't be shadowed 103 107 // This carried out section 8.1.1.4.14 of the ES6 spec: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasrestrictedglobalproperty … … 108 112 return createSyntaxError(exec, makeString("Can't create duplicate variable that shadows a global property: '", String(entry.key.get()), "'")); 109 113 } 110 111 if (globalLexicalEnvironment->hasProperty(exec, entry.key.get())) { 114 115 hasProperty = globalLexicalEnvironment->hasProperty(exec, entry.key.get()); 116 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 117 if (hasProperty) { 112 118 if (UNLIKELY(entry.value.isConst() && !vm.globalConstRedeclarationShouldThrow() && !isStrictMode())) { 113 119 // We only allow "const" duplicate declarations under this setting. … … 124 130 if (!globalLexicalEnvironment->isEmpty()) { 125 131 for (auto& entry : variableDeclarations) { 126 if (globalLexicalEnvironment->hasProperty(exec, entry.key.get())) 132 bool hasProperty = globalLexicalEnvironment->hasProperty(exec, entry.key.get()); 133 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 134 if (hasProperty) 127 135 return createSyntaxError(exec, makeString("Can't create duplicate variable: '", String(entry.key.get()), "'")); 128 136 } … … 149 157 ASSERT(entry.value.isVar()); 150 158 globalObject->addVar(callFrame, Identifier::fromUid(&vm, entry.key.get())); 159 ASSERT(!throwScope.exception()); 151 160 } 152 161 -
trunk/Source/JavaScriptCore/runtime/ScriptExecutable.cpp
r208309 r208950 308 308 VM& vm, JSFunction* function, JSScope* scope, CodeSpecializationKind kind, CodeBlock*& resultCodeBlock) 309 309 { 310 auto throwScope = DECLARE_THROW_SCOPE(vm); 310 311 DeferGCForAWhile deferGC(vm.heap); 311 312 312 if (vm.getAndClearFailNextNewCodeBlock()) 313 return createError(scope->globalObject()->globalExec(), ASCIILiteral("Forced Failure")); 314 315 JSObject* exception = 0; 313 if (vm.getAndClearFailNextNewCodeBlock()) { 314 auto& state = *scope->globalObject()->globalExec(); 315 return throwException(&state, throwScope, createError(&state, ASCIILiteral("Forced Failure"))); 316 } 317 318 JSObject* exception = nullptr; 316 319 CodeBlock* codeBlock = newCodeBlockFor(kind, function, scope, exception); 317 320 resultCodeBlock = codeBlock; 318 if (!codeBlock) {319 RELEASE_ASSERT(exception);321 ASSERT(!!throwScope.exception() == !codeBlock); 322 if (UNLIKELY(!codeBlock)) 320 323 return exception; 321 }322 324 323 325 if (Options::validateBytecode())
Note: See TracChangeset
for help on using the changeset viewer.