Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/code-stubs.h

Issue 8520006: Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/code-stubs.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 public: 109 public:
110 enum Major { 110 enum Major {
111 #define DEF_ENUM(name) name, 111 #define DEF_ENUM(name) name,
112 CODE_STUB_LIST(DEF_ENUM) 112 CODE_STUB_LIST(DEF_ENUM)
113 #undef DEF_ENUM 113 #undef DEF_ENUM
114 NoCache, // marker for stubs that do custom caching 114 NoCache, // marker for stubs that do custom caching
115 NUMBER_OF_IDS 115 NUMBER_OF_IDS
116 }; 116 };
117 117
118 // Retrieve the code for the stub. Generate the code if needed. 118 // Retrieve the code for the stub. Generate the code if needed.
119 Handle<Code> GetCode(); 119 Handle<Code> GetCode(bool use_special_cache = false);
120 120
121 static Major MajorKeyFromKey(uint32_t key) { 121 static Major MajorKeyFromKey(uint32_t key) {
122 return static_cast<Major>(MajorKeyBits::decode(key)); 122 return static_cast<Major>(MajorKeyBits::decode(key));
123 } 123 }
124 static int MinorKeyFromKey(uint32_t key) { 124 static int MinorKeyFromKey(uint32_t key) {
125 return MinorKeyBits::decode(key); 125 return MinorKeyBits::decode(key);
126 } 126 }
127 127
128 // Gets the major key from a code object that is a code stub or binary op IC. 128 // Gets the major key from a code object that is a code stub or binary op IC.
129 static Major GetMajorKey(Code* code_stub) { 129 static Major GetMajorKey(Code* code_stub) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
196 // Returns a name for logging/debugging purposes. 204 // Returns a name for logging/debugging purposes.
197 SmartArrayPointer<const char> GetName(); 205 SmartArrayPointer<const char> GetName();
198 virtual void PrintName(StringStream* stream); 206 virtual void PrintName(StringStream* stream);
199 207
200 // Returns whether the code generated for this stub needs to be allocated as 208 // Returns whether the code generated for this stub needs to be allocated as
201 // a fixed (non-moveable) code object. 209 // a fixed (non-moveable) code object.
202 virtual bool NeedsImmovableCode() { return false; } 210 virtual bool NeedsImmovableCode() { return false; }
203 211
204 // Computes the key based on major and minor. 212 // Computes the key based on major and minor.
205 uint32_t GetKey() { 213 uint32_t GetKey() {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 437
430 438
431 class ICCompareStub: public CodeStub { 439 class ICCompareStub: public CodeStub {
432 public: 440 public:
433 ICCompareStub(Token::Value op, CompareIC::State state) 441 ICCompareStub(Token::Value op, CompareIC::State state)
434 : op_(op), state_(state) { 442 : op_(op), state_(state) {
435 ASSERT(Token::IsCompareOp(op)); 443 ASSERT(Token::IsCompareOp(op));
436 } 444 }
437 445
438 virtual void Generate(MacroAssembler* masm); 446 virtual void Generate(MacroAssembler* masm);
447 static void GenerateKnownObjects(MacroAssembler* masm, Map* map);
Kevin Millikin (Chromium) 2011/11/10 19:08:42 Put this down in the private section with the othe
Rico 2011/11/11 08:49:11 Done.
448
449 void set_known_map(Map* map) { known_map_ = map; }
Kevin Millikin (Chromium) 2011/11/10 19:08:42 Make map a Handle<Map>. There's a risk that a GC
Rico 2011/11/11 08:49:11 OK, will do, but maps don't move right, and we alr
439 450
440 private: 451 private:
441 class OpField: public BitField<int, 0, 3> { }; 452 class OpField: public BitField<int, 0, 3> { };
442 class StateField: public BitField<int, 3, 5> { }; 453 class StateField: public BitField<int, 3, 5> { };
443 454
444 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } 455 virtual void FinishCode(Code* code) { code->set_compare_state(state_); }
445 456
446 virtual CodeStub::Major MajorKey() { return CompareIC; } 457 virtual CodeStub::Major MajorKey() { return CompareIC; }
447 virtual int MinorKey(); 458 virtual int MinorKey();
448 459
449 virtual int GetCodeKind() { return Code::COMPARE_IC; } 460 virtual int GetCodeKind() { return Code::COMPARE_IC; }
450 461
451 void GenerateSmis(MacroAssembler* masm); 462 void GenerateSmis(MacroAssembler* masm);
452 void GenerateHeapNumbers(MacroAssembler* masm); 463 void GenerateHeapNumbers(MacroAssembler* masm);
453 void GenerateSymbols(MacroAssembler* masm); 464 void GenerateSymbols(MacroAssembler* masm);
454 void GenerateStrings(MacroAssembler* masm); 465 void GenerateStrings(MacroAssembler* masm);
455 void GenerateObjects(MacroAssembler* masm); 466 void GenerateObjects(MacroAssembler* masm);
456 void GenerateMiss(MacroAssembler* masm); 467 void GenerateMiss(MacroAssembler* masm);
457 468
458 bool strict() const { return op_ == Token::EQ_STRICT; } 469 bool strict() const { return op_ == Token::EQ_STRICT; }
459 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } 470 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); }
471 bool AddToSpecialCache(Handle<Code> new_object);
472 bool FindCodeInSpecialCache(Code** code_out);
460 473
461 Token::Value op_; 474 Token::Value op_;
462 CompareIC::State state_; 475 CompareIC::State state_;
476 Map* known_map_;
Kevin Millikin (Chromium) 2011/11/10 19:08:42 Handle<Map>.
Rico 2011/11/11 08:49:11 Done.
463 }; 477 };
464 478
465 479
466 // Flags that control the compare stub code generation. 480 // Flags that control the compare stub code generation.
467 enum CompareFlags { 481 enum CompareFlags {
468 NO_COMPARE_FLAGS = 0, 482 NO_COMPARE_FLAGS = 0,
469 NO_SMI_COMPARE_IN_STUB = 1 << 0, 483 NO_SMI_COMPARE_IN_STUB = 1 << 0,
470 NO_NUMBER_COMPARE_IN_STUB = 1 << 1, 484 NO_NUMBER_COMPARE_IN_STUB = 1 << 1,
471 CANT_BOTH_BE_NAN = 1 << 2 485 CANT_BOTH_BE_NAN = 1 << 2
472 }; 486 };
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 int MinorKey() { return 0; } 1070 int MinorKey() { return 0; }
1057 1071
1058 void Generate(MacroAssembler* masm); 1072 void Generate(MacroAssembler* masm);
1059 1073
1060 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1074 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1061 }; 1075 };
1062 1076
1063 } } // namespace v8::internal 1077 } } // namespace v8::internal
1064 1078
1065 #endif // V8_CODE_STUBS_H_ 1079 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | src/code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698