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/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 | 2055 |
2056 void MacroAssembler::PrepareCallApiFunction(int argc) { | 2056 void MacroAssembler::PrepareCallApiFunction(int argc) { |
2057 EnterApiExitFrame(argc); | 2057 EnterApiExitFrame(argc); |
2058 if (emit_debug_code()) { | 2058 if (emit_debug_code()) { |
2059 mov(esi, Immediate(bit_cast<int32_t>(kZapValue))); | 2059 mov(esi, Immediate(bit_cast<int32_t>(kZapValue))); |
2060 } | 2060 } |
2061 } | 2061 } |
2062 | 2062 |
2063 | 2063 |
2064 void MacroAssembler::CallApiFunctionAndReturn( | 2064 void MacroAssembler::CallApiFunctionAndReturn( |
2065 Register function_address, | 2065 Register function_address, ExternalReference thunk_ref, |
2066 ExternalReference thunk_ref, | 2066 Operand thunk_last_arg, int stack_space, Operand* stack_space_operand, |
2067 Operand thunk_last_arg, | 2067 Operand return_value_operand, Operand* context_restore_operand) { |
2068 int stack_space, | |
2069 Operand return_value_operand, | |
2070 Operand* context_restore_operand) { | |
2071 ExternalReference next_address = | 2068 ExternalReference next_address = |
2072 ExternalReference::handle_scope_next_address(isolate()); | 2069 ExternalReference::handle_scope_next_address(isolate()); |
2073 ExternalReference limit_address = | 2070 ExternalReference limit_address = |
2074 ExternalReference::handle_scope_limit_address(isolate()); | 2071 ExternalReference::handle_scope_limit_address(isolate()); |
2075 ExternalReference level_address = | 2072 ExternalReference level_address = |
2076 ExternalReference::handle_scope_level_address(isolate()); | 2073 ExternalReference::handle_scope_level_address(isolate()); |
2077 | 2074 |
2078 DCHECK(edx.is(function_address)); | 2075 DCHECK(edx.is(function_address)); |
2079 // Allocate HandleScope in callee-save registers. | 2076 // Allocate HandleScope in callee-save registers. |
2080 mov(ebx, Operand::StaticVariable(next_address)); | 2077 mov(ebx, Operand::StaticVariable(next_address)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 | 2176 |
2180 Abort(kAPICallReturnedInvalidObject); | 2177 Abort(kAPICallReturnedInvalidObject); |
2181 | 2178 |
2182 bind(&ok); | 2179 bind(&ok); |
2183 #endif | 2180 #endif |
2184 | 2181 |
2185 bool restore_context = context_restore_operand != NULL; | 2182 bool restore_context = context_restore_operand != NULL; |
2186 if (restore_context) { | 2183 if (restore_context) { |
2187 mov(esi, *context_restore_operand); | 2184 mov(esi, *context_restore_operand); |
2188 } | 2185 } |
| 2186 if (stack_space_operand != nullptr) { |
| 2187 mov(ebx, *stack_space_operand); |
| 2188 } |
2189 LeaveApiExitFrame(!restore_context); | 2189 LeaveApiExitFrame(!restore_context); |
2190 ret(stack_space * kPointerSize); | 2190 if (stack_space_operand != nullptr) { |
| 2191 DCHECK_EQ(0, stack_space); |
| 2192 pop(ecx); |
| 2193 add(esp, ebx); |
| 2194 jmp(ecx); |
| 2195 } else { |
| 2196 ret(stack_space * kPointerSize); |
| 2197 } |
2191 | 2198 |
2192 bind(&promote_scheduled_exception); | 2199 bind(&promote_scheduled_exception); |
2193 { | 2200 { |
2194 FrameScope frame(this, StackFrame::INTERNAL); | 2201 FrameScope frame(this, StackFrame::INTERNAL); |
2195 CallRuntime(Runtime::kPromoteScheduledException, 0); | 2202 CallRuntime(Runtime::kPromoteScheduledException, 0); |
2196 } | 2203 } |
2197 jmp(&exception_handled); | 2204 jmp(&exception_handled); |
2198 | 2205 |
2199 // HandleScope limit has changed. Delete allocated extensions. | 2206 // HandleScope limit has changed. Delete allocated extensions. |
2200 ExternalReference delete_extensions = | 2207 ExternalReference delete_extensions = |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3365 if (mag.shift > 0) sar(edx, mag.shift); | 3372 if (mag.shift > 0) sar(edx, mag.shift); |
3366 mov(eax, dividend); | 3373 mov(eax, dividend); |
3367 shr(eax, 31); | 3374 shr(eax, 31); |
3368 add(edx, eax); | 3375 add(edx, eax); |
3369 } | 3376 } |
3370 | 3377 |
3371 | 3378 |
3372 } } // namespace v8::internal | 3379 } } // namespace v8::internal |
3373 | 3380 |
3374 #endif // V8_TARGET_ARCH_X87 | 3381 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |