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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 mov(esp, ebp); | 1019 mov(esp, ebp); |
1020 pop(ebp); | 1020 pop(ebp); |
1021 | 1021 |
1022 LeaveExitFrameEpilogue(restore_context); | 1022 LeaveExitFrameEpilogue(restore_context); |
1023 } | 1023 } |
1024 | 1024 |
1025 | 1025 |
1026 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 1026 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
1027 int handler_index) { | 1027 int handler_index) { |
1028 // Adjust this code if not the case. | 1028 // Adjust this code if not the case. |
1029 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 1029 STATIC_ASSERT(StackHandlerConstants::kSize == 3 * kPointerSize); |
1030 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1030 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1031 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | 1031 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
1032 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | 1032 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
1033 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); | |
1034 | 1033 |
1035 // We will build up the handler from the bottom by pushing on the stack. | 1034 // We will build up the handler from the bottom by pushing on the stack. |
1036 // First push the frame pointer and context. | 1035 // First push the context. |
1037 if (kind == StackHandler::JS_ENTRY) { | 1036 if (kind == StackHandler::JS_ENTRY) { |
1038 // The frame pointer does not point to a JS frame so we save NULL for | |
1039 // ebp. We expect the code throwing an exception to check ebp before | |
1040 // dereferencing it to restore the context. | |
1041 push(Immediate(0)); // NULL frame pointer. | |
1042 push(Immediate(Smi::FromInt(0))); // No context. | 1037 push(Immediate(Smi::FromInt(0))); // No context. |
1043 } else { | 1038 } else { |
1044 push(ebp); | |
1045 push(esi); | 1039 push(esi); |
1046 } | 1040 } |
1047 // Push the state. | 1041 // Push the state. |
1048 unsigned state = | 1042 unsigned state = |
1049 StackHandler::IndexField::encode(handler_index) | | 1043 StackHandler::IndexField::encode(handler_index) | |
1050 StackHandler::KindField::encode(kind); | 1044 StackHandler::KindField::encode(kind); |
1051 push(Immediate(state)); | 1045 push(Immediate(state)); |
1052 | 1046 |
1053 // Link the current handler as the next handler. | 1047 // Link the current handler as the next handler. |
1054 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 1048 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3233 if (mag.shift > 0) sar(edx, mag.shift); | 3227 if (mag.shift > 0) sar(edx, mag.shift); |
3234 mov(eax, dividend); | 3228 mov(eax, dividend); |
3235 shr(eax, 31); | 3229 shr(eax, 31); |
3236 add(edx, eax); | 3230 add(edx, eax); |
3237 } | 3231 } |
3238 | 3232 |
3239 | 3233 |
3240 } } // namespace v8::internal | 3234 } } // namespace v8::internal |
3241 | 3235 |
3242 #endif // V8_TARGET_ARCH_IA32 | 3236 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |