Changeset 38209 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Nov 6, 2008, 5:30:03 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r38148 r38209 4709 4709 } 4710 4710 4711 VoidPtrPairMachine::cti_op_call_JSFunction(CTI_ARGS)4711 void* Machine::cti_op_call_JSFunction(CTI_ARGS) 4712 4712 { 4713 4713 CTI_STACK_HACK(); … … 4720 4720 ScopeChainNode* callDataScopeChain = asFunction(ARG_src1)->m_scopeChain.node(); 4721 4721 CodeBlock* newCodeBlock = &asFunction(ARG_src1)->m_body->byteCode(callDataScopeChain); 4722 CallFrame* callFrame = ARG_callFrame; 4723 size_t registerOffset = ARG_int2; 4722 4723 if (!newCodeBlock->ctiCode) 4724 CTI::compile(ARG_globalData->machine, ARG_callFrame, newCodeBlock); 4725 4726 return newCodeBlock; 4727 } 4728 4729 VoidPtrPair Machine::cti_op_call_arityCheck(CTI_ARGS) 4730 { 4731 CTI_STACK_HACK(); 4732 4733 CallFrame* callFrame = ARG_callFrame; 4734 CodeBlock* newCodeBlock = ARG_codeBlock4; 4724 4735 int argCount = ARG_int3; 4725 4736 4726 if (LIKELY(argCount == newCodeBlock->numParameters)) { 4727 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(callFrame->registers() + registerOffset) }}; 4728 return pair.i; 4729 } 4737 ASSERT(argCount != newCodeBlock->numParameters); 4738 4739 CallFrame* oldCallFrame = callFrame->callerFrame(); 4730 4740 4731 4741 if (argCount > newCodeBlock->numParameters) { 4732 4742 size_t numParameters = newCodeBlock->numParameters; 4733 Register* r = callFrame->registers() + registerOffset +numParameters;4743 Register* r = callFrame->registers() + numParameters; 4734 4744 4735 4745 Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount; … … 4737 4747 argv[i + argCount] = argv[i]; 4738 4748 4739 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(r) }}; 4740 return pair.i; 4741 } 4742 4743 size_t omittedArgCount = newCodeBlock->numParameters - argCount; 4744 Register* r = callFrame->registers() + registerOffset + omittedArgCount; 4745 Register* newEnd = r + newCodeBlock->numCalleeRegisters; 4746 if (!ARG_registerFile->grow(newEnd)) { 4747 ARG_globalData->exception = createStackOverflowError(callFrame); 4748 VM_THROW_EXCEPTION_2(); 4749 } 4750 4751 Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount; 4752 for (size_t i = 0; i < omittedArgCount; ++i) 4753 argv[i] = jsUndefined(); 4754 4755 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(r) }}; 4749 callFrame = CallFrame::create(r); 4750 callFrame->setCallerFrame(oldCallFrame); 4751 } else { 4752 size_t omittedArgCount = newCodeBlock->numParameters - argCount; 4753 Register* r = callFrame->registers() + omittedArgCount; 4754 Register* newEnd = r + newCodeBlock->numCalleeRegisters; 4755 if (!ARG_registerFile->grow(newEnd)) { 4756 ARG_globalData->exception = createStackOverflowError(oldCallFrame); 4757 VM_THROW_EXCEPTION_2(); 4758 } 4759 4760 Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount; 4761 for (size_t i = 0; i < omittedArgCount; ++i) 4762 argv[i] = jsUndefined(); 4763 4764 callFrame = CallFrame::create(r); 4765 callFrame->setCallerFrame(oldCallFrame); 4766 } 4767 4768 VoidPtrPairValue pair = {{ newCodeBlock, callFrame }}; 4756 4769 return pair.i; 4757 4770 } … … 4771 4784 CTI::linkCall(callee, codeBlock, codeBlock->ctiCode, ARG_linkInfo2, ARG_int3); 4772 4785 4773 return codeBlock->ctiCode;4774 }4775 4776 void* Machine::cti_vm_compile(CTI_ARGS)4777 {4778 CTI_STACK_HACK();4779 4780 CodeBlock* codeBlock = ARG_callFrame->codeBlock();4781 if (!codeBlock->ctiCode)4782 CTI::compile(ARG_globalData->machine, ARG_callFrame, codeBlock);4783 4786 return codeBlock->ctiCode; 4784 4787 } … … 4934 4937 } 4935 4938 4936 JSObject* Machine::cti_op_construct_JSConstruct Fast(CTI_ARGS)4939 JSObject* Machine::cti_op_construct_JSConstruct(CTI_ARGS) 4937 4940 { 4938 4941 CTI_STACK_HACK(); … … 4944 4947 4945 4948 StructureID* structure; 4946 if (ARG_src 2->isObject())4947 structure = asObject(ARG_src 2)->inheritorID();4949 if (ARG_src5->isObject()) 4950 structure = asObject(ARG_src5)->inheritorID(); 4948 4951 else 4949 4952 structure = asFunction(ARG_src1)->m_scopeChain.node()->globalObject()->emptyObjectStructure(); 4950 4953 return new (ARG_globalData) JSObject(structure); 4951 }4952 4953 VoidPtrPair Machine::cti_op_construct_JSConstruct(CTI_ARGS)4954 {4955 CTI_STACK_HACK();4956 4957 CallFrame* callFrame = ARG_callFrame;4958 4959 JSFunction* constructor = asFunction(ARG_src1);4960 int registerOffset = ARG_int2;4961 int argCount = ARG_int3;4962 JSValue* constrProtoVal = ARG_src5;4963 int firstArg = ARG_int6;4964 4965 #ifndef NDEBUG4966 ConstructData constructData;4967 ASSERT(constructor->getConstructData(constructData) == ConstructTypeJS);4968 #endif4969 4970 ScopeChainNode* callDataScopeChain = constructor->m_scopeChain.node();4971 FunctionBodyNode* functionBodyNode = constructor->m_body.get();4972 CodeBlock* newCodeBlock = &functionBodyNode->byteCode(callDataScopeChain);4973 4974 StructureID* structure;4975 if (constrProtoVal->isObject())4976 structure = asObject(constrProtoVal)->inheritorID();4977 else4978 structure = callDataScopeChain->globalObject()->emptyObjectStructure();4979 JSObject* newObject = new (ARG_globalData) JSObject(structure);4980 callFrame[firstArg] = newObject; // "this" value4981 4982 if (LIKELY(argCount == newCodeBlock->numParameters)) {4983 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(callFrame->registers() + registerOffset) }};4984 return pair.i;4985 }4986 4987 if (argCount > newCodeBlock->numParameters) {4988 size_t numParameters = newCodeBlock->numParameters;4989 Register* r = callFrame->registers() + registerOffset + numParameters;4990 4991 Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount;4992 for (size_t i = 0; i < numParameters; ++i)4993 argv[i + argCount] = argv[i];4994 4995 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(r) }};4996 return pair.i;4997 }4998 4999 size_t omittedArgCount = newCodeBlock->numParameters - argCount;5000 Register* r = callFrame->registers() + registerOffset + omittedArgCount;5001 Register* newEnd = r + newCodeBlock->numCalleeRegisters;5002 if (!ARG_registerFile->grow(newEnd)) {5003 ARG_globalData->exception = createStackOverflowError(callFrame);5004 VM_THROW_EXCEPTION_2();5005 }5006 5007 Register* argv = r - RegisterFile::CallFrameHeaderSize - omittedArgCount;5008 for (size_t i = 0; i < omittedArgCount; ++i)5009 argv[i] = jsUndefined();5010 5011 VoidPtrPairValue pair = {{ newCodeBlock, CallFrame::create(r) }};5012 return pair.i;5013 4954 } 5014 4955
Note:
See TracChangeset
for help on using the changeset viewer.