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

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

Issue 8337008: Handlify upper layers of LoadIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix cast style. Created 9 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 | « src/runtime.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 struct Entry { 69 struct Entry {
70 String* key; 70 String* key;
71 Code* value; 71 Code* value;
72 }; 72 };
73 73
74 void Initialize(bool create_heap_objects); 74 void Initialize(bool create_heap_objects);
75 75
76 76
77 // Computes the right stub matching. Inserts the result in the 77 // Computes the right stub matching. Inserts the result in the
78 // cache before returning. This might compile a stub if needed. 78 // cache before returning. This might compile a stub if needed.
79 MUST_USE_RESULT MaybeObject* ComputeLoadNonexistent( 79 Handle<Code> ComputeLoadNonexistent(Handle<String> name,
80 String* name, 80 Handle<JSObject> receiver);
81 JSObject* receiver);
82 81
83 MUST_USE_RESULT MaybeObject* ComputeLoadField(String* name, 82 Handle<Code> ComputeLoadField(Handle<String> name,
84 JSObject* receiver, 83 Handle<JSObject> receiver,
85 JSObject* holder, 84 Handle<JSObject> holder,
86 int field_index); 85 int field_index);
87 86
88 MUST_USE_RESULT MaybeObject* ComputeLoadCallback( 87 Handle<Code> ComputeLoadCallback(Handle<String> name,
89 String* name, 88 Handle<JSObject> receiver,
90 JSObject* receiver, 89 Handle<JSObject> holder,
91 JSObject* holder, 90 Handle<AccessorInfo> callback);
92 AccessorInfo* callback);
93 91
94 MUST_USE_RESULT MaybeObject* ComputeLoadConstant(String* name, 92 Handle<Code> ComputeLoadConstant(Handle<String> name,
95 JSObject* receiver, 93 Handle<JSObject> receiver,
96 JSObject* holder, 94 Handle<JSObject> holder,
97 Object* value); 95 Handle<Object> value);
98 96
99 MUST_USE_RESULT MaybeObject* ComputeLoadInterceptor( 97 Handle<Code> ComputeLoadInterceptor(Handle<String> name,
100 String* name, 98 Handle<JSObject> receiver,
101 JSObject* receiver, 99 Handle<JSObject> holder);
102 JSObject* holder);
103 100
104 MUST_USE_RESULT MaybeObject* ComputeLoadNormal(); 101 Handle<Code> ComputeLoadNormal();
105 102
106 103 Handle<Code> ComputeLoadGlobal(Handle<String> name,
107 MUST_USE_RESULT MaybeObject* ComputeLoadGlobal( 104 Handle<JSObject> receiver,
108 String* name, 105 Handle<GlobalObject> holder,
109 JSObject* receiver, 106 Handle<JSGlobalPropertyCell> cell,
110 GlobalObject* holder, 107 bool is_dont_delete);
111 JSGlobalPropertyCell* cell,
112 bool is_dont_delete);
113
114 108
115 // --- 109 // ---
116 110
117 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadField(String* name, 111 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadField(String* name,
118 JSObject* receiver, 112 JSObject* receiver,
119 JSObject* holder, 113 JSObject* holder,
120 int field_index); 114 int field_index);
121 115
122 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadCallback( 116 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadCallback(
123 String* name, 117 String* name,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 switch (table) { 317 switch (table) {
324 case StubCache::kPrimary: return StubCache::primary_; 318 case StubCache::kPrimary: return StubCache::primary_;
325 case StubCache::kSecondary: return StubCache::secondary_; 319 case StubCache::kSecondary: return StubCache::secondary_;
326 } 320 }
327 UNREACHABLE(); 321 UNREACHABLE();
328 return NULL; 322 return NULL;
329 } 323 }
330 324
331 Isolate* isolate() { return isolate_; } 325 Isolate* isolate() { return isolate_; }
332 Heap* heap() { return isolate()->heap(); } 326 Heap* heap() { return isolate()->heap(); }
327 Factory* factory() { return isolate()->factory(); }
333 328
334 private: 329 private:
335 explicit StubCache(Isolate* isolate); 330 explicit StubCache(Isolate* isolate);
336 331
337 friend class Isolate; 332 friend class Isolate;
338 friend class SCTableReference; 333 friend class SCTableReference;
339 static const int kPrimaryTableSize = 2048; 334 static const int kPrimaryTableSize = 2048;
340 static const int kSecondaryTableSize = 512; 335 static const int kSecondaryTableSize = 512;
341 Entry primary_[kPrimaryTableSize]; 336 Entry primary_[kPrimaryTableSize];
342 Entry secondary_[kSecondaryTableSize]; 337 Entry secondary_[kSecondaryTableSize];
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad); 398 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad);
404 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall); 399 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall);
405 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty); 400 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty);
406 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CallInterceptorProperty); 401 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CallInterceptorProperty);
407 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor); 402 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor);
408 403
409 404
410 // The stub compiler compiles stubs for the stub cache. 405 // The stub compiler compiles stubs for the stub cache.
411 class StubCompiler BASE_EMBEDDED { 406 class StubCompiler BASE_EMBEDDED {
412 public: 407 public:
413 StubCompiler() 408 explicit StubCompiler(Isolate* isolate)
414 : scope_(), masm_(Isolate::Current(), NULL, 256), failure_(NULL) { } 409 : isolate_(isolate), masm_(isolate, NULL, 256), failure_(NULL) { }
415 410
416 MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags); 411 MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags);
417 MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags); 412 MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags);
418 MUST_USE_RESULT MaybeObject* CompileCallNormal(Code::Flags flags); 413 MUST_USE_RESULT MaybeObject* CompileCallNormal(Code::Flags flags);
419 MUST_USE_RESULT MaybeObject* CompileCallMegamorphic(Code::Flags flags); 414 MUST_USE_RESULT MaybeObject* CompileCallMegamorphic(Code::Flags flags);
420 MUST_USE_RESULT MaybeObject* CompileCallArguments(Code::Flags flags); 415 MUST_USE_RESULT MaybeObject* CompileCallArguments(Code::Flags flags);
421 MUST_USE_RESULT MaybeObject* CompileCallMiss(Code::Flags flags); 416 MUST_USE_RESULT MaybeObject* CompileCallMiss(Code::Flags flags);
422 #ifdef ENABLE_DEBUGGER_SUPPORT 417 #ifdef ENABLE_DEBUGGER_SUPPORT
423 MUST_USE_RESULT MaybeObject* CompileCallDebugBreak(Code::Flags flags); 418 MUST_USE_RESULT MaybeObject* CompileCallDebugBreak(Code::Flags flags);
424 MUST_USE_RESULT MaybeObject* CompileCallDebugPrepareStepIn(Code::Flags flags); 419 MUST_USE_RESULT MaybeObject* CompileCallDebugPrepareStepIn(Code::Flags flags);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 Register scratch1, 555 Register scratch1,
561 Register scratch2, 556 Register scratch2,
562 Register scratch3, 557 Register scratch3,
563 String* name, 558 String* name,
564 Label* miss); 559 Label* miss);
565 560
566 static void LookupPostInterceptor(JSObject* holder, 561 static void LookupPostInterceptor(JSObject* holder,
567 String* name, 562 String* name,
568 LookupResult* lookup); 563 LookupResult* lookup);
569 564
570 Isolate* isolate() { return scope_.isolate(); } 565 Isolate* isolate() { return isolate_; }
571 Heap* heap() { return isolate()->heap(); } 566 Heap* heap() { return isolate()->heap(); }
572 Factory* factory() { return isolate()->factory(); } 567 Factory* factory() { return isolate()->factory(); }
573 568
574 private: 569 private:
575 HandleScope scope_; 570 Isolate* isolate_;
576 MacroAssembler masm_; 571 MacroAssembler masm_;
577 Failure* failure_; 572 Failure* failure_;
578 }; 573 };
579 574
580 575
581 class LoadStubCompiler: public StubCompiler { 576 class LoadStubCompiler: public StubCompiler {
582 public: 577 public:
578 explicit LoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
579
580 Handle<Code> CompileLoadNonexistent(Handle<String> name,
581 Handle<JSObject> object,
582 Handle<JSObject> last);
583
583 MUST_USE_RESULT MaybeObject* CompileLoadNonexistent(String* name, 584 MUST_USE_RESULT MaybeObject* CompileLoadNonexistent(String* name,
584 JSObject* object, 585 JSObject* object,
585 JSObject* last); 586 JSObject* last);
586 587
588 Handle<Code> CompileLoadField(Handle<JSObject> object,
589 Handle<JSObject> holder,
590 int index,
591 Handle<String> name);
592
587 MUST_USE_RESULT MaybeObject* CompileLoadField(JSObject* object, 593 MUST_USE_RESULT MaybeObject* CompileLoadField(JSObject* object,
588 JSObject* holder, 594 JSObject* holder,
589 int index, 595 int index,
590 String* name); 596 String* name);
591 597
598 Handle<Code> CompileLoadCallback(Handle<String> name,
599 Handle<JSObject> object,
600 Handle<JSObject> holder,
601 Handle<AccessorInfo> callback);
602
592 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name, 603 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name,
593 JSObject* object, 604 JSObject* object,
594 JSObject* holder, 605 JSObject* holder,
595 AccessorInfo* callback); 606 AccessorInfo* callback);
596 607
608 Handle<Code> CompileLoadConstant(Handle<JSObject> object,
609 Handle<JSObject> holder,
610 Handle<Object> value,
611 Handle<String> name);
612
597 MUST_USE_RESULT MaybeObject* CompileLoadConstant(JSObject* object, 613 MUST_USE_RESULT MaybeObject* CompileLoadConstant(JSObject* object,
598 JSObject* holder, 614 JSObject* holder,
599 Object* value, 615 Object* value,
600 String* name); 616 String* name);
601 617
618 Handle<Code> CompileLoadInterceptor(Handle<JSObject> object,
619 Handle<JSObject> holder,
620 Handle<String> name);
621
602 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, 622 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object,
603 JSObject* holder, 623 JSObject* holder,
604 String* name); 624 String* name);
605 625
626 Handle<Code> CompileLoadGlobal(Handle<JSObject> object,
627 Handle<GlobalObject> holder,
628 Handle<JSGlobalPropertyCell> cell,
629 Handle<String> name,
630 bool is_dont_delete);
631
606 MUST_USE_RESULT MaybeObject* CompileLoadGlobal(JSObject* object, 632 MUST_USE_RESULT MaybeObject* CompileLoadGlobal(JSObject* object,
607 GlobalObject* holder, 633 GlobalObject* holder,
608 JSGlobalPropertyCell* cell, 634 JSGlobalPropertyCell* cell,
609 String* name, 635 String* name,
610 bool is_dont_delete); 636 bool is_dont_delete);
611 637
612 private: 638 private:
613 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); 639 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name);
614 }; 640 };
615 641
616 642
617 class KeyedLoadStubCompiler: public StubCompiler { 643 class KeyedLoadStubCompiler: public StubCompiler {
618 public: 644 public:
645 explicit KeyedLoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
619 MUST_USE_RESULT MaybeObject* CompileLoadField(String* name, 646 MUST_USE_RESULT MaybeObject* CompileLoadField(String* name,
620 JSObject* object, 647 JSObject* object,
621 JSObject* holder, 648 JSObject* holder,
622 int index); 649 int index);
623 650
624 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name, 651 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name,
625 JSObject* object, 652 JSObject* object,
626 JSObject* holder, 653 JSObject* holder,
627 AccessorInfo* callback); 654 AccessorInfo* callback);
628 655
(...skipping 27 matching lines...) Expand all
656 683
657 private: 684 private:
658 MaybeObject* GetCode(PropertyType type, 685 MaybeObject* GetCode(PropertyType type,
659 String* name, 686 String* name,
660 InlineCacheState state = MONOMORPHIC); 687 InlineCacheState state = MONOMORPHIC);
661 }; 688 };
662 689
663 690
664 class StoreStubCompiler: public StubCompiler { 691 class StoreStubCompiler: public StubCompiler {
665 public: 692 public:
666 explicit StoreStubCompiler(StrictModeFlag strict_mode) 693 StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode)
667 : strict_mode_(strict_mode) { } 694 : StubCompiler(isolate), strict_mode_(strict_mode) { }
668 695
669 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, 696 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
670 int index, 697 int index,
671 Map* transition, 698 Map* transition,
672 String* name); 699 String* name);
673 700
674 MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object, 701 MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object,
675 AccessorInfo* callbacks, 702 AccessorInfo* callbacks,
676 String* name); 703 String* name);
677 MUST_USE_RESULT MaybeObject* CompileStoreInterceptor(JSObject* object, 704 MUST_USE_RESULT MaybeObject* CompileStoreInterceptor(JSObject* object,
678 String* name); 705 String* name);
679 MUST_USE_RESULT MaybeObject* CompileStoreGlobal(GlobalObject* object, 706 MUST_USE_RESULT MaybeObject* CompileStoreGlobal(GlobalObject* object,
680 JSGlobalPropertyCell* holder, 707 JSGlobalPropertyCell* holder,
681 String* name); 708 String* name);
682 709
683 710
684 private: 711 private:
685 MaybeObject* GetCode(PropertyType type, String* name); 712 MaybeObject* GetCode(PropertyType type, String* name);
686 713
687 StrictModeFlag strict_mode_; 714 StrictModeFlag strict_mode_;
688 }; 715 };
689 716
690 717
691 class KeyedStoreStubCompiler: public StubCompiler { 718 class KeyedStoreStubCompiler: public StubCompiler {
692 public: 719 public:
693 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) 720 KeyedStoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode)
694 : strict_mode_(strict_mode) { } 721 : StubCompiler(isolate), strict_mode_(strict_mode) { }
695 722
696 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, 723 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
697 int index, 724 int index,
698 Map* transition, 725 Map* transition,
699 String* name); 726 String* name);
700 727
701 MUST_USE_RESULT MaybeObject* CompileStoreElement(Map* receiver_map); 728 MUST_USE_RESULT MaybeObject* CompileStoreElement(Map* receiver_map);
702 729
703 MUST_USE_RESULT MaybeObject* CompileStorePolymorphic( 730 MUST_USE_RESULT MaybeObject* CompileStorePolymorphic(
704 MapList* receiver_maps, 731 MapList* receiver_maps,
(...skipping 30 matching lines...) Expand all
735 V(StringCharAt) \ 762 V(StringCharAt) \
736 V(StringFromCharCode) \ 763 V(StringFromCharCode) \
737 V(MathFloor) \ 764 V(MathFloor) \
738 V(MathAbs) 765 V(MathAbs)
739 766
740 767
741 class CallOptimization; 768 class CallOptimization;
742 769
743 class CallStubCompiler: public StubCompiler { 770 class CallStubCompiler: public StubCompiler {
744 public: 771 public:
745 CallStubCompiler(int argc, 772 CallStubCompiler(Isolate* isolate,
773 int argc,
746 Code::Kind kind, 774 Code::Kind kind,
747 Code::ExtraICState extra_ic_state, 775 Code::ExtraICState extra_ic_state,
748 InlineCacheHolderFlag cache_holder); 776 InlineCacheHolderFlag cache_holder);
749 777
750 MUST_USE_RESULT MaybeObject* CompileCallField( 778 MUST_USE_RESULT MaybeObject* CompileCallField(
751 JSObject* object, 779 JSObject* object,
752 JSObject* holder, 780 JSObject* holder,
753 int index, 781 int index,
754 String* name); 782 String* name);
755 783
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 Label* miss); 856 Label* miss);
829 857
830 // Generates a jump to CallIC miss stub. Returns Failure if the jump cannot 858 // Generates a jump to CallIC miss stub. Returns Failure if the jump cannot
831 // be generated. 859 // be generated.
832 MUST_USE_RESULT MaybeObject* GenerateMissBranch(); 860 MUST_USE_RESULT MaybeObject* GenerateMissBranch();
833 }; 861 };
834 862
835 863
836 class ConstructStubCompiler: public StubCompiler { 864 class ConstructStubCompiler: public StubCompiler {
837 public: 865 public:
838 explicit ConstructStubCompiler() {} 866 explicit ConstructStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
839 867
840 MUST_USE_RESULT MaybeObject* CompileConstructStub(JSFunction* function); 868 MUST_USE_RESULT MaybeObject* CompileConstructStub(JSFunction* function);
841 869
842 private: 870 private:
843 MaybeObject* GetCode(); 871 MaybeObject* GetCode();
844 }; 872 };
845 873
846 874
847 // Holds information about possible function call optimizations. 875 // Holds information about possible function call optimizations.
848 class CallOptimization BASE_EMBEDDED { 876 class CallOptimization BASE_EMBEDDED {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 JSFunction* constant_function_; 917 JSFunction* constant_function_;
890 bool is_simple_api_call_; 918 bool is_simple_api_call_;
891 FunctionTemplateInfo* expected_receiver_type_; 919 FunctionTemplateInfo* expected_receiver_type_;
892 CallHandlerInfo* api_call_info_; 920 CallHandlerInfo* api_call_info_;
893 }; 921 };
894 922
895 923
896 } } // namespace v8::internal 924 } } // namespace v8::internal
897 925
898 #endif // V8_STUB_CACHE_H_ 926 #endif // V8_STUB_CACHE_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698