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