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

Side by Side Diff: src/stub-cache.h

Issue 98853002: StubCompiler gets extra_ic_state member. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years 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/mips/stub-cache-mips.cc ('k') | src/stub-cache.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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor); 357 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor);
358 358
359 359
360 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER }; 360 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER };
361 enum IcCheckType { ELEMENT, PROPERTY }; 361 enum IcCheckType { ELEMENT, PROPERTY };
362 362
363 363
364 // The stub compilers compile stubs for the stub cache. 364 // The stub compilers compile stubs for the stub cache.
365 class StubCompiler BASE_EMBEDDED { 365 class StubCompiler BASE_EMBEDDED {
366 public: 366 public:
367 explicit StubCompiler(Isolate* isolate) 367 explicit StubCompiler(Isolate* isolate,
368 : isolate_(isolate), masm_(isolate, NULL, 256), failure_(NULL) { } 368 ExtraICState extra_ic_state = kNoExtraICState)
369 : isolate_(isolate), extra_ic_state_(extra_ic_state),
370 masm_(isolate, NULL, 256), failure_(NULL) { }
369 371
370 // Functions to compile either CallIC or KeyedCallIC. The specific kind 372 // Functions to compile either CallIC or KeyedCallIC. The specific kind
371 // is extracted from the code flags. 373 // is extracted from the code flags.
372 Handle<Code> CompileCallInitialize(Code::Flags flags); 374 Handle<Code> CompileCallInitialize(Code::Flags flags);
373 Handle<Code> CompileCallPreMonomorphic(Code::Flags flags); 375 Handle<Code> CompileCallPreMonomorphic(Code::Flags flags);
374 Handle<Code> CompileCallNormal(Code::Flags flags); 376 Handle<Code> CompileCallNormal(Code::Flags flags);
375 Handle<Code> CompileCallMegamorphic(Code::Flags flags); 377 Handle<Code> CompileCallMegamorphic(Code::Flags flags);
376 Handle<Code> CompileCallArguments(Code::Flags flags); 378 Handle<Code> CompileCallArguments(Code::Flags flags);
377 Handle<Code> CompileCallMiss(Code::Flags flags); 379 Handle<Code> CompileCallMiss(Code::Flags flags);
378 380
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 int save_at_depth, 484 int save_at_depth,
483 Label* miss, 485 Label* miss,
484 PrototypeCheckType check = CHECK_ALL_MAPS); 486 PrototypeCheckType check = CHECK_ALL_MAPS);
485 487
486 void GenerateBooleanCheck(Register object, Label* miss); 488 void GenerateBooleanCheck(Register object, Label* miss);
487 489
488 protected: 490 protected:
489 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); 491 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name);
490 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name); 492 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name);
491 493
494 ExtraICState extra_state() { return extra_ic_state_; }
495
492 MacroAssembler* masm() { return &masm_; } 496 MacroAssembler* masm() { return &masm_; }
493 void set_failure(Failure* failure) { failure_ = failure; } 497 void set_failure(Failure* failure) { failure_ = failure; }
494 498
495 static void LookupPostInterceptor(Handle<JSObject> holder, 499 static void LookupPostInterceptor(Handle<JSObject> holder,
496 Handle<Name> name, 500 Handle<Name> name,
497 LookupResult* lookup); 501 LookupResult* lookup);
498 502
499 Isolate* isolate() { return isolate_; } 503 Isolate* isolate() { return isolate_; }
500 Heap* heap() { return isolate()->heap(); } 504 Heap* heap() { return isolate()->heap(); }
501 Factory* factory() { return isolate()->factory(); } 505 Factory* factory() { return isolate()->factory(); }
502 506
503 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code); 507 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code);
504 508
505 private: 509 private:
506 Isolate* isolate_; 510 Isolate* isolate_;
511 const ExtraICState extra_ic_state_;
507 MacroAssembler masm_; 512 MacroAssembler masm_;
508 Failure* failure_; 513 Failure* failure_;
509 }; 514 };
510 515
511 516
512 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; 517 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS };
513 518
514 519
515 class BaseLoadStoreStubCompiler: public StubCompiler { 520 class BaseLoadStoreStubCompiler: public StubCompiler {
516 public: 521 public:
517 BaseLoadStoreStubCompiler(Isolate* isolate, 522 BaseLoadStoreStubCompiler(Isolate* isolate,
518 Code::Kind kind, 523 Code::Kind kind,
524 ExtraICState extra_ic_state = kNoExtraICState,
519 InlineCacheHolderFlag cache_holder = OWN_MAP) 525 InlineCacheHolderFlag cache_holder = OWN_MAP)
520 : StubCompiler(isolate), kind_(kind), cache_holder_(cache_holder) { 526 : StubCompiler(isolate, extra_ic_state),
527 kind_(kind),
528 cache_holder_(cache_holder) {
521 InitializeRegisters(); 529 InitializeRegisters();
522 } 530 }
523 virtual ~BaseLoadStoreStubCompiler() { } 531 virtual ~BaseLoadStoreStubCompiler() { }
524 532
525 Handle<Code> CompileMonomorphicIC(Handle<Type> type, 533 Handle<Code> CompileMonomorphicIC(Handle<Type> type,
526 Handle<Code> handler, 534 Handle<Code> handler,
527 Handle<Name> name); 535 Handle<Name> name);
528 536
529 Handle<Code> CompilePolymorphicIC(TypeHandleList* types, 537 Handle<Code> CompilePolymorphicIC(TypeHandleList* types,
530 CodeHandleList* handlers, 538 CodeHandleList* handlers,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } else if (kind_ == Code::STORE_IC) { 590 } else if (kind_ == Code::STORE_IC) {
583 return code->ic_state() == MONOMORPHIC 591 return code->ic_state() == MONOMORPHIC
584 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG; 592 ? Logger::STORE_IC_TAG : Logger::STORE_POLYMORPHIC_IC_TAG;
585 } else { 593 } else {
586 return code->ic_state() == MONOMORPHIC 594 return code->ic_state() == MONOMORPHIC
587 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; 595 ? Logger::KEYED_STORE_IC_TAG : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG;
588 } 596 }
589 } 597 }
590 void JitEvent(Handle<Name> name, Handle<Code> code); 598 void JitEvent(Handle<Name> name, Handle<Code> code);
591 599
592 virtual ExtraICState extra_state() { return kNoExtraICState; }
593 virtual Register receiver() = 0; 600 virtual Register receiver() = 0;
594 virtual Register name() = 0; 601 virtual Register name() = 0;
595 virtual Register scratch1() = 0; 602 virtual Register scratch1() = 0;
596 virtual Register scratch2() = 0; 603 virtual Register scratch2() = 0;
597 virtual Register scratch3() = 0; 604 virtual Register scratch3() = 0;
598 605
599 void InitializeRegisters(); 606 void InitializeRegisters();
600 607
601 bool IncludesNumberType(TypeHandleList* types); 608 bool IncludesNumberType(TypeHandleList* types);
602 609
603 Code::Kind kind_; 610 Code::Kind kind_;
604 InlineCacheHolderFlag cache_holder_; 611 InlineCacheHolderFlag cache_holder_;
605 Register* registers_; 612 Register* registers_;
606 }; 613 };
607 614
608 615
609 class LoadStubCompiler: public BaseLoadStoreStubCompiler { 616 class LoadStubCompiler: public BaseLoadStoreStubCompiler {
610 public: 617 public:
611 LoadStubCompiler(Isolate* isolate, 618 LoadStubCompiler(Isolate* isolate,
619 ExtraICState extra_ic_state = kNoExtraICState,
612 InlineCacheHolderFlag cache_holder = OWN_MAP, 620 InlineCacheHolderFlag cache_holder = OWN_MAP,
613 Code::Kind kind = Code::LOAD_IC) 621 Code::Kind kind = Code::LOAD_IC)
614 : BaseLoadStoreStubCompiler(isolate, kind, cache_holder) { } 622 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state,
623 cache_holder) { }
615 virtual ~LoadStubCompiler() { } 624 virtual ~LoadStubCompiler() { }
616 625
617 Handle<Code> CompileLoadField(Handle<Type> type, 626 Handle<Code> CompileLoadField(Handle<Type> type,
618 Handle<JSObject> holder, 627 Handle<JSObject> holder,
619 Handle<Name> name, 628 Handle<Name> name,
620 PropertyIndex index, 629 PropertyIndex index,
621 Representation representation); 630 Representation representation);
622 631
623 Handle<Code> CompileLoadCallback(Handle<Type> type, 632 Handle<Code> CompileLoadCallback(Handle<Type> type,
624 Handle<JSObject> holder, 633 Handle<JSObject> holder,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 virtual Register scratch1() { return registers_[2]; } 710 virtual Register scratch1() { return registers_[2]; }
702 virtual Register scratch2() { return registers_[3]; } 711 virtual Register scratch2() { return registers_[3]; }
703 virtual Register scratch3() { return registers_[4]; } 712 virtual Register scratch3() { return registers_[4]; }
704 Register scratch4() { return registers_[5]; } 713 Register scratch4() { return registers_[5]; }
705 }; 714 };
706 715
707 716
708 class KeyedLoadStubCompiler: public LoadStubCompiler { 717 class KeyedLoadStubCompiler: public LoadStubCompiler {
709 public: 718 public:
710 KeyedLoadStubCompiler(Isolate* isolate, 719 KeyedLoadStubCompiler(Isolate* isolate,
720 ExtraICState extra_ic_state = kNoExtraICState,
711 InlineCacheHolderFlag cache_holder = OWN_MAP) 721 InlineCacheHolderFlag cache_holder = OWN_MAP)
712 : LoadStubCompiler(isolate, cache_holder, Code::KEYED_LOAD_IC) { } 722 : LoadStubCompiler(isolate, extra_ic_state, cache_holder,
723 Code::KEYED_LOAD_IC) { }
713 724
714 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); 725 Handle<Code> CompileLoadElement(Handle<Map> receiver_map);
715 726
716 void CompileElementHandlers(MapHandleList* receiver_maps, 727 void CompileElementHandlers(MapHandleList* receiver_maps,
717 CodeHandleList* handlers); 728 CodeHandleList* handlers);
718 729
719 static void GenerateLoadDictionaryElement(MacroAssembler* masm); 730 static void GenerateLoadDictionaryElement(MacroAssembler* masm);
720 731
721 protected: 732 protected:
722 static Register* registers(); 733 static Register* registers();
723 734
724 private: 735 private:
725 virtual void GenerateNameCheck(Handle<Name> name, 736 virtual void GenerateNameCheck(Handle<Name> name,
726 Register name_reg, 737 Register name_reg,
727 Label* miss); 738 Label* miss);
728 friend class BaseLoadStoreStubCompiler; 739 friend class BaseLoadStoreStubCompiler;
729 }; 740 };
730 741
731 742
732 class StoreStubCompiler: public BaseLoadStoreStubCompiler { 743 class StoreStubCompiler: public BaseLoadStoreStubCompiler {
733 public: 744 public:
734 StoreStubCompiler(Isolate* isolate, 745 StoreStubCompiler(Isolate* isolate,
735 StrictModeFlag strict_mode, 746 ExtraICState extra_ic_state,
736 Code::Kind kind = Code::STORE_IC) 747 Code::Kind kind = Code::STORE_IC)
737 : BaseLoadStoreStubCompiler(isolate, kind), 748 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state) {}
738 strict_mode_(strict_mode) { }
739 749
740 virtual ~StoreStubCompiler() { } 750 virtual ~StoreStubCompiler() { }
741 751
742 Handle<Code> CompileStoreTransition(Handle<JSObject> object, 752 Handle<Code> CompileStoreTransition(Handle<JSObject> object,
743 LookupResult* lookup, 753 LookupResult* lookup,
744 Handle<Map> transition, 754 Handle<Map> transition,
745 Handle<Name> name); 755 Handle<Name> name);
746 756
747 Handle<Code> CompileStoreField(Handle<JSObject> object, 757 Handle<Code> CompileStoreField(Handle<JSObject> object,
748 LookupResult* lookup, 758 LookupResult* lookup,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void GenerateRestoreName(MacroAssembler* masm, 829 void GenerateRestoreName(MacroAssembler* masm,
820 Label* label, 830 Label* label,
821 Handle<Name> name); 831 Handle<Name> name);
822 832
823 virtual Register receiver() { return registers_[0]; } 833 virtual Register receiver() { return registers_[0]; }
824 virtual Register name() { return registers_[1]; } 834 virtual Register name() { return registers_[1]; }
825 Register value() { return registers_[2]; } 835 Register value() { return registers_[2]; }
826 virtual Register scratch1() { return registers_[3]; } 836 virtual Register scratch1() { return registers_[3]; }
827 virtual Register scratch2() { return registers_[4]; } 837 virtual Register scratch2() { return registers_[4]; }
828 virtual Register scratch3() { return registers_[5]; } 838 virtual Register scratch3() { return registers_[5]; }
829 StrictModeFlag strict_mode() { return strict_mode_; }
830 virtual ExtraICState extra_state() {
831 return StoreIC::ComputeExtraICState(strict_mode_);
832 }
833 839
834 protected: 840 protected:
835 static Register* registers(); 841 static Register* registers();
836 842
837 private: 843 private:
838 StrictModeFlag strict_mode_;
839 friend class BaseLoadStoreStubCompiler; 844 friend class BaseLoadStoreStubCompiler;
840 }; 845 };
841 846
842 847
843 class KeyedStoreStubCompiler: public StoreStubCompiler { 848 class KeyedStoreStubCompiler: public StoreStubCompiler {
844 public: 849 public:
845 KeyedStoreStubCompiler(Isolate* isolate, 850 KeyedStoreStubCompiler(Isolate* isolate,
846 StrictModeFlag strict_mode, 851 ExtraICState extra_ic_state)
847 KeyedAccessStoreMode store_mode) 852 : StoreStubCompiler(isolate, extra_ic_state, Code::KEYED_STORE_IC) {}
848 : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC),
849 store_mode_(store_mode) { }
850 853
851 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); 854 Handle<Code> CompileStoreElement(Handle<Map> receiver_map);
852 855
853 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, 856 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps,
854 CodeHandleList* handler_stubs, 857 CodeHandleList* handler_stubs,
855 MapHandleList* transitioned_maps); 858 MapHandleList* transitioned_maps);
856 859
857 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); 860 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps);
858 861
859 static void GenerateStoreDictionaryElement(MacroAssembler* masm); 862 static void GenerateStoreDictionaryElement(MacroAssembler* masm);
860 863
861 protected: 864 protected:
862 virtual ExtraICState extra_state() { 865 static Register* registers();
863 return KeyedStoreIC::ComputeExtraICState(strict_mode(), store_mode_); 866
867 KeyedAccessStoreMode store_mode() {
868 return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state());
864 } 869 }
865 static Register* registers();
866 870
867 private: 871 private:
868 Register transition_map() { 872 Register transition_map() {
869 return registers()[3]; 873 return registers()[3];
870 } 874 }
871 875
872 virtual void GenerateNameCheck(Handle<Name> name, 876 virtual void GenerateNameCheck(Handle<Name> name,
873 Register name_reg, 877 Register name_reg,
874 Label* miss); 878 Label* miss);
875 KeyedAccessStoreMode store_mode_;
876 friend class BaseLoadStoreStubCompiler; 879 friend class BaseLoadStoreStubCompiler;
877 }; 880 };
878 881
879 882
880 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call 883 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call
881 // IC stubs. 884 // IC stubs.
882 #define CUSTOM_CALL_IC_GENERATORS(V) \ 885 #define CUSTOM_CALL_IC_GENERATORS(V) \
883 V(ArrayPush) \ 886 V(ArrayPush) \
884 V(ArrayPop) \ 887 V(ArrayPop) \
885 V(StringCharCodeAt) \ 888 V(StringCharCodeAt) \
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 Handle<JSFunction> function, 996 Handle<JSFunction> function,
994 Label* miss); 997 Label* miss);
995 998
996 void GenerateFunctionCheck(Register function, Register scratch, Label* miss); 999 void GenerateFunctionCheck(Register function, Register scratch, Label* miss);
997 1000
998 // Generates a jump to CallIC miss stub. 1001 // Generates a jump to CallIC miss stub.
999 void GenerateMissBranch(); 1002 void GenerateMissBranch();
1000 1003
1001 const ParameterCount arguments_; 1004 const ParameterCount arguments_;
1002 const Code::Kind kind_; 1005 const Code::Kind kind_;
1003 const ExtraICState extra_state_;
1004 const InlineCacheHolderFlag cache_holder_; 1006 const InlineCacheHolderFlag cache_holder_;
1005 }; 1007 };
1006 1008
1007 1009
1008 // Holds information about possible function call optimizations. 1010 // Holds information about possible function call optimizations.
1009 class CallOptimization BASE_EMBEDDED { 1011 class CallOptimization BASE_EMBEDDED {
1010 public: 1012 public:
1011 explicit CallOptimization(LookupResult* lookup); 1013 explicit CallOptimization(LookupResult* lookup);
1012 1014
1013 explicit CallOptimization(Handle<JSFunction> function); 1015 explicit CallOptimization(Handle<JSFunction> function);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 Handle<JSFunction> constant_function_; 1058 Handle<JSFunction> constant_function_;
1057 bool is_simple_api_call_; 1059 bool is_simple_api_call_;
1058 Handle<FunctionTemplateInfo> expected_receiver_type_; 1060 Handle<FunctionTemplateInfo> expected_receiver_type_;
1059 Handle<CallHandlerInfo> api_call_info_; 1061 Handle<CallHandlerInfo> api_call_info_;
1060 }; 1062 };
1061 1063
1062 1064
1063 } } // namespace v8::internal 1065 } } // namespace v8::internal
1064 1066
1065 #endif // V8_STUB_CACHE_H_ 1067 #endif // V8_STUB_CACHE_H_
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698