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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 friend class JumpTarget; | 594 friend class JumpTarget; |
595 friend class Reference; | 595 friend class Reference; |
596 friend class Result; | 596 friend class Result; |
597 | 597 |
598 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc | 598 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc |
599 | 599 |
600 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 600 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
601 }; | 601 }; |
602 | 602 |
603 | 603 |
| 604 // Flag that indicates whether or not the code that handles smi arguments |
| 605 // should be placed in the stub, inlined, or omitted entirely. |
| 606 enum GenericBinaryFlags { |
| 607 SMI_CODE_IN_STUB, |
| 608 SMI_CODE_INLINED |
| 609 }; |
| 610 |
| 611 |
| 612 class GenericBinaryOpStub: public CodeStub { |
| 613 public: |
| 614 GenericBinaryOpStub(Token::Value op, |
| 615 OverwriteMode mode, |
| 616 GenericBinaryFlags flags) |
| 617 : op_(op), mode_(mode), flags_(flags) { |
| 618 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| 619 } |
| 620 |
| 621 void GenerateSmiCode(MacroAssembler* masm, Label* slow); |
| 622 |
| 623 private: |
| 624 Token::Value op_; |
| 625 OverwriteMode mode_; |
| 626 GenericBinaryFlags flags_; |
| 627 |
| 628 const char* GetName(); |
| 629 |
| 630 #ifdef DEBUG |
| 631 void Print() { |
| 632 PrintF("GenericBinaryOpStub (op %s), (mode %d, flags %d)\n", |
| 633 Token::String(op_), |
| 634 static_cast<int>(mode_), |
| 635 static_cast<int>(flags_)); |
| 636 } |
| 637 #endif |
| 638 |
| 639 // Minor key encoding in 16 bits FOOOOOOOOOOOOOMM. |
| 640 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
| 641 class OpBits: public BitField<Token::Value, 2, 13> {}; |
| 642 class FlagBits: public BitField<GenericBinaryFlags, 15, 1> {}; |
| 643 |
| 644 Major MajorKey() { return GenericBinaryOp; } |
| 645 int MinorKey() { |
| 646 // Encode the parameters in a unique 16 bit value. |
| 647 return OpBits::encode(op_) |
| 648 | ModeBits::encode(mode_) |
| 649 | FlagBits::encode(flags_); |
| 650 } |
| 651 void Generate(MacroAssembler* masm); |
| 652 }; |
| 653 |
| 654 |
604 } } // namespace v8::internal | 655 } } // namespace v8::internal |
605 | 656 |
606 #endif // V8_X64_CODEGEN_X64_H_ | 657 #endif // V8_X64_CODEGEN_X64_H_ |
OLD | NEW |