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

Side by Side Diff: src/ic.h

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/ia32/stub-cache-ia32.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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 virtual ~IC() {} 95 virtual ~IC() {}
96 96
97 // Get the call-site target; used for determining the state. 97 // Get the call-site target; used for determining the state.
98 Code* target() const { return GetTargetAtAddress(address()); } 98 Code* target() const { return GetTargetAtAddress(address()); }
99 inline Address address() const; 99 inline Address address() const;
100 100
101 // Compute the current IC state based on the target stub, receiver and name. 101 // Compute the current IC state based on the target stub, receiver and name.
102 static State StateFrom(Code* target, Object* receiver, Object* name); 102 static State StateFrom(Code* target, Object* receiver, Object* name);
103 103
104 // Clear the inline cache to initial state. 104 // Clear the inline cache to initial state.
105 static void Clear(Address address); 105 static void Clear(Isolate* isolate, Address address);
106 106
107 // Computes the reloc info for this IC. This is a fairly expensive 107 // Computes the reloc info for this IC. This is a fairly expensive
108 // operation as it has to search through the heap to find the code 108 // operation as it has to search through the heap to find the code
109 // object that contains this IC site. 109 // object that contains this IC site.
110 RelocInfo::Mode ComputeMode(); 110 RelocInfo::Mode ComputeMode();
111 111
112 // Returns if this IC is for contextual (no explicit receiver) 112 // Returns if this IC is for contextual (no explicit receiver)
113 // access to properties. 113 // access to properties.
114 bool IsUndeclaredGlobal(Handle<Object> receiver) { 114 bool IsUndeclaredGlobal(Handle<Object> receiver) {
115 if (receiver->IsGlobalObject()) { 115 if (receiver->IsGlobalObject()) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, 417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup,
418 Handle<JSObject> receiver, 418 Handle<JSObject> receiver,
419 Handle<String> name); 419 Handle<String> name);
420 420
421 private: 421 private:
422 // Stub accessors. 422 // Stub accessors.
423 static Handle<Code> initialize_stub() { 423 static Handle<Code> initialize_stub(Isolate* isolate) {
424 return Isolate::Current()->builtins()->LoadIC_Initialize(); 424 return isolate->builtins()->LoadIC_Initialize();
425 } 425 }
426 virtual Handle<Code> pre_monomorphic_stub() { 426 virtual Handle<Code> pre_monomorphic_stub() {
427 return isolate()->builtins()->LoadIC_PreMonomorphic(); 427 return isolate()->builtins()->LoadIC_PreMonomorphic();
428 } 428 }
429 429
430 static void Clear(Address address, Code* target); 430 static void Clear(Isolate* isolate, Address address, Code* target);
431 431
432 friend class IC; 432 friend class IC;
433 }; 433 };
434 434
435 435
436 enum ICMissMode { 436 enum ICMissMode {
437 MISS_FORCE_GENERIC, 437 MISS_FORCE_GENERIC,
438 MISS 438 MISS
439 }; 439 };
440 440
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 Handle<Code> handler, 489 Handle<Code> handler,
490 Handle<String> name, 490 Handle<String> name,
491 StrictModeFlag strict_mode); 491 StrictModeFlag strict_mode);
492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, 492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup,
493 Handle<JSObject> receiver, 493 Handle<JSObject> receiver,
494 Handle<String> name); 494 Handle<String> name);
495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
496 496
497 private: 497 private:
498 // Stub accessors. 498 // Stub accessors.
499 static Handle<Code> initialize_stub() { 499 static Handle<Code> initialize_stub(Isolate* isolate) {
500 return Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); 500 return isolate->builtins()->KeyedLoadIC_Initialize();
501 } 501 }
502 virtual Handle<Code> pre_monomorphic_stub() { 502 virtual Handle<Code> pre_monomorphic_stub() {
503 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic(); 503 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
504 } 504 }
505 Handle<Code> indexed_interceptor_stub() { 505 Handle<Code> indexed_interceptor_stub() {
506 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); 506 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
507 } 507 }
508 Handle<Code> non_strict_arguments_stub() { 508 Handle<Code> non_strict_arguments_stub() {
509 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); 509 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments();
510 } 510 }
511 Handle<Code> string_stub() { 511 Handle<Code> string_stub() {
512 return isolate()->builtins()->KeyedLoadIC_String(); 512 return isolate()->builtins()->KeyedLoadIC_String();
513 } 513 }
514 514
515 static void Clear(Address address, Code* target); 515 static void Clear(Isolate* isolate, Address address, Code* target);
516 516
517 friend class IC; 517 friend class IC;
518 }; 518 };
519 519
520 520
521 class StoreIC: public IC { 521 class StoreIC: public IC {
522 public: 522 public:
523 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { 523 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) {
524 ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub()); 524 ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub());
525 } 525 }
526 526
527 // Code generators for stub routines. Only called once at startup. 527 // Code generators for stub routines. Only called once at startup.
528 static void GenerateSlow(MacroAssembler* masm); 528 static void GenerateSlow(MacroAssembler* masm);
529 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 529 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
530 static void GeneratePreMonomorphic(MacroAssembler* masm) {
531 GenerateMiss(masm);
532 }
530 static void GenerateMiss(MacroAssembler* masm); 533 static void GenerateMiss(MacroAssembler* masm);
531 static void GenerateMegamorphic(MacroAssembler* masm, 534 static void GenerateMegamorphic(MacroAssembler* masm,
532 StrictModeFlag strict_mode); 535 StrictModeFlag strict_mode);
533 static void GenerateNormal(MacroAssembler* masm); 536 static void GenerateNormal(MacroAssembler* masm);
534 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 537 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
535 StrictModeFlag strict_mode); 538 StrictModeFlag strict_mode);
536 539
537 MUST_USE_RESULT MaybeObject* Store( 540 MUST_USE_RESULT MaybeObject* Store(
538 State state, 541 State state,
539 StrictModeFlag strict_mode, 542 StrictModeFlag strict_mode,
(...skipping 11 matching lines...) Expand all
551 // Stub accessors. 554 // Stub accessors.
552 virtual Handle<Code> megamorphic_stub_strict() { 555 virtual Handle<Code> megamorphic_stub_strict() {
553 return isolate()->builtins()->StoreIC_Megamorphic_Strict(); 556 return isolate()->builtins()->StoreIC_Megamorphic_Strict();
554 } 557 }
555 virtual Handle<Code> generic_stub() const { 558 virtual Handle<Code> generic_stub() const {
556 return isolate()->builtins()->StoreIC_Generic(); 559 return isolate()->builtins()->StoreIC_Generic();
557 } 560 }
558 virtual Handle<Code> generic_stub_strict() const { 561 virtual Handle<Code> generic_stub_strict() const {
559 return isolate()->builtins()->StoreIC_Generic_Strict(); 562 return isolate()->builtins()->StoreIC_Generic_Strict();
560 } 563 }
564 virtual Handle<Code> pre_monomorphic_stub() const {
565 return isolate()->builtins()->StoreIC_PreMonomorphic();
566 }
567 virtual Handle<Code> pre_monomorphic_stub_strict() const {
568 return isolate()->builtins()->StoreIC_PreMonomorphic_Strict();
569 }
561 virtual Handle<Code> global_proxy_stub() { 570 virtual Handle<Code> global_proxy_stub() {
562 return isolate()->builtins()->StoreIC_GlobalProxy(); 571 return isolate()->builtins()->StoreIC_GlobalProxy();
563 } 572 }
564 virtual Handle<Code> global_proxy_stub_strict() { 573 virtual Handle<Code> global_proxy_stub_strict() {
565 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); 574 return isolate()->builtins()->StoreIC_GlobalProxy_Strict();
566 } 575 }
567 576
568 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 577 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver,
569 Handle<Code> handler, 578 Handle<Code> handler,
570 Handle<String> name, 579 Handle<String> name,
(...skipping 23 matching lines...) Expand all
594 Handle<Object> value); 603 Handle<Object> value);
595 604
596 private: 605 private:
597 void set_target(Code* code) { 606 void set_target(Code* code) {
598 // Strict mode must be preserved across IC patching. 607 // Strict mode must be preserved across IC patching.
599 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 608 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
600 Code::GetStrictMode(target()->extra_ic_state())); 609 Code::GetStrictMode(target()->extra_ic_state()));
601 IC::set_target(code); 610 IC::set_target(code);
602 } 611 }
603 612
604 static Handle<Code> initialize_stub() { 613 static Handle<Code> initialize_stub(Isolate* isolate) {
605 return Isolate::Current()->builtins()->StoreIC_Initialize(); 614 return isolate->builtins()->StoreIC_Initialize();
606 } 615 }
607 static Handle<Code> initialize_stub_strict() { 616 static Handle<Code> initialize_stub_strict(Isolate* isolate) {
608 return Isolate::Current()->builtins()->StoreIC_Initialize_Strict(); 617 return isolate->builtins()->StoreIC_Initialize_Strict();
609 } 618 }
610 static void Clear(Address address, Code* target); 619 static void Clear(Isolate* isolate, Address address, Code* target);
611 620
612 friend class IC; 621 friend class IC;
613 }; 622 };
614 623
615 624
616 enum KeyedStoreCheckMap { 625 enum KeyedStoreCheckMap {
617 kDontCheckMap, 626 kDontCheckMap,
618 kCheckMap 627 kCheckMap
619 }; 628 };
620 629
(...skipping 15 matching lines...) Expand all
636 StrictModeFlag strict_mode, 645 StrictModeFlag strict_mode,
637 Handle<Object> object, 646 Handle<Object> object,
638 Handle<Object> name, 647 Handle<Object> name,
639 Handle<Object> value, 648 Handle<Object> value,
640 ICMissMode force_generic); 649 ICMissMode force_generic);
641 650
642 // Code generators for stub routines. Only called once at startup. 651 // Code generators for stub routines. Only called once at startup.
643 static void GenerateInitialize(MacroAssembler* masm) { 652 static void GenerateInitialize(MacroAssembler* masm) {
644 GenerateMiss(masm, MISS); 653 GenerateMiss(masm, MISS);
645 } 654 }
655 static void GeneratePreMonomorphic(MacroAssembler* masm) {
656 GenerateMiss(masm, MISS);
657 }
646 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); 658 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic);
647 static void GenerateSlow(MacroAssembler* masm); 659 static void GenerateSlow(MacroAssembler* masm);
648 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 660 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
649 StrictModeFlag strict_mode); 661 StrictModeFlag strict_mode);
650 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 662 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
651 static void GenerateNonStrictArguments(MacroAssembler* masm); 663 static void GenerateNonStrictArguments(MacroAssembler* masm);
652 664
653 protected: 665 protected:
654 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 666 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
655 667
656 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, 668 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup,
657 StrictModeFlag strict_mode, 669 StrictModeFlag strict_mode,
658 Handle<JSObject> receiver, 670 Handle<JSObject> receiver,
659 Handle<String> name, 671 Handle<String> name,
660 Handle<Object> value); 672 Handle<Object> value);
661 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } 673 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
662 674
675 virtual Handle<Code> pre_monomorphic_stub() const {
676 return isolate()->builtins()->KeyedStoreIC_PreMonomorphic();
677 }
678 virtual Handle<Code> pre_monomorphic_stub_strict() const {
679 return isolate()->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
680 }
663 virtual Handle<Code> megamorphic_stub() { 681 virtual Handle<Code> megamorphic_stub() {
664 return isolate()->builtins()->KeyedStoreIC_Generic(); 682 return isolate()->builtins()->KeyedStoreIC_Generic();
665 } 683 }
666 virtual Handle<Code> megamorphic_stub_strict() { 684 virtual Handle<Code> megamorphic_stub_strict() {
667 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 685 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
668 } 686 }
669 687
670 Handle<Code> StoreElementStub(Handle<JSObject> receiver, 688 Handle<Code> StoreElementStub(Handle<JSObject> receiver,
671 KeyedAccessStoreMode store_mode, 689 KeyedAccessStoreMode store_mode,
672 StrictModeFlag strict_mode); 690 StrictModeFlag strict_mode);
673 691
674 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, 692 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver,
675 Handle<Code> handler, 693 Handle<Code> handler,
676 Handle<String> name, 694 Handle<String> name,
677 StrictModeFlag strict_mode); 695 StrictModeFlag strict_mode);
678 696
679 private: 697 private:
680 void set_target(Code* code) { 698 void set_target(Code* code) {
681 // Strict mode must be preserved across IC patching. 699 // Strict mode must be preserved across IC patching.
682 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == 700 ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
683 Code::GetStrictMode(target()->extra_ic_state())); 701 Code::GetStrictMode(target()->extra_ic_state()));
684 IC::set_target(code); 702 IC::set_target(code);
685 } 703 }
686 704
687 // Stub accessors. 705 // Stub accessors.
688 static Handle<Code> initialize_stub() { 706 static Handle<Code> initialize_stub(Isolate* isolate) {
689 return Isolate::Current()->builtins()->KeyedStoreIC_Initialize(); 707 return isolate->builtins()->KeyedStoreIC_Initialize();
690 } 708 }
691 static Handle<Code> initialize_stub_strict() { 709 static Handle<Code> initialize_stub_strict(Isolate* isolate) {
692 return Isolate::Current()->builtins()->KeyedStoreIC_Initialize_Strict(); 710 return isolate->builtins()->KeyedStoreIC_Initialize_Strict();
693 } 711 }
694 Handle<Code> generic_stub() const { 712 Handle<Code> generic_stub() const {
695 return isolate()->builtins()->KeyedStoreIC_Generic(); 713 return isolate()->builtins()->KeyedStoreIC_Generic();
696 } 714 }
697 Handle<Code> generic_stub_strict() const { 715 Handle<Code> generic_stub_strict() const {
698 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 716 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
699 } 717 }
700 Handle<Code> non_strict_arguments_stub() { 718 Handle<Code> non_strict_arguments_stub() {
701 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); 719 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments();
702 } 720 }
703 721
704 static void Clear(Address address, Code* target); 722 static void Clear(Isolate* isolate, Address address, Code* target);
705 723
706 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, 724 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
707 Handle<Object> key, 725 Handle<Object> key,
708 Handle<Object> value); 726 Handle<Object> value);
709 727
710 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, 728 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
711 KeyedAccessStoreMode store_mode); 729 KeyedAccessStoreMode store_mode);
712 730
713 friend class IC; 731 friend class IC;
714 }; 732 };
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 State TargetState(State old_state, 818 State TargetState(State old_state,
801 State old_left, 819 State old_left,
802 State old_right, 820 State old_right,
803 bool has_inlined_smi_code, 821 bool has_inlined_smi_code,
804 Handle<Object> x, 822 Handle<Object> x,
805 Handle<Object> y); 823 Handle<Object> y);
806 824
807 bool strict() const { return op_ == Token::EQ_STRICT; } 825 bool strict() const { return op_ == Token::EQ_STRICT; }
808 Condition GetCondition() const { return ComputeCondition(op_); } 826 Condition GetCondition() const { return ComputeCondition(op_); }
809 827
810 static Code* GetRawUninitialized(Token::Value op); 828 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
811 829
812 static void Clear(Address address, Code* target); 830 static void Clear(Isolate* isolate, Address address, Code* target);
813 831
814 Token::Value op_; 832 Token::Value op_;
815 833
816 friend class IC; 834 friend class IC;
817 }; 835 };
818 836
819 837
820 class CompareNilIC: public IC { 838 class CompareNilIC: public IC {
821 public: 839 public:
822 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} 840 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {}
(...skipping 26 matching lines...) Expand all
849 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 867 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
850 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 868 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
851 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 869 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 870 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
854 872
855 873
856 } } // namespace v8::internal 874 } } // namespace v8::internal
857 875
858 #endif // V8_IC_H_ 876 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698