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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 virtual int MinorKey() = 0; | 187 virtual int MinorKey() = 0; |
188 | 188 |
189 // BinaryOpStub needs to override this. | 189 // BinaryOpStub needs to override this. |
190 virtual int GetCodeKind(); | 190 virtual int GetCodeKind(); |
191 | 191 |
192 // BinaryOpStub needs to override this. | 192 // BinaryOpStub needs to override this. |
193 virtual InlineCacheState GetICState() { | 193 virtual InlineCacheState GetICState() { |
194 return UNINITIALIZED; | 194 return UNINITIALIZED; |
195 } | 195 } |
196 | 196 |
197 // Add the code to a specialized cache, specific to an individual | |
198 // stub type. Please note, this method must add the code object to a | |
199 // roots object, otherwise we will remove the code during GC. | |
200 virtual void AddToSpecialCache(Handle<Code> new_object) { } | |
201 | |
202 // Find code in a specialized cache, work is delegated to the specific stub. | |
203 virtual bool FindCodeInSpecialCache(Code** code_out) { return false; } | |
204 | |
205 // If a stub uses a special cache override this. | |
206 virtual bool UseSpecialCache() { return false; } | |
207 | |
208 // Returns a name for logging/debugging purposes. | 197 // Returns a name for logging/debugging purposes. |
209 SmartArrayPointer<const char> GetName(); | 198 SmartArrayPointer<const char> GetName(); |
210 virtual void PrintName(StringStream* stream); | 199 virtual void PrintName(StringStream* stream); |
211 | 200 |
212 // Returns whether the code generated for this stub needs to be allocated as | 201 // Returns whether the code generated for this stub needs to be allocated as |
213 // a fixed (non-moveable) code object. | 202 // a fixed (non-moveable) code object. |
214 virtual bool NeedsImmovableCode() { return false; } | 203 virtual bool NeedsImmovableCode() { return false; } |
215 | 204 |
216 // Computes the key based on major and minor. | 205 // Computes the key based on major and minor. |
217 uint32_t GetKey() { | 206 uint32_t GetKey() { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 458 |
470 class ICCompareStub: public CodeStub { | 459 class ICCompareStub: public CodeStub { |
471 public: | 460 public: |
472 ICCompareStub(Token::Value op, CompareIC::State state) | 461 ICCompareStub(Token::Value op, CompareIC::State state) |
473 : op_(op), state_(state) { | 462 : op_(op), state_(state) { |
474 ASSERT(Token::IsCompareOp(op)); | 463 ASSERT(Token::IsCompareOp(op)); |
475 } | 464 } |
476 | 465 |
477 virtual void Generate(MacroAssembler* masm); | 466 virtual void Generate(MacroAssembler* masm); |
478 | 467 |
479 void set_known_map(Handle<Map> map) { known_map_ = map; } | |
480 | |
481 private: | 468 private: |
482 class OpField: public BitField<int, 0, 3> { }; | 469 class OpField: public BitField<int, 0, 3> { }; |
483 class StateField: public BitField<int, 3, 5> { }; | 470 class StateField: public BitField<int, 3, 5> { }; |
484 | 471 |
485 virtual void FinishCode(Handle<Code> code) { | 472 virtual void FinishCode(Handle<Code> code) { |
486 code->set_compare_state(state_); | 473 code->set_compare_state(state_); |
487 } | 474 } |
488 | 475 |
489 virtual CodeStub::Major MajorKey() { return CompareIC; } | 476 virtual CodeStub::Major MajorKey() { return CompareIC; } |
490 virtual int MinorKey(); | 477 virtual int MinorKey(); |
491 | 478 |
492 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 479 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
493 | 480 |
494 void GenerateSmis(MacroAssembler* masm); | 481 void GenerateSmis(MacroAssembler* masm); |
495 void GenerateHeapNumbers(MacroAssembler* masm); | 482 void GenerateHeapNumbers(MacroAssembler* masm); |
496 void GenerateSymbols(MacroAssembler* masm); | 483 void GenerateSymbols(MacroAssembler* masm); |
497 void GenerateStrings(MacroAssembler* masm); | 484 void GenerateStrings(MacroAssembler* masm); |
498 void GenerateObjects(MacroAssembler* masm); | 485 void GenerateObjects(MacroAssembler* masm); |
499 void GenerateMiss(MacroAssembler* masm); | 486 void GenerateMiss(MacroAssembler* masm); |
500 void GenerateKnownObjects(MacroAssembler* masm); | |
501 | 487 |
502 bool strict() const { return op_ == Token::EQ_STRICT; } | 488 bool strict() const { return op_ == Token::EQ_STRICT; } |
503 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } | 489 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } |
504 | 490 |
505 virtual void AddToSpecialCache(Handle<Code> new_object); | |
506 virtual bool FindCodeInSpecialCache(Code** code_out); | |
507 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; } | |
508 | |
509 Token::Value op_; | 491 Token::Value op_; |
510 CompareIC::State state_; | 492 CompareIC::State state_; |
511 Handle<Map> known_map_; | |
512 }; | 493 }; |
513 | 494 |
514 | 495 |
515 // Flags that control the compare stub code generation. | 496 // Flags that control the compare stub code generation. |
516 enum CompareFlags { | 497 enum CompareFlags { |
517 NO_COMPARE_FLAGS = 0, | 498 NO_COMPARE_FLAGS = 0, |
518 NO_SMI_COMPARE_IN_STUB = 1 << 0, | 499 NO_SMI_COMPARE_IN_STUB = 1 << 0, |
519 NO_NUMBER_COMPARE_IN_STUB = 1 << 1, | 500 NO_NUMBER_COMPARE_IN_STUB = 1 << 1, |
520 CANT_BOTH_BE_NAN = 1 << 2 | 501 CANT_BOTH_BE_NAN = 1 << 2 |
521 }; | 502 }; |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 int MinorKey() { return 0; } | 1090 int MinorKey() { return 0; } |
1110 | 1091 |
1111 void Generate(MacroAssembler* masm); | 1092 void Generate(MacroAssembler* masm); |
1112 | 1093 |
1113 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1094 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1114 }; | 1095 }; |
1115 | 1096 |
1116 } } // namespace v8::internal | 1097 } } // namespace v8::internal |
1117 | 1098 |
1118 #endif // V8_CODE_STUBS_H_ | 1099 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |