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

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

Issue 451643002: Clean up IC tracing for CallICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments. Created 6 years, 4 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/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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // result in a traversable stack. 176 // result in a traversable stack.
177 virtual bool SometimesSetsUpAFrame() { return true; } 177 virtual bool SometimesSetsUpAFrame() { return true; }
178 178
179 // Lookup the code in the (possibly custom) cache. 179 // Lookup the code in the (possibly custom) cache.
180 bool FindCodeInCache(Code** code_out); 180 bool FindCodeInCache(Code** code_out);
181 181
182 // Returns information for computing the number key. 182 // Returns information for computing the number key.
183 virtual Major MajorKey() const = 0; 183 virtual Major MajorKey() const = 0;
184 virtual int MinorKey() const = 0; 184 virtual int MinorKey() const = 0;
185 185
186 virtual InlineCacheState GetICState() { 186 virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
187 return UNINITIALIZED;
188 }
189 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } 187 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
190 virtual Code::StubType GetStubType() { 188 virtual Code::StubType GetStubType() {
191 return Code::NORMAL; 189 return Code::NORMAL;
192 } 190 }
193 191
194 friend OStream& operator<<(OStream& os, const CodeStub& s) { 192 friend OStream& operator<<(OStream& os, const CodeStub& s) {
195 s.PrintName(os); 193 s.PrintName(os);
196 return os; 194 return os;
197 } 195 }
198 196
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 CallIC::State state((ExtraICState) minor_key); 841 CallIC::State state((ExtraICState) minor_key);
844 return state.arg_count(); 842 return state.arg_count();
845 } 843 }
846 844
847 virtual void Generate(MacroAssembler* masm); 845 virtual void Generate(MacroAssembler* masm);
848 846
849 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 847 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
850 return Code::CALL_IC; 848 return Code::CALL_IC;
851 } 849 }
852 850
853 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { 851 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; }
854 return state_.GetICState();
855 }
856 852
857 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { 853 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
858 return state_.GetExtraICState(); 854 return state_.GetExtraICState();
859 } 855 }
860 856
861 protected: 857 protected:
862 virtual int MinorKey() const { return GetExtraICState(); } 858 virtual int MinorKey() const { return GetExtraICState(); }
863 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 859 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
864 860
865 virtual CodeStub::Major MajorKey() const { return CallIC; } 861 virtual CodeStub::Major MajorKey() const { return CallIC; }
866 862
867 // Code generation helpers. 863 // Code generation helpers.
868 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); 864 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
869 865
870 const CallIC::State state_; 866 const CallIC::State state_;
871 }; 867 };
872 868
873 869
874 class CallIC_ArrayStub: public CallICStub { 870 class CallIC_ArrayStub: public CallICStub {
875 public: 871 public:
876 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) 872 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in)
877 : CallICStub(isolate, state_in) {} 873 : CallICStub(isolate, state_in) {}
878 874
879 virtual void Generate(MacroAssembler* masm); 875 virtual void Generate(MacroAssembler* masm);
880 876
877 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE {
878 return MONOMORPHIC;
879 }
880
881 protected: 881 protected:
882 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 882 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
883 883
884 virtual CodeStub::Major MajorKey() const { return CallIC_Array; } 884 virtual CodeStub::Major MajorKey() const { return CallIC_Array; }
885 }; 885 };
886 886
887 887
888 // TODO(verwaest): Translate to hydrogen code stub. 888 // TODO(verwaest): Translate to hydrogen code stub.
889 class FunctionPrototypeStub : public PlatformCodeStub { 889 class FunctionPrototypeStub : public PlatformCodeStub {
890 public: 890 public:
891 explicit FunctionPrototypeStub(Isolate* isolate) 891 explicit FunctionPrototypeStub(Isolate* isolate)
892 : PlatformCodeStub(isolate) {} 892 : PlatformCodeStub(isolate) {}
893 virtual void Generate(MacroAssembler* masm); 893 virtual void Generate(MacroAssembler* masm);
894 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 894 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
895 895
896 private: 896 private:
897 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; } 897 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; }
898 virtual int MinorKey() const { return 0; } 898 virtual int MinorKey() const { return 0; }
899 }; 899 };
900 900
901 901
902 class HandlerStub : public HydrogenCodeStub { 902 class HandlerStub : public HydrogenCodeStub {
903 public: 903 public:
904 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 904 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
905 virtual ExtraICState GetExtraICState() const { return kind(); } 905 virtual ExtraICState GetExtraICState() const { return kind(); }
906 virtual InlineCacheState GetICState() { return MONOMORPHIC; } 906 virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
907 907
908 virtual void InitializeInterfaceDescriptor( 908 virtual void InitializeInterfaceDescriptor(
909 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 909 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
910 910
911 protected: 911 protected:
912 explicit HandlerStub(Isolate* isolate) 912 explicit HandlerStub(Isolate* isolate)
913 : HydrogenCodeStub(isolate), bit_field_(0) {} 913 : HydrogenCodeStub(isolate), bit_field_(0) {}
914 virtual int NotMissMinorKey() const { return bit_field_; } 914 virtual int NotMissMinorKey() const { return bit_field_; }
915 virtual Code::Kind kind() const = 0; 915 virtual Code::Kind kind() const = 0;
916 int bit_field_; 916 int bit_field_;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1119
1120 virtual void InitializeInterfaceDescriptor( 1120 virtual void InitializeInterfaceDescriptor(
1121 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1121 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1122 1122
1123 static void InstallDescriptors(Isolate* isolate); 1123 static void InstallDescriptors(Isolate* isolate);
1124 1124
1125 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 1125 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
1126 return Code::BINARY_OP_IC; 1126 return Code::BINARY_OP_IC;
1127 } 1127 }
1128 1128
1129 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { 1129 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE {
1130 return state_.GetICState(); 1130 return state_.GetICState();
1131 } 1131 }
1132 1132
1133 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { 1133 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
1134 return state_.GetExtraICState(); 1134 return state_.GetExtraICState();
1135 } 1135 }
1136 1136
1137 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 1137 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
1138 1138
1139 const BinaryOpIC::State& state() const { return state_; } 1139 const BinaryOpIC::State& state() const { return state_; }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { 1172 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) {
1173 Code::FindAndReplacePattern pattern; 1173 Code::FindAndReplacePattern pattern;
1174 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); 1174 pattern.Add(isolate()->factory()->undefined_map(), allocation_site);
1175 return CodeStub::GetCodeCopy(pattern); 1175 return CodeStub::GetCodeCopy(pattern);
1176 } 1176 }
1177 1177
1178 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 1178 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
1179 return Code::BINARY_OP_IC; 1179 return Code::BINARY_OP_IC;
1180 } 1180 }
1181 1181
1182 virtual InlineCacheState GetICState() V8_OVERRIDE { 1182 virtual InlineCacheState GetICState() const V8_OVERRIDE {
1183 return state_.GetICState(); 1183 return state_.GetICState();
1184 } 1184 }
1185 1185
1186 virtual ExtraICState GetExtraICState() const V8_OVERRIDE { 1186 virtual ExtraICState GetExtraICState() const V8_OVERRIDE {
1187 return state_.GetExtraICState(); 1187 return state_.GetExtraICState();
1188 } 1188 }
1189 1189
1190 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1190 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1191 1191
1192 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 1192 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 } 1309 }
1310 1310
1311 virtual void Generate(MacroAssembler* masm); 1311 virtual void Generate(MacroAssembler* masm);
1312 1312
1313 void set_known_map(Handle<Map> map) { known_map_ = map; } 1313 void set_known_map(Handle<Map> map) { known_map_ = map; }
1314 1314
1315 static void DecodeKey(uint32_t stub_key, CompareIC::State* left_state, 1315 static void DecodeKey(uint32_t stub_key, CompareIC::State* left_state,
1316 CompareIC::State* right_state, 1316 CompareIC::State* right_state,
1317 CompareIC::State* handler_state, Token::Value* op); 1317 CompareIC::State* handler_state, Token::Value* op);
1318 1318
1319 virtual InlineCacheState GetICState(); 1319 virtual InlineCacheState GetICState() const;
1320 1320
1321 private: 1321 private:
1322 class OpField: public BitField<int, 0, 3> { }; 1322 class OpField: public BitField<int, 0, 3> { };
1323 class LeftStateField: public BitField<int, 3, 4> { }; 1323 class LeftStateField: public BitField<int, 3, 4> { };
1324 class RightStateField: public BitField<int, 7, 4> { }; 1324 class RightStateField: public BitField<int, 7, 4> { };
1325 class HandlerStateField: public BitField<int, 11, 4> { }; 1325 class HandlerStateField: public BitField<int, 11, 4> { };
1326 1326
1327 virtual CodeStub::Major MajorKey() const { return CompareIC; } 1327 virtual CodeStub::Major MajorKey() const { return CompareIC; }
1328 virtual int MinorKey() const; 1328 virtual int MinorKey() const;
1329 1329
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 1377
1378 virtual void InitializeInterfaceDescriptor( 1378 virtual void InitializeInterfaceDescriptor(
1379 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1379 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1380 1380
1381 static void InstallDescriptors(Isolate* isolate) { 1381 static void InstallDescriptors(Isolate* isolate) {
1382 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); 1382 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED);
1383 compare_stub.InitializeInterfaceDescriptor( 1383 compare_stub.InitializeInterfaceDescriptor(
1384 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1384 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1385 } 1385 }
1386 1386
1387 virtual InlineCacheState GetICState() { 1387 virtual InlineCacheState GetICState() const {
1388 if (state_.Contains(GENERIC)) { 1388 if (state_.Contains(GENERIC)) {
1389 return MEGAMORPHIC; 1389 return MEGAMORPHIC;
1390 } else if (state_.Contains(MONOMORPHIC_MAP)) { 1390 } else if (state_.Contains(MONOMORPHIC_MAP)) {
1391 return MONOMORPHIC; 1391 return MONOMORPHIC;
1392 } else { 1392 } else {
1393 return PREMONOMORPHIC; 1393 return PREMONOMORPHIC;
1394 } 1394 }
1395 } 1395 }
1396 1396
1397 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } 1397 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 1868 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
1869 1869
1870 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 1870 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
1871 1871
1872 virtual void InitializeInterfaceDescriptor( 1872 virtual void InitializeInterfaceDescriptor(
1873 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1873 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1874 1874
1875 static void InstallDescriptors(Isolate* isolate); 1875 static void InstallDescriptors(Isolate* isolate);
1876 1876
1877 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } 1877 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; }
1878 virtual InlineCacheState GetICState() { return GENERIC; } 1878 virtual InlineCacheState GetICState() const { return GENERIC; }
1879 1879
1880 private: 1880 private:
1881 Major MajorKey() const { return KeyedLoadGeneric; } 1881 Major MajorKey() const { return KeyedLoadGeneric; }
1882 int NotMissMinorKey() const { return 0; } 1882 int NotMissMinorKey() const { return 0; }
1883 1883
1884 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); 1884 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub);
1885 }; 1885 };
1886 1886
1887 1887
1888 class DoubleToIStub : public PlatformCodeStub { 1888 class DoubleToIStub : public PlatformCodeStub {
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 stub.InitializeInterfaceDescriptor( 2355 stub.InitializeInterfaceDescriptor(
2356 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); 2356 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean));
2357 } 2357 }
2358 2358
2359 static Handle<Code> GetUninitialized(Isolate* isolate) { 2359 static Handle<Code> GetUninitialized(Isolate* isolate) {
2360 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); 2360 return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
2361 } 2361 }
2362 2362
2363 virtual ExtraICState GetExtraICState() const { return types_.ToIntegral(); } 2363 virtual ExtraICState GetExtraICState() const { return types_.ToIntegral(); }
2364 2364
2365 virtual InlineCacheState GetICState() { 2365 virtual InlineCacheState GetICState() const {
2366 if (types_.IsEmpty()) { 2366 if (types_.IsEmpty()) {
2367 return ::v8::internal::UNINITIALIZED; 2367 return ::v8::internal::UNINITIALIZED;
2368 } else { 2368 } else {
2369 return MONOMORPHIC; 2369 return MONOMORPHIC;
2370 } 2370 }
2371 } 2371 }
2372 2372
2373 private: 2373 private:
2374 Major MajorKey() const { return ToBoolean; } 2374 Major MajorKey() const { return ToBoolean; }
2375 int NotMissMinorKey() const { return GetExtraICState(); } 2375 int NotMissMinorKey() const { return GetExtraICState(); }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 2510
2511 2511
2512 class CallDescriptors { 2512 class CallDescriptors {
2513 public: 2513 public:
2514 static void InitializeForIsolate(Isolate* isolate); 2514 static void InitializeForIsolate(Isolate* isolate);
2515 }; 2515 };
2516 2516
2517 } } // namespace v8::internal 2517 } } // namespace v8::internal
2518 2518
2519 #endif // V8_CODE_STUBS_H_ 2519 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698