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

Side by Side Diff: src/ic.h

Issue 62953007: Handle all object types (minus smi) in load/store ICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed commentsx Created 7 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 | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return false; 125 return false;
126 } 126 }
127 } 127 }
128 128
129 bool SlowIsUndeclaredGlobal() { 129 bool SlowIsUndeclaredGlobal() {
130 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT; 130 return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT;
131 } 131 }
132 132
133 // Determines which map must be used for keeping the code stub. 133 // Determines which map must be used for keeping the code stub.
134 // These methods should not be called with undefined or null. 134 // These methods should not be called with undefined or null.
135 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, 135 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object);
136 JSObject* holder); 136 // TODO(verwaest): This currently returns a HeapObject rather than JSObject*
137 static inline JSObject* GetCodeCacheHolder(Isolate* isolate, 137 // since loading the IC for loading the length from strings are stored on
138 Object* object, 138 // the string map directly, rather than on the JSObject-typed prototype.
139 InlineCacheHolderFlag holder); 139 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate,
140 Object* object,
141 InlineCacheHolderFlag holder);
140 142
141 static bool IsCleared(Code* code) { 143 static bool IsCleared(Code* code) {
142 InlineCacheState state = code->ic_state(); 144 InlineCacheState state = code->ic_state();
143 return state == UNINITIALIZED || state == PREMONOMORPHIC; 145 return state == UNINITIALIZED || state == PREMONOMORPHIC;
144 } 146 }
145 147
146 protected: 148 protected:
147 Address fp() const { return fp_; } 149 Address fp() const { return fp_; }
148 Address pc() const { return *pc_address_; } 150 Address pc() const { return *pc_address_; }
149 Isolate* isolate() const { return isolate_; } 151 Isolate* isolate() const { return isolate_; }
(...skipping 23 matching lines...) Expand all
173 Handle<Object> key); 175 Handle<Object> key);
174 Failure* ReferenceError(const char* type, Handle<String> name); 176 Failure* ReferenceError(const char* type, Handle<String> name);
175 177
176 // Access the target code for the given IC address. 178 // Access the target code for the given IC address.
177 static inline Code* GetTargetAtAddress(Address address); 179 static inline Code* GetTargetAtAddress(Address address);
178 static inline void SetTargetAtAddress(Address address, Code* target); 180 static inline void SetTargetAtAddress(Address address, Code* target);
179 static void PostPatching(Address address, Code* target, Code* old_target); 181 static void PostPatching(Address address, Code* target, Code* old_target);
180 182
181 // Compute the handler either by compiling or by retrieving a cached version. 183 // Compute the handler either by compiling or by retrieving a cached version.
182 Handle<Code> ComputeHandler(LookupResult* lookup, 184 Handle<Code> ComputeHandler(LookupResult* lookup,
183 Handle<JSObject> receiver, 185 Handle<Object> object,
184 Handle<String> name, 186 Handle<String> name,
185 Handle<Object> value = Handle<Code>::null()); 187 Handle<Object> value = Handle<Code>::null());
186 virtual Handle<Code> CompileHandler(LookupResult* lookup, 188 virtual Handle<Code> CompileHandler(LookupResult* lookup,
187 Handle<JSObject> receiver, 189 Handle<Object> object,
188 Handle<String> name, 190 Handle<String> name,
189 Handle<Object> value) { 191 Handle<Object> value,
192 InlineCacheHolderFlag cache_holder) {
190 UNREACHABLE(); 193 UNREACHABLE();
191 return Handle<Code>::null(); 194 return Handle<Code>::null();
192 } 195 }
193 void UpdateMonomorphicIC(Handle<HeapObject> receiver, 196 void UpdateMonomorphicIC(Handle<HeapObject> receiver,
194 Handle<Code> handler, 197 Handle<Code> handler,
195 Handle<String> name); 198 Handle<String> name);
196 199
197 bool UpdatePolymorphicIC(Handle<HeapObject> receiver, 200 bool UpdatePolymorphicIC(Handle<HeapObject> receiver,
198 Handle<String> name, 201 Handle<String> name,
199 Handle<Code> code); 202 Handle<Code> code);
200 203
201 void CopyICToMegamorphicCache(Handle<String> name); 204 void CopyICToMegamorphicCache(Handle<String> name);
202 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); 205 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map);
203 void PatchCache(Handle<HeapObject> receiver, 206 void PatchCache(Handle<Object> object,
204 Handle<String> name, 207 Handle<String> name,
205 Handle<Code> code); 208 Handle<Code> code);
206 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); 209 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
207 virtual Code::Kind kind() const { 210 virtual Code::Kind kind() const {
208 UNREACHABLE(); 211 UNREACHABLE();
209 return Code::STUB; 212 return Code::STUB;
210 } 213 }
211 virtual Handle<Code> slow_stub() const { 214 virtual Handle<Code> slow_stub() const {
212 UNREACHABLE(); 215 UNREACHABLE();
213 return Handle<Code>::null(); 216 return Handle<Code>::null();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return isolate()->builtins()->LoadIC_Megamorphic(); 418 return isolate()->builtins()->LoadIC_Megamorphic();
416 } 419 }
417 420
418 // Update the inline cache and the global stub cache based on the 421 // Update the inline cache and the global stub cache based on the
419 // lookup result. 422 // lookup result.
420 void UpdateCaches(LookupResult* lookup, 423 void UpdateCaches(LookupResult* lookup,
421 Handle<Object> object, 424 Handle<Object> object,
422 Handle<String> name); 425 Handle<String> name);
423 426
424 virtual Handle<Code> CompileHandler(LookupResult* lookup, 427 virtual Handle<Code> CompileHandler(LookupResult* lookup,
425 Handle<JSObject> receiver, 428 Handle<Object> object,
426 Handle<String> name, 429 Handle<String> name,
427 Handle<Object> unused); 430 Handle<Object> unused,
431 InlineCacheHolderFlag cache_holder);
428 432
429 private: 433 private:
430 // Stub accessors. 434 // Stub accessors.
431 static Handle<Code> initialize_stub(Isolate* isolate) { 435 static Handle<Code> initialize_stub(Isolate* isolate) {
432 return isolate->builtins()->LoadIC_Initialize(); 436 return isolate->builtins()->LoadIC_Initialize();
433 } 437 }
434 438
435 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 439 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
436 return isolate->builtins()->LoadIC_PreMonomorphic(); 440 return isolate->builtins()->LoadIC_PreMonomorphic();
437 } 441 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 614 }
611 } 615 }
612 616
613 // Update the inline cache and the global stub cache based on the 617 // Update the inline cache and the global stub cache based on the
614 // lookup result. 618 // lookup result.
615 void UpdateCaches(LookupResult* lookup, 619 void UpdateCaches(LookupResult* lookup,
616 Handle<JSObject> receiver, 620 Handle<JSObject> receiver,
617 Handle<String> name, 621 Handle<String> name,
618 Handle<Object> value); 622 Handle<Object> value);
619 virtual Handle<Code> CompileHandler(LookupResult* lookup, 623 virtual Handle<Code> CompileHandler(LookupResult* lookup,
620 Handle<JSObject> receiver, 624 Handle<Object> object,
621 Handle<String> name, 625 Handle<String> name,
622 Handle<Object> value); 626 Handle<Object> value,
627 InlineCacheHolderFlag cache_holder);
623 628
624 private: 629 private:
625 void set_target(Code* code) { 630 void set_target(Code* code) {
626 // Strict mode must be preserved across IC patching. 631 // Strict mode must be preserved across IC patching.
627 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 632 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
628 Code::GetStrictMode(target()->extra_ic_state())); 633 Code::GetStrictMode(target()->extra_ic_state()));
629 IC::set_target(code); 634 IC::set_target(code);
630 } 635 }
631 636
632 static Handle<Code> initialize_stub(Isolate* isolate, 637 static Handle<Code> initialize_stub(Isolate* isolate,
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
889 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 894 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
890 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 895 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
891 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 896 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
892 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 897 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
893 898
894 899
895 } } // namespace v8::internal 900 } } // namespace v8::internal
896 901
897 #endif // V8_IC_H_ 902 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698