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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 virtual int MinorKey() = 0; | 186 virtual int MinorKey() = 0; |
187 | 187 |
188 // BinaryOpStub needs to override this. | 188 // BinaryOpStub needs to override this. |
189 virtual int GetCodeKind(); | 189 virtual int GetCodeKind(); |
190 | 190 |
191 // BinaryOpStub needs to override this. | 191 // BinaryOpStub needs to override this. |
192 virtual InlineCacheState GetICState() { | 192 virtual InlineCacheState GetICState() { |
193 return UNINITIALIZED; | 193 return UNINITIALIZED; |
194 } | 194 } |
195 | 195 |
196 // Add the code to a specialized cache, specific to an individual | |
197 // stub type. Please note, this method must add the code object to a | |
198 // roots object, otherwise we will remove the code during GC. | |
199 virtual bool AddToSpecialCache(Handle<Code> new_object) { return false; } | |
200 | |
201 // Find code in a specialized cache, work is delegated to the specific stub. | |
202 virtual bool FindCodeInSpecialCache(Code** code_out) { return false; } | |
203 | |
204 // If a stub uses a special cache override this. | |
205 virtual bool UseSpecialCache() { return false; } | |
206 | |
196 // Returns a name for logging/debugging purposes. | 207 // Returns a name for logging/debugging purposes. |
197 SmartArrayPointer<const char> GetName(); | 208 SmartArrayPointer<const char> GetName(); |
198 virtual void PrintName(StringStream* stream); | 209 virtual void PrintName(StringStream* stream); |
199 | 210 |
200 // Returns whether the code generated for this stub needs to be allocated as | 211 // Returns whether the code generated for this stub needs to be allocated as |
201 // a fixed (non-moveable) code object. | 212 // a fixed (non-moveable) code object. |
202 virtual bool NeedsImmovableCode() { return false; } | 213 virtual bool NeedsImmovableCode() { return false; } |
203 | 214 |
204 // Computes the key based on major and minor. | 215 // Computes the key based on major and minor. |
205 uint32_t GetKey() { | 216 uint32_t GetKey() { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 | 441 |
431 class ICCompareStub: public CodeStub { | 442 class ICCompareStub: public CodeStub { |
432 public: | 443 public: |
433 ICCompareStub(Token::Value op, CompareIC::State state) | 444 ICCompareStub(Token::Value op, CompareIC::State state) |
434 : op_(op), state_(state) { | 445 : op_(op), state_(state) { |
435 ASSERT(Token::IsCompareOp(op)); | 446 ASSERT(Token::IsCompareOp(op)); |
436 } | 447 } |
437 | 448 |
438 virtual void Generate(MacroAssembler* masm); | 449 virtual void Generate(MacroAssembler* masm); |
439 | 450 |
451 void set_known_map(Handle<Map> map) { known_map_ = map; } | |
452 | |
440 private: | 453 private: |
441 class OpField: public BitField<int, 0, 3> { }; | 454 class OpField: public BitField<int, 0, 3> { }; |
442 class StateField: public BitField<int, 3, 5> { }; | 455 class StateField: public BitField<int, 3, 5> { }; |
443 | 456 |
444 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } | 457 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } |
445 | 458 |
446 virtual CodeStub::Major MajorKey() { return CompareIC; } | 459 virtual CodeStub::Major MajorKey() { return CompareIC; } |
447 virtual int MinorKey(); | 460 virtual int MinorKey(); |
448 | 461 |
449 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 462 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
450 | 463 |
451 void GenerateSmis(MacroAssembler* masm); | 464 void GenerateSmis(MacroAssembler* masm); |
452 void GenerateHeapNumbers(MacroAssembler* masm); | 465 void GenerateHeapNumbers(MacroAssembler* masm); |
453 void GenerateSymbols(MacroAssembler* masm); | 466 void GenerateSymbols(MacroAssembler* masm); |
454 void GenerateStrings(MacroAssembler* masm); | 467 void GenerateStrings(MacroAssembler* masm); |
455 void GenerateObjects(MacroAssembler* masm); | 468 void GenerateObjects(MacroAssembler* masm); |
456 void GenerateMiss(MacroAssembler* masm); | 469 void GenerateMiss(MacroAssembler* masm); |
470 void GenerateKnownObjects(MacroAssembler* masm, Handle<Map> map); | |
457 | 471 |
458 bool strict() const { return op_ == Token::EQ_STRICT; } | 472 bool strict() const { return op_ == Token::EQ_STRICT; } |
459 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } | 473 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } |
474 bool AddToSpecialCache(Handle<Code> new_object); | |
Kevin Millikin (Chromium)
2011/11/11 10:12:34
It seems better to declare these virtual.
Rico
2011/11/15 10:12:26
Done.
| |
475 bool FindCodeInSpecialCache(Code** code_out); | |
476 bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; } | |
460 | 477 |
461 Token::Value op_; | 478 Token::Value op_; |
462 CompareIC::State state_; | 479 CompareIC::State state_; |
480 Handle<Map> known_map_; | |
463 }; | 481 }; |
464 | 482 |
465 | 483 |
466 // Flags that control the compare stub code generation. | 484 // Flags that control the compare stub code generation. |
467 enum CompareFlags { | 485 enum CompareFlags { |
468 NO_COMPARE_FLAGS = 0, | 486 NO_COMPARE_FLAGS = 0, |
469 NO_SMI_COMPARE_IN_STUB = 1 << 0, | 487 NO_SMI_COMPARE_IN_STUB = 1 << 0, |
470 NO_NUMBER_COMPARE_IN_STUB = 1 << 1, | 488 NO_NUMBER_COMPARE_IN_STUB = 1 << 1, |
471 CANT_BOTH_BE_NAN = 1 << 2 | 489 CANT_BOTH_BE_NAN = 1 << 2 |
472 }; | 490 }; |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1056 int MinorKey() { return 0; } | 1074 int MinorKey() { return 0; } |
1057 | 1075 |
1058 void Generate(MacroAssembler* masm); | 1076 void Generate(MacroAssembler* masm); |
1059 | 1077 |
1060 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1078 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1061 }; | 1079 }; |
1062 | 1080 |
1063 } } // namespace v8::internal | 1081 } } // namespace v8::internal |
1064 | 1082 |
1065 #endif // V8_CODE_STUBS_H_ | 1083 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |