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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 __ j(equal, &throw_termination_exception); | 2066 __ j(equal, &throw_termination_exception); |
2067 | 2067 |
2068 // Handle normal exception. | 2068 // Handle normal exception. |
2069 __ Throw(eax); | 2069 __ Throw(eax); |
2070 | 2070 |
2071 __ bind(&throw_termination_exception); | 2071 __ bind(&throw_termination_exception); |
2072 __ ThrowUncatchable(eax); | 2072 __ ThrowUncatchable(eax); |
2073 } | 2073 } |
2074 | 2074 |
2075 | 2075 |
2076 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 2076 void JSEntryStub::Generate(MacroAssembler* masm) { |
2077 Label invoke, handler_entry, exit; | 2077 Label invoke, handler_entry, exit; |
2078 Label not_outermost_js, not_outermost_js_2; | 2078 Label not_outermost_js, not_outermost_js_2; |
2079 | 2079 |
2080 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 2080 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
2081 | 2081 |
2082 // Set up frame. | 2082 // Set up frame. |
2083 __ push(ebp); | 2083 __ push(ebp); |
2084 __ mov(ebp, esp); | 2084 __ mov(ebp, esp); |
2085 | 2085 |
2086 // Push marker in two places. | 2086 // Push marker in two places. |
2087 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 2087 int marker = type(); |
2088 __ push(Immediate(Smi::FromInt(marker))); // context slot | 2088 __ push(Immediate(Smi::FromInt(marker))); // context slot |
2089 __ push(Immediate(Smi::FromInt(marker))); // function slot | 2089 __ push(Immediate(Smi::FromInt(marker))); // function slot |
2090 // Save callee-saved registers (C calling conventions). | 2090 // Save callee-saved registers (C calling conventions). |
2091 __ push(edi); | 2091 __ push(edi); |
2092 __ push(esi); | 2092 __ push(esi); |
2093 __ push(ebx); | 2093 __ push(ebx); |
2094 | 2094 |
2095 // Save copies of the top frame descriptor on the stack. | 2095 // Save copies of the top frame descriptor on the stack. |
2096 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); | 2096 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate()); |
2097 __ push(Operand::StaticVariable(c_entry_fp)); | 2097 __ push(Operand::StaticVariable(c_entry_fp)); |
(...skipping 30 matching lines...) Expand all Loading... |
2128 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); | 2128 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); |
2129 __ mov(Operand::StaticVariable(pending_exception), edx); | 2129 __ mov(Operand::StaticVariable(pending_exception), edx); |
2130 | 2130 |
2131 // Fake a receiver (NULL). | 2131 // Fake a receiver (NULL). |
2132 __ push(Immediate(0)); // receiver | 2132 __ push(Immediate(0)); // receiver |
2133 | 2133 |
2134 // Invoke the function by calling through JS entry trampoline builtin and | 2134 // Invoke the function by calling through JS entry trampoline builtin and |
2135 // pop the faked function when we return. Notice that we cannot store a | 2135 // pop the faked function when we return. Notice that we cannot store a |
2136 // reference to the trampoline code directly in this stub, because the | 2136 // reference to the trampoline code directly in this stub, because the |
2137 // builtin stubs may not have been generated yet. | 2137 // builtin stubs may not have been generated yet. |
2138 if (is_construct) { | 2138 if (type() == StackFrame::ENTRY_CONSTRUCT) { |
2139 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, | 2139 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, |
2140 isolate()); | 2140 isolate()); |
2141 __ mov(edx, Immediate(construct_entry)); | 2141 __ mov(edx, Immediate(construct_entry)); |
2142 } else { | 2142 } else { |
2143 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); | 2143 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate()); |
2144 __ mov(edx, Immediate(entry)); | 2144 __ mov(edx, Immediate(entry)); |
2145 } | 2145 } |
2146 __ mov(edx, Operand(edx, 0)); // deref address | 2146 __ mov(edx, Operand(edx, 0)); // deref address |
2147 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 2147 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
2148 __ call(edx); | 2148 __ call(edx); |
(...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4323 Operand(ebp, 7 * kPointerSize), | 4323 Operand(ebp, 7 * kPointerSize), |
4324 NULL); | 4324 NULL); |
4325 } | 4325 } |
4326 | 4326 |
4327 | 4327 |
4328 #undef __ | 4328 #undef __ |
4329 | 4329 |
4330 } } // namespace v8::internal | 4330 } } // namespace v8::internal |
4331 | 4331 |
4332 #endif // V8_TARGET_ARCH_X87 | 4332 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |