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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/flags.h" |
10 #include "src/frames.h" | 11 #include "src/frames.h" |
11 #include "src/globals.h" | 12 #include "src/globals.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 // Default scratch register used by MacroAssembler (and other code that needs | 17 // Default scratch register used by MacroAssembler (and other code that needs |
17 // a spare register). The register isn't callee save, and not used by the | 18 // a spare register). The register isn't callee save, and not used by the |
18 // function calling convention. | 19 // function calling convention. |
19 const Register kScratchRegister = { 10 }; // r10. | 20 const Register kScratchRegister = { 10 }; // r10. |
20 const Register kRootRegister = { 13 }; // r13 (callee save). | 21 const Register kRootRegister = { 13 }; // r13 (callee save). |
21 // Actual value of root register is offset from the root array's start | 22 // Actual value of root register is offset from the root array's start |
22 // to take advantage of negitive 8-bit displacement values. | 23 // to take advantage of negitive 8-bit displacement values. |
23 const int kRootRegisterBias = 128; | 24 const int kRootRegisterBias = 128; |
24 | 25 |
25 // Convenience for platform-independent signatures. | 26 // Convenience for platform-independent signatures. |
26 typedef Operand MemOperand; | 27 typedef Operand MemOperand; |
27 | 28 |
28 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; | 29 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; |
29 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; | 30 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; |
30 enum PointersToHereCheck { | 31 enum PointersToHereCheck { |
31 kPointersToHereMaybeInteresting, | 32 kPointersToHereMaybeInteresting, |
32 kPointersToHereAreAlwaysInteresting | 33 kPointersToHereAreAlwaysInteresting |
33 }; | 34 }; |
34 | 35 |
35 enum SmiOperationConstraint { | 36 enum class SmiOperationConstraint { |
36 PRESERVE_SOURCE_REGISTER, | 37 kPreserveSourceRegister = 1 << 0, |
37 BAILOUT_ON_NO_OVERFLOW, | 38 kBailoutOnNoOverflow = 1 << 1, |
38 BAILOUT_ON_OVERFLOW, | 39 kBailoutOnOverflow = 1 << 2 |
39 NUMBER_OF_CONSTRAINTS | |
40 }; | 40 }; |
41 | 41 |
42 STATIC_ASSERT(NUMBER_OF_CONSTRAINTS <= 8); | 42 typedef base::Flags<SmiOperationConstraint> SmiOperationConstraints; |
43 | 43 |
44 class SmiOperationExecutionMode : public EnumSet<SmiOperationConstraint, byte> { | 44 DEFINE_OPERATORS_FOR_FLAGS(SmiOperationConstraints) |
45 public: | |
46 SmiOperationExecutionMode() : EnumSet<SmiOperationConstraint, byte>(0) { } | |
47 explicit SmiOperationExecutionMode(byte bits) | |
48 : EnumSet<SmiOperationConstraint, byte>(bits) { } | |
49 }; | |
50 | 45 |
51 #ifdef DEBUG | 46 #ifdef DEBUG |
52 bool AreAliased(Register reg1, | 47 bool AreAliased(Register reg1, |
53 Register reg2, | 48 Register reg2, |
54 Register reg3 = no_reg, | 49 Register reg3 = no_reg, |
55 Register reg4 = no_reg, | 50 Register reg4 = no_reg, |
56 Register reg5 = no_reg, | 51 Register reg5 = no_reg, |
57 Register reg6 = no_reg, | 52 Register reg6 = no_reg, |
58 Register reg7 = no_reg, | 53 Register reg7 = no_reg, |
59 Register reg8 = no_reg); | 54 Register reg8 = no_reg); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // Add an integer constant to a tagged smi, giving a tagged smi as result. | 534 // Add an integer constant to a tagged smi, giving a tagged smi as result. |
540 // No overflow testing on the result is done. | 535 // No overflow testing on the result is done. |
541 void SmiAddConstant(Register dst, Register src, Smi* constant); | 536 void SmiAddConstant(Register dst, Register src, Smi* constant); |
542 | 537 |
543 // Add an integer constant to a tagged smi, giving a tagged smi as result. | 538 // Add an integer constant to a tagged smi, giving a tagged smi as result. |
544 // No overflow testing on the result is done. | 539 // No overflow testing on the result is done. |
545 void SmiAddConstant(const Operand& dst, Smi* constant); | 540 void SmiAddConstant(const Operand& dst, Smi* constant); |
546 | 541 |
547 // Add an integer constant to a tagged smi, giving a tagged smi as result, | 542 // Add an integer constant to a tagged smi, giving a tagged smi as result, |
548 // or jumping to a label if the result cannot be represented by a smi. | 543 // or jumping to a label if the result cannot be represented by a smi. |
549 void SmiAddConstant(Register dst, | 544 void SmiAddConstant(Register dst, Register src, Smi* constant, |
550 Register src, | 545 SmiOperationConstraints constraints, Label* bailout_label, |
551 Smi* constant, | |
552 SmiOperationExecutionMode mode, | |
553 Label* bailout_label, | |
554 Label::Distance near_jump = Label::kFar); | 546 Label::Distance near_jump = Label::kFar); |
555 | 547 |
556 // Subtract an integer constant from a tagged smi, giving a tagged smi as | 548 // Subtract an integer constant from a tagged smi, giving a tagged smi as |
557 // result. No testing on the result is done. Sets the N and Z flags | 549 // result. No testing on the result is done. Sets the N and Z flags |
558 // based on the value of the resulting integer. | 550 // based on the value of the resulting integer. |
559 void SmiSubConstant(Register dst, Register src, Smi* constant); | 551 void SmiSubConstant(Register dst, Register src, Smi* constant); |
560 | 552 |
561 // Subtract an integer constant from a tagged smi, giving a tagged smi as | 553 // Subtract an integer constant from a tagged smi, giving a tagged smi as |
562 // result, or jumping to a label if the result cannot be represented by a smi. | 554 // result, or jumping to a label if the result cannot be represented by a smi. |
563 void SmiSubConstant(Register dst, | 555 void SmiSubConstant(Register dst, Register src, Smi* constant, |
564 Register src, | 556 SmiOperationConstraints constraints, Label* bailout_label, |
565 Smi* constant, | |
566 SmiOperationExecutionMode mode, | |
567 Label* bailout_label, | |
568 Label::Distance near_jump = Label::kFar); | 557 Label::Distance near_jump = Label::kFar); |
569 | 558 |
570 // Negating a smi can give a negative zero or too large positive value. | 559 // Negating a smi can give a negative zero or too large positive value. |
571 // NOTICE: This operation jumps on success, not failure! | 560 // NOTICE: This operation jumps on success, not failure! |
572 void SmiNeg(Register dst, | 561 void SmiNeg(Register dst, |
573 Register src, | 562 Register src, |
574 Label* on_smi_result, | 563 Label* on_smi_result, |
575 Label::Distance near_jump = Label::kFar); | 564 Label::Distance near_jump = Label::kFar); |
576 | 565 |
577 // Adds smi values and return the result as a smi. | 566 // Adds smi values and return the result as a smi. |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 masm->popfq(); \ | 1611 masm->popfq(); \ |
1623 } \ | 1612 } \ |
1624 masm-> | 1613 masm-> |
1625 #else | 1614 #else |
1626 #define ACCESS_MASM(masm) masm-> | 1615 #define ACCESS_MASM(masm) masm-> |
1627 #endif | 1616 #endif |
1628 | 1617 |
1629 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
1630 | 1619 |
1631 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1620 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |