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

Side by Side Diff: src/ic/ic.h

Issue 2133233002: [LoadIC] Handle simple field loads in the dispatcher (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix release builds for realz Created 4 years, 5 months 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
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/ic/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IC_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool use = ICUseVector(kind()); 100 bool use = ICUseVector(kind());
101 // If we are supposed to use the nexus, verify the nexus is non-null. 101 // If we are supposed to use the nexus, verify the nexus is non-null.
102 DCHECK(!use || nexus_ != nullptr); 102 DCHECK(!use || nexus_ != nullptr);
103 return use; 103 return use;
104 } 104 }
105 105
106 // Configure for most states. 106 // Configure for most states.
107 void ConfigureVectorState(IC::State new_state, Handle<Object> key); 107 void ConfigureVectorState(IC::State new_state, Handle<Object> key);
108 // Configure the vector for MONOMORPHIC. 108 // Configure the vector for MONOMORPHIC.
109 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, 109 void ConfigureVectorState(Handle<Name> name, Handle<Map> map,
110 Handle<Code> handler); 110 Handle<Object> handler);
111 // Configure the vector for POLYMORPHIC. 111 // Configure the vector for POLYMORPHIC.
112 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, 112 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps,
113 CodeHandleList* handlers); 113 List<Handle<Object>>* handlers);
114 // Configure the vector for POLYMORPHIC with transitions (only for element 114 // Configure the vector for POLYMORPHIC with transitions (only for element
115 // keyed stores). 115 // keyed stores).
116 void ConfigureVectorState(MapHandleList* maps, 116 void ConfigureVectorState(MapHandleList* maps,
117 MapHandleList* transitioned_maps, 117 MapHandleList* transitioned_maps,
118 CodeHandleList* handlers); 118 CodeHandleList* handlers);
119 119
120 char TransitionMarkFromState(IC::State state); 120 char TransitionMarkFromState(IC::State state);
121 void TraceIC(const char* type, Handle<Object> name); 121 void TraceIC(const char* type, Handle<Object> name);
122 void TraceIC(const char* type, Handle<Object> name, State old_state, 122 void TraceIC(const char* type, Handle<Object> name, State old_state,
123 State new_state); 123 State new_state);
124 124
125 MaybeHandle<Object> TypeError(MessageTemplate::Template, 125 MaybeHandle<Object> TypeError(MessageTemplate::Template,
126 Handle<Object> object, Handle<Object> key); 126 Handle<Object> object, Handle<Object> key);
127 MaybeHandle<Object> ReferenceError(Handle<Name> name); 127 MaybeHandle<Object> ReferenceError(Handle<Name> name);
128 128
129 // Access the target code for the given IC address. 129 // Access the target code for the given IC address.
130 static inline Code* GetTargetAtAddress(Address address, 130 static inline Code* GetTargetAtAddress(Address address,
131 Address constant_pool); 131 Address constant_pool);
132 static inline void SetTargetAtAddress(Address address, Code* target, 132 static inline void SetTargetAtAddress(Address address, Code* target,
133 Address constant_pool); 133 Address constant_pool);
134 // As a vector-based IC, type feedback must be updated differently. 134 // As a vector-based IC, type feedback must be updated differently.
135 static void OnTypeFeedbackChanged(Isolate* isolate, Code* host); 135 static void OnTypeFeedbackChanged(Isolate* isolate, Code* host);
136 static void PostPatching(Address address, Code* target, Code* old_target); 136 static void PostPatching(Address address, Code* target, Code* old_target);
137 137
138 // Compute the handler either by compiling or by retrieving a cached version. 138 // Compute the handler either by compiling or by retrieving a cached version.
139 Handle<Code> ComputeHandler(LookupIterator* lookup, 139 Handle<Object> ComputeHandler(LookupIterator* lookup,
140 Handle<Object> value = Handle<Code>::null()); 140 Handle<Object> value = Handle<Code>::null());
141 virtual Handle<Code> GetMapIndependentHandler(LookupIterator* lookup) { 141 virtual Handle<Object> GetMapIndependentHandler(LookupIterator* lookup) {
142 UNREACHABLE(); 142 UNREACHABLE();
143 return Handle<Code>::null(); 143 return Handle<Code>::null();
144 } 144 }
145 virtual Handle<Code> CompileHandler(LookupIterator* lookup, 145 virtual Handle<Code> CompileHandler(LookupIterator* lookup,
146 Handle<Object> value, 146 Handle<Object> value,
147 CacheHolderFlag cache_holder) { 147 CacheHolderFlag cache_holder) {
148 UNREACHABLE(); 148 UNREACHABLE();
149 return Handle<Code>::null(); 149 return Handle<Code>::null();
150 } 150 }
151 151
152 void UpdateMonomorphicIC(Handle<Code> handler, Handle<Name> name); 152 void UpdateMonomorphicIC(Handle<Object> handler, Handle<Name> name);
153 bool UpdatePolymorphicIC(Handle<Name> name, Handle<Code> code); 153 bool UpdatePolymorphicIC(Handle<Name> name, Handle<Object> code);
154 void UpdateMegamorphicCache(Map* map, Name* name, Code* code); 154 void UpdateMegamorphicCache(Map* map, Name* name, Object* code);
155 155
156 StubCache* stub_cache(); 156 StubCache* stub_cache();
157 157
158 void CopyICToMegamorphicCache(Handle<Name> name); 158 void CopyICToMegamorphicCache(Handle<Name> name);
159 bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map); 159 bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map);
160 void PatchCache(Handle<Name> name, Handle<Code> code); 160 void PatchCache(Handle<Name> name, Handle<Object> code);
161 Code::Kind kind() const { return kind_; } 161 Code::Kind kind() const { return kind_; }
162 bool is_keyed() const { 162 bool is_keyed() const {
163 return kind_ == Code::KEYED_LOAD_IC || kind_ == Code::KEYED_STORE_IC; 163 return kind_ == Code::KEYED_LOAD_IC || kind_ == Code::KEYED_STORE_IC;
164 } 164 }
165 Code::Kind handler_kind() const { 165 Code::Kind handler_kind() const {
166 if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC; 166 if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC;
167 DCHECK(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC || 167 DCHECK(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC ||
168 kind_ == Code::KEYED_STORE_IC); 168 kind_ == Code::KEYED_STORE_IC);
169 return kind_; 169 return kind_;
170 } 170 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // be for the breakpointed copy of the original code). 232 // be for the breakpointed copy of the original code).
233 Address* constant_pool_address_; 233 Address* constant_pool_address_;
234 234
235 Isolate* isolate_; 235 Isolate* isolate_;
236 236
237 bool vector_set_; 237 bool vector_set_;
238 State old_state_; // For saving if we marked as prototype failure. 238 State old_state_; // For saving if we marked as prototype failure.
239 State state_; 239 State state_;
240 Code::Kind kind_; 240 Code::Kind kind_;
241 Handle<Map> receiver_map_; 241 Handle<Map> receiver_map_;
242 MaybeHandle<Code> maybe_handler_; 242 MaybeHandle<Object> maybe_handler_;
243 243
244 ExtraICState extra_ic_state_; 244 ExtraICState extra_ic_state_;
245 MapHandleList target_maps_; 245 MapHandleList target_maps_;
246 bool target_maps_set_; 246 bool target_maps_set_;
247 247
248 FeedbackNexus* nexus_; 248 FeedbackNexus* nexus_;
249 249
250 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); 250 DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
251 }; 251 };
252 252
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 protected: 299 protected:
300 virtual Handle<Code> slow_stub() const { 300 virtual Handle<Code> slow_stub() const {
301 return isolate()->builtins()->LoadIC_Slow(); 301 return isolate()->builtins()->LoadIC_Slow();
302 } 302 }
303 303
304 // Update the inline cache and the global stub cache based on the 304 // Update the inline cache and the global stub cache based on the
305 // lookup result. 305 // lookup result.
306 void UpdateCaches(LookupIterator* lookup); 306 void UpdateCaches(LookupIterator* lookup);
307 307
308 Handle<Code> GetMapIndependentHandler(LookupIterator* lookup) override; 308 Handle<Object> GetMapIndependentHandler(LookupIterator* lookup) override;
309 309
310 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> unused, 310 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> unused,
311 CacheHolderFlag cache_holder) override; 311 CacheHolderFlag cache_holder) override;
312 312
313 private: 313 private:
314 Handle<Code> SimpleFieldLoad(FieldIndex index); 314 Handle<Object> SimpleFieldLoad(FieldIndex index);
315 315
316 friend class IC; 316 friend class IC;
317 }; 317 };
318 318
319 class LoadGlobalIC : public LoadIC { 319 class LoadGlobalIC : public LoadIC {
320 public: 320 public:
321 LoadGlobalIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 321 LoadGlobalIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
322 : LoadIC(depth, isolate, nexus) {} 322 : LoadIC(depth, isolate, nexus) {}
323 323
324 static Handle<Code> initialize_stub_in_optimized_code( 324 static Handle<Code> initialize_stub_in_optimized_code(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 default: 411 default:
412 UNREACHABLE(); 412 UNREACHABLE();
413 return Handle<Code>(); 413 return Handle<Code>();
414 } 414 }
415 } 415 }
416 416
417 // Update the inline cache and the global stub cache based on the 417 // Update the inline cache and the global stub cache based on the
418 // lookup result. 418 // lookup result.
419 void UpdateCaches(LookupIterator* lookup, Handle<Object> value, 419 void UpdateCaches(LookupIterator* lookup, Handle<Object> value,
420 JSReceiver::StoreFromKeyed store_mode); 420 JSReceiver::StoreFromKeyed store_mode);
421 Handle<Code> GetMapIndependentHandler(LookupIterator* lookup) override; 421 Handle<Object> GetMapIndependentHandler(LookupIterator* lookup) override;
422 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> value, 422 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> value,
423 CacheHolderFlag cache_holder) override; 423 CacheHolderFlag cache_holder) override;
424 424
425 private: 425 private:
426 friend class IC; 426 friend class IC;
427 }; 427 };
428 428
429 429
430 enum KeyedStoreCheckMap { kDontCheckMap, kCheckMap }; 430 enum KeyedStoreCheckMap { kDontCheckMap, kCheckMap };
431 431
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 // Helper for BinaryOpIC and CompareIC. 525 // Helper for BinaryOpIC and CompareIC.
526 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 526 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
527 void PatchInlinedSmiCode(Isolate* isolate, Address address, 527 void PatchInlinedSmiCode(Isolate* isolate, Address address,
528 InlinedSmiCheck check); 528 InlinedSmiCheck check);
529 529
530 } // namespace internal 530 } // namespace internal
531 } // namespace v8 531 } // namespace v8
532 532
533 #endif // V8_IC_H_ 533 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698