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 == 5 * kPointerSize); | 1029 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
1030 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1030 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1031 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 1031 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
1032 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 1032 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
1033 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 1033 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); |
1034 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | |
1035 | 1034 |
1036 // We will build up the handler from the bottom by pushing on the stack. | 1035 // We will build up the handler from the bottom by pushing on the stack. |
1037 // First push the frame pointer and context. | 1036 // First push the frame pointer and context. |
1038 if (kind == StackHandler::JS_ENTRY) { | 1037 if (kind == StackHandler::JS_ENTRY) { |
1039 // The frame pointer does not point to a JS frame so we save NULL for | 1038 // The frame pointer does not point to a JS frame so we save NULL for |
1040 // ebp. We expect the code throwing an exception to check ebp before | 1039 // ebp. We expect the code throwing an exception to check ebp before |
1041 // dereferencing it to restore the context. | 1040 // dereferencing it to restore the context. |
1042 push(Immediate(0)); // NULL frame pointer. | 1041 push(Immediate(0)); // NULL frame pointer. |
1043 push(Immediate(Smi::FromInt(0))); // No context. | 1042 push(Immediate(Smi::FromInt(0))); // No context. |
1044 } else { | 1043 } else { |
1045 push(ebp); | 1044 push(ebp); |
1046 push(esi); | 1045 push(esi); |
1047 } | 1046 } |
1048 // Push the state and the code object. | 1047 // Push the state. |
1049 unsigned state = | 1048 unsigned state = |
1050 StackHandler::IndexField::encode(handler_index) | | 1049 StackHandler::IndexField::encode(handler_index) | |
1051 StackHandler::KindField::encode(kind); | 1050 StackHandler::KindField::encode(kind); |
1052 push(Immediate(state)); | 1051 push(Immediate(state)); |
1053 Push(CodeObject()); | |
1054 | 1052 |
1055 // Link the current handler as the next handler. | 1053 // Link the current handler as the next handler. |
1056 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 1054 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
1057 push(Operand::StaticVariable(handler_address)); | 1055 push(Operand::StaticVariable(handler_address)); |
1058 // Set this new handler as the current one. | 1056 // Set this new handler as the current one. |
1059 mov(Operand::StaticVariable(handler_address), esp); | 1057 mov(Operand::StaticVariable(handler_address), esp); |
1060 } | 1058 } |
1061 | 1059 |
1062 | 1060 |
1063 void MacroAssembler::PopTryHandler() { | 1061 void MacroAssembler::PopTryHandler() { |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3235 if (mag.shift > 0) sar(edx, mag.shift); | 3233 if (mag.shift > 0) sar(edx, mag.shift); |
3236 mov(eax, dividend); | 3234 mov(eax, dividend); |
3237 shr(eax, 31); | 3235 shr(eax, 31); |
3238 add(edx, eax); | 3236 add(edx, eax); |
3239 } | 3237 } |
3240 | 3238 |
3241 | 3239 |
3242 } } // namespace v8::internal | 3240 } } // namespace v8::internal |
3243 | 3241 |
3244 #endif // V8_TARGET_ARCH_IA32 | 3242 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |