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

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

Issue 532133002: X87: First step to cleanup the power-of-2 mess (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: Created 6 years, 3 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
« no previous file with comments | « src/x87/lithium-codegen-x87.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 11 #include "src/codegen.h"
11 #include "src/cpu-profiler.h" 12 #include "src/cpu-profiler.h"
12 #include "src/debug.h" 13 #include "src/debug.h"
13 #include "src/isolate-inl.h" 14 #include "src/isolate-inl.h"
14 #include "src/runtime.h" 15 #include "src/runtime.h"
15 #include "src/serialize.h" 16 #include "src/serialize.h"
16 17
17 namespace v8 { 18 namespace v8 {
18 namespace internal { 19 namespace internal {
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 mov(Operand::StaticVariable(context_address), esi); 889 mov(Operand::StaticVariable(context_address), esi);
889 } 890 }
890 891
891 892
892 void MacroAssembler::EnterExitFrameEpilogue(int argc) { 893 void MacroAssembler::EnterExitFrameEpilogue(int argc) {
893 sub(esp, Immediate(argc * kPointerSize)); 894 sub(esp, Immediate(argc * kPointerSize));
894 895
895 // Get the required frame alignment for the OS. 896 // Get the required frame alignment for the OS.
896 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); 897 const int kFrameAlignment = base::OS::ActivationFrameAlignment();
897 if (kFrameAlignment > 0) { 898 if (kFrameAlignment > 0) {
898 DCHECK(IsPowerOf2(kFrameAlignment)); 899 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment));
899 and_(esp, -kFrameAlignment); 900 and_(esp, -kFrameAlignment);
900 } 901 }
901 902
902 // Patch the saved entry sp. 903 // Patch the saved entry sp.
903 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); 904 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp);
904 } 905 }
905 906
906 907
907 void MacroAssembler::EnterExitFrame() { 908 void MacroAssembler::EnterExitFrame() {
908 EnterExitFramePrologue(); 909 EnterExitFramePrologue();
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 bind(&entry); 1821 bind(&entry);
1821 cmp(start_offset, end_offset); 1822 cmp(start_offset, end_offset);
1822 j(less, &loop); 1823 j(less, &loop);
1823 } 1824 }
1824 1825
1825 1826
1826 void MacroAssembler::BooleanBitTest(Register object, 1827 void MacroAssembler::BooleanBitTest(Register object,
1827 int field_offset, 1828 int field_offset,
1828 int bit_index) { 1829 int bit_index) {
1829 bit_index += kSmiTagSize + kSmiShiftSize; 1830 bit_index += kSmiTagSize + kSmiShiftSize;
1830 DCHECK(IsPowerOf2(kBitsPerByte)); 1831 DCHECK(base::bits::IsPowerOfTwo32(kBitsPerByte));
1831 int byte_index = bit_index / kBitsPerByte; 1832 int byte_index = bit_index / kBitsPerByte;
1832 int byte_bit_index = bit_index & (kBitsPerByte - 1); 1833 int byte_bit_index = bit_index & (kBitsPerByte - 1);
1833 test_b(FieldOperand(object, field_offset + byte_index), 1834 test_b(FieldOperand(object, field_offset + byte_index),
1834 static_cast<byte>(1 << byte_bit_index)); 1835 static_cast<byte>(1 << byte_bit_index));
1835 } 1836 }
1836 1837
1837 1838
1838 1839
1839 void MacroAssembler::NegativeZeroTest(Register result, 1840 void MacroAssembler::NegativeZeroTest(Register result,
1840 Register op, 1841 Register op,
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 Abort(reason); 2662 Abort(reason);
2662 // will not return here 2663 // will not return here
2663 bind(&L); 2664 bind(&L);
2664 } 2665 }
2665 2666
2666 2667
2667 void MacroAssembler::CheckStackAlignment() { 2668 void MacroAssembler::CheckStackAlignment() {
2668 int frame_alignment = base::OS::ActivationFrameAlignment(); 2669 int frame_alignment = base::OS::ActivationFrameAlignment();
2669 int frame_alignment_mask = frame_alignment - 1; 2670 int frame_alignment_mask = frame_alignment - 1;
2670 if (frame_alignment > kPointerSize) { 2671 if (frame_alignment > kPointerSize) {
2671 DCHECK(IsPowerOf2(frame_alignment)); 2672 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
2672 Label alignment_as_expected; 2673 Label alignment_as_expected;
2673 test(esp, Immediate(frame_alignment_mask)); 2674 test(esp, Immediate(frame_alignment_mask));
2674 j(zero, &alignment_as_expected); 2675 j(zero, &alignment_as_expected);
2675 // Abort if stack is not aligned. 2676 // Abort if stack is not aligned.
2676 int3(); 2677 int3();
2677 bind(&alignment_as_expected); 2678 bind(&alignment_as_expected);
2678 } 2679 }
2679 } 2680 }
2680 2681
2681 2682
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 } 2892 }
2892 2893
2893 2894
2894 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { 2895 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
2895 int frame_alignment = base::OS::ActivationFrameAlignment(); 2896 int frame_alignment = base::OS::ActivationFrameAlignment();
2896 if (frame_alignment != 0) { 2897 if (frame_alignment != 0) {
2897 // Make stack end at alignment and make room for num_arguments words 2898 // Make stack end at alignment and make room for num_arguments words
2898 // and the original value of esp. 2899 // and the original value of esp.
2899 mov(scratch, esp); 2900 mov(scratch, esp);
2900 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); 2901 sub(esp, Immediate((num_arguments + 1) * kPointerSize));
2901 DCHECK(IsPowerOf2(frame_alignment)); 2902 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment));
2902 and_(esp, -frame_alignment); 2903 and_(esp, -frame_alignment);
2903 mov(Operand(esp, num_arguments * kPointerSize), scratch); 2904 mov(Operand(esp, num_arguments * kPointerSize), scratch);
2904 } else { 2905 } else {
2905 sub(esp, Immediate(num_arguments * kPointerSize)); 2906 sub(esp, Immediate(num_arguments * kPointerSize));
2906 } 2907 }
2907 } 2908 }
2908 2909
2909 2910
2910 void MacroAssembler::CallCFunction(ExternalReference function, 2911 void MacroAssembler::CallCFunction(ExternalReference function,
2911 int num_arguments) { 2912 int num_arguments) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 if (ms.shift() > 0) sar(edx, ms.shift()); 3318 if (ms.shift() > 0) sar(edx, ms.shift());
3318 mov(eax, dividend); 3319 mov(eax, dividend);
3319 shr(eax, 31); 3320 shr(eax, 31);
3320 add(edx, eax); 3321 add(edx, eax);
3321 } 3322 }
3322 3323
3323 3324
3324 } } // namespace v8::internal 3325 } } // namespace v8::internal
3325 3326
3326 #endif // V8_TARGET_ARCH_X87 3327 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/lithium-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698