| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 | 645 |
| 646 // Methods used to indicate which source code is generated for. Source | 646 // Methods used to indicate which source code is generated for. Source |
| 647 // positions are collected by the assembler and emitted with the relocation | 647 // positions are collected by the assembler and emitted with the relocation |
| 648 // information. | 648 // information. |
| 649 void CodeForFunctionPosition(FunctionLiteral* fun); | 649 void CodeForFunctionPosition(FunctionLiteral* fun); |
| 650 void CodeForReturnPosition(FunctionLiteral* fun); | 650 void CodeForReturnPosition(FunctionLiteral* fun); |
| 651 void CodeForStatementPosition(Statement* stmt); | 651 void CodeForStatementPosition(Statement* stmt); |
| 652 void CodeForDoWhileConditionPosition(DoWhileStatement* stmt); | 652 void CodeForDoWhileConditionPosition(DoWhileStatement* stmt); |
| 653 void CodeForSourcePosition(int pos); | 653 void CodeForSourcePosition(int pos); |
| 654 | 654 |
| 655 void SetTypeForStackSlot(Slot* slot, NumberInfo info); | 655 void SetTypeForStackSlot(Slot* slot, TypeInfo info); |
| 656 | 656 |
| 657 #ifdef DEBUG | 657 #ifdef DEBUG |
| 658 // True if the registers are valid for entry to a block. There should | 658 // True if the registers are valid for entry to a block. There should |
| 659 // be no frame-external references to (non-reserved) registers. | 659 // be no frame-external references to (non-reserved) registers. |
| 660 bool HasValidEntryRegisters(); | 660 bool HasValidEntryRegisters(); |
| 661 #endif | 661 #endif |
| 662 | 662 |
| 663 ZoneList<DeferredCode*> deferred_; | 663 ZoneList<DeferredCode*> deferred_; |
| 664 | 664 |
| 665 // Assembler | 665 // Assembler |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 NO_GENERIC_BINARY_FLAGS = 0, | 729 NO_GENERIC_BINARY_FLAGS = 0, |
| 730 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. | 730 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. |
| 731 }; | 731 }; |
| 732 | 732 |
| 733 | 733 |
| 734 class GenericBinaryOpStub: public CodeStub { | 734 class GenericBinaryOpStub: public CodeStub { |
| 735 public: | 735 public: |
| 736 GenericBinaryOpStub(Token::Value op, | 736 GenericBinaryOpStub(Token::Value op, |
| 737 OverwriteMode mode, | 737 OverwriteMode mode, |
| 738 GenericBinaryFlags flags, | 738 GenericBinaryFlags flags, |
| 739 NumberInfo operands_type) | 739 TypeInfo operands_type) |
| 740 : op_(op), | 740 : op_(op), |
| 741 mode_(mode), | 741 mode_(mode), |
| 742 flags_(flags), | 742 flags_(flags), |
| 743 args_in_registers_(false), | 743 args_in_registers_(false), |
| 744 args_reversed_(false), | 744 args_reversed_(false), |
| 745 static_operands_type_(operands_type), | 745 static_operands_type_(operands_type), |
| 746 runtime_operands_type_(BinaryOpIC::DEFAULT), | 746 runtime_operands_type_(BinaryOpIC::DEFAULT), |
| 747 name_(NULL) { | 747 name_(NULL) { |
| 748 if (static_operands_type_.IsSmi()) { | 748 if (static_operands_type_.IsSmi()) { |
| 749 mode_ = NO_OVERWRITE; | 749 mode_ = NO_OVERWRITE; |
| 750 } | 750 } |
| 751 use_sse3_ = CpuFeatures::IsSupported(SSE3); | 751 use_sse3_ = CpuFeatures::IsSupported(SSE3); |
| 752 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 752 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| 753 } | 753 } |
| 754 | 754 |
| 755 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type) | 755 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type) |
| 756 : op_(OpBits::decode(key)), | 756 : op_(OpBits::decode(key)), |
| 757 mode_(ModeBits::decode(key)), | 757 mode_(ModeBits::decode(key)), |
| 758 flags_(FlagBits::decode(key)), | 758 flags_(FlagBits::decode(key)), |
| 759 args_in_registers_(ArgsInRegistersBits::decode(key)), | 759 args_in_registers_(ArgsInRegistersBits::decode(key)), |
| 760 args_reversed_(ArgsReversedBits::decode(key)), | 760 args_reversed_(ArgsReversedBits::decode(key)), |
| 761 use_sse3_(SSE3Bits::decode(key)), | 761 use_sse3_(SSE3Bits::decode(key)), |
| 762 static_operands_type_(NumberInfo::ExpandedRepresentation( | 762 static_operands_type_(TypeInfo::ExpandedRepresentation( |
| 763 StaticTypeInfoBits::decode(key))), | 763 StaticTypeInfoBits::decode(key))), |
| 764 runtime_operands_type_(runtime_operands_type), | 764 runtime_operands_type_(runtime_operands_type), |
| 765 name_(NULL) { | 765 name_(NULL) { |
| 766 } | 766 } |
| 767 | 767 |
| 768 // Generate code to call the stub with the supplied arguments. This will add | 768 // Generate code to call the stub with the supplied arguments. This will add |
| 769 // code at the call site to prepare arguments either in registers or on the | 769 // code at the call site to prepare arguments either in registers or on the |
| 770 // stack together with the actual call. | 770 // stack together with the actual call. |
| 771 void GenerateCall(MacroAssembler* masm, Register left, Register right); | 771 void GenerateCall(MacroAssembler* masm, Register left, Register right); |
| 772 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); | 772 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); |
| 773 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); | 773 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); |
| 774 | 774 |
| 775 Result GenerateCall(MacroAssembler* masm, | 775 Result GenerateCall(MacroAssembler* masm, |
| 776 VirtualFrame* frame, | 776 VirtualFrame* frame, |
| 777 Result* left, | 777 Result* left, |
| 778 Result* right); | 778 Result* right); |
| 779 | 779 |
| 780 private: | 780 private: |
| 781 Token::Value op_; | 781 Token::Value op_; |
| 782 OverwriteMode mode_; | 782 OverwriteMode mode_; |
| 783 GenericBinaryFlags flags_; | 783 GenericBinaryFlags flags_; |
| 784 bool args_in_registers_; // Arguments passed in registers not on the stack. | 784 bool args_in_registers_; // Arguments passed in registers not on the stack. |
| 785 bool args_reversed_; // Left and right argument are swapped. | 785 bool args_reversed_; // Left and right argument are swapped. |
| 786 bool use_sse3_; | 786 bool use_sse3_; |
| 787 | 787 |
| 788 // Number type information of operands, determined by code generator. | 788 // Number type information of operands, determined by code generator. |
| 789 NumberInfo static_operands_type_; | 789 TypeInfo static_operands_type_; |
| 790 | 790 |
| 791 // Operand type information determined at runtime. | 791 // Operand type information determined at runtime. |
| 792 BinaryOpIC::TypeInfo runtime_operands_type_; | 792 BinaryOpIC::TypeInfo runtime_operands_type_; |
| 793 | 793 |
| 794 char* name_; | 794 char* name_; |
| 795 | 795 |
| 796 const char* GetName(); | 796 const char* GetName(); |
| 797 | 797 |
| 798 #ifdef DEBUG | 798 #ifdef DEBUG |
| 799 void Print() { | 799 void Print() { |
| 800 PrintF("GenericBinaryOpStub %d (op %s), " | 800 PrintF("GenericBinaryOpStub %d (op %s), " |
| 801 "(mode %d, flags %d, registers %d, reversed %d, number_info %s)\n", | 801 "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n", |
| 802 MinorKey(), | 802 MinorKey(), |
| 803 Token::String(op_), | 803 Token::String(op_), |
| 804 static_cast<int>(mode_), | 804 static_cast<int>(mode_), |
| 805 static_cast<int>(flags_), | 805 static_cast<int>(flags_), |
| 806 static_cast<int>(args_in_registers_), | 806 static_cast<int>(args_in_registers_), |
| 807 static_cast<int>(args_reversed_), | 807 static_cast<int>(args_reversed_), |
| 808 static_operands_type_.ToString()); | 808 static_operands_type_.ToString()); |
| 809 } | 809 } |
| 810 #endif | 810 #endif |
| 811 | 811 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 return ObjectBits::encode(object_.code()) | | 1046 return ObjectBits::encode(object_.code()) | |
| 1047 AddressBits::encode(addr_.code()) | | 1047 AddressBits::encode(addr_.code()) | |
| 1048 ScratchBits::encode(scratch_.code()); | 1048 ScratchBits::encode(scratch_.code()); |
| 1049 } | 1049 } |
| 1050 }; | 1050 }; |
| 1051 | 1051 |
| 1052 | 1052 |
| 1053 } } // namespace v8::internal | 1053 } } // namespace v8::internal |
| 1054 | 1054 |
| 1055 #endif // V8_IA32_CODEGEN_IA32_H_ | 1055 #endif // V8_IA32_CODEGEN_IA32_H_ |
| OLD | NEW |