Changeset 37324 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Oct 5, 2008, 11:00:58 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-05 Cameron Zwarich <[email protected]>

Reviewed by Oliver Hunt.

Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
<https://bugs.webkit.org/show_bug.cgi?id=21364>

Use information from the parser to detect whether an activation is
needed or 'arguments' is used, and emit explicit instructions to tear
them off before op_ret. This allows a branch to be removed from op_ret
and simplifies some other code. This does cause a small change in the
behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
mentioned in the lexical scope of the function.

It should now be easy to remove the OptionaCalleeActivation slot in the
call frame, but this will be done in a later patch.

JavaScriptCore:

  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitReturn):
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (JSC::Machine::unwindCallFrame): (JSC::Machine::privateExecute): (JSC::Machine::retrieveArguments): (JSC::Machine::cti_op_create_arguments): (JSC::Machine::cti_op_tear_off_activation): (JSC::Machine::cti_op_tear_off_arguments):
  • VM/Machine.h:
  • VM/Opcode.h:
  • kjs/Arguments.cpp: (JSC::Arguments::mark):
  • kjs/Arguments.h: (JSC::Arguments::isTornOff): (JSC::Arguments::Arguments): (JSC::Arguments::copyRegisters): (JSC::JSActivation::copyRegisters):
  • kjs/JSActivation.cpp: (JSC::JSActivation::argumentsGetter):
  • kjs/JSActivation.h:

LayoutTests:

  • fast/js/function-dot-arguments-expected.txt:
  • fast/js/resources/function-dot-arguments.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r37297 r37324  
    11711171            break;
    11721172        }
     1173        case op_tear_off_activation: {
     1174            emitCall(i, Machine::cti_op_tear_off_activation);
     1175            i += 1;
     1176            break;
     1177        }
     1178        case op_tear_off_arguments: {
     1179            emitCall(i, Machine::cti_op_tear_off_arguments);
     1180            i += 1;
     1181            break;
     1182        }
    11731183        case op_ret: {
    1174             // If there is an activation or an 'arguments' object, we tear it
    1175             // off by jumping to the hook below.
    1176             m_jit.movl_mr(RegisterFile::OptionalCalleeActivation * static_cast<int>(sizeof(Register)), X86::edi, X86::eax);
    1177             m_jit.orl_mr(RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register)), X86::edi, X86::eax);
    1178             m_jit.cmpl_i32r(0, X86::eax);
    1179             X86Assembler::JmpSrc activation = m_jit.emitUnlinkedJne();
    1180             X86Assembler::JmpDst activated = m_jit.label();
    1181 
    11821184            // Check for a profiler - if there is one, jump to the hook below.
    11831185            emitGetCTIParam(CTI_ARGS_profilerReference, X86::eax);
     
    12031205            m_jit.pushl_r(X86::edx);
    12041206            m_jit.ret();
    1205 
    1206             // Activation and 'arguments' hook
    1207             m_jit.link(activation, m_jit.label());
    1208             emitCall(i, Machine::cti_op_ret_activation_arguments);
    1209             m_jit.link(m_jit.emitUnlinkedJmp(), activated);
    12101207
    12111208            // Profiling hook
Note: See TracChangeset for help on using the changeset viewer.