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

Side by Side Diff: src/ic.h

Issue 25548009: Centralize handler caching and probing in ic.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Undo moving fallback IC handling 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 UNREACHABLE(); 191 UNREACHABLE();
192 return Handle<Code>::null(); 192 return Handle<Code>::null();
193 } 193 }
194 virtual Handle<Code> generic_stub() const { 194 virtual Handle<Code> generic_stub() const {
195 UNREACHABLE(); 195 UNREACHABLE();
196 return Handle<Code>::null(); 196 return Handle<Code>::null();
197 } 197 }
198 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; } 198 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; }
199 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, 199 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
200 Handle<String> name); 200 Handle<String> name);
201 void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
201 202
202 private: 203 private:
203 // Frame pointer for the frame that uses (calls) the IC. 204 // Frame pointer for the frame that uses (calls) the IC.
204 Address fp_; 205 Address fp_;
205 206
206 // All access to the program counter of an IC structure is indirect 207 // All access to the program counter of an IC structure is indirect
207 // to make the code GC safe. This feature is crucial since 208 // to make the code GC safe. This feature is crucial since
208 // GetProperty and SetProperty are called and they in turn might 209 // GetProperty and SetProperty are called and they in turn might
209 // invoke the garbage collector. 210 // invoke the garbage collector.
210 Address* pc_address_; 211 Address* pc_address_;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 virtual Handle<Code> megamorphic_stub() { 388 virtual Handle<Code> megamorphic_stub() {
388 return isolate()->builtins()->LoadIC_Megamorphic(); 389 return isolate()->builtins()->LoadIC_Megamorphic();
389 } 390 }
390 391
391 // Update the inline cache and the global stub cache based on the 392 // Update the inline cache and the global stub cache based on the
392 // lookup result. 393 // lookup result.
393 void UpdateCaches(LookupResult* lookup, 394 void UpdateCaches(LookupResult* lookup,
394 Handle<Object> object, 395 Handle<Object> object,
395 Handle<String> name); 396 Handle<String> name);
396 397
397 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, 398 Handle<Code> ComputeLoadHandler(LookupResult* lookup,
399 Handle<JSObject> receiver,
400 Handle<String> name);
401 virtual Handle<Code> CompileLoadHandler(LookupResult* lookup,
398 Handle<JSObject> receiver, 402 Handle<JSObject> receiver,
399 Handle<String> name); 403 Handle<String> name);
400 404
401 private: 405 private:
402 // Stub accessors. 406 // Stub accessors.
403 static Handle<Code> initialize_stub(Isolate* isolate) { 407 static Handle<Code> initialize_stub(Isolate* isolate) {
404 return isolate->builtins()->LoadIC_Initialize(); 408 return isolate->builtins()->LoadIC_Initialize();
405 } 409 }
406 410
407 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 411 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 virtual Handle<Code> megamorphic_stub() { 468 virtual Handle<Code> megamorphic_stub() {
465 return isolate()->builtins()->KeyedLoadIC_Generic(); 469 return isolate()->builtins()->KeyedLoadIC_Generic();
466 } 470 }
467 virtual Handle<Code> generic_stub() const { 471 virtual Handle<Code> generic_stub() const {
468 return isolate()->builtins()->KeyedLoadIC_Generic(); 472 return isolate()->builtins()->KeyedLoadIC_Generic();
469 } 473 }
470 virtual Handle<Code> slow_stub() const { 474 virtual Handle<Code> slow_stub() const {
471 return isolate()->builtins()->KeyedLoadIC_Slow(); 475 return isolate()->builtins()->KeyedLoadIC_Slow();
472 } 476 }
473 477
474 // Update the inline cache. 478 virtual Handle<Code> CompileLoadHandler(LookupResult* lookup,
475 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup,
476 Handle<JSObject> receiver, 479 Handle<JSObject> receiver,
477 Handle<String> name); 480 Handle<String> name);
478 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 481 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
479 482
480 private: 483 private:
481 // Stub accessors. 484 // Stub accessors.
482 static Handle<Code> initialize_stub(Isolate* isolate) { 485 static Handle<Code> initialize_stub(Isolate* isolate) {
483 return isolate->builtins()->KeyedLoadIC_Initialize(); 486 return isolate->builtins()->KeyedLoadIC_Initialize();
484 } 487 }
485 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) { 488 static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 578
576 // Update the inline cache and the global stub cache based on the 579 // Update the inline cache and the global stub cache based on the
577 // lookup result. 580 // lookup result.
578 void UpdateCaches(LookupResult* lookup, 581 void UpdateCaches(LookupResult* lookup,
579 Handle<JSObject> receiver, 582 Handle<JSObject> receiver,
580 Handle<String> name, 583 Handle<String> name,
581 Handle<Object> value); 584 Handle<Object> value);
582 // Compute the code stub for this store; used for rewriting to 585 // Compute the code stub for this store; used for rewriting to
583 // monomorphic state and making sure that the code stub is in the 586 // monomorphic state and making sure that the code stub is in the
584 // stub cache. 587 // stub cache.
585 virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup, 588 Handle<Code> ComputeStoreHandler(LookupResult* lookup,
589 Handle<JSObject> receiver,
590 Handle<String> name,
591 Handle<Object> value);
592 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup,
586 Handle<JSObject> receiver, 593 Handle<JSObject> receiver,
587 Handle<String> name, 594 Handle<String> name,
588 Handle<Object> value); 595 Handle<Object> value);
589 596
590 private: 597 private:
591 void set_target(Code* code) { 598 void set_target(Code* code) {
592 // Strict mode must be preserved across IC patching. 599 // Strict mode must be preserved across IC patching.
593 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 600 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
594 Code::GetStrictMode(target()->extra_ic_state())); 601 Code::GetStrictMode(target()->extra_ic_state()));
595 IC::set_target(code); 602 IC::set_target(code);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); 653 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
647 static void GenerateSlow(MacroAssembler* masm); 654 static void GenerateSlow(MacroAssembler* masm);
648 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 655 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
649 StrictModeFlag strict_mode); 656 StrictModeFlag strict_mode);
650 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 657 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
651 static void GenerateNonStrictArguments(MacroAssembler* masm); 658 static void GenerateNonStrictArguments(MacroAssembler* masm);
652 659
653 protected: 660 protected:
654 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 661 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
655 662
656 virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup, 663 virtual Handle<Code> CompileStoreHandler(LookupResult* lookup,
657 Handle<JSObject> receiver, 664 Handle<JSObject> receiver,
658 Handle<String> name, 665 Handle<String> name,
659 Handle<Object> value); 666 Handle<Object> value);
660 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 667 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
661 668
662 virtual Handle<Code> pre_monomorphic_stub() { 669 virtual Handle<Code> pre_monomorphic_stub() {
663 return pre_monomorphic_stub(isolate(), strict_mode()); 670 return pre_monomorphic_stub(isolate(), strict_mode());
664 } 671 }
665 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 672 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
666 StrictModeFlag strict_mode) { 673 StrictModeFlag strict_mode) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
854 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
855 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 862 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
856 863
857 864
858 } } // namespace v8::internal 865 } } // namespace v8::internal
859 866
860 #endif // V8_IC_H_ 867 #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