OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual bool SometimesSetsUpAFrame() { return false; } | 74 virtual bool SometimesSetsUpAFrame() { return false; } |
75 | 75 |
76 private: | 76 private: |
77 SaveFPRegsMode save_doubles_; | 77 SaveFPRegsMode save_doubles_; |
78 | 78 |
79 Major MajorKey() { return StoreBufferOverflow; } | 79 Major MajorKey() { return StoreBufferOverflow; } |
80 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | 80 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
| 84 class UnaryOpStub: public PlatformCodeStub { |
| 85 public: |
| 86 UnaryOpStub(Token::Value op, |
| 87 UnaryOverwriteMode mode, |
| 88 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) |
| 89 : op_(op), |
| 90 mode_(mode), |
| 91 operand_type_(operand_type) { |
| 92 } |
| 93 |
| 94 private: |
| 95 Token::Value op_; |
| 96 UnaryOverwriteMode mode_; |
| 97 |
| 98 // Operand type information determined at runtime. |
| 99 UnaryOpIC::TypeInfo operand_type_; |
| 100 |
| 101 virtual void PrintName(StringStream* stream); |
| 102 |
| 103 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
| 104 class OpBits: public BitField<Token::Value, 1, 7> {}; |
| 105 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
| 106 |
| 107 Major MajorKey() { return UnaryOp; } |
| 108 int MinorKey() { |
| 109 return ModeBits::encode(mode_) |
| 110 | OpBits::encode(op_) |
| 111 | OperandTypeInfoBits::encode(operand_type_); |
| 112 } |
| 113 |
| 114 // Note: A lot of the helper functions below will vanish when we use virtual |
| 115 // function instead of switch more often. |
| 116 void Generate(MacroAssembler* masm); |
| 117 |
| 118 void GenerateTypeTransition(MacroAssembler* masm); |
| 119 |
| 120 void GenerateSmiStub(MacroAssembler* masm); |
| 121 void GenerateSmiStubSub(MacroAssembler* masm); |
| 122 void GenerateSmiStubBitNot(MacroAssembler* masm); |
| 123 void GenerateSmiCodeSub(MacroAssembler* masm, |
| 124 Label* non_smi, |
| 125 Label* slow, |
| 126 Label::Distance non_smi_near = Label::kFar, |
| 127 Label::Distance slow_near = Label::kFar); |
| 128 void GenerateSmiCodeBitNot(MacroAssembler* masm, |
| 129 Label* non_smi, |
| 130 Label::Distance non_smi_near); |
| 131 |
| 132 void GenerateNumberStub(MacroAssembler* masm); |
| 133 void GenerateNumberStubSub(MacroAssembler* masm); |
| 134 void GenerateNumberStubBitNot(MacroAssembler* masm); |
| 135 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); |
| 136 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); |
| 137 |
| 138 void GenerateGenericStub(MacroAssembler* masm); |
| 139 void GenerateGenericStubSub(MacroAssembler* masm); |
| 140 void GenerateGenericStubBitNot(MacroAssembler* masm); |
| 141 void GenerateGenericCodeFallback(MacroAssembler* masm); |
| 142 |
| 143 virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; } |
| 144 |
| 145 virtual InlineCacheState GetICState() { |
| 146 return UnaryOpIC::ToState(operand_type_); |
| 147 } |
| 148 |
| 149 virtual void FinishCode(Handle<Code> code) { |
| 150 code->set_unary_op_type(operand_type_); |
| 151 } |
| 152 }; |
| 153 |
| 154 |
84 class StringHelper : public AllStatic { | 155 class StringHelper : public AllStatic { |
85 public: | 156 public: |
86 // Generate code for copying characters using a simple loop. This should only | 157 // Generate code for copying characters using a simple loop. This should only |
87 // be used in places where the number of characters is small and the | 158 // be used in places where the number of characters is small and the |
88 // additional setup and checking in GenerateCopyCharactersREP adds too much | 159 // additional setup and checking in GenerateCopyCharactersREP adds too much |
89 // overhead. Copying of overlapping regions is not supported. | 160 // overhead. Copying of overlapping regions is not supported. |
90 static void GenerateCopyCharacters(MacroAssembler* masm, | 161 static void GenerateCopyCharacters(MacroAssembler* masm, |
91 Register dest, | 162 Register dest, |
92 Register src, | 163 Register src, |
93 Register count, | 164 Register count, |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 RememberedSetAction remembered_set_action_; | 621 RememberedSetAction remembered_set_action_; |
551 SaveFPRegsMode save_fp_regs_mode_; | 622 SaveFPRegsMode save_fp_regs_mode_; |
552 Label slow_; | 623 Label slow_; |
553 RegisterAllocation regs_; | 624 RegisterAllocation regs_; |
554 }; | 625 }; |
555 | 626 |
556 | 627 |
557 } } // namespace v8::internal | 628 } } // namespace v8::internal |
558 | 629 |
559 #endif // V8_X64_CODE_STUBS_X64_H_ | 630 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |