| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 XMMRegister reg = XMMRegister::from_code(i); | 987 XMMRegister reg = XMMRegister::from_code(i); |
| 987 movsd(Operand(ebp, offset - ((i + 1) * kDoubleSize)), reg); | 988 movsd(Operand(ebp, offset - ((i + 1) * kDoubleSize)), reg); |
| 988 } | 989 } |
| 989 } else { | 990 } else { |
| 990 sub(esp, Immediate(argc * kPointerSize)); | 991 sub(esp, Immediate(argc * kPointerSize)); |
| 991 } | 992 } |
| 992 | 993 |
| 993 // Get the required frame alignment for the OS. | 994 // Get the required frame alignment for the OS. |
| 994 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); | 995 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); |
| 995 if (kFrameAlignment > 0) { | 996 if (kFrameAlignment > 0) { |
| 996 DCHECK(IsPowerOf2(kFrameAlignment)); | 997 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment)); |
| 997 and_(esp, -kFrameAlignment); | 998 and_(esp, -kFrameAlignment); |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 // Patch the saved entry sp. | 1001 // Patch the saved entry sp. |
| 1001 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); | 1002 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp); |
| 1002 } | 1003 } |
| 1003 | 1004 |
| 1004 | 1005 |
| 1005 void MacroAssembler::EnterExitFrame(bool save_doubles) { | 1006 void MacroAssembler::EnterExitFrame(bool save_doubles) { |
| 1006 EnterExitFramePrologue(); | 1007 EnterExitFramePrologue(); |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 bind(&entry); | 1928 bind(&entry); |
| 1928 cmp(start_offset, end_offset); | 1929 cmp(start_offset, end_offset); |
| 1929 j(less, &loop); | 1930 j(less, &loop); |
| 1930 } | 1931 } |
| 1931 | 1932 |
| 1932 | 1933 |
| 1933 void MacroAssembler::BooleanBitTest(Register object, | 1934 void MacroAssembler::BooleanBitTest(Register object, |
| 1934 int field_offset, | 1935 int field_offset, |
| 1935 int bit_index) { | 1936 int bit_index) { |
| 1936 bit_index += kSmiTagSize + kSmiShiftSize; | 1937 bit_index += kSmiTagSize + kSmiShiftSize; |
| 1937 DCHECK(IsPowerOf2(kBitsPerByte)); | 1938 DCHECK(base::bits::IsPowerOfTwo32(kBitsPerByte)); |
| 1938 int byte_index = bit_index / kBitsPerByte; | 1939 int byte_index = bit_index / kBitsPerByte; |
| 1939 int byte_bit_index = bit_index & (kBitsPerByte - 1); | 1940 int byte_bit_index = bit_index & (kBitsPerByte - 1); |
| 1940 test_b(FieldOperand(object, field_offset + byte_index), | 1941 test_b(FieldOperand(object, field_offset + byte_index), |
| 1941 static_cast<byte>(1 << byte_bit_index)); | 1942 static_cast<byte>(1 << byte_bit_index)); |
| 1942 } | 1943 } |
| 1943 | 1944 |
| 1944 | 1945 |
| 1945 | 1946 |
| 1946 void MacroAssembler::NegativeZeroTest(Register result, | 1947 void MacroAssembler::NegativeZeroTest(Register result, |
| 1947 Register op, | 1948 Register op, |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2764 Abort(reason); | 2765 Abort(reason); |
| 2765 // will not return here | 2766 // will not return here |
| 2766 bind(&L); | 2767 bind(&L); |
| 2767 } | 2768 } |
| 2768 | 2769 |
| 2769 | 2770 |
| 2770 void MacroAssembler::CheckStackAlignment() { | 2771 void MacroAssembler::CheckStackAlignment() { |
| 2771 int frame_alignment = base::OS::ActivationFrameAlignment(); | 2772 int frame_alignment = base::OS::ActivationFrameAlignment(); |
| 2772 int frame_alignment_mask = frame_alignment - 1; | 2773 int frame_alignment_mask = frame_alignment - 1; |
| 2773 if (frame_alignment > kPointerSize) { | 2774 if (frame_alignment > kPointerSize) { |
| 2774 DCHECK(IsPowerOf2(frame_alignment)); | 2775 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
| 2775 Label alignment_as_expected; | 2776 Label alignment_as_expected; |
| 2776 test(esp, Immediate(frame_alignment_mask)); | 2777 test(esp, Immediate(frame_alignment_mask)); |
| 2777 j(zero, &alignment_as_expected); | 2778 j(zero, &alignment_as_expected); |
| 2778 // Abort if stack is not aligned. | 2779 // Abort if stack is not aligned. |
| 2779 int3(); | 2780 int3(); |
| 2780 bind(&alignment_as_expected); | 2781 bind(&alignment_as_expected); |
| 2781 } | 2782 } |
| 2782 } | 2783 } |
| 2783 | 2784 |
| 2784 | 2785 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3004 } | 3005 } |
| 3005 | 3006 |
| 3006 | 3007 |
| 3007 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 3008 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
| 3008 int frame_alignment = base::OS::ActivationFrameAlignment(); | 3009 int frame_alignment = base::OS::ActivationFrameAlignment(); |
| 3009 if (frame_alignment != 0) { | 3010 if (frame_alignment != 0) { |
| 3010 // Make stack end at alignment and make room for num_arguments words | 3011 // Make stack end at alignment and make room for num_arguments words |
| 3011 // and the original value of esp. | 3012 // and the original value of esp. |
| 3012 mov(scratch, esp); | 3013 mov(scratch, esp); |
| 3013 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); | 3014 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); |
| 3014 DCHECK(IsPowerOf2(frame_alignment)); | 3015 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
| 3015 and_(esp, -frame_alignment); | 3016 and_(esp, -frame_alignment); |
| 3016 mov(Operand(esp, num_arguments * kPointerSize), scratch); | 3017 mov(Operand(esp, num_arguments * kPointerSize), scratch); |
| 3017 } else { | 3018 } else { |
| 3018 sub(esp, Immediate(num_arguments * kPointerSize)); | 3019 sub(esp, Immediate(num_arguments * kPointerSize)); |
| 3019 } | 3020 } |
| 3020 } | 3021 } |
| 3021 | 3022 |
| 3022 | 3023 |
| 3023 void MacroAssembler::CallCFunction(ExternalReference function, | 3024 void MacroAssembler::CallCFunction(ExternalReference function, |
| 3024 int num_arguments) { | 3025 int num_arguments) { |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 if (ms.shift() > 0) sar(edx, ms.shift()); | 3431 if (ms.shift() > 0) sar(edx, ms.shift()); |
| 3431 mov(eax, dividend); | 3432 mov(eax, dividend); |
| 3432 shr(eax, 31); | 3433 shr(eax, 31); |
| 3433 add(edx, eax); | 3434 add(edx, eax); |
| 3434 } | 3435 } |
| 3435 | 3436 |
| 3436 | 3437 |
| 3437 } } // namespace v8::internal | 3438 } } // namespace v8::internal |
| 3438 | 3439 |
| 3439 #endif // V8_TARGET_ARCH_IA32 | 3440 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |