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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 ExternalReference context_address(Isolate::kContextAddress, isolate()); | 887 ExternalReference context_address(Isolate::kContextAddress, isolate()); |
888 mov(Operand::StaticVariable(c_entry_fp_address), ebp); | 888 mov(Operand::StaticVariable(c_entry_fp_address), ebp); |
889 mov(Operand::StaticVariable(context_address), esi); | 889 mov(Operand::StaticVariable(context_address), esi); |
890 } | 890 } |
891 | 891 |
892 | 892 |
893 void MacroAssembler::EnterExitFrameEpilogue(int argc) { | 893 void MacroAssembler::EnterExitFrameEpilogue(int argc) { |
894 sub(esp, Immediate(argc * kPointerSize)); | 894 sub(esp, Immediate(argc * kPointerSize)); |
895 | 895 |
896 // Get the required frame alignment for the OS. | 896 // Get the required frame alignment for the OS. |
897 const int kFrameAlignment = OS::ActivationFrameAlignment(); | 897 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); |
898 if (kFrameAlignment > 0) { | 898 if (kFrameAlignment > 0) { |
899 ASSERT(IsPowerOf2(kFrameAlignment)); | 899 ASSERT(IsPowerOf2(kFrameAlignment)); |
900 and_(esp, -kFrameAlignment); | 900 and_(esp, -kFrameAlignment); |
901 } | 901 } |
902 | 902 |
903 // Patch the saved entry sp. | 903 // Patch the saved entry sp. |
904 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); | 904 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); |
905 } | 905 } |
906 | 906 |
907 | 907 |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 void MacroAssembler::Check(Condition cc, BailoutReason reason) { | 2652 void MacroAssembler::Check(Condition cc, BailoutReason reason) { |
2653 Label L; | 2653 Label L; |
2654 j(cc, &L); | 2654 j(cc, &L); |
2655 Abort(reason); | 2655 Abort(reason); |
2656 // will not return here | 2656 // will not return here |
2657 bind(&L); | 2657 bind(&L); |
2658 } | 2658 } |
2659 | 2659 |
2660 | 2660 |
2661 void MacroAssembler::CheckStackAlignment() { | 2661 void MacroAssembler::CheckStackAlignment() { |
2662 int frame_alignment = OS::ActivationFrameAlignment(); | 2662 int frame_alignment = base::OS::ActivationFrameAlignment(); |
2663 int frame_alignment_mask = frame_alignment - 1; | 2663 int frame_alignment_mask = frame_alignment - 1; |
2664 if (frame_alignment > kPointerSize) { | 2664 if (frame_alignment > kPointerSize) { |
2665 ASSERT(IsPowerOf2(frame_alignment)); | 2665 ASSERT(IsPowerOf2(frame_alignment)); |
2666 Label alignment_as_expected; | 2666 Label alignment_as_expected; |
2667 test(esp, Immediate(frame_alignment_mask)); | 2667 test(esp, Immediate(frame_alignment_mask)); |
2668 j(zero, &alignment_as_expected); | 2668 j(zero, &alignment_as_expected); |
2669 // Abort if stack is not aligned. | 2669 // Abort if stack is not aligned. |
2670 int3(); | 2670 int3(); |
2671 bind(&alignment_as_expected); | 2671 bind(&alignment_as_expected); |
2672 } | 2672 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 | 2879 |
2880 cmp(index, Immediate(Smi::FromInt(0))); | 2880 cmp(index, Immediate(Smi::FromInt(0))); |
2881 Check(greater_equal, kIndexIsNegative); | 2881 Check(greater_equal, kIndexIsNegative); |
2882 | 2882 |
2883 // Restore the index | 2883 // Restore the index |
2884 SmiUntag(index); | 2884 SmiUntag(index); |
2885 } | 2885 } |
2886 | 2886 |
2887 | 2887 |
2888 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 2888 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
2889 int frame_alignment = OS::ActivationFrameAlignment(); | 2889 int frame_alignment = base::OS::ActivationFrameAlignment(); |
2890 if (frame_alignment != 0) { | 2890 if (frame_alignment != 0) { |
2891 // Make stack end at alignment and make room for num_arguments words | 2891 // Make stack end at alignment and make room for num_arguments words |
2892 // and the original value of esp. | 2892 // and the original value of esp. |
2893 mov(scratch, esp); | 2893 mov(scratch, esp); |
2894 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); | 2894 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); |
2895 ASSERT(IsPowerOf2(frame_alignment)); | 2895 ASSERT(IsPowerOf2(frame_alignment)); |
2896 and_(esp, -frame_alignment); | 2896 and_(esp, -frame_alignment); |
2897 mov(Operand(esp, num_arguments * kPointerSize), scratch); | 2897 mov(Operand(esp, num_arguments * kPointerSize), scratch); |
2898 } else { | 2898 } else { |
2899 sub(esp, Immediate(num_arguments * kPointerSize)); | 2899 sub(esp, Immediate(num_arguments * kPointerSize)); |
(...skipping 11 matching lines...) Expand all Loading... |
2911 | 2911 |
2912 void MacroAssembler::CallCFunction(Register function, | 2912 void MacroAssembler::CallCFunction(Register function, |
2913 int num_arguments) { | 2913 int num_arguments) { |
2914 ASSERT(has_frame()); | 2914 ASSERT(has_frame()); |
2915 // Check stack alignment. | 2915 // Check stack alignment. |
2916 if (emit_debug_code()) { | 2916 if (emit_debug_code()) { |
2917 CheckStackAlignment(); | 2917 CheckStackAlignment(); |
2918 } | 2918 } |
2919 | 2919 |
2920 call(function); | 2920 call(function); |
2921 if (OS::ActivationFrameAlignment() != 0) { | 2921 if (base::OS::ActivationFrameAlignment() != 0) { |
2922 mov(esp, Operand(esp, num_arguments * kPointerSize)); | 2922 mov(esp, Operand(esp, num_arguments * kPointerSize)); |
2923 } else { | 2923 } else { |
2924 add(esp, Immediate(num_arguments * kPointerSize)); | 2924 add(esp, Immediate(num_arguments * kPointerSize)); |
2925 } | 2925 } |
2926 } | 2926 } |
2927 | 2927 |
2928 | 2928 |
2929 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { | 2929 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { |
2930 if (r1.is(r2)) return true; | 2930 if (r1.is(r2)) return true; |
2931 if (r1.is(r3)) return true; | 2931 if (r1.is(r3)) return true; |
(...skipping 11 matching lines...) Expand all Loading... |
2943 masm_(NULL, address, size + Assembler::kGap) { | 2943 masm_(NULL, address, size + Assembler::kGap) { |
2944 // Create a new macro assembler pointing to the address of the code to patch. | 2944 // Create a new macro assembler pointing to the address of the code to patch. |
2945 // The size is adjusted with kGap on order for the assembler to generate size | 2945 // The size is adjusted with kGap on order for the assembler to generate size |
2946 // bytes of instructions without failing with buffer size constraints. | 2946 // bytes of instructions without failing with buffer size constraints. |
2947 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2947 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2948 } | 2948 } |
2949 | 2949 |
2950 | 2950 |
2951 CodePatcher::~CodePatcher() { | 2951 CodePatcher::~CodePatcher() { |
2952 // Indicate that code has changed. | 2952 // Indicate that code has changed. |
2953 CPU::FlushICache(address_, size_); | 2953 CpuFeatures::FlushICache(address_, size_); |
2954 | 2954 |
2955 // Check that the code was patched as expected. | 2955 // Check that the code was patched as expected. |
2956 ASSERT(masm_.pc_ == address_ + size_); | 2956 ASSERT(masm_.pc_ == address_ + size_); |
2957 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2957 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2958 } | 2958 } |
2959 | 2959 |
2960 | 2960 |
2961 void MacroAssembler::CheckPageFlag( | 2961 void MacroAssembler::CheckPageFlag( |
2962 Register object, | 2962 Register object, |
2963 Register scratch, | 2963 Register scratch, |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3292 if (ms.shift() > 0) sar(edx, ms.shift()); | 3292 if (ms.shift() > 0) sar(edx, ms.shift()); |
3293 mov(eax, dividend); | 3293 mov(eax, dividend); |
3294 shr(eax, 31); | 3294 shr(eax, 31); |
3295 add(edx, eax); | 3295 add(edx, eax); |
3296 } | 3296 } |
3297 | 3297 |
3298 | 3298 |
3299 } } // namespace v8::internal | 3299 } } // namespace v8::internal |
3300 | 3300 |
3301 #endif // V8_TARGET_ARCH_X87 | 3301 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |