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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 mov(esp, ebp); | 983 mov(esp, ebp); |
984 pop(ebp); | 984 pop(ebp); |
985 | 985 |
986 LeaveExitFrameEpilogue(restore_context); | 986 LeaveExitFrameEpilogue(restore_context); |
987 } | 987 } |
988 | 988 |
989 | 989 |
990 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 990 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
991 int handler_index) { | 991 int handler_index) { |
992 // Adjust this code if not the case. | 992 // Adjust this code if not the case. |
993 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 993 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
994 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 994 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
995 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 995 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
996 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 996 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
997 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 997 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); |
998 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | |
999 | 998 |
1000 // We will build up the handler from the bottom by pushing on the stack. | 999 // We will build up the handler from the bottom by pushing on the stack. |
1001 // First push the frame pointer and context. | 1000 // First push the frame pointer and context. |
1002 if (kind == StackHandler::JS_ENTRY) { | 1001 if (kind == StackHandler::JS_ENTRY) { |
1003 // The frame pointer does not point to a JS frame so we save NULL for | 1002 // The frame pointer does not point to a JS frame so we save NULL for |
1004 // ebp. We expect the code throwing an exception to check ebp before | 1003 // ebp. We expect the code throwing an exception to check ebp before |
1005 // dereferencing it to restore the context. | 1004 // dereferencing it to restore the context. |
1006 push(Immediate(0)); // NULL frame pointer. | 1005 push(Immediate(0)); // NULL frame pointer. |
1007 push(Immediate(Smi::FromInt(0))); // No context. | 1006 push(Immediate(Smi::FromInt(0))); // No context. |
1008 } else { | 1007 } else { |
1009 push(ebp); | 1008 push(ebp); |
1010 push(esi); | 1009 push(esi); |
1011 } | 1010 } |
1012 // Push the state and the code object. | 1011 // Push the state. |
1013 unsigned state = | 1012 unsigned state = |
1014 StackHandler::IndexField::encode(handler_index) | | 1013 StackHandler::IndexField::encode(handler_index) | |
1015 StackHandler::KindField::encode(kind); | 1014 StackHandler::KindField::encode(kind); |
1016 push(Immediate(state)); | 1015 push(Immediate(state)); |
1017 Push(CodeObject()); | |
1018 | 1016 |
1019 // Link the current handler as the next handler. | 1017 // Link the current handler as the next handler. |
1020 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 1018 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
1021 push(Operand::StaticVariable(handler_address)); | 1019 push(Operand::StaticVariable(handler_address)); |
1022 // Set this new handler as the current one. | 1020 // Set this new handler as the current one. |
1023 mov(Operand::StaticVariable(handler_address), esp); | 1021 mov(Operand::StaticVariable(handler_address), esp); |
1024 } | 1022 } |
1025 | 1023 |
1026 | 1024 |
1027 void MacroAssembler::PopTryHandler() { | 1025 void MacroAssembler::PopTryHandler() { |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 if (mag.shift > 0) sar(edx, mag.shift); | 3112 if (mag.shift > 0) sar(edx, mag.shift); |
3115 mov(eax, dividend); | 3113 mov(eax, dividend); |
3116 shr(eax, 31); | 3114 shr(eax, 31); |
3117 add(edx, eax); | 3115 add(edx, eax); |
3118 } | 3116 } |
3119 | 3117 |
3120 | 3118 |
3121 } } // namespace v8::internal | 3119 } } // namespace v8::internal |
3122 | 3120 |
3123 #endif // V8_TARGET_ARCH_X87 | 3121 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |