Ignore:
Timestamp:
Feb 23, 2009, 7:58:09 PM (16 years ago)
Author:
[email protected]
Message:

2009-02-23 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.

Next step in splitting JIT functionality out of the Interpreter class:
Moved vptr storage from Interpreter to JSGlobalData, so it could be shared
between Interpreter and JITStubs, and moved the *Trampoline JIT stubs
into the JITStubs class. Also added a VPtrSet class to encapsulate vptr
hacks during JSGlobalData initialization.


SunSpider says 0.4% faster. Meh.

  • JavaScriptCore.exp:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): (JSC::Interpreter::tryCacheGetByID): (JSC::Interpreter::privateExecute):
  • interpreter/Interpreter.h:
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JIT.h: (JSC::JIT::compileCTIMachineTrampolines):
  • jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePatchGetArrayLength):
  • jit/JITStubs.cpp: (JSC::JITStubs::JITStubs): (JSC::JITStubs::tryCacheGetByID): (JSC::JITStubs::cti_vm_dontLazyLinkCall): (JSC::JITStubs::cti_op_get_by_val): (JSC::JITStubs::cti_op_get_by_val_byte_array): (JSC::JITStubs::cti_op_put_by_val): (JSC::JITStubs::cti_op_put_by_val_array): (JSC::JITStubs::cti_op_put_by_val_byte_array): (JSC::JITStubs::cti_op_is_string):
  • jit/JITStubs.h: (JSC::JITStubs::ctiArrayLengthTrampoline): (JSC::JITStubs::ctiStringLengthTrampoline): (JSC::JITStubs::ctiVirtualCallPreLink): (JSC::JITStubs::ctiVirtualCallLink): (JSC::JITStubs::ctiVirtualCall):
  • runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush):
  • runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncApply):
  • runtime/JSArray.h: (JSC::isJSArray):
  • runtime/JSByteArray.h: (JSC::asByteArray): (JSC::isJSByteArray):
  • runtime/JSCell.h:
  • runtime/JSFunction.h:
  • runtime/JSGlobalData.cpp: (JSC::VPtrSet::VPtrSet): (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::create): (JSC::JSGlobalData::sharedInstance):
  • runtime/JSGlobalData.h:
  • runtime/JSString.h: (JSC::isJSString):
  • runtime/Operations.h: (JSC::jsLess): (JSC::jsLessEq):
  • wrec/WREC.cpp: (JSC::WREC::Generator::compileRegExp):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r41126 r41168  
    348348Interpreter::Interpreter()
    349349    : m_sampler(0)
    350 #if ENABLE(JIT)
    351     , m_ctiArrayLengthTrampoline(0)
    352     , m_ctiStringLengthTrampoline(0)
    353     , m_ctiVirtualCallPreLink(0)
    354     , m_ctiVirtualCallLink(0)
    355     , m_ctiVirtualCall(0)
    356 #endif
    357350    , m_reentryDepth(0)
    358351{
    359352    privateExecute(InitializeAndReturn, 0, 0, 0);
    360    
    361     // Bizarrely, calling fastMalloc here is faster than allocating space on the stack.
    362     void* storage = fastMalloc(sizeof(CollectorBlock));
    363 
    364     JSCell* jsArray = new (storage) JSArray(JSArray::createStructure(jsNull()));
    365     m_jsArrayVptr = jsArray->vptr();
    366     jsArray->~JSCell();
    367 
    368     JSCell* jsByteArray = new (storage) JSByteArray(JSByteArray::VPtrStealingHack);
    369     m_jsByteArrayVptr = jsByteArray->vptr();
    370     jsByteArray->~JSCell();
    371 
    372     JSCell* jsString = new (storage) JSString(JSString::VPtrStealingHack);
    373     m_jsStringVptr = jsString->vptr();
    374     jsString->~JSCell();
    375 
    376     JSCell* jsFunction = new (storage) JSFunction(JSFunction::createStructure(jsNull()));
    377     m_jsFunctionVptr = jsFunction->vptr();
    378     jsFunction->~JSCell();
    379    
    380     fastFree(storage);
    381 }
    382 
    383 void Interpreter::initialize(JSGlobalData* globalData)
    384 {
    385 #if ENABLE(JIT)
    386     JIT::compileCTIMachineTrampolines(globalData);
    387 #else
    388     UNUSED_PARAM(globalData);
    389 #endif
    390 }
    391 
    392 Interpreter::~Interpreter()
    393 {
    394353}
    395354
     
    963922    }
    964923
    965     if (isJSArray(baseValue) && propertyName == callFrame->propertyNames().length) {
     924    JSGlobalData* globalData = &callFrame->globalData();
     925    if (isJSArray(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
    966926        vPC[0] = getOpcode(op_get_array_length);
    967927        return;
    968928    }
    969929
    970     if (isJSString(baseValue) && propertyName == callFrame->propertyNames().length) {
     930    if (isJSString(globalData, baseValue) && propertyName == callFrame->propertyNames().length) {
    971931        vPC[0] = getOpcode(op_get_string_length);
    972932        return;
     
    22742234        int base = vPC[2].u.operand;
    22752235        JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
    2276         if (LIKELY(isJSArray(baseValue))) {
     2236        if (LIKELY(isJSArray(globalData, baseValue))) {
    22772237            int dst = vPC[1].u.operand;
    22782238            callFrame[dst] = JSValuePtr(jsNumber(callFrame, asArray(baseValue)->length()));
     
    22942254        int base = vPC[2].u.operand;
    22952255        JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
    2296         if (LIKELY(isJSString(baseValue))) {
     2256        if (LIKELY(isJSString(globalData, baseValue))) {
    22972257            int dst = vPC[1].u.operand;
    22982258            callFrame[dst] = JSValuePtr(jsNumber(callFrame, asString(baseValue)->value().size()));
     
    24762436        if (LIKELY(subscript.isUInt32Fast())) {
    24772437            uint32_t i = subscript.getUInt32Fast();
    2478             if (isJSArray(baseValue)) {
     2438            if (isJSArray(globalData, baseValue)) {
    24792439                JSArray* jsArray = asArray(baseValue);
    24802440                if (jsArray->canGetIndex(i))
     
    24822442                else
    24832443                    result = jsArray->JSArray::get(callFrame, i);
    2484             } else if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i))
     2444            } else if (isJSString(globalData, baseValue) && asString(baseValue)->canGetIndex(i))
    24852445                result = asString(baseValue)->getIndex(&callFrame->globalData(), i);
    2486             else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i))
     2446            else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i))
    24872447                result = asByteArray(baseValue)->getIndex(callFrame, i);
    24882448            else
     
    25182478        if (LIKELY(subscript.isUInt32Fast())) {
    25192479            uint32_t i = subscript.getUInt32Fast();
    2520             if (isJSArray(baseValue)) {
     2480            if (isJSArray(globalData, baseValue)) {
    25212481                JSArray* jsArray = asArray(baseValue);
    25222482                if (jsArray->canSetIndex(i))
     
    25242484                else
    25252485                    jsArray->JSArray::put(callFrame, i, callFrame[value].jsValue(callFrame));
    2526             } else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
     2486            } else if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
    25272487                JSByteArray* jsByteArray = asByteArray(baseValue);
    25282488                double dValue = 0;
Note: See TracChangeset for help on using the changeset viewer.