| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void Generate(MacroAssembler* masm); | 66 void Generate(MacroAssembler* masm); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 Register tos_; | 69 Register tos_; |
| 70 Major MajorKey() { return ToBoolean; } | 70 Major MajorKey() { return ToBoolean; } |
| 71 int MinorKey() { return tos_.code(); } | 71 int MinorKey() { return tos_.code(); } |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 | 74 |
| 75 class TypeRecordingUnaryOpStub: public CodeStub { | 75 class UnaryOpStub: public CodeStub { |
| 76 public: | 76 public: |
| 77 TypeRecordingUnaryOpStub(Token::Value op, UnaryOverwriteMode mode) | 77 UnaryOpStub(Token::Value op, UnaryOverwriteMode mode) |
| 78 : op_(op), | 78 : op_(op), |
| 79 mode_(mode), | 79 mode_(mode), |
| 80 operand_type_(TRUnaryOpIC::UNINITIALIZED), | 80 operand_type_(UnaryOpIC::UNINITIALIZED), |
| 81 name_(NULL) { | 81 name_(NULL) { |
| 82 } | 82 } |
| 83 | 83 |
| 84 TypeRecordingUnaryOpStub( | 84 UnaryOpStub( |
| 85 int key, | 85 int key, |
| 86 TRUnaryOpIC::TypeInfo operand_type) | 86 UnaryOpIC::TypeInfo operand_type) |
| 87 : op_(OpBits::decode(key)), | 87 : op_(OpBits::decode(key)), |
| 88 mode_(ModeBits::decode(key)), | 88 mode_(ModeBits::decode(key)), |
| 89 operand_type_(operand_type), | 89 operand_type_(operand_type), |
| 90 name_(NULL) { | 90 name_(NULL) { |
| 91 } | 91 } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 Token::Value op_; | 94 Token::Value op_; |
| 95 UnaryOverwriteMode mode_; | 95 UnaryOverwriteMode mode_; |
| 96 | 96 |
| 97 // Operand type information determined at runtime. | 97 // Operand type information determined at runtime. |
| 98 TRUnaryOpIC::TypeInfo operand_type_; | 98 UnaryOpIC::TypeInfo operand_type_; |
| 99 | 99 |
| 100 char* name_; | 100 char* name_; |
| 101 | 101 |
| 102 const char* GetName(); | 102 const char* GetName(); |
| 103 | 103 |
| 104 #ifdef DEBUG | 104 #ifdef DEBUG |
| 105 void Print() { | 105 void Print() { |
| 106 PrintF("TypeRecordingUnaryOpStub %d (op %s), " | 106 PrintF("UnaryOpStub %d (op %s), " |
| 107 "(mode %d, runtime_type_info %s)\n", | 107 "(mode %d, runtime_type_info %s)\n", |
| 108 MinorKey(), | 108 MinorKey(), |
| 109 Token::String(op_), | 109 Token::String(op_), |
| 110 static_cast<int>(mode_), | 110 static_cast<int>(mode_), |
| 111 TRUnaryOpIC::GetName(operand_type_)); | 111 UnaryOpIC::GetName(operand_type_)); |
| 112 } | 112 } |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; | 115 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
| 116 class OpBits: public BitField<Token::Value, 1, 7> {}; | 116 class OpBits: public BitField<Token::Value, 1, 7> {}; |
| 117 class OperandTypeInfoBits: public BitField<TRUnaryOpIC::TypeInfo, 8, 3> {}; | 117 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
| 118 | 118 |
| 119 Major MajorKey() { return TypeRecordingUnaryOp; } | 119 Major MajorKey() { return UnaryOp; } |
| 120 int MinorKey() { | 120 int MinorKey() { |
| 121 return ModeBits::encode(mode_) | 121 return ModeBits::encode(mode_) |
| 122 | OpBits::encode(op_) | 122 | OpBits::encode(op_) |
| 123 | OperandTypeInfoBits::encode(operand_type_); | 123 | OperandTypeInfoBits::encode(operand_type_); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Note: A lot of the helper functions below will vanish when we use virtual | 126 // Note: A lot of the helper functions below will vanish when we use virtual |
| 127 // function instead of switch more often. | 127 // function instead of switch more often. |
| 128 void Generate(MacroAssembler* masm); | 128 void Generate(MacroAssembler* masm); |
| 129 | 129 |
| 130 void GenerateTypeTransition(MacroAssembler* masm); | 130 void GenerateTypeTransition(MacroAssembler* masm); |
| 131 | 131 |
| 132 void GenerateSmiStub(MacroAssembler* masm); | 132 void GenerateSmiStub(MacroAssembler* masm); |
| 133 void GenerateSmiStubSub(MacroAssembler* masm); | 133 void GenerateSmiStubSub(MacroAssembler* masm); |
| 134 void GenerateSmiStubBitNot(MacroAssembler* masm); | 134 void GenerateSmiStubBitNot(MacroAssembler* masm); |
| 135 void GenerateSmiCodeSub(MacroAssembler* masm, Label* non_smi, Label* slow); | 135 void GenerateSmiCodeSub(MacroAssembler* masm, Label* non_smi, Label* slow); |
| 136 void GenerateSmiCodeBitNot(MacroAssembler* masm, Label* slow); | 136 void GenerateSmiCodeBitNot(MacroAssembler* masm, Label* slow); |
| 137 | 137 |
| 138 void GenerateHeapNumberStub(MacroAssembler* masm); | 138 void GenerateHeapNumberStub(MacroAssembler* masm); |
| 139 void GenerateHeapNumberStubSub(MacroAssembler* masm); | 139 void GenerateHeapNumberStubSub(MacroAssembler* masm); |
| 140 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); | 140 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); |
| 141 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); | 141 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); |
| 142 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); | 142 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); |
| 143 | 143 |
| 144 void GenerateGenericStub(MacroAssembler* masm); | 144 void GenerateGenericStub(MacroAssembler* masm); |
| 145 void GenerateGenericStubSub(MacroAssembler* masm); | 145 void GenerateGenericStubSub(MacroAssembler* masm); |
| 146 void GenerateGenericStubBitNot(MacroAssembler* masm); | 146 void GenerateGenericStubBitNot(MacroAssembler* masm); |
| 147 void GenerateGenericCodeFallback(MacroAssembler* masm); | 147 void GenerateGenericCodeFallback(MacroAssembler* masm); |
| 148 | 148 |
| 149 virtual int GetCodeKind() { return Code::TYPE_RECORDING_UNARY_OP_IC; } | 149 virtual int GetCodeKind() { return Code::UNARY_OP_IC; } |
| 150 | 150 |
| 151 virtual InlineCacheState GetICState() { | 151 virtual InlineCacheState GetICState() { |
| 152 return TRUnaryOpIC::ToState(operand_type_); | 152 return UnaryOpIC::ToState(operand_type_); |
| 153 } | 153 } |
| 154 | 154 |
| 155 virtual void FinishCode(Code* code) { | 155 virtual void FinishCode(Code* code) { |
| 156 code->set_type_recording_unary_op_type(operand_type_); | 156 code->set_unary_op_type(operand_type_); |
| 157 } | 157 } |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 | 160 |
| 161 class TypeRecordingBinaryOpStub: public CodeStub { | 161 class BinaryOpStub: public CodeStub { |
| 162 public: | 162 public: |
| 163 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) | 163 BinaryOpStub(Token::Value op, OverwriteMode mode) |
| 164 : op_(op), | 164 : op_(op), |
| 165 mode_(mode), | 165 mode_(mode), |
| 166 operands_type_(TRBinaryOpIC::UNINITIALIZED), | 166 operands_type_(BinaryOpIC::UNINITIALIZED), |
| 167 result_type_(TRBinaryOpIC::UNINITIALIZED), | 167 result_type_(BinaryOpIC::UNINITIALIZED), |
| 168 name_(NULL) { | 168 name_(NULL) { |
| 169 use_fpu_ = CpuFeatures::IsSupported(FPU); | 169 use_fpu_ = CpuFeatures::IsSupported(FPU); |
| 170 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 170 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 TypeRecordingBinaryOpStub( | 173 BinaryOpStub( |
| 174 int key, | 174 int key, |
| 175 TRBinaryOpIC::TypeInfo operands_type, | 175 BinaryOpIC::TypeInfo operands_type, |
| 176 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED) | 176 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) |
| 177 : op_(OpBits::decode(key)), | 177 : op_(OpBits::decode(key)), |
| 178 mode_(ModeBits::decode(key)), | 178 mode_(ModeBits::decode(key)), |
| 179 use_fpu_(FPUBits::decode(key)), | 179 use_fpu_(FPUBits::decode(key)), |
| 180 operands_type_(operands_type), | 180 operands_type_(operands_type), |
| 181 result_type_(result_type), | 181 result_type_(result_type), |
| 182 name_(NULL) { } | 182 name_(NULL) { } |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 enum SmiCodeGenerateHeapNumberResults { | 185 enum SmiCodeGenerateHeapNumberResults { |
| 186 ALLOW_HEAPNUMBER_RESULTS, | 186 ALLOW_HEAPNUMBER_RESULTS, |
| 187 NO_HEAPNUMBER_RESULTS | 187 NO_HEAPNUMBER_RESULTS |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 Token::Value op_; | 190 Token::Value op_; |
| 191 OverwriteMode mode_; | 191 OverwriteMode mode_; |
| 192 bool use_fpu_; | 192 bool use_fpu_; |
| 193 | 193 |
| 194 // Operand type information determined at runtime. | 194 // Operand type information determined at runtime. |
| 195 TRBinaryOpIC::TypeInfo operands_type_; | 195 BinaryOpIC::TypeInfo operands_type_; |
| 196 TRBinaryOpIC::TypeInfo result_type_; | 196 BinaryOpIC::TypeInfo result_type_; |
| 197 | 197 |
| 198 char* name_; | 198 char* name_; |
| 199 | 199 |
| 200 const char* GetName(); | 200 const char* GetName(); |
| 201 | 201 |
| 202 #ifdef DEBUG | 202 #ifdef DEBUG |
| 203 void Print() { | 203 void Print() { |
| 204 PrintF("TypeRecordingBinaryOpStub %d (op %s), " | 204 PrintF("BinaryOpStub %d (op %s), " |
| 205 "(mode %d, runtime_type_info %s)\n", | 205 "(mode %d, runtime_type_info %s)\n", |
| 206 MinorKey(), | 206 MinorKey(), |
| 207 Token::String(op_), | 207 Token::String(op_), |
| 208 static_cast<int>(mode_), | 208 static_cast<int>(mode_), |
| 209 TRBinaryOpIC::GetName(operands_type_)); | 209 BinaryOpIC::GetName(operands_type_)); |
| 210 } | 210 } |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. | 213 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM. |
| 214 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | 214 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
| 215 class OpBits: public BitField<Token::Value, 2, 7> {}; | 215 class OpBits: public BitField<Token::Value, 2, 7> {}; |
| 216 class FPUBits: public BitField<bool, 9, 1> {}; | 216 class FPUBits: public BitField<bool, 9, 1> {}; |
| 217 class OperandTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 10, 3> {}; | 217 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; |
| 218 class ResultTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 13, 3> {}; | 218 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; |
| 219 | 219 |
| 220 Major MajorKey() { return TypeRecordingBinaryOp; } | 220 Major MajorKey() { return BinaryOp; } |
| 221 int MinorKey() { | 221 int MinorKey() { |
| 222 return OpBits::encode(op_) | 222 return OpBits::encode(op_) |
| 223 | ModeBits::encode(mode_) | 223 | ModeBits::encode(mode_) |
| 224 | FPUBits::encode(use_fpu_) | 224 | FPUBits::encode(use_fpu_) |
| 225 | OperandTypeInfoBits::encode(operands_type_) | 225 | OperandTypeInfoBits::encode(operands_type_) |
| 226 | ResultTypeInfoBits::encode(result_type_); | 226 | ResultTypeInfoBits::encode(result_type_); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void Generate(MacroAssembler* masm); | 229 void Generate(MacroAssembler* masm); |
| 230 void GenerateGeneric(MacroAssembler* masm); | 230 void GenerateGeneric(MacroAssembler* masm); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 253 void GenerateHeapResultAllocation(MacroAssembler* masm, | 253 void GenerateHeapResultAllocation(MacroAssembler* masm, |
| 254 Register result, | 254 Register result, |
| 255 Register heap_number_map, | 255 Register heap_number_map, |
| 256 Register scratch1, | 256 Register scratch1, |
| 257 Register scratch2, | 257 Register scratch2, |
| 258 Label* gc_required); | 258 Label* gc_required); |
| 259 void GenerateRegisterArgsPush(MacroAssembler* masm); | 259 void GenerateRegisterArgsPush(MacroAssembler* masm); |
| 260 void GenerateTypeTransition(MacroAssembler* masm); | 260 void GenerateTypeTransition(MacroAssembler* masm); |
| 261 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); | 261 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); |
| 262 | 262 |
| 263 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; } | 263 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } |
| 264 | 264 |
| 265 virtual InlineCacheState GetICState() { | 265 virtual InlineCacheState GetICState() { |
| 266 return TRBinaryOpIC::ToState(operands_type_); | 266 return BinaryOpIC::ToState(operands_type_); |
| 267 } | 267 } |
| 268 | 268 |
| 269 virtual void FinishCode(Code* code) { | 269 virtual void FinishCode(Code* code) { |
| 270 code->set_type_recording_binary_op_type(operands_type_); | 270 code->set_binary_op_type(operands_type_); |
| 271 code->set_type_recording_binary_op_result_type(result_type_); | 271 code->set_binary_op_result_type(result_type_); |
| 272 } | 272 } |
| 273 | 273 |
| 274 friend class CodeGenerator; | 274 friend class CodeGenerator; |
| 275 }; | 275 }; |
| 276 | 276 |
| 277 | 277 |
| 278 // Flag that indicates how to generate code for the stub StringAddStub. | 278 // Flag that indicates how to generate code for the stub StringAddStub. |
| 279 enum StringAddFlags { | 279 enum StringAddFlags { |
| 280 NO_STRING_ADD_FLAGS = 0, | 280 NO_STRING_ADD_FLAGS = 0, |
| 281 // Omit left string check in stub (left is definitely a string). | 281 // Omit left string check in stub (left is definitely a string). |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 673 |
| 674 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 674 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
| 675 | 675 |
| 676 LookupMode mode_; | 676 LookupMode mode_; |
| 677 }; | 677 }; |
| 678 | 678 |
| 679 | 679 |
| 680 } } // namespace v8::internal | 680 } } // namespace v8::internal |
| 681 | 681 |
| 682 #endif // V8_MIPS_CODE_STUBS_ARM_H_ | 682 #endif // V8_MIPS_CODE_STUBS_ARM_H_ |
| OLD | NEW |