OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 __ bind(&argc); | 68 __ bind(&argc); |
69 __ add(eax, Immediate(num_extra_args + 1)); | 69 __ add(eax, Immediate(num_extra_args + 1)); |
70 __ bind(&done_argc); | 70 __ bind(&done_argc); |
71 | 71 |
72 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 72 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 static void CallRuntimePassFunction( | 76 static void CallRuntimePassFunction( |
77 MacroAssembler* masm, Runtime::FunctionId function_id) { | 77 MacroAssembler* masm, Runtime::FunctionId function_id) { |
| 78 // ----------- S t a t e ------------- |
| 79 // -- edx : new target (preserved for callee) |
| 80 // -- edi : target function (preserved for callee) |
| 81 // ----------------------------------- |
| 82 |
78 FrameScope scope(masm, StackFrame::INTERNAL); | 83 FrameScope scope(masm, StackFrame::INTERNAL); |
79 // Push a copy of the function. | 84 // Push a copy of the target function and the new target. |
80 __ push(edi); | 85 __ push(edi); |
| 86 __ push(edx); |
81 // Function is also the parameter to the runtime call. | 87 // Function is also the parameter to the runtime call. |
82 __ push(edi); | 88 __ push(edi); |
83 | 89 |
84 __ CallRuntime(function_id, 1); | 90 __ CallRuntime(function_id, 1); |
85 // Restore receiver. | 91 // Restore target function and new target. |
| 92 __ pop(edx); |
86 __ pop(edi); | 93 __ pop(edi); |
87 } | 94 } |
88 | 95 |
89 | 96 |
90 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 97 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
91 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 98 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
92 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); | 99 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); |
93 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | 100 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
94 __ jmp(eax); | 101 __ jmp(eax); |
95 } | 102 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 __ j(greater_equal, &loop); | 332 __ j(greater_equal, &loop); |
326 | 333 |
327 // Call the function. | 334 // Call the function. |
328 if (is_api_function) { | 335 if (is_api_function) { |
329 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 336 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
330 Handle<Code> code = | 337 Handle<Code> code = |
331 masm->isolate()->builtins()->HandleApiCallConstruct(); | 338 masm->isolate()->builtins()->HandleApiCallConstruct(); |
332 __ call(code, RelocInfo::CODE_TARGET); | 339 __ call(code, RelocInfo::CODE_TARGET); |
333 } else { | 340 } else { |
334 ParameterCount actual(eax); | 341 ParameterCount actual(eax); |
335 __ InvokeFunction(edi, actual, CALL_FUNCTION, | 342 __ InvokeFunction(edi, edx, actual, CALL_FUNCTION, NullCallWrapper()); |
336 NullCallWrapper()); | |
337 } | 343 } |
338 | 344 |
339 // Store offset of return address for deoptimizer. | 345 // Store offset of return address for deoptimizer. |
340 if (create_implicit_receiver && !is_api_function) { | 346 if (create_implicit_receiver && !is_api_function) { |
341 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 347 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
342 } | 348 } |
343 | 349 |
344 // Restore context from the frame. | 350 // Restore context from the frame. |
345 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
346 | 352 |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 // -- edx : the shared function info. | 1527 // -- edx : the shared function info. |
1522 // -- edi : the function to call (checked to be a JSFunction) | 1528 // -- edi : the function to call (checked to be a JSFunction) |
1523 // -- esi : the function context. | 1529 // -- esi : the function context. |
1524 // ----------------------------------- | 1530 // ----------------------------------- |
1525 | 1531 |
1526 __ mov(ebx, | 1532 __ mov(ebx, |
1527 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); | 1533 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
1528 __ SmiUntag(ebx); | 1534 __ SmiUntag(ebx); |
1529 ParameterCount actual(eax); | 1535 ParameterCount actual(eax); |
1530 ParameterCount expected(ebx); | 1536 ParameterCount expected(ebx); |
1531 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), expected, | 1537 __ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), no_reg, |
1532 actual, JUMP_FUNCTION, NullCallWrapper()); | 1538 expected, actual, JUMP_FUNCTION, NullCallWrapper()); |
1533 | 1539 |
1534 // The function is a "classConstructor", need to raise an exception. | 1540 // The function is a "classConstructor", need to raise an exception. |
1535 __ bind(&class_constructor); | 1541 __ bind(&class_constructor); |
1536 { | 1542 { |
1537 FrameScope frame(masm, StackFrame::INTERNAL); | 1543 FrameScope frame(masm, StackFrame::INTERNAL); |
1538 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); | 1544 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); |
1539 } | 1545 } |
1540 } | 1546 } |
1541 | 1547 |
1542 | 1548 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 | 1858 |
1853 __ bind(&ok); | 1859 __ bind(&ok); |
1854 __ ret(0); | 1860 __ ret(0); |
1855 } | 1861 } |
1856 | 1862 |
1857 #undef __ | 1863 #undef __ |
1858 } // namespace internal | 1864 } // namespace internal |
1859 } // namespace v8 | 1865 } // namespace v8 |
1860 | 1866 |
1861 #endif // V8_TARGET_ARCH_IA32 | 1867 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |