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/CodeGenerator.cpp

    r37184 r37285  
    138138
    139139    if (m_codeType == FunctionCode && m_codeBlock->needsFullScopeChain) {
    140         ASSERT(globalData()->machine->getOpcodeID(m_codeBlock->instructions[0].u.opcode) == op_init);
    141         m_codeBlock->instructions[0] = globalData()->machine->getOpcode(op_init_activation);
     140        ASSERT(globalData()->machine->getOpcodeID(m_codeBlock->instructions[0].u.opcode) == op_enter);
     141        m_codeBlock->instructions[0] = globalData()->machine->getOpcode(op_enter_with_activation);
    142142    }
    143143
     
    217217    , m_lastOpcodeID(op_end)
    218218{
    219     emitOpcode(op_init);
     219    emitOpcode(op_enter);
    220220    codeBlock->globalData = m_globalData;
    221221
     
    290290    , m_lastOpcodeID(op_end)
    291291{
    292     emitOpcode(op_init);
     292    emitOpcode(op_enter);
    293293    codeBlock->globalData = m_globalData;
    294294
     
    322322    ++m_nextParameter;
    323323    ++m_codeBlock->numParameters;
     324
     325    if (functionBody->usesThis()) {
     326        emitOpcode(op_convert_this);
     327        instructions().append(m_thisRegister.index());
     328    }
    324329   
    325330    for (size_t i = 0; i < parameterCount; ++i)
     
    343348    , m_lastOpcodeID(op_end)
    344349{
    345     emitOpcode(op_init);
     350    emitOpcode(op_enter);
    346351    codeBlock->globalData = m_globalData;
    347352    m_codeBlock->numParameters = 1; // Allocate space for "this"
Note: See TracChangeset for help on using the changeset viewer.