| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4175 __ j(not_equal, label); | 4175 __ j(not_equal, label); |
| 4176 } | 4176 } |
| 4177 | 4177 |
| 4178 | 4178 |
| 4179 void StackCheckStub::Generate(MacroAssembler* masm) { | 4179 void StackCheckStub::Generate(MacroAssembler* masm) { |
| 4180 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); | 4180 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); |
| 4181 } | 4181 } |
| 4182 | 4182 |
| 4183 | 4183 |
| 4184 void CallFunctionStub::Generate(MacroAssembler* masm) { | 4184 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 4185 Label slow; | 4185 Label slow, non_function; |
| 4186 | 4186 |
| 4187 // The receiver might implicitly be the global object. This is | 4187 // The receiver might implicitly be the global object. This is |
| 4188 // indicated by passing the hole as the receiver to the call | 4188 // indicated by passing the hole as the receiver to the call |
| 4189 // function stub. | 4189 // function stub. |
| 4190 if (ReceiverMightBeImplicit()) { | 4190 if (ReceiverMightBeImplicit()) { |
| 4191 Label call; | 4191 Label call; |
| 4192 // Get the receiver from the stack. | 4192 // Get the receiver from the stack. |
| 4193 // +1 ~ return address | 4193 // +1 ~ return address |
| 4194 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); | 4194 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); |
| 4195 // Call as function is indicated with the hole. | 4195 // Call as function is indicated with the hole. |
| 4196 __ cmp(eax, masm->isolate()->factory()->the_hole_value()); | 4196 __ cmp(eax, masm->isolate()->factory()->the_hole_value()); |
| 4197 __ j(not_equal, &call, Label::kNear); | 4197 __ j(not_equal, &call, Label::kNear); |
| 4198 // Patch the receiver on the stack with the global receiver object. | 4198 // Patch the receiver on the stack with the global receiver object. |
| 4199 __ mov(ebx, GlobalObjectOperand()); | 4199 __ mov(ebx, GlobalObjectOperand()); |
| 4200 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); | 4200 __ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); |
| 4201 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ebx); | 4201 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ebx); |
| 4202 __ bind(&call); | 4202 __ bind(&call); |
| 4203 } | 4203 } |
| 4204 | 4204 |
| 4205 // Get the function to call from the stack. | 4205 // Get the function to call from the stack. |
| 4206 // +2 ~ receiver, return address | 4206 // +2 ~ receiver, return address |
| 4207 __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize)); | 4207 __ mov(edi, Operand(esp, (argc_ + 2) * kPointerSize)); |
| 4208 | 4208 |
| 4209 // Check that the function really is a JavaScript function. | 4209 // Check that the function really is a JavaScript function. |
| 4210 __ JumpIfSmi(edi, &slow); | 4210 __ JumpIfSmi(edi, &non_function); |
| 4211 // Goto slow case if we do not have a function. | 4211 // Goto slow case if we do not have a function. |
| 4212 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 4212 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 4213 __ j(not_equal, &slow); | 4213 __ j(not_equal, &slow); |
| 4214 | 4214 |
| 4215 // Fast-case: Just invoke the function. | 4215 // Fast-case: Just invoke the function. |
| 4216 ParameterCount actual(argc_); | 4216 ParameterCount actual(argc_); |
| 4217 | 4217 |
| 4218 if (ReceiverMightBeImplicit()) { | 4218 if (ReceiverMightBeImplicit()) { |
| 4219 Label call_as_function; | 4219 Label call_as_function; |
| 4220 __ cmp(eax, masm->isolate()->factory()->the_hole_value()); | 4220 __ cmp(eax, masm->isolate()->factory()->the_hole_value()); |
| 4221 __ j(equal, &call_as_function); | 4221 __ j(equal, &call_as_function); |
| 4222 __ InvokeFunction(edi, | 4222 __ InvokeFunction(edi, |
| 4223 actual, | 4223 actual, |
| 4224 JUMP_FUNCTION, | 4224 JUMP_FUNCTION, |
| 4225 NullCallWrapper(), | 4225 NullCallWrapper(), |
| 4226 CALL_AS_METHOD); | 4226 CALL_AS_METHOD); |
| 4227 __ bind(&call_as_function); | 4227 __ bind(&call_as_function); |
| 4228 } | 4228 } |
| 4229 __ InvokeFunction(edi, | 4229 __ InvokeFunction(edi, |
| 4230 actual, | 4230 actual, |
| 4231 JUMP_FUNCTION, | 4231 JUMP_FUNCTION, |
| 4232 NullCallWrapper(), | 4232 NullCallWrapper(), |
| 4233 CALL_AS_FUNCTION); | 4233 CALL_AS_FUNCTION); |
| 4234 | 4234 |
| 4235 // Slow-case: Non-function called. | 4235 // Slow-case: Non-function called. |
| 4236 __ bind(&slow); | 4236 __ bind(&slow); |
| 4237 // Check for function proxy. |
| 4238 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
| 4239 __ j(not_equal, &non_function); |
| 4240 __ pop(ecx); |
| 4241 __ push(edi); // put proxy as additional argument under return address |
| 4242 __ push(ecx); |
| 4243 __ Set(eax, Immediate(argc_ + 1)); |
| 4244 __ Set(ebx, Immediate(0)); |
| 4245 __ SetCallKind(ecx, CALL_AS_FUNCTION); |
| 4246 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); |
| 4247 { |
| 4248 Handle<Code> adaptor = |
| 4249 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 4250 __ jmp(adaptor, RelocInfo::CODE_TARGET); |
| 4251 } |
| 4252 |
| 4237 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 4253 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 4238 // of the original receiver from the call site). | 4254 // of the original receiver from the call site). |
| 4255 __ bind(&non_function); |
| 4239 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); | 4256 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); |
| 4240 __ Set(eax, Immediate(argc_)); | 4257 __ Set(eax, Immediate(argc_)); |
| 4241 __ Set(ebx, Immediate(0)); | 4258 __ Set(ebx, Immediate(0)); |
| 4259 __ SetCallKind(ecx, CALL_AS_METHOD); |
| 4242 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 4260 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); |
| 4243 Handle<Code> adaptor = | 4261 Handle<Code> adaptor = |
| 4244 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 4262 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 4245 __ SetCallKind(ecx, CALL_AS_METHOD); | |
| 4246 __ jmp(adaptor, RelocInfo::CODE_TARGET); | 4263 __ jmp(adaptor, RelocInfo::CODE_TARGET); |
| 4247 } | 4264 } |
| 4248 | 4265 |
| 4249 | 4266 |
| 4250 bool CEntryStub::NeedsImmovableCode() { | 4267 bool CEntryStub::NeedsImmovableCode() { |
| 4251 return false; | 4268 return false; |
| 4252 } | 4269 } |
| 4253 | 4270 |
| 4254 | 4271 |
| 4255 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 4272 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6377 __ Drop(1); | 6394 __ Drop(1); |
| 6378 __ ret(2 * kPointerSize); | 6395 __ ret(2 * kPointerSize); |
| 6379 } | 6396 } |
| 6380 | 6397 |
| 6381 | 6398 |
| 6382 #undef __ | 6399 #undef __ |
| 6383 | 6400 |
| 6384 } } // namespace v8::internal | 6401 } } // namespace v8::internal |
| 6385 | 6402 |
| 6386 #endif // V8_TARGET_ARCH_IA32 | 6403 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |