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

Side by Side Diff: src/code-stubs.h

Issue 491143003: Minor-key-ify CallICStub and CallIC_ArrayStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/arm64/code-stubs-arm64.cc ('k') | src/code-stubs.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 847
848 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; 848 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {};
849 849
850 DISALLOW_COPY_AND_ASSIGN(MathPowStub); 850 DISALLOW_COPY_AND_ASSIGN(MathPowStub);
851 }; 851 };
852 852
853 853
854 class CallICStub: public PlatformCodeStub { 854 class CallICStub: public PlatformCodeStub {
855 public: 855 public:
856 CallICStub(Isolate* isolate, const CallIC::State& state) 856 CallICStub(Isolate* isolate, const CallIC::State& state)
857 : PlatformCodeStub(isolate), state_(state) {} 857 : PlatformCodeStub(isolate) {
858 858 minor_key_ = state.GetExtraICState();
859 bool CallAsMethod() const { return state_.CallAsMethod(); } 859 }
860
861 int arg_count() const { return state_.arg_count(); }
862 860
863 static int ExtractArgcFromMinorKey(int minor_key) { 861 static int ExtractArgcFromMinorKey(int minor_key) {
864 CallIC::State state((ExtraICState) minor_key); 862 CallIC::State state(static_cast<ExtraICState>(minor_key));
865 return state.arg_count(); 863 return state.arg_count();
866 } 864 }
867 865
868 virtual void Generate(MacroAssembler* masm); 866 virtual void Generate(MacroAssembler* masm);
869 867
870 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 868 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::CALL_IC; }
871 return Code::CALL_IC;
872 }
873 869
874 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; } 870 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; }
875 871
876 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { 872 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
877 return state_.GetExtraICState(); 873 return static_cast<ExtraICState>(minor_key_);
878 } 874 }
879 875
880 protected: 876 protected:
881 virtual uint32_t MinorKey() const { return GetExtraICState(); } 877 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; }
882 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
883 878
884 virtual CodeStub::Major MajorKey() const { return CallIC; } 879 int arg_count() const { return state().arg_count(); }
880
881 CallIC::State state() const {
882 return CallIC::State(static_cast<ExtraICState>(minor_key_));
883 }
885 884
886 // Code generation helpers. 885 // Code generation helpers.
887 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); 886 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
888 887
889 const CallIC::State state_; 888 private:
889 virtual CodeStub::Major MajorKey() const { return CallIC; }
890
891 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
892
893 DISALLOW_COPY_AND_ASSIGN(CallICStub);
890 }; 894 };
891 895
892 896
893 class CallIC_ArrayStub: public CallICStub { 897 class CallIC_ArrayStub: public CallICStub {
894 public: 898 public:
895 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) 899 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in)
896 : CallICStub(isolate, state_in) {} 900 : CallICStub(isolate, state_in) {}
897 901
898 virtual void Generate(MacroAssembler* masm); 902 virtual void Generate(MacroAssembler* masm);
899 903
900 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { 904 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE {
901 return MONOMORPHIC; 905 return MONOMORPHIC;
902 } 906 }
903 907
904 protected: 908 private:
905 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 909 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
906 910
907 virtual CodeStub::Major MajorKey() const { return CallIC_Array; } 911 virtual CodeStub::Major MajorKey() const { return CallIC_Array; }
912
913 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub);
mvstanton 2014/08/26 13:04:36 Thanks for catching that :)
908 }; 914 };
909 915
910 916
911 // TODO(verwaest): Translate to hydrogen code stub. 917 // TODO(verwaest): Translate to hydrogen code stub.
912 class FunctionPrototypeStub : public PlatformCodeStub { 918 class FunctionPrototypeStub : public PlatformCodeStub {
913 public: 919 public:
914 explicit FunctionPrototypeStub(Isolate* isolate) 920 explicit FunctionPrototypeStub(Isolate* isolate)
915 : PlatformCodeStub(isolate) {} 921 : PlatformCodeStub(isolate) {}
916 virtual void Generate(MacroAssembler* masm); 922 virtual void Generate(MacroAssembler* masm);
917 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 923 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); 1190 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub);
1185 }; 1191 };
1186 1192
1187 1193
1188 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail 1194 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1189 // call support for stubs in Hydrogen. 1195 // call support for stubs in Hydrogen.
1190 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { 1196 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub {
1191 public: 1197 public:
1192 BinaryOpICWithAllocationSiteStub(Isolate* isolate, 1198 BinaryOpICWithAllocationSiteStub(Isolate* isolate,
1193 const BinaryOpIC::State& state) 1199 const BinaryOpIC::State& state)
1194 : PlatformCodeStub(isolate), state_(state) {} 1200 : PlatformCodeStub(isolate), state_(state) {
1201 minor_key_ = state.GetExtraICState();
1202 }
1195 1203
1196 static void GenerateAheadOfTime(Isolate* isolate); 1204 static void GenerateAheadOfTime(Isolate* isolate);
1197 1205
1198 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { 1206 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) {
1199 Code::FindAndReplacePattern pattern; 1207 Code::FindAndReplacePattern pattern;
1200 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); 1208 pattern.Add(isolate()->factory()->undefined_map(), allocation_site);
1201 return CodeStub::GetCodeCopy(pattern); 1209 return CodeStub::GetCodeCopy(pattern);
1202 } 1210 }
1203 1211
1204 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 1212 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 2553
2546 2554
2547 class CallDescriptors { 2555 class CallDescriptors {
2548 public: 2556 public:
2549 static void InitializeForIsolate(Isolate* isolate); 2557 static void InitializeForIsolate(Isolate* isolate);
2550 }; 2558 };
2551 2559
2552 } } // namespace v8::internal 2560 } } // namespace v8::internal
2553 2561
2554 #endif // V8_CODE_STUBS_H_ 2562 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698