Changeset 95787 in webkit


Ignore:
Timestamp:
Sep 23, 2011 12:18:48 AM (13 years ago)
Author:
barraclough@apple.com
Message:

Source/JavaScriptCore: GetScopedVar should have value profiling
https://bugs.webkit.org/show_bug.cgi?id=68676

Patch by Filip Pizlo <fpizlo@apple.com> on 2011-09-22
Reviewed by Oliver Hunt.

Added GetScopedVar value profiling and predictin propagation.
Added GetScopeChain to CSE.

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::predict):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasPrediction):

  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNodePredictions):
(JSC::DFG::Propagator::getScopeChainLoadElimination):
(JSC::DFG::Propagator::performNodeCSE):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_scoped_var):

LayoutTests: [Qt] Unreviewed gardening, update expected file after r95745.

Patch by Csaba Osztrogonác <Csaba Osztrogonác> on 2011-09-22

  • platform/qt/editing/deleting/merge-whitespace-pre-expected.png:
  • platform/qt/editing/deleting/merge-whitespace-pre-expected.txt:
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95785 r95787  
    9191
    9292        * platform/chromium/test_expectations.txt:
     93
     942011-09-22  Gavin Barraclough  <barraclough@apple.com>
     95
     96        Incorrect this value passed to callbacks.
     97        https://bugs.webkit.org/show_bug.cgi?id=68668
     98
     99        Reviewed by Oliver Hunt.
     100
     101        From Array/String prototype function.  Should be undefined, but
     102        global object is passed instead (this is visible for strict callbacks).
     103
     104        * fast/js/array-prototype-properties-expected.txt:
     105        * fast/js/script-tests/strict-callback-this.js: Added.
     106        (strictThrowThisString):
     107        (nonstrictThrowThisString):
     108        (testArrayPrototypeSort):
     109        (testArrayPrototypeFilter):
     110        (testArrayPrototypeMap):
     111        (testArrayPrototypeEvery):
     112        (testArrayPrototypeForEach):
     113        (testArrayPrototypeSome):
     114        (testStringPrototypeReplace):
     115        * fast/js/strict-callback-this-expected.txt: Added.
     116        * fast/js/strict-callback-this.html: Added.
     117        * ietestcenter/Javascript/15.3.4.5-0-2-expected.txt:
    93118
    941192011-09-22  Gavin Barraclough  <barraclough@apple.com>
  • trunk/LayoutTests/fast/js/array-prototype-properties-expected.txt

    r92093 r95787  
    2424FAIL Array.prototype.reduce.call(undefined, toString) should throw an exception. Was [object Object].
    2525FAIL Array.prototype.reduceRight.call(undefined, toString) should throw an exception. Was [object Object].
    26 FAIL Array.prototype.map.call(undefined, toString) should throw an exception. Was [object DOMWindow].
     26FAIL Array.prototype.map.call(undefined, toString) should throw an exception. Was [object Undefined].
    2727PASS successfullyParsed is true
    2828
  • trunk/Source/JavaScriptCore/ChangeLog

    r95786 r95787  
    4444
    4545        * Configurations/FeatureDefines.xcconfig:
     46
     472011-09-22  Gavin Barraclough  <barraclough@apple.com>
     48
     49        Incorrect this value passed to callbacks.
     50        https://bugs.webkit.org/show_bug.cgi?id=68668
     51
     52        Reviewed by Oliver Hunt.
     53
     54        From Array/String prototype function.  Should be undefined, but
     55        global object is passed instead (this is visible for strict callbacks).
     56
     57        * runtime/ArrayPrototype.cpp:
     58        (JSC::arrayProtoFuncSort):
     59        (JSC::arrayProtoFuncFilter):
     60        (JSC::arrayProtoFuncMap):
     61        (JSC::arrayProtoFuncEvery):
     62        (JSC::arrayProtoFuncForEach):
     63        (JSC::arrayProtoFuncSome):
     64        * runtime/JSArray.cpp:
     65        (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
     66        (JSC::JSArray::sort):
     67        * runtime/StringPrototype.cpp:
     68        (JSC::stringProtoFuncReplace):
    4669
    47702011-09-22  Gavin Barraclough  <barraclough@apple.com>
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r94929 r95787  
    544544                l.append(jObj);
    545545                l.append(minObj);
    546                 compareResult = call(exec, function, callType, callData, exec->globalThisValue(), l).toNumber(exec);
     546                compareResult = call(exec, function, callType, callData, jsUndefined(), l).toNumber(exec);
    547547            } else
    548548                compareResult = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1;
     
    672672        return throwVMTypeError(exec);
    673673
    674     JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
     674    JSValue applyThis = exec->argument(1);
    675675    JSArray* resultArray = constructEmptyArray(exec);
    676676
     
    731731        return throwVMTypeError(exec);
    732732
    733     JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
     733    JSValue applyThis = exec->argument(1);
    734734
    735735    JSArray* resultArray = constructEmptyArray(exec, length);
     
    793793        return throwVMTypeError(exec);
    794794
    795     JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
     795    JSValue applyThis = exec->argument(1);
    796796
    797797    JSValue result = jsBoolean(true);
     
    851851        return throwVMTypeError(exec);
    852852
    853     JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
     853    JSValue applyThis = exec->argument(1);
    854854
    855855    unsigned k = 0;
     
    901901        return throwVMTypeError(exec);
    902902
    903     JSObject* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);
     903    JSValue applyThis = exec->argument(1);
    904904
    905905    JSValue result = jsBoolean(false);
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r94364 r95787  
    10171017    CallType m_compareCallType;
    10181018    const CallData* m_compareCallData;
    1019     JSValue m_globalThisValue;
    10201019    OwnPtr<CachedCall> m_cachedCall;
    10211020
     
    10561055        double compareResult;
    10571056        if (m_cachedCall) {
    1058             m_cachedCall->setThis(m_globalThisValue);
     1057            m_cachedCall->setThis(jsUndefined());
    10591058            m_cachedCall->setArgument(0, va);
    10601059            m_cachedCall->setArgument(1, vb);
     
    10641063            arguments.append(va);
    10651064            arguments.append(vb);
    1066             compareResult = call(m_exec, m_compareFunction, m_compareCallType, *m_compareCallData, m_globalThisValue, arguments).toNumber(m_exec);
     1065            compareResult = call(m_exec, m_compareFunction, m_compareCallType, *m_compareCallData, jsUndefined(), arguments).toNumber(m_exec);
    10671066        }
    10681067        return (compareResult < 0) ? -1 : 1; // Not passing equality through, because we need to store all values, even if equivalent.
     
    11001099    tree.abstractor().m_compareCallType = callType;
    11011100    tree.abstractor().m_compareCallData = &callData;
    1102     tree.abstractor().m_globalThisValue = exec->globalThisValue();
    11031101    tree.abstractor().m_nodes.grow(nodeCount);
    11041102
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r95505 r95787  
    449449                cachedCall.setArgument(i++, sourceVal);
    450450
    451                 cachedCall.setThis(exec->globalThisValue());
     451                cachedCall.setThis(jsUndefined());
    452452                JSValue result = cachedCall.call();
    453453                if (LIKELY(result.isString()))
     
    496496                    args.append(sourceVal);
    497497
    498                     replacements.append(call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec));
     498                    replacements.append(call(exec, replacement, callType, callData, jsUndefined(), args).toString(exec));
    499499                    if (exec->hadException())
    500500                        break;
     
    552552        args.append(sourceVal);
    553553
    554         replacementString = call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec);
     554        replacementString = call(exec, replacement, callType, callData, jsUndefined(), args).toString(exec);
    555555    }
    556556   
Note: See TracChangeset for help on using the changeset viewer.