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


Ignore:
Timestamp:
Oct 4, 2008, 12:15:33 AM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-10-03 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.


I changed things so that functions which use "this" do a fast
version of toThisObject conversion if needed. Currently we miss
the conversion entirely, at least for primitive types. Using
TypeInfo and the primitive check, I made the fast case bail out
pretty fast.


This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).


Also renamed some opcodes for clarity:


init ==> enter
init_activation ==> enter_with_activation


  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass): (JSC::CTI::privateCompileSlowCases):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::generate): (JSC::CodeGenerator::CodeGenerator):
  • VM/Machine.cpp: (JSC::Machine::privateExecute): (JSC::Machine::cti_op_convert_this):
  • VM/Machine.h:
  • VM/Opcode.h:
  • kjs/JSActivation.cpp: (JSC::JSActivation::JSActivation):
  • kjs/JSActivation.h: (JSC::JSActivation::createStructureID):
  • kjs/JSCell.h: (JSC::JSValue::needsThisConversion):
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • kjs/JSGlobalData.h:
  • kjs/JSNumberCell.h: (JSC::JSNumberCell::createStructureID):
  • kjs/JSStaticScopeObject.h: (JSC::JSStaticScopeObject::JSStaticScopeObject): (JSC::JSStaticScopeObject::createStructureID):
  • kjs/JSString.h: (JSC::JSString::createStructureID):
  • kjs/JSValue.h:
  • kjs/TypeInfo.h: (JSC::TypeInfo::needsThisConversion):
  • kjs/nodes.h: (JSC::ScopeNode::usesThis):

WebCore:

2008-10-03 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.

Updated so toThis conversion for the split window is handled properly.

  • bindings/scripts/CodeGeneratorJS.pm:

LayoutTests:

2008-10-03 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.


  • test case for: "this" object in methods called on primitives should be wrapper object
  • fast/js/primitive-method-this-expected.txt: Added.
  • fast/js/primitive-method-this.html: Added.
  • fast/js/resources/primitive-method-this.js: Added.
File:
1 edited

Legend:

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

    r37264 r37285  
    19651965            break;
    19661966        }
    1967         case op_init: {
     1967        case op_enter: {
    19681968            // Even though CTI doesn't use them, we initialize our constant
    19691969            // registers to zap stale pointers, to avoid unnecessarily prolonging
     
    19761976            break;
    19771977        }
    1978         case op_init_activation: {
     1978        case op_enter_with_activation: {
    19791979            emitCall(i, Machine::cti_op_push_activation);
    19801980
     
    19921992            emitCall(i, Machine::cti_op_init_arguments);
    19931993            i += 1;
     1994            break;
     1995        }
     1996        case op_convert_this: {
     1997            emitGetArg(instruction[i + 1].u.operand, X86::eax);
     1998
     1999            emitJumpSlowCaseIfNotJSCell(X86::eax, i);
     2000            m_jit.movl_mr(OBJECT_OFFSET(JSCell, m_structureID), X86::eax, X86::edx);
     2001            m_jit.testl_i32m(NeedsThisConversion, OBJECT_OFFSET(StructureID, m_typeInfo.m_flags), X86::edx);
     2002            m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJnz(), i));
     2003
     2004            i += 2;
    19942005            break;
    19952006        }
     
    20382049        unsigned i = iter->to;
    20392050        switch (m_machine->getOpcodeID(instruction[i].u.opcode)) {
     2051        case op_convert_this: {
     2052            m_jit.link(iter->from, m_jit.label());
     2053            m_jit.link((++iter)->from, m_jit.label());
     2054            emitPutArg(X86::eax, 0);
     2055            emitCall(i, Machine::cti_op_convert_this);
     2056            emitPutResult(instruction[i + 1].u.operand);
     2057            i += 2;
     2058            break;
     2059        }
    20402060        case op_add: {
    20412061            unsigned dst = instruction[i + 1].u.operand;
Note: See TracChangeset for help on using the changeset viewer.