Changeset 34754 in webkit for trunk/JavaScriptCore/kjs/JSFunction.cpp
- Timestamp:
- Jun 23, 2008, 10:23:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSFunction.cpp
r34684 r34754 81 81 } 82 82 83 JSValue* JSFunction::call AsFunction(ExecState* exec, JSObject* thisObj, const ArgList& args)83 JSValue* JSFunction::call(ExecState* exec, JSValue* thisValue, const ArgList& args) 84 84 { 85 85 JSValue* exception = 0; … … 88 88 if (!current->safeForReentry()) { 89 89 stack->pushFunctionRegisterFile(); 90 JSValue* result = exec->machine()->execute(body.get(), exec, this, this Obj, args, stack, _scope.node(), &exception);90 JSValue* result = exec->machine()->execute(body.get(), exec, this, thisValue->toThisObject(exec), args, stack, _scope.node(), &exception); 91 91 stack->popFunctionRegisterFile(); 92 92 exec->setException(exception); 93 93 return result; 94 94 } else { 95 JSValue* result = exec->machine()->execute(body.get(), exec, this, this Obj, args, stack, _scope.node(), &exception);95 JSValue* result = exec->machine()->execute(body.get(), exec, this, thisValue->toThisObject(exec), args, stack, _scope.node(), &exception); 96 96 current->setSafeForReentry(true); 97 97 exec->setException(exception); … … 159 159 * function f2(x, x): getParameterName(0) --> null 160 160 */ 161 IdentifierJSFunction::getParameterName(int index)161 const Identifier& JSFunction::getParameterName(int index) 162 162 { 163 163 Vector<Identifier>& parameters = body->parameters(); … … 166 166 return JSGlobalData::threadInstance().propertyNames->nullIdentifier; 167 167 168 Identifiername = parameters[index];168 const Identifier& name = parameters[index]; 169 169 170 170 // Are there any subsequent parameters with the same name? … … 556 556 } 557 557 558 JSValue* globalFuncEval(ExecState* exec, PrototypeReflexiveFunction* function, JSObject* thisObj, const ArgList& args)559 { 560 JS GlobalObject* globalObject = thisObj->toGlobalObject(exec);561 558 JSValue* globalFuncEval(ExecState* exec, JSObject* function, JSValue* thisValue, const ArgList& args) 559 { 560 JSObject* thisObject = thisValue->toThisObject(exec); 561 JSGlobalObject* globalObject = thisObject->toGlobalObject(exec); 562 562 if (!globalObject || globalObject->evalFunction() != function) 563 563 return throwError(exec, EvalError, "The \"this\" value passed to eval must be the global object from which eval originated"); … … 579 579 580 580 JSValue* exception = 0; 581 JSValue* value = exec->machine()->execute(evalNode.get(), exec, thisObj , &exec->dynamicGlobalObject()->registerFileStack(), globalObject->globalScopeChain().node(), &exception);581 JSValue* value = exec->machine()->execute(evalNode.get(), exec, thisObject, &exec->dynamicGlobalObject()->registerFileStack(), globalObject->globalScopeChain().node(), &exception); 582 582 583 583 if (exception) { … … 589 589 } 590 590 591 JSValue* globalFuncParseInt(ExecState* exec, JSObject*, const ArgList& args)591 JSValue* globalFuncParseInt(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 592 592 { 593 593 return jsNumber(exec, parseInt(args[0]->toString(exec), args[1]->toInt32(exec))); 594 594 } 595 595 596 JSValue* globalFuncParseFloat(ExecState* exec, JSObject*, const ArgList& args)596 JSValue* globalFuncParseFloat(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 597 597 { 598 598 return jsNumber(exec, parseFloat(args[0]->toString(exec))); 599 599 } 600 600 601 JSValue* globalFuncIsNaN(ExecState* exec, JSObject*, const ArgList& args)601 JSValue* globalFuncIsNaN(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 602 602 { 603 603 return jsBoolean(isnan(args[0]->toNumber(exec))); 604 604 } 605 605 606 JSValue* globalFuncIsFinite(ExecState* exec, JSObject*, const ArgList& args)606 JSValue* globalFuncIsFinite(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 607 607 { 608 608 double n = args[0]->toNumber(exec); … … 610 610 } 611 611 612 JSValue* globalFuncDecodeURI(ExecState* exec, JSObject*, const ArgList& args)612 JSValue* globalFuncDecodeURI(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 613 613 { 614 614 static const char do_not_unescape_when_decoding_URI[] = … … 618 618 } 619 619 620 JSValue* globalFuncDecodeURIComponent(ExecState* exec, JSObject*, const ArgList& args)620 JSValue* globalFuncDecodeURIComponent(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 621 621 { 622 622 return decode(exec, args, "", true); 623 623 } 624 624 625 JSValue* globalFuncEncodeURI(ExecState* exec, JSObject*, const ArgList& args)625 JSValue* globalFuncEncodeURI(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 626 626 { 627 627 static const char do_not_escape_when_encoding_URI[] = … … 634 634 } 635 635 636 JSValue* globalFuncEncodeURIComponent(ExecState* exec, JSObject*, const ArgList& args)636 JSValue* globalFuncEncodeURIComponent(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 637 637 { 638 638 static const char do_not_escape_when_encoding_URI_component[] = … … 645 645 } 646 646 647 JSValue* globalFuncEscape(ExecState* exec, JSObject*, const ArgList& args)647 JSValue* globalFuncEscape(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 648 648 { 649 649 static const char do_not_escape[] = … … 674 674 } 675 675 676 JSValue* globalFuncUnescape(ExecState* exec, JSObject*, const ArgList& args)676 JSValue* globalFuncUnescape(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 677 677 { 678 678 UString s = "", str = args[0]->toString(exec); … … 700 700 701 701 #ifndef NDEBUG 702 JSValue* globalFuncKJSPrint(ExecState* exec, JSObject*, const ArgList& args)702 JSValue* globalFuncKJSPrint(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 703 703 { 704 704 CStringBuffer string; … … 711 711 // ------------------------------ PrototypeFunction ------------------------------- 712 712 713 PrototypeFunction::PrototypeFunction(ExecState* exec, int len, const Identifier& name, JSMemberFunction function)713 PrototypeFunction::PrototypeFunction(ExecState* exec, int len, const Identifier& name, NativeFunction function) 714 714 : InternalFunction(exec->lexicalGlobalObject()->functionPrototype(), name) 715 715 , m_function(function) … … 719 719 } 720 720 721 PrototypeFunction::PrototypeFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, JSMemberFunction function)721 PrototypeFunction::PrototypeFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, NativeFunction function) 722 722 : InternalFunction(functionPrototype, name) 723 723 , m_function(function) … … 727 727 } 728 728 729 JSValue* PrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const ArgList& args) 730 { 731 return m_function(exec, thisObj, args); 729 CallType PrototypeFunction::getCallData(CallData& callData) 730 { 731 callData.native.function = m_function; 732 return CallTypeNative; 732 733 } 733 734 734 735 // ------------------------------ PrototypeReflexiveFunction ------------------------------- 735 736 736 PrototypeReflexiveFunction::PrototypeReflexiveFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, JSMemberFunction function, JSGlobalObject* cachedGlobalObject) 737 : InternalFunction(functionPrototype, name) 738 , m_function(function) 737 GlobalEvalFunction::GlobalEvalFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, NativeFunction function, JSGlobalObject* cachedGlobalObject) 738 : PrototypeFunction(exec, functionPrototype, len, name, function) 739 739 , m_cachedGlobalObject(cachedGlobalObject) 740 740 { 741 ASSERT_ARG(function, function);742 741 ASSERT_ARG(cachedGlobalObject, cachedGlobalObject); 743 putDirect(exec->propertyNames().length, jsNumber(exec, len), DontDelete | ReadOnly | DontEnum); 744 } 745 746 JSValue* PrototypeReflexiveFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const ArgList& args) 747 { 748 return m_function(exec, this, thisObj, args); 749 } 750 751 void PrototypeReflexiveFunction::mark() 752 { 753 InternalFunction::mark(); 742 } 743 744 void GlobalEvalFunction::mark() 745 { 746 PrototypeFunction::mark(); 754 747 if (!m_cachedGlobalObject->marked()) 755 748 m_cachedGlobalObject->mark();
Note:
See TracChangeset
for help on using the changeset viewer.