Changeset 59742 in webkit for trunk/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- May 18, 2010, 10:10:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r59339 r59742 468 468 printf("[ArgumentCount] | %10p | %d \n", it, (*it).i()); ++it; 469 469 printf("[Callee] | %10p | %p \n", it, (*it).function()); ++it; 470 printf("[OptionalCalleeArguments] | %10p | %p \n", it, (*it).arguments()); ++it;471 470 printf("-----------------------------------------------------------------------------\n"); 472 471 … … 541 540 while (!scopeChain->object->inherits(&JSActivation::info)) 542 541 scopeChain = scopeChain->pop(); 543 static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments()); 544 } else if (Arguments* arguments = callFrame->optionalCalleeArguments()) { 545 if (!arguments->isTornOff()) 546 arguments->copyRegisters(); 542 JSActivation* activation = asActivation(scopeChain->object); 543 activation->copyRegisters(); 544 if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) 545 asArguments(arguments)->setActivation(activation); 546 } else if (oldCodeBlock->usesArguments()) { 547 if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) 548 asArguments(arguments)->copyRegisters(); 547 549 } 548 550 … … 3777 3779 } 3778 3780 DEFINE_OPCODE(op_tear_off_activation) { 3779 /* tear_off_activation activation(r) 3780 3781 Copy all locals and parameters to new memory allocated on 3782 the heap, and make the passed activation use this memory 3783 in the future when looking up entries in the symbol table. 3784 If there is an 'arguments' object, then it will also use 3785 this memory for storing the named parameters, but not any 3786 extra arguments. 3787 3788 This opcode should only be used immediately before op_ret. 3789 */ 3790 3791 int src = vPC[1].u.operand; 3781 /* tear_off_activation activation(r) arguments(r) 3782 3783 Copy locals and named parameters from the register file to the heap. 3784 Point the bindings in 'activation' and 'arguments' to this new backing 3785 store. (Note that 'arguments' may not have been created. If created, 3786 'arguments' already holds a copy of any extra / unnamed parameters.) 3787 3788 This opcode appears before op_ret in functions that require full scope chains. 3789 */ 3790 3791 int src1 = vPC[1].u.operand; 3792 int src2 = vPC[2].u.operand; 3792 3793 ASSERT(callFrame->codeBlock()->needsFullScopeChain()); 3793 3794 3794 asActivation(callFrame->r(src).jsValue())->copyRegisters(callFrame->optionalCalleeArguments()); 3795 JSActivation* activation = asActivation(callFrame->r(src1).jsValue()); 3796 activation->copyRegisters(); 3797 3798 if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(src2)).jsValue()) 3799 asArguments(arguments)->setActivation(activation); 3795 3800 3796 3801 vPC += OPCODE_LENGTH(op_tear_off_activation); … … 3798 3803 } 3799 3804 DEFINE_OPCODE(op_tear_off_arguments) { 3800 /* tear_off_arguments 3801 3802 Copy all arguments to new memory allocated on the heap,3803 and make the 'arguments' object use this memory in the3804 future when looking up named parameters, but not any3805 extra arguments. If an activation object exists for the3806 current function context, then the tear_off_activation 3807 opcode should be used instead.3808 3809 This opcode should only be used immediately before op_ret.3810 */ 3811 3812 ASSERT( callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain());3813 3814 if ( callFrame->optionalCalleeArguments())3815 callFrame->optionalCalleeArguments()->copyRegisters();3805 /* tear_off_arguments arguments(r) 3806 3807 Copy named parameters from the register file to the heap. Point the 3808 bindings in 'arguments' to this new backing store. (Note that 3809 'arguments' may not have been created. If created, 'arguments' already 3810 holds a copy of any extra / unnamed parameters.) 3811 3812 This opcode appears before op_ret in functions that don't require full 3813 scope chains, but do use 'arguments'. 3814 */ 3815 3816 int src1 = vPC[1].u.operand; 3817 ASSERT(!callFrame->codeBlock()->needsFullScopeChain() && callFrame->codeBlock()->usesArguments()); 3818 3819 if (JSValue arguments = callFrame->r(unmodifiedArgumentsRegister(src1)).jsValue()) 3820 asArguments(arguments)->copyRegisters(); 3816 3821 3817 3822 vPC += OPCODE_LENGTH(op_tear_off_arguments); … … 3849 3854 /* enter 3850 3855 3851 Initializes local variables to undefined and fills constant 3852 registers with their values. If the code block requires an 3853 activation, enter_with_activation should be used instead. 3854 3855 This opcode should only be used at the beginning of a code 3856 block. 3856 Initializes local variables to undefined. If the code block requires 3857 an activation, enter_with_activation is used instead. 3858 3859 This opcode appears only at the beginning of a code block. 3857 3860 */ 3858 3861 … … 3869 3872 /* enter_with_activation dst(r) 3870 3873 3871 Initializes local variables to undefined, fills constant 3872 registers with their values, creates an activation object, 3873 and places the new activation both in dst and at the top 3874 of the scope chain. If the code block does not require an 3875 activation, enter should be used instead. 3876 3877 This opcode should only be used at the beginning of a code 3878 block. 3874 Initializes local variables to undefined, creates an activation object, 3875 places it in dst, and pushes it onto the scope chain. 3876 3877 This opcode appears only at the beginning of a code block. 3879 3878 */ 3880 3879 … … 3914 3913 } 3915 3914 DEFINE_OPCODE(op_init_arguments) { 3916 /* create_arguments 3917 3918 Initialises the arguments object reference to null to ensure 3919 we can correctly detect that we need to create it later (or 3920 avoid creating it altogether). 3921 3922 This opcode should only be used at the beginning of a code 3923 block. 3915 /* create_arguments dst(r) 3916 3917 Initialises 'arguments' to JSValue(). 3918 3919 This opcode appears only at the beginning of a code block. 3924 3920 */ 3925 callFrame->r(RegisterFile::ArgumentsRegister) = JSValue(); 3921 int dst = vPC[1].u.operand; 3922 3923 callFrame->r(dst) = JSValue(); 3924 callFrame->r(unmodifiedArgumentsRegister(dst)) = JSValue(); 3926 3925 vPC += OPCODE_LENGTH(op_init_arguments); 3927 3926 NEXT_INSTRUCTION(); 3928 3927 } 3929 3928 DEFINE_OPCODE(op_create_arguments) { 3930 /* create_arguments 3929 /* create_arguments dst(r) 3931 3930 3932 3931 Creates the 'arguments' object and places it in both the … … 3935 3934 */ 3936 3935 3937 if (!callFrame->r(RegisterFile::ArgumentsRegister).jsValue()) { 3938 Arguments* arguments = new (globalData) Arguments(callFrame); 3939 callFrame->setCalleeArguments(arguments); 3940 callFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments); 3941 } 3936 int dst = vPC[1].u.operand; 3937 3938 if (!callFrame->r(dst).jsValue()) { 3939 Arguments* arguments = new (globalData) Arguments(callFrame); 3940 callFrame->r(dst) = JSValue(arguments); 3941 callFrame->r(unmodifiedArgumentsRegister(dst)) = JSValue(arguments); 3942 } 3942 3943 vPC += OPCODE_LENGTH(op_create_arguments); 3943 3944 NEXT_INSTRUCTION(); … … 4420 4421 if (codeBlock->usesArguments()) { 4421 4422 ASSERT(codeBlock->codeType() == FunctionCode); 4422 SymbolTable& symbolTable = *codeBlock->symbolTable(); 4423 int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex(); 4424 if (!functionCallFrame->r(argumentsIndex).jsValue()) { 4425 Arguments* arguments = new (callFrame) Arguments(functionCallFrame); 4426 functionCallFrame->setCalleeArguments(arguments); 4427 functionCallFrame->r(RegisterFile::ArgumentsRegister) = JSValue(arguments); 4428 } 4429 return functionCallFrame->r(argumentsIndex).jsValue(); 4430 } 4431 4432 Arguments* arguments = functionCallFrame->optionalCalleeArguments(); 4433 if (!arguments) { 4434 arguments = new (functionCallFrame) Arguments(functionCallFrame); 4435 arguments->copyRegisters(); 4436 callFrame->setCalleeArguments(arguments); 4437 } 4438 4423 int argumentsRegister = codeBlock->argumentsRegister(); 4424 if (!functionCallFrame->r(argumentsRegister).jsValue()) { 4425 JSValue arguments = JSValue(new (callFrame) Arguments(functionCallFrame)); 4426 functionCallFrame->r(argumentsRegister) = arguments; 4427 functionCallFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments; 4428 } 4429 return functionCallFrame->r(argumentsRegister).jsValue(); 4430 } 4431 4432 Arguments* arguments = new (functionCallFrame) Arguments(functionCallFrame); 4433 arguments->copyRegisters(); 4439 4434 return arguments; 4440 4435 }
Note:
See TracChangeset
for help on using the changeset viewer.