Chromium Code Reviews| 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 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ | 5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
| 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
| 7 | 7 |
| 8 #include "assembler.h" | 8 #include "assembler.h" |
| 9 #include "frames.h" | 9 #include "frames.h" |
| 10 #include "globals.h" | 10 #include "globals.h" |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 static const int shift = Field::kShift; | 1015 static const int shift = Field::kShift; |
| 1016 static const int mask = Field::kMask >> Field::kShift; | 1016 static const int mask = Field::kMask >> Field::kShift; |
| 1017 if (shift != 0) { | 1017 if (shift != 0) { |
| 1018 shrp(reg, Immediate(shift)); | 1018 shrp(reg, Immediate(shift)); |
| 1019 } | 1019 } |
| 1020 andp(reg, Immediate(mask)); | 1020 andp(reg, Immediate(mask)); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 template<typename Field> | 1023 template<typename Field> |
| 1024 void DecodeFieldToSmi(Register reg) { | 1024 void DecodeFieldToSmi(Register reg) { |
| 1025 andp(reg, Immediate(Field::kMask)); | 1025 if (SmiValuesAre32Bits()) { |
| 1026 shlp(reg, Immediate(kSmiShift - Field::kShift)); | 1026 andp(reg, Immediate(Field::kMask)); |
| 1027 shlp(reg, Immediate(kSmiShift - Field::kShift)); | |
| 1028 } else { | |
| 1029 static const int shift = Field::kShift; | |
| 1030 static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; | |
|
haitao.feng
2014/06/09 05:43:06
Clang reports an error when using kSmiShift:
| |
| 1031 ASSERT(SmiValuesAre31Bits()); | |
| 1032 ASSERT(kSmiShift == kSmiTagSize); | |
| 1033 ASSERT((mask & 0x80000000u) == 0); | |
| 1034 if (shift < kSmiShift) { | |
| 1035 shlp(reg, Immediate(kSmiShift - shift)); | |
| 1036 } else if (shift > kSmiShift) { | |
| 1037 sarp(reg, Immediate(shift - kSmiShift)); | |
| 1038 } | |
| 1039 andp(reg, Immediate(mask)); | |
| 1040 } | |
| 1027 } | 1041 } |
| 1028 | 1042 |
| 1029 // Abort execution if argument is not a number, enabled via --debug-code. | 1043 // Abort execution if argument is not a number, enabled via --debug-code. |
| 1030 void AssertNumber(Register object); | 1044 void AssertNumber(Register object); |
| 1031 | 1045 |
| 1032 // Abort execution if argument is a smi, enabled via --debug-code. | 1046 // Abort execution if argument is a smi, enabled via --debug-code. |
| 1033 void AssertNotSmi(Register object); | 1047 void AssertNotSmi(Register object); |
| 1034 | 1048 |
| 1035 // Abort execution if argument is not a smi, enabled via --debug-code. | 1049 // Abort execution if argument is not a smi, enabled via --debug-code. |
| 1036 void AssertSmi(Register object); | 1050 void AssertSmi(Register object); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1597 masm->popfq(); \ | 1611 masm->popfq(); \ |
| 1598 } \ | 1612 } \ |
| 1599 masm-> | 1613 masm-> |
| 1600 #else | 1614 #else |
| 1601 #define ACCESS_MASM(masm) masm-> | 1615 #define ACCESS_MASM(masm) masm-> |
| 1602 #endif | 1616 #endif |
| 1603 | 1617 |
| 1604 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
| 1605 | 1619 |
| 1606 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1620 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
| OLD | NEW |