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

Side by Side Diff: src/ic.h

Issue 26831002: Unify ComputeLoad/StoreHandler and dispatch on compile. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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') | 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 Failure* TypeError(const char* type, 166 Failure* TypeError(const char* type,
167 Handle<Object> object, 167 Handle<Object> object,
168 Handle<Object> key); 168 Handle<Object> key);
169 Failure* ReferenceError(const char* type, Handle<String> name); 169 Failure* ReferenceError(const char* type, Handle<String> name);
170 170
171 // Access the target code for the given IC address. 171 // Access the target code for the given IC address.
172 static inline Code* GetTargetAtAddress(Address address); 172 static inline Code* GetTargetAtAddress(Address address);
173 static inline void SetTargetAtAddress(Address address, Code* target); 173 static inline void SetTargetAtAddress(Address address, Code* target);
174 static void PostPatching(Address address, Code* target, Code* old_target); 174 static void PostPatching(Address address, Code* target, Code* old_target);
175 175
176 // Compute the handler either by compiling or by retrieving a cached version.
177 Handle<Code> ComputeHandler(LookupResult* lookup,
178 Handle<JSObject> receiver,
179 Handle<String> name,
180 Handle<Object> value = Handle<Code>::null());
181 virtual Handle<Code> CompileHandler(LookupResult* lookup,
182 Handle<JSObject> receiver,
183 Handle<String> name,
184 Handle<Object> value) {
185 UNREACHABLE();
186 return Handle<Code>::null();
187 }
176 void UpdateMonomorphicIC(Handle<HeapObject> receiver, 188 void UpdateMonomorphicIC(Handle<HeapObject> receiver,
177 Handle<Code> handler, 189 Handle<Code> handler,
178 Handle<String> name); 190 Handle<String> name);
179 191
180 bool UpdatePolymorphicIC(Handle<HeapObject> receiver, 192 bool UpdatePolymorphicIC(Handle<HeapObject> receiver,
181 Handle<String> name, 193 Handle<String> name,
182 Handle<Code> code); 194 Handle<Code> code);
183 195
184 void CopyICToMegamorphicCache(Handle<String> name); 196 void CopyICToMegamorphicCache(Handle<String> name);
185 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); 197 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map);
186 void PatchCache(Handle<HeapObject> receiver, 198 void PatchCache(Handle<HeapObject> receiver,
187 Handle<String> name, 199 Handle<String> name,
188 Handle<Code> code); 200 Handle<Code> code);
189 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); 201 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
202 virtual Code::Kind kind() const {
203 UNREACHABLE();
204 return Code::STUB;
205 }
206 virtual Handle<Code> slow_stub() const {
207 UNREACHABLE();
208 return Handle<Code>::null();
209 }
190 virtual Handle<Code> megamorphic_stub() { 210 virtual Handle<Code> megamorphic_stub() {
191 UNREACHABLE(); 211 UNREACHABLE();
192 return Handle<Code>::null(); 212 return Handle<Code>::null();
193 } 213 }
194 virtual Handle<Code> generic_stub() const { 214 virtual Handle<Code> generic_stub() const {
195 UNREACHABLE(); 215 UNREACHABLE();
196 return Handle<Code>::null(); 216 return Handle<Code>::null();
197 } 217 }
198 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; } 218 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; }
199 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, 219 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 virtual Handle<Code> megamorphic_stub() { 408 virtual Handle<Code> megamorphic_stub() {
389 return isolate()->builtins()->LoadIC_Megamorphic(); 409 return isolate()->builtins()->LoadIC_Megamorphic();
390 } 410 }
391 411
392 // Update the inline cache and the global stub cache based on the 412 // Update the inline cache and the global stub cache based on the
393 // lookup result. 413 // lookup result.
394 void UpdateCaches(LookupResult* lookup, 414 void UpdateCaches(LookupResult* lookup,
395 Handle<Object> object, 415 Handle<Object> object,
396 Handle<String> name); 416 Handle<String> name);
397 417
398 Handle<Code> ComputeLoadHandler(LookupResult* lookup, 418 virtual Handle<Code> CompileHandler(LookupResult* lookup,
399 Handle<JSObject> receiver, 419 Handle<JSObject> receiver,
400 Handle<String> name); 420 Handle<String> name,
401 virtual Handle<Code> CompileLoadHandler(LookupResult* lookup, 421 Handle<Object> unused);
402 Handle<JSObject> receiver,
403 Handle<String> name);
404 422
405 private: 423 private:
406 // Stub accessors. 424 // Stub accessors.
407 static Handle<Code> initialize_stub(Isolate* isolate) { 425 static Handle<Code> initialize_stub(Isolate* isolate) {
408 return isolate->builtins()->LoadIC_Initialize(); 426 return isolate->builtins()->LoadIC_Initialize();
409 } 427 }
410 428
411 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 429 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
412 return isolate->builtins()->LoadIC_PreMonomorphic(); 430 return isolate->builtins()->LoadIC_PreMonomorphic();
413 } 431 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 virtual Handle<Code> megamorphic_stub() { 486 virtual Handle<Code> megamorphic_stub() {
469 return isolate()->builtins()->KeyedLoadIC_Generic(); 487 return isolate()->builtins()->KeyedLoadIC_Generic();
470 } 488 }
471 virtual Handle<Code> generic_stub() const { 489 virtual Handle<Code> generic_stub() const {
472 return isolate()->builtins()->KeyedLoadIC_Generic(); 490 return isolate()->builtins()->KeyedLoadIC_Generic();
473 } 491 }
474 virtual Handle<Code> slow_stub() const { 492 virtual Handle<Code> slow_stub() const {
475 return isolate()->builtins()->KeyedLoadIC_Slow(); 493 return isolate()->builtins()->KeyedLoadIC_Slow();
476 } 494 }
477 495
478 virtual Handle<Code> CompileLoadHandler(LookupResult* lookup, 496 virtual Handle<Code> CompileHandler(LookupResult* lookup,
479 Handle<JSObject> receiver, 497 Handle<JSObject> receiver,
480 Handle<String> name); 498 Handle<String> name,
499 Handle<Object> unused);
481 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 500 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
482 501
483 private: 502 private:
484 // Stub accessors. 503 // Stub accessors.
485 static Handle<Code> initialize_stub(Isolate* isolate) { 504 static Handle<Code> initialize_stub(Isolate* isolate) {
486 return isolate->builtins()->KeyedLoadIC_Initialize(); 505 return isolate->builtins()->KeyedLoadIC_Initialize();
487 } 506 }
488 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 507 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
489 return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); 508 return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
490 } 509 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 return isolate()->builtins()->StoreIC_GlobalProxy(); 602 return isolate()->builtins()->StoreIC_GlobalProxy();
584 } 603 }
585 } 604 }
586 605
587 // Update the inline cache and the global stub cache based on the 606 // Update the inline cache and the global stub cache based on the
588 // lookup result. 607 // lookup result.
589 void UpdateCaches(LookupResult* lookup, 608 void UpdateCaches(LookupResult* lookup,
590 Handle<JSObject> receiver, 609 Handle<JSObject> receiver,
591 Handle<String> name, 610 Handle<String> name,
592 Handle<Object> value); 611 Handle<Object> value);
593 // Compute the code stub for this store; used for rewriting to 612 virtual Handle<Code> CompileHandler(LookupResult* lookup,
594 // monomorphic state and making sure that the code stub is in the 613 Handle<JSObject> receiver,
595 // stub cache. 614 Handle<String> name,
596 Handle<Code> ComputeStoreHandler(LookupResult* lookup, 615 Handle<Object> value);
597 Handle<JSObject> receiver,
598 Handle<String> name,
599 Handle<Object> value);
600 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup,
601 Handle<JSObject> receiver,
602 Handle<String> name,
603 Handle<Object> value);
604 616
605 private: 617 private:
606 void set_target(Code* code) { 618 void set_target(Code* code) {
607 // Strict mode must be preserved across IC patching. 619 // Strict mode must be preserved across IC patching.
608 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 620 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
609 Code::GetStrictMode(target()->extra_ic_state())); 621 Code::GetStrictMode(target()->extra_ic_state()));
610 IC::set_target(code); 622 IC::set_target(code);
611 } 623 }
612 624
613 static Handle<Code> initialize_stub(Isolate* isolate, 625 static Handle<Code> initialize_stub(Isolate* isolate,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); 673 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
662 static void GenerateSlow(MacroAssembler* masm); 674 static void GenerateSlow(MacroAssembler* masm);
663 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 675 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
664 StrictModeFlag strict_mode); 676 StrictModeFlag strict_mode);
665 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 677 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
666 static void GenerateNonStrictArguments(MacroAssembler* masm); 678 static void GenerateNonStrictArguments(MacroAssembler* masm);
667 679
668 protected: 680 protected:
669 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 681 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
670 682
671 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup, 683 virtual Handle<Code> CompileHandler(LookupResult* lookup,
672 Handle<JSObject> receiver, 684 Handle<JSObject> receiver,
673 Handle<String> name, 685 Handle<String> name,
674 Handle<Object> value); 686 Handle<Object> value);
675 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 687 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
676 688
677 virtual Handle<Code> pre_monomorphic_stub() { 689 virtual Handle<Code> pre_monomorphic_stub() {
678 return pre_monomorphic_stub(isolate(), strict_mode()); 690 return pre_monomorphic_stub(isolate(), strict_mode());
679 } 691 }
680 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 692 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
681 StrictModeFlag strict_mode) { 693 StrictModeFlag strict_mode) {
682 if (strict_mode == kStrictMode) { 694 if (strict_mode == kStrictMode) {
683 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); 695 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
684 } else { 696 } else {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 885 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
874 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 886 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
875 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 887 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
876 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 888 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
877 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 889 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
878 890
879 891
880 } } // namespace v8::internal 892 } } // namespace v8::internal
881 893
882 #endif // V8_IC_H_ 894 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698