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

Side by Side Diff: src/ic.h

Issue 220923003: Lazily initialize the target map list in IC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, 241 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
242 Handle<String> name); 242 Handle<String> name);
243 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name); 243 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
244 244
245 ExtraICState extra_ic_state() const { return extra_ic_state_; } 245 ExtraICState extra_ic_state() const { return extra_ic_state_; }
246 void set_extra_ic_state(ExtraICState state) { 246 void set_extra_ic_state(ExtraICState state) {
247 extra_ic_state_ = state; 247 extra_ic_state_ = state;
248 } 248 }
249 249
250 void TargetMaps(MapHandleList* list) {
251 FindTargetMaps();
252 for (int i = 0; i < target_maps_.length(); i++) {
253 list->Add(target_maps_.at(i));
254 }
255 }
256
257 void TargetTypes(TypeHandleList* list) {
258 FindTargetMaps();
259 for (int i = 0; i < target_maps_.length(); i++) {
260 list->Add(IC::MapToType<HeapType>(target_maps_.at(i), isolate_));
261 }
262 }
263
264 Map* FirstTargetMap() {
265 FindTargetMaps();
266 return target_maps_.length() > 0 ? *target_maps_.at(0) : NULL;
267 }
268
250 protected: 269 protected:
251 void UpdateTarget() { 270 void UpdateTarget() {
252 target_ = handle(raw_target(), isolate_); 271 target_ = handle(raw_target(), isolate_);
253 } 272 }
254 273
255 private: 274 private:
256 Code* raw_target() const { 275 Code* raw_target() const {
257 return GetTargetAtAddress(address(), constant_pool()); 276 return GetTargetAtAddress(address(), constant_pool());
258 } 277 }
259 inline ConstantPoolArray* constant_pool() const; 278 inline ConstantPoolArray* constant_pool() const;
260 inline ConstantPoolArray* raw_constant_pool() const; 279 inline ConstantPoolArray* raw_constant_pool() const;
261 280
281 void FindTargetMaps() {
282 if (target_maps_set_) return;
283 target_maps_set_ = true;
284 if (state_ == MONOMORPHIC) {
285 Map* map = target_->FindFirstMap();
286 if (map != NULL) target_maps_.Add(handle(map));
287 } else if (state_ != UNINITIALIZED && state_ != PREMONOMORPHIC) {
288 target_->FindAllMaps(&target_maps_);
289 }
290 }
291
262 // Frame pointer for the frame that uses (calls) the IC. 292 // Frame pointer for the frame that uses (calls) the IC.
263 Address fp_; 293 Address fp_;
264 294
265 // All access to the program counter of an IC structure is indirect 295 // All access to the program counter of an IC structure is indirect
266 // to make the code GC safe. This feature is crucial since 296 // to make the code GC safe. This feature is crucial since
267 // GetProperty and SetProperty are called and they in turn might 297 // GetProperty and SetProperty are called and they in turn might
268 // invoke the garbage collector. 298 // invoke the garbage collector.
269 Address* pc_address_; 299 Address* pc_address_;
270 300
271 Isolate* isolate_; 301 Isolate* isolate_;
272 302
273 // The constant pool of the code which originally called the IC (which might 303 // The constant pool of the code which originally called the IC (which might
274 // be for the breakpointed copy of the original code). 304 // be for the breakpointed copy of the original code).
275 Handle<ConstantPoolArray> raw_constant_pool_; 305 Handle<ConstantPoolArray> raw_constant_pool_;
276 306
277 // The original code target that missed. 307 // The original code target that missed.
278 Handle<Code> target_; 308 Handle<Code> target_;
279 State state_; 309 State state_;
280 bool target_set_; 310 bool target_set_;
281 311
282 ExtraICState extra_ic_state_; 312 ExtraICState extra_ic_state_;
313 MapHandleList target_maps_;
314 bool target_maps_set_;
283 315
284 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); 316 DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
285 }; 317 };
286 318
287 319
288 // An IC_Utility encapsulates IC::UtilityId. It exists mainly because you 320 // An IC_Utility encapsulates IC::UtilityId. It exists mainly because you
289 // cannot make forward declarations to an enum. 321 // cannot make forward declarations to an enum.
290 class IC_Utility { 322 class IC_Utility {
291 public: 323 public:
292 explicit IC_Utility(IC::UtilityId id) 324 explicit IC_Utility(IC::UtilityId id)
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 959 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
928 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 960 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
929 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); 961 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite);
930 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 962 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
931 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 963 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
932 964
933 965
934 } } // namespace v8::internal 966 } } // namespace v8::internal
935 967
936 #endif // V8_IC_H_ 968 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698