| 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 "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/frames.h" | 9 #include "src/frames.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 // Default scratch register used by MacroAssembler (and other code that needs | 15 // Default scratch register used by MacroAssembler (and other code that needs |
| 16 // a spare register). The register isn't callee save, and not used by the | 16 // a spare register). The register isn't callee save, and not used by the |
| 17 // function calling convention. | 17 // function calling convention. |
| 18 const Register kScratchRegister = { 10 }; // r10. | 18 const Register kScratchRegister = { 10 }; // r10. |
| 19 const Register kSmiConstantRegister = { 12 }; // r12 (callee save). | |
| 20 const Register kRootRegister = { 13 }; // r13 (callee save). | 19 const Register kRootRegister = { 13 }; // r13 (callee save). |
| 21 // Value of smi in kSmiConstantRegister. | |
| 22 const int kSmiConstantRegisterValue = 1; | |
| 23 // Actual value of root register is offset from the root array's start | 20 // Actual value of root register is offset from the root array's start |
| 24 // to take advantage of negitive 8-bit displacement values. | 21 // to take advantage of negitive 8-bit displacement values. |
| 25 const int kRootRegisterBias = 128; | 22 const int kRootRegisterBias = 128; |
| 26 | 23 |
| 27 // Convenience for platform-independent signatures. | 24 // Convenience for platform-independent signatures. |
| 28 typedef Operand MemOperand; | 25 typedef Operand MemOperand; |
| 29 | 26 |
| 30 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; | 27 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; |
| 31 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; | 28 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; |
| 32 enum PointersToHereCheck { | 29 enum PointersToHereCheck { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 383 |
| 387 | 384 |
| 388 // --------------------------------------------------------------------------- | 385 // --------------------------------------------------------------------------- |
| 389 // Smi tagging, untagging and operations on tagged smis. | 386 // Smi tagging, untagging and operations on tagged smis. |
| 390 | 387 |
| 391 // Support for constant splitting. | 388 // Support for constant splitting. |
| 392 bool IsUnsafeInt(const int32_t x); | 389 bool IsUnsafeInt(const int32_t x); |
| 393 void SafeMove(Register dst, Smi* src); | 390 void SafeMove(Register dst, Smi* src); |
| 394 void SafePush(Smi* src); | 391 void SafePush(Smi* src); |
| 395 | 392 |
| 396 void InitializeSmiConstantRegister() { | |
| 397 Move(kSmiConstantRegister, Smi::FromInt(kSmiConstantRegisterValue), | |
| 398 Assembler::RelocInfoNone()); | |
| 399 } | |
| 400 | |
| 401 // Conversions between tagged smi values and non-tagged integer values. | 393 // Conversions between tagged smi values and non-tagged integer values. |
| 402 | 394 |
| 403 // Tag an integer value. The result must be known to be a valid smi value. | 395 // Tag an integer value. The result must be known to be a valid smi value. |
| 404 // Only uses the low 32 bits of the src register. Sets the N and Z flags | 396 // Only uses the low 32 bits of the src register. Sets the N and Z flags |
| 405 // based on the value of the resulting smi. | 397 // based on the value of the resulting smi. |
| 406 void Integer32ToSmi(Register dst, Register src); | 398 void Integer32ToSmi(Register dst, Register src); |
| 407 | 399 |
| 408 // Stores an integer32 value into a memory field that already holds a smi. | 400 // Stores an integer32 value into a memory field that already holds a smi. |
| 409 void Integer32ToSmiField(const Operand& dst, Register src); | 401 void Integer32ToSmiField(const Operand& dst, Register src); |
| 410 | 402 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Condition CheckBothSmi(Register first, Register second); | 462 Condition CheckBothSmi(Register first, Register second); |
| 471 | 463 |
| 472 // Are both values non-negative tagged smis. | 464 // Are both values non-negative tagged smis. |
| 473 Condition CheckBothNonNegativeSmi(Register first, Register second); | 465 Condition CheckBothNonNegativeSmi(Register first, Register second); |
| 474 | 466 |
| 475 // Are either value a tagged smi. | 467 // Are either value a tagged smi. |
| 476 Condition CheckEitherSmi(Register first, | 468 Condition CheckEitherSmi(Register first, |
| 477 Register second, | 469 Register second, |
| 478 Register scratch = kScratchRegister); | 470 Register scratch = kScratchRegister); |
| 479 | 471 |
| 480 // Is the value the minimum smi value (since we are using | |
| 481 // two's complement numbers, negating the value is known to yield | |
| 482 // a non-smi value). | |
| 483 Condition CheckIsMinSmi(Register src); | |
| 484 | |
| 485 // Checks whether an 32-bit integer value is a valid for conversion | 472 // Checks whether an 32-bit integer value is a valid for conversion |
| 486 // to a smi. | 473 // to a smi. |
| 487 Condition CheckInteger32ValidSmiValue(Register src); | 474 Condition CheckInteger32ValidSmiValue(Register src); |
| 488 | 475 |
| 489 // Checks whether an 32-bit unsigned integer value is a valid for | 476 // Checks whether an 32-bit unsigned integer value is a valid for |
| 490 // conversion to a smi. | 477 // conversion to a smi. |
| 491 Condition CheckUInteger32ValidSmiValue(Register src); | 478 Condition CheckUInteger32ValidSmiValue(Register src); |
| 492 | 479 |
| 493 // Check whether src is a Smi, and set dst to zero if it is a smi, | 480 // Check whether src is a Smi, and set dst to zero if it is a smi, |
| 494 // and to one if it isn't. | 481 // and to one if it isn't. |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 914 |
| 928 // Emit call to the code we are currently generating. | 915 // Emit call to the code we are currently generating. |
| 929 void CallSelf() { | 916 void CallSelf() { |
| 930 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); | 917 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); |
| 931 Call(self, RelocInfo::CODE_TARGET); | 918 Call(self, RelocInfo::CODE_TARGET); |
| 932 } | 919 } |
| 933 | 920 |
| 934 // Non-x64 instructions. | 921 // Non-x64 instructions. |
| 935 // Push/pop all general purpose registers. | 922 // Push/pop all general purpose registers. |
| 936 // Does not push rsp/rbp nor any of the assembler's special purpose registers | 923 // Does not push rsp/rbp nor any of the assembler's special purpose registers |
| 937 // (kScratchRegister, kSmiConstantRegister, kRootRegister). | 924 // (kScratchRegister, kRootRegister). |
| 938 void Pushad(); | 925 void Pushad(); |
| 939 void Popad(); | 926 void Popad(); |
| 940 // Sets the stack as after performing Popad, without actually loading the | 927 // Sets the stack as after performing Popad, without actually loading the |
| 941 // registers. | 928 // registers. |
| 942 void Dropad(); | 929 void Dropad(); |
| 943 | 930 |
| 944 // Compare object type for heap object. | 931 // Compare object type for heap object. |
| 945 // Always use unsigned comparisons: above and below, not less and greater. | 932 // Always use unsigned comparisons: above and below, not less and greater. |
| 946 // Incoming register is heap_object and outgoing register is map. | 933 // Incoming register is heap_object and outgoing register is map. |
| 947 // They may be the same register, and may be kScratchRegister. | 934 // They may be the same register, and may be kScratchRegister. |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 masm->popfq(); \ | 1644 masm->popfq(); \ |
| 1658 } \ | 1645 } \ |
| 1659 masm-> | 1646 masm-> |
| 1660 #else | 1647 #else |
| 1661 #define ACCESS_MASM(masm) masm-> | 1648 #define ACCESS_MASM(masm) masm-> |
| 1662 #endif | 1649 #endif |
| 1663 | 1650 |
| 1664 } } // namespace v8::internal | 1651 } } // namespace v8::internal |
| 1665 | 1652 |
| 1666 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1653 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
| OLD | NEW |