| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual bool SometimesSetsUpAFrame() { return false; } | 72 virtual bool SometimesSetsUpAFrame() { return false; } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 SaveFPRegsMode save_doubles_; | 75 SaveFPRegsMode save_doubles_; |
| 76 | 76 |
| 77 Major MajorKey() { return StoreBufferOverflow; } | 77 Major MajorKey() { return StoreBufferOverflow; } |
| 78 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | 78 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 | 81 |
| 82 // Flag that indicates how to generate code for the stub GenericBinaryOpStub. | |
| 83 enum GenericBinaryFlags { | |
| 84 NO_GENERIC_BINARY_FLAGS = 0, | |
| 85 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. | |
| 86 }; | |
| 87 | |
| 88 | |
| 89 class UnaryOpStub: public CodeStub { | 82 class UnaryOpStub: public CodeStub { |
| 90 public: | 83 public: |
| 91 UnaryOpStub(Token::Value op, | 84 UnaryOpStub(Token::Value op, |
| 92 UnaryOverwriteMode mode, | 85 UnaryOverwriteMode mode, |
| 93 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) | 86 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) |
| 94 : op_(op), | 87 : op_(op), |
| 95 mode_(mode), | 88 mode_(mode), |
| 96 operand_type_(operand_type) { | 89 operand_type_(operand_type) { |
| 97 } | 90 } |
| 98 | 91 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 virtual InlineCacheState GetICState() { | 143 virtual InlineCacheState GetICState() { |
| 151 return UnaryOpIC::ToState(operand_type_); | 144 return UnaryOpIC::ToState(operand_type_); |
| 152 } | 145 } |
| 153 | 146 |
| 154 virtual void FinishCode(Handle<Code> code) { | 147 virtual void FinishCode(Handle<Code> code) { |
| 155 code->set_unary_op_type(operand_type_); | 148 code->set_unary_op_type(operand_type_); |
| 156 } | 149 } |
| 157 }; | 150 }; |
| 158 | 151 |
| 159 | 152 |
| 160 class BinaryOpStub: public CodeStub { | |
| 161 public: | |
| 162 BinaryOpStub(Token::Value op, OverwriteMode mode) | |
| 163 : op_(op), | |
| 164 mode_(mode), | |
| 165 operands_type_(BinaryOpIC::UNINITIALIZED), | |
| 166 result_type_(BinaryOpIC::UNINITIALIZED) { | |
| 167 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | |
| 168 } | |
| 169 | |
| 170 BinaryOpStub( | |
| 171 int key, | |
| 172 BinaryOpIC::TypeInfo operands_type, | |
| 173 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) | |
| 174 : op_(OpBits::decode(key)), | |
| 175 mode_(ModeBits::decode(key)), | |
| 176 operands_type_(operands_type), | |
| 177 result_type_(result_type) { } | |
| 178 | |
| 179 private: | |
| 180 enum SmiCodeGenerateHeapNumberResults { | |
| 181 ALLOW_HEAPNUMBER_RESULTS, | |
| 182 NO_HEAPNUMBER_RESULTS | |
| 183 }; | |
| 184 | |
| 185 Token::Value op_; | |
| 186 OverwriteMode mode_; | |
| 187 | |
| 188 // Operand type information determined at runtime. | |
| 189 BinaryOpIC::TypeInfo operands_type_; | |
| 190 BinaryOpIC::TypeInfo result_type_; | |
| 191 | |
| 192 virtual void PrintName(StringStream* stream); | |
| 193 | |
| 194 // Minor key encoding in 15 bits RRRTTTOOOOOOOMM. | |
| 195 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | |
| 196 class OpBits: public BitField<Token::Value, 2, 7> {}; | |
| 197 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 9, 3> {}; | |
| 198 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 12, 3> {}; | |
| 199 | |
| 200 Major MajorKey() { return BinaryOp; } | |
| 201 int MinorKey() { | |
| 202 return OpBits::encode(op_) | |
| 203 | ModeBits::encode(mode_) | |
| 204 | OperandTypeInfoBits::encode(operands_type_) | |
| 205 | ResultTypeInfoBits::encode(result_type_); | |
| 206 } | |
| 207 | |
| 208 void Generate(MacroAssembler* masm); | |
| 209 void GenerateGeneric(MacroAssembler* masm); | |
| 210 void GenerateSmiCode(MacroAssembler* masm, | |
| 211 Label* slow, | |
| 212 SmiCodeGenerateHeapNumberResults heapnumber_results); | |
| 213 void GenerateFloatingPointCode(MacroAssembler* masm, | |
| 214 Label* allocation_failure, | |
| 215 Label* non_numeric_failure); | |
| 216 void GenerateStringAddCode(MacroAssembler* masm); | |
| 217 void GenerateCallRuntimeCode(MacroAssembler* masm); | |
| 218 void GenerateLoadArguments(MacroAssembler* masm); | |
| 219 void GenerateReturn(MacroAssembler* masm); | |
| 220 void GenerateUninitializedStub(MacroAssembler* masm); | |
| 221 void GenerateSmiStub(MacroAssembler* masm); | |
| 222 void GenerateInt32Stub(MacroAssembler* masm); | |
| 223 void GenerateHeapNumberStub(MacroAssembler* masm); | |
| 224 void GenerateOddballStub(MacroAssembler* masm); | |
| 225 void GenerateStringStub(MacroAssembler* masm); | |
| 226 void GenerateBothStringStub(MacroAssembler* masm); | |
| 227 void GenerateGenericStub(MacroAssembler* masm); | |
| 228 | |
| 229 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); | |
| 230 void GenerateRegisterArgsPush(MacroAssembler* masm); | |
| 231 void GenerateTypeTransition(MacroAssembler* masm); | |
| 232 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); | |
| 233 | |
| 234 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } | |
| 235 | |
| 236 virtual InlineCacheState GetICState() { | |
| 237 return BinaryOpIC::ToState(operands_type_); | |
| 238 } | |
| 239 | |
| 240 virtual void FinishCode(Handle<Code> code) { | |
| 241 code->set_binary_op_type(operands_type_); | |
| 242 code->set_binary_op_result_type(result_type_); | |
| 243 } | |
| 244 | |
| 245 friend class CodeGenerator; | |
| 246 }; | |
| 247 | |
| 248 | |
| 249 class StringHelper : public AllStatic { | 153 class StringHelper : public AllStatic { |
| 250 public: | 154 public: |
| 251 // Generate code for copying characters using a simple loop. This should only | 155 // Generate code for copying characters using a simple loop. This should only |
| 252 // be used in places where the number of characters is small and the | 156 // be used in places where the number of characters is small and the |
| 253 // additional setup and checking in GenerateCopyCharactersREP adds too much | 157 // additional setup and checking in GenerateCopyCharactersREP adds too much |
| 254 // overhead. Copying of overlapping regions is not supported. | 158 // overhead. Copying of overlapping regions is not supported. |
| 255 static void GenerateCopyCharacters(MacroAssembler* masm, | 159 static void GenerateCopyCharacters(MacroAssembler* masm, |
| 256 Register dest, | 160 Register dest, |
| 257 Register src, | 161 Register src, |
| 258 Register count, | 162 Register count, |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 RememberedSetAction remembered_set_action_; | 614 RememberedSetAction remembered_set_action_; |
| 711 SaveFPRegsMode save_fp_regs_mode_; | 615 SaveFPRegsMode save_fp_regs_mode_; |
| 712 Label slow_; | 616 Label slow_; |
| 713 RegisterAllocation regs_; | 617 RegisterAllocation regs_; |
| 714 }; | 618 }; |
| 715 | 619 |
| 716 | 620 |
| 717 } } // namespace v8::internal | 621 } } // namespace v8::internal |
| 718 | 622 |
| 719 #endif // V8_X64_CODE_STUBS_X64_H_ | 623 #endif // V8_X64_CODE_STUBS_X64_H_ |
| OLD | NEW |