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

Side by Side Diff: src/ic.h

Issue 23578030: Reland Handle non-JSObject heap objects using slow-path IC stub guarded by the map. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 3 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 | « src/hydrogen.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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Failure* TypeError(const char* type, 160 Failure* TypeError(const char* type,
161 Handle<Object> object, 161 Handle<Object> object,
162 Handle<Object> key); 162 Handle<Object> key);
163 Failure* ReferenceError(const char* type, Handle<String> name); 163 Failure* ReferenceError(const char* type, Handle<String> name);
164 164
165 // Access the target code for the given IC address. 165 // Access the target code for the given IC address.
166 static inline Code* GetTargetAtAddress(Address address); 166 static inline Code* GetTargetAtAddress(Address address);
167 static inline void SetTargetAtAddress(Address address, Code* target); 167 static inline void SetTargetAtAddress(Address address, Code* target);
168 static void PostPatching(Address address, Code* target, Code* old_target); 168 static void PostPatching(Address address, Code* target, Code* old_target);
169 169
170 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 170 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver,
171 Handle<Code> handler, 171 Handle<Code> handler,
172 Handle<String> name, 172 Handle<String> name,
173 StrictModeFlag strict_mode) { 173 StrictModeFlag strict_mode) {
174 set_target(*handler); 174 set_target(*handler);
175 } 175 }
176 bool UpdatePolymorphicIC(State state, 176 bool UpdatePolymorphicIC(State state,
177 Handle<JSObject> receiver, 177 Handle<HeapObject> receiver,
178 Handle<String> name, 178 Handle<String> name,
179 Handle<Code> code, 179 Handle<Code> code,
180 StrictModeFlag strict_mode); 180 StrictModeFlag strict_mode);
181 181
182 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, 182 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps,
183 CodeHandleList* handlers, 183 CodeHandleList* handlers,
184 int number_of_valid_maps, 184 int number_of_valid_maps,
185 Handle<Name> name, 185 Handle<Name> name,
186 StrictModeFlag strict_mode) { 186 StrictModeFlag strict_mode) {
187 UNREACHABLE(); 187 UNREACHABLE();
188 return Handle<Code>::null(); 188 return Handle<Code>::null();
189 }; 189 };
190 190
191 void CopyICToMegamorphicCache(Handle<String> name); 191 void CopyICToMegamorphicCache(Handle<String> name);
192 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); 192 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map);
193 void PatchCache(State state, 193 void PatchCache(State state,
194 StrictModeFlag strict_mode, 194 StrictModeFlag strict_mode,
195 Handle<JSObject> receiver, 195 Handle<HeapObject> receiver,
196 Handle<String> name, 196 Handle<String> name,
197 Handle<Code> code); 197 Handle<Code> code);
198 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); 198 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
199 virtual Handle<Code> megamorphic_stub() { 199 virtual Handle<Code> megamorphic_stub() {
200 UNREACHABLE(); 200 UNREACHABLE();
201 return Handle<Code>::null(); 201 return Handle<Code>::null();
202 } 202 }
203 virtual Handle<Code> megamorphic_stub_strict() { 203 virtual Handle<Code> megamorphic_stub_strict() {
204 UNREACHABLE(); 204 UNREACHABLE();
205 return Handle<Code>::null(); 205 return Handle<Code>::null();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 static void GenerateNormal(MacroAssembler* masm); 381 static void GenerateNormal(MacroAssembler* masm);
382 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 382 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
383 383
384 MUST_USE_RESULT MaybeObject* Load(State state, 384 MUST_USE_RESULT MaybeObject* Load(State state,
385 Handle<Object> object, 385 Handle<Object> object,
386 Handle<String> name); 386 Handle<String> name);
387 387
388 protected: 388 protected:
389 virtual Code::Kind kind() const { return Code::LOAD_IC; } 389 virtual Code::Kind kind() const { return Code::LOAD_IC; }
390 390
391 virtual Handle<Code> generic_stub() const { 391 virtual Handle<Code> slow_stub() const {
392 return isolate()->builtins()->LoadIC_Slow(); 392 return isolate()->builtins()->LoadIC_Slow();
393 } 393 }
394 394
395 virtual Handle<Code> megamorphic_stub() { 395 virtual Handle<Code> megamorphic_stub() {
396 return isolate()->builtins()->LoadIC_Megamorphic(); 396 return isolate()->builtins()->LoadIC_Megamorphic();
397 } 397 }
398 398
399 // Update the inline cache and the global stub cache based on the 399 // Update the inline cache and the global stub cache based on the
400 // lookup result. 400 // lookup result.
401 void UpdateCaches(LookupResult* lookup, 401 void UpdateCaches(LookupResult* lookup,
402 State state, 402 State state,
403 Handle<Object> object, 403 Handle<Object> object,
404 Handle<String> name); 404 Handle<String> name);
405 405
406 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 406 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver,
407 Handle<Code> handler, 407 Handle<Code> handler,
408 Handle<String> name, 408 Handle<String> name,
409 StrictModeFlag strict_mode); 409 StrictModeFlag strict_mode);
410 410
411 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, 411 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps,
412 CodeHandleList* handlers, 412 CodeHandleList* handlers,
413 int number_of_valid_maps, 413 int number_of_valid_maps,
414 Handle<Name> name, 414 Handle<Name> name,
415 StrictModeFlag strict_mode); 415 StrictModeFlag strict_mode);
416 416
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } 476 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
477 477
478 Handle<Code> LoadElementStub(Handle<JSObject> receiver); 478 Handle<Code> LoadElementStub(Handle<JSObject> receiver);
479 479
480 virtual Handle<Code> megamorphic_stub() { 480 virtual Handle<Code> megamorphic_stub() {
481 return isolate()->builtins()->KeyedLoadIC_Generic(); 481 return isolate()->builtins()->KeyedLoadIC_Generic();
482 } 482 }
483 virtual Handle<Code> generic_stub() const { 483 virtual Handle<Code> generic_stub() const {
484 return isolate()->builtins()->KeyedLoadIC_Generic(); 484 return isolate()->builtins()->KeyedLoadIC_Generic();
485 } 485 }
486 virtual Handle<Code> slow_stub() const {
487 return isolate()->builtins()->KeyedLoadIC_Slow();
488 }
486 489
487 // Update the inline cache. 490 // Update the inline cache.
488 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 491 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver,
489 Handle<Code> handler, 492 Handle<Code> handler,
490 Handle<String> name, 493 Handle<String> name,
491 StrictModeFlag strict_mode); 494 StrictModeFlag strict_mode);
492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, 495 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup,
493 Handle<JSObject> receiver, 496 Handle<JSObject> receiver,
494 Handle<String> name); 497 Handle<String> name);
495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 498 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
496 499
497 private: 500 private:
498 // Stub accessors. 501 // Stub accessors.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 virtual Handle<Code> pre_monomorphic_stub_strict() const { 570 virtual Handle<Code> pre_monomorphic_stub_strict() const {
568 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict(); 571 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict();
569 } 572 }
570 virtual Handle<Code> global_proxy_stub() { 573 virtual Handle<Code> global_proxy_stub() {
571 return isolate()->builtins()->StoreIC_GlobalProxy(); 574 return isolate()->builtins()->StoreIC_GlobalProxy();
572 } 575 }
573 virtual Handle<Code> global_proxy_stub_strict() { 576 virtual Handle<Code> global_proxy_stub_strict() {
574 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); 577 return isolate()->builtins()->StoreIC_GlobalProxy_Strict();
575 } 578 }
576 579
577 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 580 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver,
578 Handle<Code> handler, 581 Handle<Code> handler,
579 Handle<String> name, 582 Handle<String> name,
580 StrictModeFlag strict_mode); 583 StrictModeFlag strict_mode);
581 584
582 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, 585 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps,
583 CodeHandleList* handlers, 586 CodeHandleList* handlers,
584 int number_of_valid_maps, 587 int number_of_valid_maps,
585 Handle<Name> name, 588 Handle<Name> name,
586 StrictModeFlag strict_mode); 589 StrictModeFlag strict_mode);
587 590
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return isolate()->builtins()->KeyedStoreIC_Generic(); 685 return isolate()->builtins()->KeyedStoreIC_Generic();
683 } 686 }
684 virtual Handle<Code> megamorphic_stub_strict() { 687 virtual Handle<Code> megamorphic_stub_strict() {
685 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 688 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
686 } 689 }
687 690
688 Handle<Code> StoreElementStub(Handle<JSObject> receiver, 691 Handle<Code> StoreElementStub(Handle<JSObject> receiver,
689 KeyedAccessStoreMode store_mode, 692 KeyedAccessStoreMode store_mode,
690 StrictModeFlag strict_mode); 693 StrictModeFlag strict_mode);
691 694
692 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 695 virtual void UpdateMonomorphicIC(Handle<HeapObject> receiver,
693 Handle<Code> handler, 696 Handle<Code> handler,
694 Handle<String> name, 697 Handle<String> name,
695 StrictModeFlag strict_mode); 698 StrictModeFlag strict_mode);
696 699
697 private: 700 private:
698 void set_target(Code* code) { 701 void set_target(Code* code) {
699 // Strict mode must be preserved across IC patching. 702 // Strict mode must be preserved across IC patching.
700 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 703 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
701 Code::GetStrictMode(target()->extra_ic_state())); 704 Code::GetStrictMode(target()->extra_ic_state()));
702 IC::set_target(code); 705 IC::set_target(code);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
868 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
869 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 872 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 873 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 874 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
872 875
873 876
874 } } // namespace v8::internal 877 } } // namespace v8::internal
875 878
876 #endif // V8_IC_H_ 879 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698