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

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

Issue 544123002: Do not cache CodeStubInterfaceDescriptor on the isolate. (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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #define CODE_STUB_LIST(V) \ 126 #define CODE_STUB_LIST(V) \
127 CODE_STUB_LIST_ALL_PLATFORMS(V) \ 127 CODE_STUB_LIST_ALL_PLATFORMS(V) \
128 CODE_STUB_LIST_ARM(V) \ 128 CODE_STUB_LIST_ARM(V) \
129 CODE_STUB_LIST_ARM64(V) \ 129 CODE_STUB_LIST_ARM64(V) \
130 CODE_STUB_LIST_MIPS(V) 130 CODE_STUB_LIST_MIPS(V)
131 131
132 // Stub is base classes of all stubs. 132 // Stub is base classes of all stubs.
133 class CodeStub BASE_EMBEDDED { 133 class CodeStub BASE_EMBEDDED {
134 public: 134 public:
135 enum Major { 135 enum Major {
136 UninitializedMajorKey = 0,
mvstanton 2014/09/05 13:38:43 yay, this is gone! :)
137 #define DEF_ENUM(name) name, 136 #define DEF_ENUM(name) name,
138 CODE_STUB_LIST(DEF_ENUM) 137 CODE_STUB_LIST(DEF_ENUM)
139 #undef DEF_ENUM 138 #undef DEF_ENUM
140 NoCache, // marker for stubs that do custom caching 139 NoCache, // marker for stubs that do custom caching
141 NUMBER_OF_IDS 140 NUMBER_OF_IDS
142 }; 141 };
143 142
144 // Retrieve the code for the stub. Generate the code if needed. 143 // Retrieve the code for the stub. Generate the code if needed.
145 Handle<Code> GetCode(); 144 Handle<Code> GetCode();
146 145
(...skipping 26 matching lines...) Expand all
173 // GC. This means that we must be statically sure that no GC can occur while 172 // GC. This means that we must be statically sure that no GC can occur while
174 // they are running. If that is the case they should override this to return 173 // they are running. If that is the case they should override this to return
175 // true, which will cause an assertion if we try to call something that can 174 // true, which will cause an assertion if we try to call something that can
176 // GC or if we try to put a stack frame on top of the junk, which would not 175 // GC or if we try to put a stack frame on top of the junk, which would not
177 // result in a traversable stack. 176 // result in a traversable stack.
178 virtual bool SometimesSetsUpAFrame() { return true; } 177 virtual bool SometimesSetsUpAFrame() { return true; }
179 178
180 // Lookup the code in the (possibly custom) cache. 179 // Lookup the code in the (possibly custom) cache.
181 bool FindCodeInCache(Code** code_out); 180 bool FindCodeInCache(Code** code_out);
182 181
182 virtual void InitializeInterfaceDescriptor(
183 CodeStubInterfaceDescriptor* descriptor) {}
184
185 static void InitializeInterfaceDescriptor(Isolate* isolate, uint32_t key,
186 CodeStubInterfaceDescriptor* desc);
187
183 // Returns information for computing the number key. 188 // Returns information for computing the number key.
184 virtual Major MajorKey() const = 0; 189 virtual Major MajorKey() const = 0;
185 uint32_t MinorKey() const { return minor_key_; } 190 uint32_t MinorKey() const { return minor_key_; }
186 191
187 virtual InlineCacheState GetICState() const { return UNINITIALIZED; } 192 virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
188 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } 193 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
189 virtual Code::StubType GetStubType() { 194 virtual Code::StubType GetStubType() {
190 return Code::NORMAL; 195 return Code::NORMAL;
191 } 196 }
192 197
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 virtual void AddToSpecialCache(Handle<Code> new_object) { } 246 virtual void AddToSpecialCache(Handle<Code> new_object) { }
242 247
243 // Find code in a specialized cache, work is delegated to the specific stub. 248 // Find code in a specialized cache, work is delegated to the specific stub.
244 virtual bool FindCodeInSpecialCache(Code** code_out) { 249 virtual bool FindCodeInSpecialCache(Code** code_out) {
245 return false; 250 return false;
246 } 251 }
247 252
248 // If a stub uses a special cache override this. 253 // If a stub uses a special cache override this.
249 virtual bool UseSpecialCache() { return false; } 254 virtual bool UseSpecialCache() { return false; }
250 255
256 // We use this dispatch to statically instantiate the correct code stub for
257 // the given stub key and call the passed function with that code stub.
258 typedef void (*DispatchedCall)(CodeStub* stub, void** value_out);
259 static void Dispatch(Isolate* isolate, uint32_t key, void** value_out,
260 DispatchedCall call);
261
251 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits)); 262 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits));
252 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; 263 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {};
253 class MinorKeyBits: public BitField<uint32_t, 264 class MinorKeyBits: public BitField<uint32_t,
254 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT 265 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT
255 266
256 friend class BreakPointIterator; 267 friend class BreakPointIterator;
257 268
258 Isolate* isolate_; 269 Isolate* isolate_;
259 }; 270 };
260 271
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 430
420 class HydrogenCodeStub : public CodeStub { 431 class HydrogenCodeStub : public CodeStub {
421 public: 432 public:
422 enum InitializationState { 433 enum InitializationState {
423 UNINITIALIZED, 434 UNINITIALIZED,
424 INITIALIZED 435 INITIALIZED
425 }; 436 };
426 437
427 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 438 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
428 439
429 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() {
430 return isolate()->code_stub_interface_descriptor(MajorKey());
431 }
432
433 template<class SubClass> 440 template<class SubClass>
434 static Handle<Code> GetUninitialized(Isolate* isolate) { 441 static Handle<Code> GetUninitialized(Isolate* isolate) {
435 SubClass::GenerateAheadOfTime(isolate); 442 SubClass::GenerateAheadOfTime(isolate);
436 return SubClass().GetCode(isolate); 443 return SubClass().GetCode(isolate);
437 } 444 }
438 445
439 virtual void InitializeInterfaceDescriptor(
440 CodeStubInterfaceDescriptor* descriptor) = 0;
441
442 // Retrieve the code for the stub. Generate the code if needed. 446 // Retrieve the code for the stub. Generate the code if needed.
443 virtual Handle<Code> GenerateCode() = 0; 447 virtual Handle<Code> GenerateCode() = 0;
444 448
445 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } 449 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); }
446 450
447 Handle<Code> GenerateLightweightMissCode(); 451 Handle<Code> GenerateLightweightMissCode();
448 452
449 template<class StateType> 453 template<class StateType>
450 void TraceTransition(StateType from, StateType to); 454 void TraceTransition(StateType from, StateType to);
451 455
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 virtual void BeforeCall(MacroAssembler* masm) const {} 539 virtual void BeforeCall(MacroAssembler* masm) const {}
536 540
537 virtual void AfterCall(MacroAssembler* masm) const {} 541 virtual void AfterCall(MacroAssembler* masm) const {}
538 }; 542 };
539 543
540 544
541 class ToNumberStub: public HydrogenCodeStub { 545 class ToNumberStub: public HydrogenCodeStub {
542 public: 546 public:
543 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } 547 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
544 548
545 static void InstallDescriptors(Isolate* isolate) {
546 ToNumberStub stub(isolate);
547 stub.InitializeInterfaceDescriptor(
548 isolate->code_stub_interface_descriptor(CodeStub::ToNumber));
549 }
550
551 DEFINE_HYDROGEN_CODE_STUB(ToNumber, HydrogenCodeStub); 549 DEFINE_HYDROGEN_CODE_STUB(ToNumber, HydrogenCodeStub);
552 }; 550 };
553 551
554 552
555 class NumberToStringStub FINAL : public HydrogenCodeStub { 553 class NumberToStringStub FINAL : public HydrogenCodeStub {
556 public: 554 public:
557 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 555 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
558 556
559 static void InstallDescriptors(Isolate* isolate);
560
561 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 557 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
562 static const int kNumber = 0; 558 static const int kNumber = 0;
563 559
564 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); 560 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub);
565 }; 561 };
566 562
567 563
568 class FastNewClosureStub : public HydrogenCodeStub { 564 class FastNewClosureStub : public HydrogenCodeStub {
569 public: 565 public:
570 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, 566 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode,
571 bool is_generator) 567 bool is_generator)
572 : HydrogenCodeStub(isolate) { 568 : HydrogenCodeStub(isolate) {
573 set_sub_minor_key(StrictModeBits::encode(strict_mode) | 569 set_sub_minor_key(StrictModeBits::encode(strict_mode) |
574 IsGeneratorBits::encode(is_generator)); 570 IsGeneratorBits::encode(is_generator));
575 } 571 }
576 572
577 static void InstallDescriptors(Isolate* isolate);
578
579 StrictMode strict_mode() const { 573 StrictMode strict_mode() const {
580 return StrictModeBits::decode(sub_minor_key()); 574 return StrictModeBits::decode(sub_minor_key());
581 } 575 }
582 576
583 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } 577 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); }
584 578
585 private: 579 private:
586 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; 580 class StrictModeBits : public BitField<StrictMode, 0, 1> {};
587 class IsGeneratorBits : public BitField<bool, 1, 1> {}; 581 class IsGeneratorBits : public BitField<bool, 1, 1> {};
588 582
589 DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub); 583 DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub);
590 }; 584 };
591 585
592 586
593 class FastNewContextStub FINAL : public HydrogenCodeStub { 587 class FastNewContextStub FINAL : public HydrogenCodeStub {
594 public: 588 public:
595 static const int kMaximumSlots = 64; 589 static const int kMaximumSlots = 64;
596 590
597 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { 591 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) {
598 DCHECK(slots > 0 && slots <= kMaximumSlots); 592 DCHECK(slots > 0 && slots <= kMaximumSlots);
599 set_sub_minor_key(SlotsBits::encode(slots)); 593 set_sub_minor_key(SlotsBits::encode(slots));
600 } 594 }
601 595
602 static void InstallDescriptors(Isolate* isolate);
603
604 int slots() const { return SlotsBits::decode(sub_minor_key()); } 596 int slots() const { return SlotsBits::decode(sub_minor_key()); }
605 597
606 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 598 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
607 static const int kFunction = 0; 599 static const int kFunction = 0;
608 600
609 private: 601 private:
610 class SlotsBits : public BitField<int, 0, 8> {}; 602 class SlotsBits : public BitField<int, 0, 8> {};
611 603
612 DEFINE_HYDROGEN_CODE_STUB(FastNewContext, HydrogenCodeStub); 604 DEFINE_HYDROGEN_CODE_STUB(FastNewContext, HydrogenCodeStub);
613 }; 605 };
614 606
615 607
616 class FastCloneShallowArrayStub : public HydrogenCodeStub { 608 class FastCloneShallowArrayStub : public HydrogenCodeStub {
617 public: 609 public:
618 FastCloneShallowArrayStub(Isolate* isolate, 610 FastCloneShallowArrayStub(Isolate* isolate,
619 AllocationSiteMode allocation_site_mode) 611 AllocationSiteMode allocation_site_mode)
620 : HydrogenCodeStub(isolate) { 612 : HydrogenCodeStub(isolate) {
621 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); 613 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode));
622 } 614 }
623 615
624 AllocationSiteMode allocation_site_mode() const { 616 AllocationSiteMode allocation_site_mode() const {
625 return AllocationSiteModeBits::decode(sub_minor_key()); 617 return AllocationSiteModeBits::decode(sub_minor_key());
626 } 618 }
627 619
628 static void InstallDescriptors(Isolate* isolate);
629
630 private: 620 private:
631 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 621 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
632 622
633 DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub); 623 DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub);
634 }; 624 };
635 625
636 626
637 class FastCloneShallowObjectStub : public HydrogenCodeStub { 627 class FastCloneShallowObjectStub : public HydrogenCodeStub {
638 public: 628 public:
639 // Maximum number of properties in copied object. 629 // Maximum number of properties in copied object.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 FieldIndex index() const { 914 FieldIndex index() const {
925 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); 915 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
926 return FieldIndex::FromFieldAccessStubKey(property_index_key); 916 return FieldIndex::FromFieldAccessStubKey(property_index_key);
927 } 917 }
928 918
929 Representation representation() { 919 Representation representation() {
930 uint8_t repr = RepresentationBits::decode(sub_minor_key()); 920 uint8_t repr = RepresentationBits::decode(sub_minor_key());
931 return PropertyDetails::DecodeRepresentation(repr); 921 return PropertyDetails::DecodeRepresentation(repr);
932 } 922 }
933 923
934 static void InstallDescriptors(Isolate* isolate);
935
936 protected: 924 protected:
937 virtual Code::Kind kind() const { return Code::STORE_IC; } 925 virtual Code::Kind kind() const { return Code::STORE_IC; }
938 virtual Code::StubType GetStubType() { return Code::FAST; } 926 virtual Code::StubType GetStubType() { return Code::FAST; }
939 927
940 private: 928 private:
941 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; 929 class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
942 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; 930 class RepresentationBits : public BitField<uint8_t, 13, 4> {};
943 931
944 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); 932 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub);
945 }; 933 };
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 set_sub_minor_key(state.GetExtraICState()); 1033 set_sub_minor_key(state.GetExtraICState());
1046 } 1034 }
1047 1035
1048 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) 1036 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
1049 : HydrogenCodeStub(isolate) { 1037 : HydrogenCodeStub(isolate) {
1050 set_sub_minor_key(state.GetExtraICState()); 1038 set_sub_minor_key(state.GetExtraICState());
1051 } 1039 }
1052 1040
1053 static void GenerateAheadOfTime(Isolate* isolate); 1041 static void GenerateAheadOfTime(Isolate* isolate);
1054 1042
1055 static void InstallDescriptors(Isolate* isolate);
1056
1057 virtual Code::Kind GetCodeKind() const OVERRIDE { 1043 virtual Code::Kind GetCodeKind() const OVERRIDE {
1058 return Code::BINARY_OP_IC; 1044 return Code::BINARY_OP_IC;
1059 } 1045 }
1060 1046
1061 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 1047 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
1062 return state().GetICState(); 1048 return state().GetICState();
1063 } 1049 }
1064 1050
1065 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1051 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1066 return static_cast<ExtraICState>(sub_minor_key()); 1052 return static_cast<ExtraICState>(sub_minor_key());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 public: 1118 public:
1133 BinaryOpWithAllocationSiteStub(Isolate* isolate, 1119 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1134 Token::Value op, 1120 Token::Value op,
1135 OverwriteMode mode) 1121 OverwriteMode mode)
1136 : BinaryOpICStub(isolate, op, mode) {} 1122 : BinaryOpICStub(isolate, op, mode) {}
1137 1123
1138 BinaryOpWithAllocationSiteStub(Isolate* isolate, 1124 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1139 const BinaryOpIC::State& state) 1125 const BinaryOpIC::State& state)
1140 : BinaryOpICStub(isolate, state) {} 1126 : BinaryOpICStub(isolate, state) {}
1141 1127
1142 static void InstallDescriptors(Isolate* isolate);
1143
1144 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { 1128 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE {
1145 return Code::STUB; 1129 return Code::STUB;
1146 } 1130 }
1147 1131
1148 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1132 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1149 static const int kAllocationSite = 0; 1133 static const int kAllocationSite = 0;
1150 static const int kLeft = 1; 1134 static const int kLeft = 1;
1151 static const int kRight = 2; 1135 static const int kRight = 2;
1152 1136
1153 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); 1137 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub);
(...skipping 22 matching lines...) Expand all
1176 } 1160 }
1177 1161
1178 StringAddFlags flags() const { 1162 StringAddFlags flags() const {
1179 return StringAddFlagsBits::decode(sub_minor_key()); 1163 return StringAddFlagsBits::decode(sub_minor_key());
1180 } 1164 }
1181 1165
1182 PretenureFlag pretenure_flag() const { 1166 PretenureFlag pretenure_flag() const {
1183 return PretenureFlagBits::decode(sub_minor_key()); 1167 return PretenureFlagBits::decode(sub_minor_key());
1184 } 1168 }
1185 1169
1186 static void InstallDescriptors(Isolate* isolate);
1187
1188 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1170 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1189 static const int kLeft = 0; 1171 static const int kLeft = 0;
1190 static const int kRight = 1; 1172 static const int kRight = 1;
1191 1173
1192 private: 1174 private:
1193 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; 1175 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1194 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; 1176 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1195 1177
1196 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT 1178 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
1197 1179
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 InitializationState init_state = INITIALIZED) 1247 InitializationState init_state = INITIALIZED)
1266 : HydrogenCodeStub(isolate, init_state) { 1248 : HydrogenCodeStub(isolate, init_state) {
1267 set_sub_minor_key(ic_state); 1249 set_sub_minor_key(ic_state);
1268 } 1250 }
1269 1251
1270 static Handle<Code> GetUninitialized(Isolate* isolate, 1252 static Handle<Code> GetUninitialized(Isolate* isolate,
1271 NilValue nil) { 1253 NilValue nil) {
1272 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); 1254 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
1273 } 1255 }
1274 1256
1275 static void InstallDescriptors(Isolate* isolate) {
1276 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED);
1277 compare_stub.InitializeInterfaceDescriptor(
1278 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1279 }
1280
1281 virtual InlineCacheState GetICState() const { 1257 virtual InlineCacheState GetICState() const {
1282 State state = this->state(); 1258 State state = this->state();
1283 if (state.Contains(GENERIC)) { 1259 if (state.Contains(GENERIC)) {
1284 return MEGAMORPHIC; 1260 return MEGAMORPHIC;
1285 } else if (state.Contains(MONOMORPHIC_MAP)) { 1261 } else if (state.Contains(MONOMORPHIC_MAP)) {
1286 return MONOMORPHIC; 1262 return MONOMORPHIC;
1287 } else { 1263 } else {
1288 return PREMONOMORPHIC; 1264 return PREMONOMORPHIC;
1289 } 1265 }
1290 } 1266 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1419
1444 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); 1420 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
1445 }; 1421 };
1446 1422
1447 1423
1448 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { 1424 class RegExpConstructResultStub FINAL : public HydrogenCodeStub {
1449 public: 1425 public:
1450 explicit RegExpConstructResultStub(Isolate* isolate) 1426 explicit RegExpConstructResultStub(Isolate* isolate)
1451 : HydrogenCodeStub(isolate) { } 1427 : HydrogenCodeStub(isolate) { }
1452 1428
1453 static void InstallDescriptors(Isolate* isolate);
1454
1455 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1429 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1456 static const int kLength = 0; 1430 static const int kLength = 0;
1457 static const int kIndex = 1; 1431 static const int kIndex = 1;
1458 static const int kInput = 2; 1432 static const int kInput = 2;
1459 1433
1460 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); 1434 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub);
1461 }; 1435 };
1462 1436
1463 1437
1464 class CallFunctionStub: public PlatformCodeStub { 1438 class CallFunctionStub: public PlatformCodeStub {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 : HydrogenCodeStub(isolate) {} 1680 : HydrogenCodeStub(isolate) {}
1707 1681
1708 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); 1682 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
1709 }; 1683 };
1710 1684
1711 1685
1712 class KeyedLoadGenericStub : public HydrogenCodeStub { 1686 class KeyedLoadGenericStub : public HydrogenCodeStub {
1713 public: 1687 public:
1714 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 1688 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
1715 1689
1716 static void InstallDescriptors(Isolate* isolate);
1717
1718 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } 1690 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; }
1719 virtual InlineCacheState GetICState() const { return GENERIC; } 1691 virtual InlineCacheState GetICState() const { return GENERIC; }
1720 1692
1721 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); 1693 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub);
1722 }; 1694 };
1723 1695
1724 1696
1725 class LoadICTrampolineStub : public PlatformCodeStub { 1697 class LoadICTrampolineStub : public PlatformCodeStub {
1726 public: 1698 public:
1727 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) 1699 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 }; 1733 };
1762 1734
1763 1735
1764 class VectorLoadStub : public HydrogenCodeStub { 1736 class VectorLoadStub : public HydrogenCodeStub {
1765 public: 1737 public:
1766 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) 1738 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state)
1767 : HydrogenCodeStub(isolate) { 1739 : HydrogenCodeStub(isolate) {
1768 set_sub_minor_key(state.GetExtraICState()); 1740 set_sub_minor_key(state.GetExtraICState());
1769 } 1741 }
1770 1742
1771 static void InstallDescriptors(Isolate* isolate);
1772
1773 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } 1743 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1774 1744
1775 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 1745 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
1776 return GENERIC; 1746 return GENERIC;
1777 } 1747 }
1778 1748
1779 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1749 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1780 return static_cast<ExtraICState>(sub_minor_key()); 1750 return static_cast<ExtraICState>(sub_minor_key());
1781 } 1751 }
1782 1752
1783 private: 1753 private:
1784 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); } 1754 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); }
1785 1755
1786 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); 1756 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub);
1787 }; 1757 };
1788 1758
1789 1759
1790 class VectorKeyedLoadStub : public VectorLoadStub { 1760 class VectorKeyedLoadStub : public VectorLoadStub {
1791 public: 1761 public:
1792 explicit VectorKeyedLoadStub(Isolate* isolate) 1762 explicit VectorKeyedLoadStub(Isolate* isolate)
1793 : VectorLoadStub(isolate, LoadIC::State(0)) {} 1763 : VectorLoadStub(isolate, LoadIC::State(0)) {}
1794 1764
1795 static void InstallDescriptors(Isolate* isolate);
1796
1797 virtual Code::Kind GetCodeKind() const OVERRIDE { 1765 virtual Code::Kind GetCodeKind() const OVERRIDE {
1798 return Code::KEYED_LOAD_IC; 1766 return Code::KEYED_LOAD_IC;
1799 } 1767 }
1800 1768
1801 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub); 1769 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub);
1802 }; 1770 };
1803 1771
1804 1772
1805 class DoubleToIStub : public PlatformCodeStub { 1773 class DoubleToIStub : public PlatformCodeStub {
1806 public: 1774 public:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | 1824 set_sub_minor_key(ElementsKindBits::encode(elements_kind) |
1857 IsJSArrayBits::encode(is_js_array)); 1825 IsJSArrayBits::encode(is_js_array));
1858 } 1826 }
1859 1827
1860 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } 1828 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
1861 1829
1862 ElementsKind elements_kind() const { 1830 ElementsKind elements_kind() const {
1863 return ElementsKindBits::decode(sub_minor_key()); 1831 return ElementsKindBits::decode(sub_minor_key());
1864 } 1832 }
1865 1833
1866 static void InstallDescriptors(Isolate* isolate);
1867
1868 private: 1834 private:
1869 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 1835 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1870 class IsJSArrayBits: public BitField<bool, 8, 1> {}; 1836 class IsJSArrayBits: public BitField<bool, 8, 1> {};
1871 1837
1872 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); 1838 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub);
1873 }; 1839 };
1874 1840
1875 1841
1876 class StoreFastElementStub : public HydrogenCodeStub { 1842 class StoreFastElementStub : public HydrogenCodeStub {
1877 public: 1843 public:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 1913
1948 ElementsKind elements_kind() const { 1914 ElementsKind elements_kind() const {
1949 return ElementsKindBits::decode(sub_minor_key()); 1915 return ElementsKindBits::decode(sub_minor_key());
1950 } 1916 }
1951 1917
1952 AllocationSiteOverrideMode override_mode() const { 1918 AllocationSiteOverrideMode override_mode() const {
1953 return AllocationSiteOverrideModeBits::decode(sub_minor_key()); 1919 return AllocationSiteOverrideModeBits::decode(sub_minor_key());
1954 } 1920 }
1955 1921
1956 static void GenerateStubsAheadOfTime(Isolate* isolate); 1922 static void GenerateStubsAheadOfTime(Isolate* isolate);
1957 static void InstallDescriptors(Isolate* isolate);
1958 1923
1959 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1924 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1960 static const int kConstructor = 0; 1925 static const int kConstructor = 0;
1961 static const int kAllocationSite = 1; 1926 static const int kAllocationSite = 1;
1962 1927
1963 protected: 1928 protected:
1964 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT 1929 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT
1965 1930
1966 private: 1931 private:
1967 // Ensure data fits within available bits. 1932 // Ensure data fits within available bits.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 1998
2034 1999
2035 class InternalArrayConstructorStubBase : public HydrogenCodeStub { 2000 class InternalArrayConstructorStubBase : public HydrogenCodeStub {
2036 public: 2001 public:
2037 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) 2002 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind)
2038 : HydrogenCodeStub(isolate) { 2003 : HydrogenCodeStub(isolate) {
2039 set_sub_minor_key(ElementsKindBits::encode(kind)); 2004 set_sub_minor_key(ElementsKindBits::encode(kind));
2040 } 2005 }
2041 2006
2042 static void GenerateStubsAheadOfTime(Isolate* isolate); 2007 static void GenerateStubsAheadOfTime(Isolate* isolate);
2043 static void InstallDescriptors(Isolate* isolate);
2044 2008
2045 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 2009 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2046 static const int kConstructor = 0; 2010 static const int kConstructor = 0;
2047 2011
2048 ElementsKind elements_kind() const { 2012 ElementsKind elements_kind() const {
2049 return ElementsKindBits::decode(sub_minor_key()); 2013 return ElementsKindBits::decode(sub_minor_key());
2050 } 2014 }
2051 2015
2052 private: 2016 private:
2053 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; 2017 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 2125
2162 bool UpdateStatus(Handle<Object> object); 2126 bool UpdateStatus(Handle<Object> object);
2163 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } 2127 Types types() const { return Types(TypesBits::decode(sub_minor_key())); }
2164 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } 2128 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }
2165 2129
2166 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } 2130 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2167 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 2131 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
2168 2132
2169 virtual bool SometimesSetsUpAFrame() { return false; } 2133 virtual bool SometimesSetsUpAFrame() { return false; }
2170 2134
2171 static void InstallDescriptors(Isolate* isolate) {
2172 ToBooleanStub stub(isolate, RESULT_AS_SMI);
2173 stub.InitializeInterfaceDescriptor(
2174 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean));
2175 }
2176
2177 static Handle<Code> GetUninitialized(Isolate* isolate) { 2135 static Handle<Code> GetUninitialized(Isolate* isolate) {
2178 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); 2136 return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
2179 } 2137 }
2180 2138
2181 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); } 2139 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); }
2182 2140
2183 virtual InlineCacheState GetICState() const { 2141 virtual InlineCacheState GetICState() const {
2184 if (types().IsEmpty()) { 2142 if (types().IsEmpty()) {
2185 return ::v8::internal::UNINITIALIZED; 2143 return ::v8::internal::UNINITIALIZED;
2186 } else { 2144 } else {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 2296
2339 2297
2340 #undef DEFINE_PLATFORM_CODE_STUB 2298 #undef DEFINE_PLATFORM_CODE_STUB
2341 #undef DEFINE_HANDLER_CODE_STUB 2299 #undef DEFINE_HANDLER_CODE_STUB
2342 #undef DEFINE_HYDROGEN_CODE_STUB 2300 #undef DEFINE_HYDROGEN_CODE_STUB
2343 #undef DEFINE_CODE_STUB 2301 #undef DEFINE_CODE_STUB
2344 #undef DEFINE_CODE_STUB_BASE 2302 #undef DEFINE_CODE_STUB_BASE
2345 } } // namespace v8::internal 2303 } } // namespace v8::internal
2346 2304
2347 #endif // V8_CODE_STUBS_H_ 2305 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stubs.cc » ('j') | src/code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698