| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Return the pointer to the allocated already tagged as a heap object. | 40 // Return the pointer to the allocated already tagged as a heap object. |
| 41 TAG_OBJECT = 1 << 0, | 41 TAG_OBJECT = 1 << 0, |
| 42 // The content of the result register already contains the allocation top in | 42 // The content of the result register already contains the allocation top in |
| 43 // new space. | 43 // new space. |
| 44 RESULT_CONTAINS_TOP = 1 << 1 | 44 RESULT_CONTAINS_TOP = 1 << 1 |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Default scratch register used by MacroAssembler (and other code that needs | 47 // Default scratch register used by MacroAssembler (and other code that needs |
| 48 // a spare register). The register isn't callee save, and not used by the | 48 // a spare register). The register isn't callee save, and not used by the |
| 49 // function calling convention. | 49 // function calling convention. |
| 50 static const Register kScratchRegister = { 10 }; // r10. | 50 static const Register kScratchRegister = { 10 }; // r10. |
| 51 static const Register kRootRegister = { 13 }; // r13 | 51 static const Register kSmiConstantRegister = { 15 }; // r15 (callee save). |
| 52 static const Register kRootRegister = { 13 }; // r13 (callee save). |
| 53 // Value of smi in kSmiConstantRegister. |
| 54 static const int kSmiConstantRegisterValue = 1; |
| 52 | 55 |
| 53 // Convenience for platform-independent signatures. | 56 // Convenience for platform-independent signatures. |
| 54 typedef Operand MemOperand; | 57 typedef Operand MemOperand; |
| 55 | 58 |
| 56 // Forward declaration. | 59 // Forward declaration. |
| 57 class JumpTarget; | 60 class JumpTarget; |
| 58 | 61 |
| 59 struct SmiIndex { | 62 struct SmiIndex { |
| 60 SmiIndex(Register index_register, ScaleFactor scale) | 63 SmiIndex(Register index_register, ScaleFactor scale) |
| 61 : reg(index_register), | 64 : reg(index_register), |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // the unresolved list if the name does not resolve. | 198 // the unresolved list if the name does not resolve. |
| 196 void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag); | 199 void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag); |
| 197 | 200 |
| 198 // Store the code object for the given builtin in the target register. | 201 // Store the code object for the given builtin in the target register. |
| 199 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 202 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
| 200 | 203 |
| 201 | 204 |
| 202 // --------------------------------------------------------------------------- | 205 // --------------------------------------------------------------------------- |
| 203 // Smi tagging, untagging and operations on tagged smis. | 206 // Smi tagging, untagging and operations on tagged smis. |
| 204 | 207 |
| 208 void InitializeSmiConstantRegister() { |
| 209 movq(kSmiConstantRegister, |
| 210 reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)), |
| 211 RelocInfo::NONE); |
| 212 } |
| 213 |
| 205 // Conversions between tagged smi values and non-tagged integer values. | 214 // Conversions between tagged smi values and non-tagged integer values. |
| 206 | 215 |
| 207 // Tag an integer value. The result must be known to be a valid smi value. | 216 // Tag an integer value. The result must be known to be a valid smi value. |
| 208 // Only uses the low 32 bits of the src register. Sets the N and Z flags | 217 // Only uses the low 32 bits of the src register. Sets the N and Z flags |
| 209 // based on the value of the resulting integer. | 218 // based on the value of the resulting integer. |
| 210 void Integer32ToSmi(Register dst, Register src); | 219 void Integer32ToSmi(Register dst, Register src); |
| 211 | 220 |
| 212 // Tag an integer value if possible, or jump the integer value cannot be | 221 // Tag an integer value if possible, or jump the integer value cannot be |
| 213 // represented as a smi. Only uses the low 32 bit of the src registers. | 222 // represented as a smi. Only uses the low 32 bit of the src registers. |
| 214 // NOTICE: Destroys the dst register even if unsuccessful! | 223 // NOTICE: Destroys the dst register even if unsuccessful! |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // The returned index register may be either src or dst, depending | 471 // The returned index register may be either src or dst, depending |
| 463 // on what is most efficient. If src and dst are different registers, | 472 // on what is most efficient. If src and dst are different registers, |
| 464 // src is always unchanged. | 473 // src is always unchanged. |
| 465 SmiIndex SmiToIndex(Register dst, Register src, int shift); | 474 SmiIndex SmiToIndex(Register dst, Register src, int shift); |
| 466 | 475 |
| 467 // Converts a positive smi to a negative index. | 476 // Converts a positive smi to a negative index. |
| 468 SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift); | 477 SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift); |
| 469 | 478 |
| 470 // Basic Smi operations. | 479 // Basic Smi operations. |
| 471 void Move(Register dst, Smi* source) { | 480 void Move(Register dst, Smi* source) { |
| 472 Set(dst, reinterpret_cast<int64_t>(source)); | 481 LoadSmiConstant(dst, source); |
| 473 } | 482 } |
| 474 | 483 |
| 475 void Move(const Operand& dst, Smi* source) { | 484 void Move(const Operand& dst, Smi* source) { |
| 476 Set(dst, reinterpret_cast<int64_t>(source)); | 485 Register constant = GetSmiConstant(source); |
| 486 movq(dst, constant); |
| 477 } | 487 } |
| 478 | 488 |
| 479 void Push(Smi* smi); | 489 void Push(Smi* smi); |
| 480 void Test(const Operand& dst, Smi* source); | 490 void Test(const Operand& dst, Smi* source); |
| 481 | 491 |
| 482 // --------------------------------------------------------------------------- | 492 // --------------------------------------------------------------------------- |
| 483 // String macros. | 493 // String macros. |
| 484 void JumpIfNotBothSequentialAsciiStrings(Register first_object, | 494 void JumpIfNotBothSequentialAsciiStrings(Register first_object, |
| 485 Register second_object, | 495 Register second_object, |
| 486 Register scratch1, | 496 Register scratch1, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 823 |
| 814 // Verify restrictions about code generated in stubs. | 824 // Verify restrictions about code generated in stubs. |
| 815 void set_generating_stub(bool value) { generating_stub_ = value; } | 825 void set_generating_stub(bool value) { generating_stub_ = value; } |
| 816 bool generating_stub() { return generating_stub_; } | 826 bool generating_stub() { return generating_stub_; } |
| 817 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 827 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
| 818 bool allow_stub_calls() { return allow_stub_calls_; } | 828 bool allow_stub_calls() { return allow_stub_calls_; } |
| 819 | 829 |
| 820 private: | 830 private: |
| 821 bool generating_stub_; | 831 bool generating_stub_; |
| 822 bool allow_stub_calls_; | 832 bool allow_stub_calls_; |
| 833 |
| 834 // Returns a register holding the smi value. The register MUST NOT be |
| 835 // modified. It may be the "smi 1 constant" register. |
| 836 Register GetSmiConstant(Smi* value); |
| 837 |
| 838 // Moves the smi value to the destination register. |
| 839 void LoadSmiConstant(Register dst, Smi* value); |
| 840 |
| 823 // This handle will be patched with the code object on installation. | 841 // This handle will be patched with the code object on installation. |
| 824 Handle<Object> code_object_; | 842 Handle<Object> code_object_; |
| 825 | 843 |
| 826 // Helper functions for generating invokes. | 844 // Helper functions for generating invokes. |
| 827 void InvokePrologue(const ParameterCount& expected, | 845 void InvokePrologue(const ParameterCount& expected, |
| 828 const ParameterCount& actual, | 846 const ParameterCount& actual, |
| 829 Handle<Code> code_constant, | 847 Handle<Code> code_constant, |
| 830 Register code_register, | 848 Register code_register, |
| 831 Label* done, | 849 Label* done, |
| 832 InvokeFlag flag); | 850 InvokeFlag flag); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 } \ | 925 } \ |
| 908 masm-> | 926 masm-> |
| 909 #else | 927 #else |
| 910 #define ACCESS_MASM(masm) masm-> | 928 #define ACCESS_MASM(masm) masm-> |
| 911 #endif | 929 #endif |
| 912 | 930 |
| 913 | 931 |
| 914 } } // namespace v8::internal | 932 } } // namespace v8::internal |
| 915 | 933 |
| 916 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 934 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
| OLD | NEW |