Changeset 183790 in webkit
- Timestamp:
- May 4, 2015 8:35:13 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r183789 r183790 1 2015-05-04 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r183789. 4 https://bugs.webkit.org/show_bug.cgi?id=144620 5 6 Causing flakiness on exceptionFuzz tests locally on 32-bit 7 build (Requested by saamyjoon on #webkit). 8 9 Reverted changeset: 10 11 "Global functions should be initialized as JSFunctions in byte 12 code" 13 https://bugs.webkit.org/show_bug.cgi?id=144178 14 http://trac.webkit.org/changeset/183789 15 1 16 2015-05-04 Saam Barati <saambarati1@gmail.com> 2 17 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r183789 r183790 472 472 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 473 473 Base::visitChildren(thisObject, visitor); 474 for (size_t i = 0, end = thisObject->m_functionDeclarations.size(); i != end; i++) 475 visitor.append(&thisObject->m_functionDeclarations[i].second); 474 476 } 475 477 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r183789 r183790 655 655 static void destroy(JSCell*); 656 656 657 void addFunctionDeclaration(VM& vm, const Identifier& name, UnlinkedFunctionExecutable* functionExecutable) 658 { 659 m_functionDeclarations.append(std::make_pair(name, WriteBarrier<UnlinkedFunctionExecutable>(vm, this, functionExecutable))); 660 } 661 657 662 void addVariableDeclaration(const Identifier& name, bool isConstant) 658 663 { … … 661 666 662 667 typedef Vector<std::pair<Identifier, bool>> VariableDeclations; 668 typedef Vector<std::pair<Identifier, WriteBarrier<UnlinkedFunctionExecutable>> > FunctionDeclations; 663 669 664 670 const VariableDeclations& variableDeclarations() const { return m_varDeclarations; } 671 const FunctionDeclations& functionDeclarations() const { return m_functionDeclarations; } 665 672 666 673 static void visitChildren(JSCell*, SlotVisitor&); … … 673 680 674 681 VariableDeclations m_varDeclarations; 682 FunctionDeclations m_functionDeclarations; 675 683 676 684 public: -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r183789 r183790 78 78 { 79 79 RefPtr<RegisterID> temp = newTemporary(); 80 RefPtr<RegisterID> globalScope = scopeRegister(); // FIXME: With lexical scoping, this won't always be the global object: https://bugs.webkit.org/show_bug.cgi?id=142944 81 for (auto functionPair : m_functionsToInitialize) { 82 FunctionBodyNode* functionBody = functionPair.first; 83 FunctionVariableType functionType = functionPair.second; 80 for (FunctionBodyNode* functionBody : m_functionsToInitialize) { 84 81 emitNewFunction(temp.get(), functionBody); 85 if (functionType == NormalFunctionVariable) 86 initializeVariable(variable(functionBody->ident()) , temp.get()); 87 else if (functionType == GlobalFunctionVariable) 88 emitPutToScope(globalScope.get(), Variable(functionBody->ident()), temp.get(), ThrowIfNotFound); 89 else 90 RELEASE_ASSERT_NOT_REACHED(); 82 initializeVariable(variable(functionBody->ident()), temp.get()); 91 83 } 92 84 } … … 172 164 for (size_t i = 0; i < functionStack.size(); ++i) { 173 165 FunctionBodyNode* function = functionStack[i]; 174 m_functionsToInitialize.append(std::make_pair(function, GlobalFunctionVariable)); 166 UnlinkedFunctionExecutable* unlinkedFunction = makeFunction(function); 167 codeBlock->addFunctionDeclaration(*m_vm, function->ident(), unlinkedFunction); 175 168 } 176 169 … … 392 385 const Identifier& ident = function->ident(); 393 386 createVariable(ident, varKind(ident.impl()), IsVariable); 394 m_functionsToInitialize.append( std::make_pair(function, NormalFunctionVariable));387 m_functionsToInitialize.append(function); 395 388 } 396 389 for (auto& entry : functionNode->varStack()) { -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r183789 r183790 745 745 Vector<TryContext> m_tryContextStack; 746 746 Vector<std::pair<RefPtr<RegisterID>, const DeconstructionPatternNode*>> m_deconstructedParameters; 747 enum FunctionVariableType : uint8_t { NormalFunctionVariable, GlobalFunctionVariable }; 748 Vector<std::pair<FunctionBodyNode*, FunctionVariableType>> m_functionsToInitialize; 747 Vector<FunctionBodyNode*> m_functionsToInitialize; 749 748 bool m_needToInitializeArguments { false }; 750 749 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r183789 r183790 511 511 512 512 const UnlinkedProgramCodeBlock::VariableDeclations& variableDeclarations = unlinkedCodeBlock->variableDeclarations(); 513 514 for (size_t i = 0, numberOfFunctions = unlinkedCodeBlock->numberOfFunctionDecls(); i < numberOfFunctions; ++i) { 515 UnlinkedFunctionExecutable* unlinkedFunctionExecutable = unlinkedCodeBlock->functionDecl(i); 516 ASSERT(!unlinkedFunctionExecutable->name().isEmpty()); 517 globalObject->addFunction(callFrame, unlinkedFunctionExecutable->name()); 513 const UnlinkedProgramCodeBlock::FunctionDeclations& functionDeclarations = unlinkedCodeBlock->functionDeclarations(); 514 515 for (size_t i = 0; i < functionDeclarations.size(); ++i) { 516 UnlinkedFunctionExecutable* unlinkedFunctionExecutable = functionDeclarations[i].second.get(); 517 JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, m_source), scope); 518 globalObject->addFunction(callFrame, functionDeclarations[i].first, value); 518 519 if (vm.typeProfiler() || vm.controlFlowProfiler()) { 519 520 vm.functionHasExecutedCache()->insertUnexecutedRange(sourceID(), -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r183789 r183790 503 503 } 504 504 505 voidJSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode)505 JSGlobalObject::NewGlobalVar JSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode) 506 506 { 507 507 ConcurrentJITLocker locker(symbolTable()->m_lock); 508 508 SymbolTableEntry entry = symbolTable()->get(locker, ident.impl()); 509 if (!entry.isNull()) 510 return; 509 if (!entry.isNull()) { 510 NewGlobalVar result; 511 result.offset = entry.scopeOffset(); 512 result.set = entry.watchpointSet(); 513 return result; 514 } 511 515 512 516 ScopeOffset offset = symbolTable()->takeNextScopeOffset(locker); … … 520 524 ScopeOffset offsetForAssert = addVariables(1); 521 525 RELEASE_ASSERT(offsetForAssert == offset); 522 } 523 524 void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName) 526 527 NewGlobalVar var; 528 var.offset = offset; 529 var.set = newEntry.watchpointSet(); 530 return var; 531 } 532 533 void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName, JSValue value) 525 534 { 526 535 VM& vm = exec->vm(); 527 536 removeDirect(vm, propertyName); // Newly declared functions overwrite existing properties. 528 addGlobalVar(propertyName, IsVariable); 537 NewGlobalVar var = addGlobalVar(propertyName, IsVariable); 538 variableAt(var.offset).set(exec->vm(), this, value); 539 if (var.set) 540 var.set->touch(VariableWriteFireDetail(this, propertyName)); 529 541 } 530 542 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r183789 r183790 339 339 } 340 340 341 void addGlobalVar(const Identifier&, ConstantMode); 341 struct NewGlobalVar { 342 ScopeOffset offset; 343 WatchpointSet* set; 344 }; 345 NewGlobalVar addGlobalVar(const Identifier&, ConstantMode); 342 346 343 347 public: … … 371 375 addGlobalVar(propertyName, IsConstant); 372 376 } 373 void addFunction(ExecState*, const Identifier& );377 void addFunction(ExecState*, const Identifier&, JSValue); 374 378 375 379 // The following accessors return pristine values, even if a script
Note: See TracChangeset
for help on using the changeset viewer.