| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ToBooleanStub() { } | 65 ToBooleanStub() { } |
| 66 | 66 |
| 67 void Generate(MacroAssembler* masm); | 67 void Generate(MacroAssembler* masm); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 Major MajorKey() { return ToBoolean; } | 70 Major MajorKey() { return ToBoolean; } |
| 71 int MinorKey() { return 0; } | 71 int MinorKey() { return 0; } |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 | 74 |
| 75 class TypeRecordingUnaryOpStub: public CodeStub { |
| 76 public: |
| 77 TypeRecordingUnaryOpStub(Token::Value op, UnaryOverwriteMode mode) |
| 78 : op_(op), |
| 79 mode_(mode), |
| 80 operand_type_(TRUnaryOpIC::UNINITIALIZED), |
| 81 name_(NULL) { |
| 82 } |
| 83 |
| 84 TypeRecordingUnaryOpStub( |
| 85 int key, |
| 86 TRUnaryOpIC::TypeInfo operand_type) |
| 87 : op_(OpBits::decode(key)), |
| 88 mode_(ModeBits::decode(key)), |
| 89 operand_type_(operand_type), |
| 90 name_(NULL) { |
| 91 } |
| 92 |
| 93 private: |
| 94 Token::Value op_; |
| 95 UnaryOverwriteMode mode_; |
| 96 |
| 97 // Operand type information determined at runtime. |
| 98 TRUnaryOpIC::TypeInfo operand_type_; |
| 99 |
| 100 char* name_; |
| 101 |
| 102 const char* GetName(); |
| 103 |
| 104 #ifdef DEBUG |
| 105 void Print() { |
| 106 PrintF("TypeRecordingUnaryOpStub %d (op %s), " |
| 107 "(mode %d, runtime_type_info %s)\n", |
| 108 MinorKey(), |
| 109 Token::String(op_), |
| 110 static_cast<int>(mode_), |
| 111 TRUnaryOpIC::GetName(operand_type_)); |
| 112 } |
| 113 #endif |
| 114 |
| 115 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
| 116 class OpBits: public BitField<Token::Value, 1, 7> {}; |
| 117 class OperandTypeInfoBits: public BitField<TRUnaryOpIC::TypeInfo, 8, 3> {}; |
| 118 |
| 119 Major MajorKey() { return TypeRecordingUnaryOp; } |
| 120 int MinorKey() { |
| 121 return ModeBits::encode(mode_) |
| 122 | OpBits::encode(op_) |
| 123 | OperandTypeInfoBits::encode(operand_type_); |
| 124 } |
| 125 |
| 126 // Note: A lot of the helper functions below will vanish when we use virtual |
| 127 // function instead of switch more often. |
| 128 void Generate(MacroAssembler* masm); |
| 129 |
| 130 void GenerateTypeTransition(MacroAssembler* masm); |
| 131 |
| 132 void GenerateSmiStub(MacroAssembler* masm); |
| 133 void GenerateSmiStubSub(MacroAssembler* masm); |
| 134 void GenerateSmiStubBitNot(MacroAssembler* masm); |
| 135 void GenerateSmiCodeSub(MacroAssembler* masm, NearLabel* non_smi, Label* undo, |
| 136 Label* slow); |
| 137 void GenerateSmiCodeBitNot(MacroAssembler* masm, NearLabel* non_smi); |
| 138 void GenerateSmiCodeUndo(MacroAssembler* masm); |
| 139 |
| 140 void GenerateHeapNumberStub(MacroAssembler* masm); |
| 141 void GenerateHeapNumberStubSub(MacroAssembler* masm); |
| 142 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); |
| 143 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* undo, |
| 144 Label* slow); |
| 145 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* undo, |
| 146 Label* slow); |
| 147 |
| 148 void GenerateGenericStub(MacroAssembler* masm); |
| 149 void GenerateGenericStubSub(MacroAssembler* masm); |
| 150 void GenerateGenericStubBitNot(MacroAssembler* masm); |
| 151 void GenerateGenericCodeFallback(MacroAssembler* masm); |
| 152 |
| 153 virtual int GetCodeKind() { return Code::TYPE_RECORDING_UNARY_OP_IC; } |
| 154 |
| 155 virtual InlineCacheState GetICState() { |
| 156 return TRUnaryOpIC::ToState(operand_type_); |
| 157 } |
| 158 |
| 159 virtual void FinishCode(Code* code) { |
| 160 code->set_type_recording_unary_op_type(operand_type_); |
| 161 } |
| 162 }; |
| 163 |
| 164 |
| 75 class TypeRecordingBinaryOpStub: public CodeStub { | 165 class TypeRecordingBinaryOpStub: public CodeStub { |
| 76 public: | 166 public: |
| 77 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) | 167 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) |
| 78 : op_(op), | 168 : op_(op), |
| 79 mode_(mode), | 169 mode_(mode), |
| 80 operands_type_(TRBinaryOpIC::UNINITIALIZED), | 170 operands_type_(TRBinaryOpIC::UNINITIALIZED), |
| 81 result_type_(TRBinaryOpIC::UNINITIALIZED), | 171 result_type_(TRBinaryOpIC::UNINITIALIZED), |
| 82 name_(NULL) { | 172 name_(NULL) { |
| 83 use_sse3_ = CpuFeatures::IsSupported(SSE3); | 173 use_sse3_ = CpuFeatures::IsSupported(SSE3); |
| 84 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | 174 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 #ifdef DEBUG | 422 #ifdef DEBUG |
| 333 void Print() { | 423 void Print() { |
| 334 PrintF("NumberToStringStub\n"); | 424 PrintF("NumberToStringStub\n"); |
| 335 } | 425 } |
| 336 #endif | 426 #endif |
| 337 }; | 427 }; |
| 338 | 428 |
| 339 } } // namespace v8::internal | 429 } } // namespace v8::internal |
| 340 | 430 |
| 341 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 431 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
| OLD | NEW |