OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <limits.h> // For LONG_MIN, LONG_MAX. | 28 #include <limits.h> // For LONG_MIN, LONG_MAX. |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 | 31 |
32 #if defined(V8_TARGET_ARCH_ARM) | 32 #if V8_TARGET_ARCH_ARM |
33 | 33 |
34 #include "bootstrapper.h" | 34 #include "bootstrapper.h" |
35 #include "codegen.h" | 35 #include "codegen.h" |
36 #include "debug.h" | 36 #include "debug.h" |
37 #include "runtime.h" | 37 #include "runtime.h" |
38 | 38 |
39 namespace v8 { | 39 namespace v8 { |
40 namespace internal { | 40 namespace internal { |
41 | 41 |
42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 SmiTag(scratch1, length); | 978 SmiTag(scratch1, length); |
979 LoadRoot(scratch2, map_index); | 979 LoadRoot(scratch2, map_index); |
980 str(scratch1, FieldMemOperand(string, String::kLengthOffset)); | 980 str(scratch1, FieldMemOperand(string, String::kLengthOffset)); |
981 mov(scratch1, Operand(String::kEmptyHashField)); | 981 mov(scratch1, Operand(String::kEmptyHashField)); |
982 str(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); | 982 str(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); |
983 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); | 983 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); |
984 } | 984 } |
985 | 985 |
986 | 986 |
987 int MacroAssembler::ActivationFrameAlignment() { | 987 int MacroAssembler::ActivationFrameAlignment() { |
988 #if defined(V8_HOST_ARCH_ARM) | 988 #if V8_HOST_ARCH_ARM |
989 // Running on the real platform. Use the alignment as mandated by the local | 989 // Running on the real platform. Use the alignment as mandated by the local |
990 // environment. | 990 // environment. |
991 // Note: This will break if we ever start generating snapshots on one ARM | 991 // Note: This will break if we ever start generating snapshots on one ARM |
992 // platform for another ARM platform with a different alignment. | 992 // platform for another ARM platform with a different alignment. |
993 return OS::ActivationFrameAlignment(); | 993 return OS::ActivationFrameAlignment(); |
994 #else // defined(V8_HOST_ARCH_ARM) | 994 #else // V8_HOST_ARCH_ARM |
995 // If we are using the simulator then we should always align to the expected | 995 // If we are using the simulator then we should always align to the expected |
996 // alignment. As the simulator is used to generate snapshots we do not know | 996 // alignment. As the simulator is used to generate snapshots we do not know |
997 // if the target platform will need alignment, so this is controlled from a | 997 // if the target platform will need alignment, so this is controlled from a |
998 // flag. | 998 // flag. |
999 return FLAG_sim_stack_alignment; | 999 return FLAG_sim_stack_alignment; |
1000 #endif // defined(V8_HOST_ARCH_ARM) | 1000 #endif // V8_HOST_ARCH_ARM |
1001 } | 1001 } |
1002 | 1002 |
1003 | 1003 |
1004 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 1004 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
1005 Register argument_count) { | 1005 Register argument_count) { |
1006 // Optionally restore all double registers. | 1006 // Optionally restore all double registers. |
1007 if (save_doubles) { | 1007 if (save_doubles) { |
1008 // Calculate the stack location of the saved doubles and restore them. | 1008 // Calculate the stack location of the saved doubles and restore them. |
1009 const int offset = 2 * kPointerSize; | 1009 const int offset = 2 * kPointerSize; |
1010 sub(r3, fp, | 1010 sub(r3, fp, |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3386 } | 3386 } |
3387 | 3387 |
3388 | 3388 |
3389 void MacroAssembler::CallCFunctionHelper(Register function, | 3389 void MacroAssembler::CallCFunctionHelper(Register function, |
3390 int num_reg_arguments, | 3390 int num_reg_arguments, |
3391 int num_double_arguments) { | 3391 int num_double_arguments) { |
3392 ASSERT(has_frame()); | 3392 ASSERT(has_frame()); |
3393 // Make sure that the stack is aligned before calling a C function unless | 3393 // Make sure that the stack is aligned before calling a C function unless |
3394 // running in the simulator. The simulator has its own alignment check which | 3394 // running in the simulator. The simulator has its own alignment check which |
3395 // provides more information. | 3395 // provides more information. |
3396 #if defined(V8_HOST_ARCH_ARM) | 3396 #if V8_HOST_ARCH_ARM |
3397 if (emit_debug_code()) { | 3397 if (emit_debug_code()) { |
3398 int frame_alignment = OS::ActivationFrameAlignment(); | 3398 int frame_alignment = OS::ActivationFrameAlignment(); |
3399 int frame_alignment_mask = frame_alignment - 1; | 3399 int frame_alignment_mask = frame_alignment - 1; |
3400 if (frame_alignment > kPointerSize) { | 3400 if (frame_alignment > kPointerSize) { |
3401 ASSERT(IsPowerOf2(frame_alignment)); | 3401 ASSERT(IsPowerOf2(frame_alignment)); |
3402 Label alignment_as_expected; | 3402 Label alignment_as_expected; |
3403 tst(sp, Operand(frame_alignment_mask)); | 3403 tst(sp, Operand(frame_alignment_mask)); |
3404 b(eq, &alignment_as_expected); | 3404 b(eq, &alignment_as_expected); |
3405 // Don't use Check here, as it will call Runtime_Abort possibly | 3405 // Don't use Check here, as it will call Runtime_Abort possibly |
3406 // re-entering here. | 3406 // re-entering here. |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3816 void CodePatcher::EmitCondition(Condition cond) { | 3816 void CodePatcher::EmitCondition(Condition cond) { |
3817 Instr instr = Assembler::instr_at(masm_.pc_); | 3817 Instr instr = Assembler::instr_at(masm_.pc_); |
3818 instr = (instr & ~kCondMask) | cond; | 3818 instr = (instr & ~kCondMask) | cond; |
3819 masm_.emit(instr); | 3819 masm_.emit(instr); |
3820 } | 3820 } |
3821 | 3821 |
3822 | 3822 |
3823 } } // namespace v8::internal | 3823 } } // namespace v8::internal |
3824 | 3824 |
3825 #endif // V8_TARGET_ARCH_ARM | 3825 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |