Ignore:
Timestamp:
Oct 7, 2014, 11:57:57 AM (11 years ago)
Author:
[email protected]
Message:

Remove op_new_captured_func
https://bugs.webkit.org/show_bug.cgi?id=137491

Reviewed by Mark Lam.

Removes the op_captured_new_func opcode as part of the work
towards having any magical opcodes that write directly to
named "registers" and then have a follow on op to ensure that
the environment record correctly represents the stack state.

For this we add a non-captured scratch register so we don't
have to have any kind of magic opcode, and instead simply
have sensible creation and move semantics for capturing new
functions.

  • bytecode/BytecodeList.json:
  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitNewFunction):
(JSC::BytecodeGenerator::emitLazyNewFunction):
(JSC::BytecodeGenerator::emitNewFunctionInternal):

  • bytecompiler/BytecodeGenerator.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_new_captured_func): Deleted.

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL): Deleted.

  • runtime/CommonSlowPaths.h:
Location:
trunk/Source/JavaScriptCore/bytecompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r174294 r174401  
    251251        instructions().append(m_lexicalEnvironmentRegister->index());
    252252    }
    253 
     253    RegisterID* scratch = addVar();
    254254    m_symbolTable->setCaptureStart(virtualRegisterForLocal(m_codeBlock->m_numVars).offset());
    255255
     
    333333            if (functionBody->captures(ident) || shouldCaptureAllTheThings) {
    334334                m_functions.add(ident.impl());
    335                 // We rely on still allocating stack space for captured variables
    336                 // here.
    337                 RegisterID* newFunction = emitNewFunction(addVar(ident, IsVariable, IsWatchable), IsCaptured, function);
    338                 initializeCapturedVariable(newFunction, ident, newFunction);
     335                emitNewFunction(scratch, function);
     336                initializeCapturedVariable(addVar(ident, IsVariable, IsWatchable), ident, scratch);
    339337            }
    340338        }
     
    360358                // as this would complicate lazy instantiation of actual arguments.
    361359                if (!canLazilyCreateFunctions || ident == propertyNames().arguments)
    362                     emitNewFunction(reg.get(), NotCaptured, function);
     360                    emitNewFunction(reg.get(), function);
    363361                else {
    364362                    emitInitLazyRegister(reg.get());
     
    16581656}
    16591657
    1660 RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, CaptureMode captureMode, FunctionBodyNode* function)
    1661 {
    1662     return emitNewFunctionInternal(dst, captureMode, m_codeBlock->addFunctionDecl(makeFunction(function)), false);
     1658RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function)
     1659{
     1660    return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(makeFunction(function)), false);
    16631661}
    16641662
     
    16681666    if (ptr.isNewEntry)
    16691667        ptr.iterator->value = m_codeBlock->addFunctionDecl(makeFunction(function));
    1670     return emitNewFunctionInternal(dst, NotCaptured, ptr.iterator->value, true);
    1671 }
    1672 
    1673 RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, CaptureMode captureMode, unsigned index, bool doNullCheck)
    1674 {
    1675     emitOpcode(captureMode == IsCaptured ? op_new_captured_func : op_new_func);
     1668    return emitNewFunctionInternal(dst, ptr.iterator->value, true);
     1669}
     1670
     1671RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, unsigned index, bool doNullCheck)
     1672{
     1673    emitOpcode(op_new_func);
    16761674    instructions().append(dst->index());
    16771675    instructions().append(index);
    1678     if (captureMode == IsCaptured) {
    1679         ASSERT(!doNullCheck);
    1680         instructions().append(watchableVariable(dst->index()));
    1681     } else
    1682         instructions().append(doNullCheck);
     1676    instructions().append(doNullCheck);
    16831677    return dst;
    16841678}
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r174226 r174401  
    450450        RegisterID* emitNewArray(RegisterID* dst, ElementNode*, unsigned length); // stops at first elision
    451451
    452         RegisterID* emitNewFunction(RegisterID* dst, CaptureMode, FunctionBodyNode*);
     452        RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode*);
    453453        RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body);
    454         RegisterID* emitNewFunctionInternal(RegisterID* dst, CaptureMode, unsigned index, bool shouldNullCheck);
     454        RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck);
    455455        RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
    456456        RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
Note: See TracChangeset for help on using the changeset viewer.