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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 | 2091 |
2092 void MacroAssembler::PrepareCallApiFunction(int argc) { | 2092 void MacroAssembler::PrepareCallApiFunction(int argc) { |
2093 EnterApiExitFrame(argc); | 2093 EnterApiExitFrame(argc); |
2094 if (emit_debug_code()) { | 2094 if (emit_debug_code()) { |
2095 mov(esi, Immediate(bit_cast<int32_t>(kZapValue))); | 2095 mov(esi, Immediate(bit_cast<int32_t>(kZapValue))); |
2096 } | 2096 } |
2097 } | 2097 } |
2098 | 2098 |
2099 | 2099 |
2100 void MacroAssembler::CallApiFunctionAndReturn( | 2100 void MacroAssembler::CallApiFunctionAndReturn( |
2101 Register function_address, | 2101 Register function_address, ExternalReference thunk_ref, |
2102 ExternalReference thunk_ref, | 2102 Operand thunk_last_arg, int stack_space, Operand* stack_space_operand, |
2103 Operand thunk_last_arg, | 2103 Operand return_value_operand, Operand* context_restore_operand) { |
2104 int stack_space, | |
2105 Operand return_value_operand, | |
2106 Operand* context_restore_operand) { | |
2107 ExternalReference next_address = | 2104 ExternalReference next_address = |
2108 ExternalReference::handle_scope_next_address(isolate()); | 2105 ExternalReference::handle_scope_next_address(isolate()); |
2109 ExternalReference limit_address = | 2106 ExternalReference limit_address = |
2110 ExternalReference::handle_scope_limit_address(isolate()); | 2107 ExternalReference::handle_scope_limit_address(isolate()); |
2111 ExternalReference level_address = | 2108 ExternalReference level_address = |
2112 ExternalReference::handle_scope_level_address(isolate()); | 2109 ExternalReference::handle_scope_level_address(isolate()); |
2113 | 2110 |
2114 DCHECK(edx.is(function_address)); | 2111 DCHECK(edx.is(function_address)); |
2115 // Allocate HandleScope in callee-save registers. | 2112 // Allocate HandleScope in callee-save registers. |
2116 mov(ebx, Operand::StaticVariable(next_address)); | 2113 mov(ebx, Operand::StaticVariable(next_address)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 | 2212 |
2216 Abort(kAPICallReturnedInvalidObject); | 2213 Abort(kAPICallReturnedInvalidObject); |
2217 | 2214 |
2218 bind(&ok); | 2215 bind(&ok); |
2219 #endif | 2216 #endif |
2220 | 2217 |
2221 bool restore_context = context_restore_operand != NULL; | 2218 bool restore_context = context_restore_operand != NULL; |
2222 if (restore_context) { | 2219 if (restore_context) { |
2223 mov(esi, *context_restore_operand); | 2220 mov(esi, *context_restore_operand); |
2224 } | 2221 } |
| 2222 if (stack_space_operand != nullptr) { |
| 2223 mov(ebx, *stack_space_operand); |
| 2224 } |
2225 LeaveApiExitFrame(!restore_context); | 2225 LeaveApiExitFrame(!restore_context); |
2226 ret(stack_space * kPointerSize); | 2226 if (stack_space_operand != nullptr) { |
| 2227 DCHECK_EQ(0, stack_space); |
| 2228 pop(ecx); |
| 2229 add(esp, ebx); |
| 2230 jmp(ecx); |
| 2231 } else { |
| 2232 ret(stack_space * kPointerSize); |
| 2233 } |
2227 | 2234 |
2228 bind(&promote_scheduled_exception); | 2235 bind(&promote_scheduled_exception); |
2229 { | 2236 { |
2230 FrameScope frame(this, StackFrame::INTERNAL); | 2237 FrameScope frame(this, StackFrame::INTERNAL); |
2231 CallRuntime(Runtime::kPromoteScheduledException, 0); | 2238 CallRuntime(Runtime::kPromoteScheduledException, 0); |
2232 } | 2239 } |
2233 jmp(&exception_handled); | 2240 jmp(&exception_handled); |
2234 | 2241 |
2235 // HandleScope limit has changed. Delete allocated extensions. | 2242 // HandleScope limit has changed. Delete allocated extensions. |
2236 ExternalReference delete_extensions = | 2243 ExternalReference delete_extensions = |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3450 if (mag.shift > 0) sar(edx, mag.shift); | 3457 if (mag.shift > 0) sar(edx, mag.shift); |
3451 mov(eax, dividend); | 3458 mov(eax, dividend); |
3452 shr(eax, 31); | 3459 shr(eax, 31); |
3453 add(edx, eax); | 3460 add(edx, eax); |
3454 } | 3461 } |
3455 | 3462 |
3456 | 3463 |
3457 } } // namespace v8::internal | 3464 } } // namespace v8::internal |
3458 | 3465 |
3459 #endif // V8_TARGET_ARCH_IA32 | 3466 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |