Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 const int offset = -2 * kPointerSize; 985 const int offset = -2 * kPointerSize;
986 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) { 986 for (int i = 0; i < XMMRegister::kMaxNumRegisters; i++) {
987 XMMRegister reg = XMMRegister::from_code(i); 987 XMMRegister reg = XMMRegister::from_code(i);
988 movsd(Operand(ebp, offset - ((i + 1) * kDoubleSize)), reg); 988 movsd(Operand(ebp, offset - ((i + 1) * kDoubleSize)), reg);
989 } 989 }
990 } else { 990 } else {
991 sub(esp, Immediate(argc * kPointerSize)); 991 sub(esp, Immediate(argc * kPointerSize));
992 } 992 }
993 993
994 // Get the required frame alignment for the OS. 994 // Get the required frame alignment for the OS.
995 const int kFrameAlignment = OS::ActivationFrameAlignment(); 995 const int kFrameAlignment = base::OS::ActivationFrameAlignment();
996 if (kFrameAlignment > 0) { 996 if (kFrameAlignment > 0) {
997 ASSERT(IsPowerOf2(kFrameAlignment)); 997 ASSERT(IsPowerOf2(kFrameAlignment));
998 and_(esp, -kFrameAlignment); 998 and_(esp, -kFrameAlignment);
999 } 999 }
1000 1000
1001 // Patch the saved entry sp. 1001 // Patch the saved entry sp.
1002 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); 1002 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp);
1003 } 1003 }
1004 1004
1005 1005
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 void MacroAssembler::Check(Condition cc, BailoutReason reason) { 2755 void MacroAssembler::Check(Condition cc, BailoutReason reason) {
2756 Label L; 2756 Label L;
2757 j(cc, &L); 2757 j(cc, &L);
2758 Abort(reason); 2758 Abort(reason);
2759 // will not return here 2759 // will not return here
2760 bind(&L); 2760 bind(&L);
2761 } 2761 }
2762 2762
2763 2763
2764 void MacroAssembler::CheckStackAlignment() { 2764 void MacroAssembler::CheckStackAlignment() {
2765 int frame_alignment = OS::ActivationFrameAlignment(); 2765 int frame_alignment = base::OS::ActivationFrameAlignment();
2766 int frame_alignment_mask = frame_alignment - 1; 2766 int frame_alignment_mask = frame_alignment - 1;
2767 if (frame_alignment > kPointerSize) { 2767 if (frame_alignment > kPointerSize) {
2768 ASSERT(IsPowerOf2(frame_alignment)); 2768 ASSERT(IsPowerOf2(frame_alignment));
2769 Label alignment_as_expected; 2769 Label alignment_as_expected;
2770 test(esp, Immediate(frame_alignment_mask)); 2770 test(esp, Immediate(frame_alignment_mask));
2771 j(zero, &alignment_as_expected); 2771 j(zero, &alignment_as_expected);
2772 // Abort if stack is not aligned. 2772 // Abort if stack is not aligned.
2773 int3(); 2773 int3();
2774 bind(&alignment_as_expected); 2774 bind(&alignment_as_expected);
2775 } 2775 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 2992
2993 cmp(index, Immediate(Smi::FromInt(0))); 2993 cmp(index, Immediate(Smi::FromInt(0)));
2994 Check(greater_equal, kIndexIsNegative); 2994 Check(greater_equal, kIndexIsNegative);
2995 2995
2996 // Restore the index 2996 // Restore the index
2997 SmiUntag(index); 2997 SmiUntag(index);
2998 } 2998 }
2999 2999
3000 3000
3001 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 3001 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
3002 int frame_alignment = OS::ActivationFrameAlignment(); 3002 int frame_alignment = base::OS::ActivationFrameAlignment();
3003 if (frame_alignment != 0) { 3003 if (frame_alignment != 0) {
3004 // Make stack end at alignment and make room for num_arguments words 3004 // Make stack end at alignment and make room for num_arguments words
3005 // and the original value of esp. 3005 // and the original value of esp.
3006 mov(scratch, esp); 3006 mov(scratch, esp);
3007 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); 3007 sub(esp, Immediate((num_arguments + 1) * kPointerSize));
3008 ASSERT(IsPowerOf2(frame_alignment)); 3008 ASSERT(IsPowerOf2(frame_alignment));
3009 and_(esp, -frame_alignment); 3009 and_(esp, -frame_alignment);
3010 mov(Operand(esp, num_arguments * kPointerSize), scratch); 3010 mov(Operand(esp, num_arguments * kPointerSize), scratch);
3011 } else { 3011 } else {
3012 sub(esp, Immediate(num_arguments * kPointerSize)); 3012 sub(esp, Immediate(num_arguments * kPointerSize));
(...skipping 11 matching lines...) Expand all
3024 3024
3025 void MacroAssembler::CallCFunction(Register function, 3025 void MacroAssembler::CallCFunction(Register function,
3026 int num_arguments) { 3026 int num_arguments) {
3027 ASSERT(has_frame()); 3027 ASSERT(has_frame());
3028 // Check stack alignment. 3028 // Check stack alignment.
3029 if (emit_debug_code()) { 3029 if (emit_debug_code()) {
3030 CheckStackAlignment(); 3030 CheckStackAlignment();
3031 } 3031 }
3032 3032
3033 call(function); 3033 call(function);
3034 if (OS::ActivationFrameAlignment() != 0) { 3034 if (base::OS::ActivationFrameAlignment() != 0) {
3035 mov(esp, Operand(esp, num_arguments * kPointerSize)); 3035 mov(esp, Operand(esp, num_arguments * kPointerSize));
3036 } else { 3036 } else {
3037 add(esp, Immediate(num_arguments * kPointerSize)); 3037 add(esp, Immediate(num_arguments * kPointerSize));
3038 } 3038 }
3039 } 3039 }
3040 3040
3041 3041
3042 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { 3042 bool AreAliased(Register r1, Register r2, Register r3, Register r4) {
3043 if (r1.is(r2)) return true; 3043 if (r1.is(r2)) return true;
3044 if (r1.is(r3)) return true; 3044 if (r1.is(r3)) return true;
(...skipping 11 matching lines...) Expand all
3056 masm_(NULL, address, size + Assembler::kGap) { 3056 masm_(NULL, address, size + Assembler::kGap) {
3057 // Create a new macro assembler pointing to the address of the code to patch. 3057 // Create a new macro assembler pointing to the address of the code to patch.
3058 // The size is adjusted with kGap on order for the assembler to generate size 3058 // The size is adjusted with kGap on order for the assembler to generate size
3059 // bytes of instructions without failing with buffer size constraints. 3059 // bytes of instructions without failing with buffer size constraints.
3060 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3060 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3061 } 3061 }
3062 3062
3063 3063
3064 CodePatcher::~CodePatcher() { 3064 CodePatcher::~CodePatcher() {
3065 // Indicate that code has changed. 3065 // Indicate that code has changed.
3066 CPU::FlushICache(address_, size_); 3066 CpuFeatures::FlushICache(address_, size_);
3067 3067
3068 // Check that the code was patched as expected. 3068 // Check that the code was patched as expected.
3069 ASSERT(masm_.pc_ == address_ + size_); 3069 ASSERT(masm_.pc_ == address_ + size_);
3070 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3070 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3071 } 3071 }
3072 3072
3073 3073
3074 void MacroAssembler::CheckPageFlag( 3074 void MacroAssembler::CheckPageFlag(
3075 Register object, 3075 Register object,
3076 Register scratch, 3076 Register scratch,
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 if (ms.shift() > 0) sar(edx, ms.shift()); 3405 if (ms.shift() > 0) sar(edx, ms.shift());
3406 mov(eax, dividend); 3406 mov(eax, dividend);
3407 shr(eax, 31); 3407 shr(eax, 31);
3408 add(edx, eax); 3408 add(edx, eax);
3409 } 3409 }
3410 3410
3411 3411
3412 } } // namespace v8::internal 3412 } } // namespace v8::internal
3413 3413
3414 #endif // V8_TARGET_ARCH_IA32 3414 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/base/macros.h ('K') | « src/ia32/lithium-codegen-ia32.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698