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_X87_MACRO_ASSEMBLER_X87_H_ | 5 #ifndef V8_X87_MACRO_ASSEMBLER_X87_H_ |
6 #define V8_X87_MACRO_ASSEMBLER_X87_H_ | 6 #define V8_X87_MACRO_ASSEMBLER_X87_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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } | 471 } |
472 | 472 |
473 void LoadInstanceDescriptors(Register map, Register descriptors); | 473 void LoadInstanceDescriptors(Register map, Register descriptors); |
474 void EnumLength(Register dst, Register map); | 474 void EnumLength(Register dst, Register map); |
475 void NumberOfOwnDescriptors(Register dst, Register map); | 475 void NumberOfOwnDescriptors(Register dst, Register map); |
476 | 476 |
477 template<typename Field> | 477 template<typename Field> |
478 void DecodeField(Register reg) { | 478 void DecodeField(Register reg) { |
479 static const int shift = Field::kShift; | 479 static const int shift = Field::kShift; |
480 static const int mask = Field::kMask >> Field::kShift; | 480 static const int mask = Field::kMask >> Field::kShift; |
481 sar(reg, shift); | 481 if (shift != 0) { |
| 482 sar(reg, shift); |
| 483 } |
482 and_(reg, Immediate(mask)); | 484 and_(reg, Immediate(mask)); |
483 } | 485 } |
484 | 486 |
| 487 template<typename Field> |
| 488 void DecodeFieldToSmi(Register reg) { |
| 489 static const int shift = Field::kShift; |
| 490 static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; |
| 491 STATIC_ASSERT((mask & (0x80000000u >> (kSmiTagSize - 1))) == 0); |
| 492 STATIC_ASSERT(kSmiTag == 0); |
| 493 if (shift < kSmiTagSize) { |
| 494 shl(reg, kSmiTagSize - shift); |
| 495 } else if (shift > kSmiTagSize) { |
| 496 sar(reg, shift - kSmiTagSize); |
| 497 } |
| 498 and_(reg, Immediate(mask)); |
| 499 } |
| 500 |
485 // Abort execution if argument is not a number, enabled via --debug-code. | 501 // Abort execution if argument is not a number, enabled via --debug-code. |
486 void AssertNumber(Register object); | 502 void AssertNumber(Register object); |
487 | 503 |
488 // Abort execution if argument is not a smi, enabled via --debug-code. | 504 // Abort execution if argument is not a smi, enabled via --debug-code. |
489 void AssertSmi(Register object); | 505 void AssertSmi(Register object); |
490 | 506 |
491 // Abort execution if argument is a smi, enabled via --debug-code. | 507 // Abort execution if argument is a smi, enabled via --debug-code. |
492 void AssertNotSmi(Register object); | 508 void AssertNotSmi(Register object); |
493 | 509 |
494 // Abort execution if argument is not a string, enabled via --debug-code. | 510 // Abort execution if argument is not a string, enabled via --debug-code. |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 } \ | 1074 } \ |
1059 masm-> | 1075 masm-> |
1060 #else | 1076 #else |
1061 #define ACCESS_MASM(masm) masm-> | 1077 #define ACCESS_MASM(masm) masm-> |
1062 #endif | 1078 #endif |
1063 | 1079 |
1064 | 1080 |
1065 } } // namespace v8::internal | 1081 } } // namespace v8::internal |
1066 | 1082 |
1067 #endif // V8_X87_MACRO_ASSEMBLER_X87_H_ | 1083 #endif // V8_X87_MACRO_ASSEMBLER_X87_H_ |
OLD | NEW |