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