| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // GC. This means that we must be statically sure that no GC can occur while | 154 // GC. This means that we must be statically sure that no GC can occur while |
| 155 // they are running. If that is the case they should override this to return | 155 // they are running. If that is the case they should override this to return |
| 156 // true, which will cause an assertion if we try to call something that can | 156 // true, which will cause an assertion if we try to call something that can |
| 157 // GC or if we try to put a stack frame on top of the junk, which would not | 157 // GC or if we try to put a stack frame on top of the junk, which would not |
| 158 // result in a traversable stack. | 158 // result in a traversable stack. |
| 159 virtual bool SometimesSetsUpAFrame() { return true; } | 159 virtual bool SometimesSetsUpAFrame() { return true; } |
| 160 | 160 |
| 161 // Lookup the code in the (possibly custom) cache. | 161 // Lookup the code in the (possibly custom) cache. |
| 162 bool FindCodeInCache(Code** code_out); | 162 bool FindCodeInCache(Code** code_out); |
| 163 | 163 |
| 164 protected: | |
| 165 static const int kMajorBits = 6; | |
| 166 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | |
| 167 | |
| 168 private: | 164 private: |
| 169 // Nonvirtual wrapper around the stub-specific Generate function. Call | 165 // Nonvirtual wrapper around the stub-specific Generate function. Call |
| 170 // this function to set up the macro assembler and generate the code. | 166 // this function to set up the macro assembler and generate the code. |
| 171 void GenerateCode(MacroAssembler* masm); | 167 void GenerateCode(MacroAssembler* masm); |
| 172 | 168 |
| 173 // Generates the assembler code for the stub. | 169 // Generates the assembler code for the stub. |
| 174 virtual void Generate(MacroAssembler* masm) = 0; | 170 virtual void Generate(MacroAssembler* masm) = 0; |
| 175 | 171 |
| 176 // Perform bookkeeping required after code generation when stub code is | 172 // Perform bookkeeping required after code generation when stub code is |
| 177 // initially generated. | 173 // initially generated. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // a fixed (non-moveable) code object. | 211 // a fixed (non-moveable) code object. |
| 216 virtual bool NeedsImmovableCode() { return false; } | 212 virtual bool NeedsImmovableCode() { return false; } |
| 217 | 213 |
| 218 // Computes the key based on major and minor. | 214 // Computes the key based on major and minor. |
| 219 uint32_t GetKey() { | 215 uint32_t GetKey() { |
| 220 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 216 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
| 221 return MinorKeyBits::encode(MinorKey()) | | 217 return MinorKeyBits::encode(MinorKey()) | |
| 222 MajorKeyBits::encode(MajorKey()); | 218 MajorKeyBits::encode(MajorKey()); |
| 223 } | 219 } |
| 224 | 220 |
| 225 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 221 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; |
| 226 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 222 class MinorKeyBits: public BitField<uint32_t, |
| 223 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT |
| 227 | 224 |
| 228 friend class BreakPointIterator; | 225 friend class BreakPointIterator; |
| 229 }; | 226 }; |
| 230 | 227 |
| 231 | 228 |
| 232 // Helper interface to prepare to/restore after making runtime calls. | 229 // Helper interface to prepare to/restore after making runtime calls. |
| 233 class RuntimeCallHelper { | 230 class RuntimeCallHelper { |
| 234 public: | 231 public: |
| 235 virtual ~RuntimeCallHelper() {} | 232 virtual ~RuntimeCallHelper() {} |
| 236 | 233 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 virtual void Generate(MacroAssembler* masm); | 488 virtual void Generate(MacroAssembler* masm); |
| 492 | 489 |
| 493 void set_known_map(Handle<Map> map) { known_map_ = map; } | 490 void set_known_map(Handle<Map> map) { known_map_ = map; } |
| 494 | 491 |
| 495 private: | 492 private: |
| 496 class OpField: public BitField<int, 0, 3> { }; | 493 class OpField: public BitField<int, 0, 3> { }; |
| 497 class StateField: public BitField<int, 3, 5> { }; | 494 class StateField: public BitField<int, 3, 5> { }; |
| 498 | 495 |
| 499 virtual void FinishCode(Handle<Code> code) { | 496 virtual void FinishCode(Handle<Code> code) { |
| 500 code->set_compare_state(state_); | 497 code->set_compare_state(state_); |
| 501 code->set_compare_operation(op_); | 498 code->set_compare_operation(op_ - Token::EQ); |
| 502 } | 499 } |
| 503 | 500 |
| 504 virtual CodeStub::Major MajorKey() { return CompareIC; } | 501 virtual CodeStub::Major MajorKey() { return CompareIC; } |
| 505 virtual int MinorKey(); | 502 virtual int MinorKey(); |
| 506 | 503 |
| 507 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 504 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
| 508 | 505 |
| 509 void GenerateSmis(MacroAssembler* masm); | 506 void GenerateSmis(MacroAssembler* masm); |
| 510 void GenerateHeapNumbers(MacroAssembler* masm); | 507 void GenerateHeapNumbers(MacroAssembler* masm); |
| 511 void GenerateSymbols(MacroAssembler* masm); | 508 void GenerateSymbols(MacroAssembler* masm); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 int MinorKey() { return 0; } | 1138 int MinorKey() { return 0; } |
| 1142 | 1139 |
| 1143 void Generate(MacroAssembler* masm); | 1140 void Generate(MacroAssembler* masm); |
| 1144 | 1141 |
| 1145 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1142 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 1146 }; | 1143 }; |
| 1147 | 1144 |
| 1148 } } // namespace v8::internal | 1145 } } // namespace v8::internal |
| 1149 | 1146 |
| 1150 #endif // V8_CODE_STUBS_H_ | 1147 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |