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

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

Issue 2033423002: [builtins] Turn LoadIC_Miss and LoadIC_Slow builtins to TurboFan code stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@load-ic-stub-tf
Patch Set: Created 4 years, 6 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
« no previous file with comments | « src/builtins.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/code-stub-assembler.h" 10 #include "src/code-stub-assembler.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 V(LoadICTrampolineTF) \ 142 V(LoadICTrampolineTF) \
143 V(LoadICTF) \ 143 V(LoadICTF) \
144 /* IC Handler stubs */ \ 144 /* IC Handler stubs */ \
145 V(ArrayBufferViewLoadField) \ 145 V(ArrayBufferViewLoadField) \
146 V(KeyedLoadSloppyArguments) \ 146 V(KeyedLoadSloppyArguments) \
147 V(KeyedStoreSloppyArguments) \ 147 V(KeyedStoreSloppyArguments) \
148 V(LoadApiGetter) \ 148 V(LoadApiGetter) \
149 V(LoadConstant) \ 149 V(LoadConstant) \
150 V(LoadFastElement) \ 150 V(LoadFastElement) \
151 V(LoadField) \ 151 V(LoadField) \
152 V(LoadICMiss) \
153 V(LoadICSlow) \
152 V(LoadIndexedInterceptor) \ 154 V(LoadIndexedInterceptor) \
153 V(StoreField) \ 155 V(StoreField) \
154 V(StoreGlobal) \ 156 V(StoreGlobal) \
155 V(StoreInterceptor) \ 157 V(StoreInterceptor) \
156 V(StoreTransition) 158 V(StoreTransition)
157 159
158 // List of code stubs only used on ARM 32 bits platforms. 160 // List of code stubs only used on ARM 32 bits platforms.
159 #if V8_TARGET_ARCH_ARM 161 #if V8_TARGET_ARCH_ARM
160 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry) 162 #define CODE_STUB_LIST_ARM(V) V(DirectCEntry)
161 163
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 public: \ 399 public: \
398 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ 400 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \
399 Handle<Code> GenerateCode() override; \ 401 Handle<Code> GenerateCode() override; \
400 DEFINE_CODE_STUB(NAME, SUPER) 402 DEFINE_CODE_STUB(NAME, SUPER)
401 403
402 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ 404 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \
403 public: \ 405 public: \
404 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ 406 void GenerateAssembly(CodeStubAssembler* assembler) const override; \
405 DEFINE_CODE_STUB(NAME, SUPER) 407 DEFINE_CODE_STUB(NAME, SUPER)
406 408
409 #define DEFINE_TURBOFAN_HANDLER_CODE_STUB(NAME, EXTRA_IC_STATE) \
410 public: \
411 Code::Kind GetCodeKind() const override { return Code::HANDLER; } \
412 ExtraICState GetExtraICState() const override { return EXTRA_IC_STATE; } \
Toon Verwaest 2016/06/06 13:01:32 EXTRA_IC_STATE -> KIND?
413 InlineCacheState GetICState() const override { return MONOMORPHIC; } \
414 DEFINE_TURBOFAN_CODE_STUB(NAME, TurboFanCodeStub)
415
407 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NAME, SUPER) \ 416 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NAME, SUPER) \
408 public: \ 417 public: \
409 static compiler::Node* Generate(CodeStubAssembler* assembler, \ 418 static compiler::Node* Generate(CodeStubAssembler* assembler, \
410 compiler::Node* left, compiler::Node* right, \ 419 compiler::Node* left, compiler::Node* right, \
411 compiler::Node* context); \ 420 compiler::Node* context); \
412 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ 421 void GenerateAssembly(CodeStubAssembler* assembler) const override { \
413 assembler->Return(Generate(assembler, assembler->Parameter(0), \ 422 assembler->Return(Generate(assembler, assembler->Parameter(0), \
414 assembler->Parameter(1), \ 423 assembler->Parameter(1), \
415 assembler->Parameter(2))); \ 424 assembler->Parameter(2))); \
416 } \ 425 } \
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 void BeforeCall(MacroAssembler* masm) const override {} 695 void BeforeCall(MacroAssembler* masm) const override {}
687 696
688 void AfterCall(MacroAssembler* masm) const override {} 697 void AfterCall(MacroAssembler* masm) const override {}
689 }; 698 };
690 699
691 700
692 class StringLengthStub : public TurboFanCodeStub { 701 class StringLengthStub : public TurboFanCodeStub {
693 public: 702 public:
694 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 703 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
695 704
696 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
697 InlineCacheState GetICState() const override { return MONOMORPHIC; }
698 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
699
700 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); 705 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
701 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); 706 DEFINE_TURBOFAN_HANDLER_CODE_STUB(StringLength, Code::LOAD_IC);
702 }; 707 };
703 708
704 class AddStub final : public TurboFanCodeStub { 709 class AddStub final : public TurboFanCodeStub {
705 public: 710 public:
706 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 711 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
707 712
708 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); 713 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp);
709 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Add, TurboFanCodeStub); 714 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Add, TurboFanCodeStub);
710 }; 715 };
711 716
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 957 explicit ToLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
953 958
954 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); 959 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
955 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub); 960 DEFINE_TURBOFAN_CODE_STUB(ToLength, TurboFanCodeStub);
956 }; 961 };
957 962
958 class StoreInterceptorStub : public TurboFanCodeStub { 963 class StoreInterceptorStub : public TurboFanCodeStub {
959 public: 964 public:
960 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 965 explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
961 966
962 void GenerateAssembly(CodeStubAssembler* assember) const override; 967 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store);
968 DEFINE_TURBOFAN_HANDLER_CODE_STUB(StoreInterceptor, Code::STORE_IC);
969 };
963 970
964 Code::Kind GetCodeKind() const override { return Code::HANDLER; } 971 class LoadICMissStub : public TurboFanCodeStub {
965 ExtraICState GetExtraICState() const override { return Code::STORE_IC; } 972 public:
966 InlineCacheState GetICState() const override { return MONOMORPHIC; } 973 explicit LoadICMissStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
967 974
968 DEFINE_CALL_INTERFACE_DESCRIPTOR(Store); 975 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
969 DEFINE_CODE_STUB(StoreInterceptor, TurboFanCodeStub); 976 DEFINE_TURBOFAN_HANDLER_CODE_STUB(LoadICMiss, Code::LOAD_IC);
Toon Verwaest 2016/06/06 13:01:32 This is not a HANDLER but a STUB. We should probab
977 };
978
979 class LoadICSlowStub : public TurboFanCodeStub {
980 public:
981 explicit LoadICSlowStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
982
983 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
984 DEFINE_TURBOFAN_HANDLER_CODE_STUB(LoadICSlow, Code::LOAD_IC);
970 }; 985 };
971 986
972 class LoadIndexedInterceptorStub : public TurboFanCodeStub { 987 class LoadIndexedInterceptorStub : public TurboFanCodeStub {
973 public: 988 public:
974 explicit LoadIndexedInterceptorStub(Isolate* isolate) 989 explicit LoadIndexedInterceptorStub(Isolate* isolate)
975 : TurboFanCodeStub(isolate) {} 990 : TurboFanCodeStub(isolate) {}
976 991
977 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
978 ExtraICState GetExtraICState() const override { return Code::KEYED_LOAD_IC; }
979 InlineCacheState GetICState() const override { return MONOMORPHIC; }
980
981 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); 992 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
982 DEFINE_TURBOFAN_CODE_STUB(LoadIndexedInterceptor, TurboFanCodeStub); 993 DEFINE_TURBOFAN_HANDLER_CODE_STUB(LoadIndexedInterceptor,
994 Code::KEYED_LOAD_IC);
983 }; 995 };
984 996
985 // ES6 section 12.10.3 "in" operator evaluation. 997 // ES6 section 12.10.3 "in" operator evaluation.
986 class HasPropertyStub : public TurboFanCodeStub { 998 class HasPropertyStub : public TurboFanCodeStub {
987 public: 999 public:
988 explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 1000 explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
989 1001
990 DEFINE_CALL_INTERFACE_DESCRIPTOR(HasProperty); 1002 DEFINE_CALL_INTERFACE_DESCRIPTOR(HasProperty);
991 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(HasProperty, TurboFanCodeStub); 1003 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(HasProperty, TurboFanCodeStub);
992 }; 1004 };
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 public: 1547 public:
1536 LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index) 1548 LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index)
1537 : TurboFanCodeStub(isolate) { 1549 : TurboFanCodeStub(isolate) {
1538 // If that's not true, we need to ensure that the receiver is actually a 1550 // If that's not true, we need to ensure that the receiver is actually a
1539 // JSReceiver. http://crbug.com/609134 1551 // JSReceiver. http://crbug.com/609134
1540 DCHECK(receiver_is_holder); 1552 DCHECK(receiver_is_holder);
1541 minor_key_ = IndexBits::encode(index) | 1553 minor_key_ = IndexBits::encode(index) |
1542 ReceiverIsHolderBits::encode(receiver_is_holder); 1554 ReceiverIsHolderBits::encode(receiver_is_holder);
1543 } 1555 }
1544 1556
1545 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
1546 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
1547 InlineCacheState GetICState() const override { return MONOMORPHIC; }
1548
1549 int index() const { return IndexBits::decode(minor_key_); } 1557 int index() const { return IndexBits::decode(minor_key_); }
1550 bool receiver_is_holder() const { 1558 bool receiver_is_holder() const {
1551 return ReceiverIsHolderBits::decode(minor_key_); 1559 return ReceiverIsHolderBits::decode(minor_key_);
1552 } 1560 }
1553 1561
1554 private: 1562 private:
1555 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {}; 1563 class ReceiverIsHolderBits : public BitField<bool, 0, 1> {};
1556 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {}; 1564 class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {};
1557 1565
1558 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); 1566 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
1559 DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub); 1567 DEFINE_TURBOFAN_HANDLER_CODE_STUB(LoadApiGetter, Code::LOAD_IC);
1560 }; 1568 };
1561 1569
1562 class StoreFieldStub : public HandlerStub { 1570 class StoreFieldStub : public HandlerStub {
1563 public: 1571 public:
1564 StoreFieldStub(Isolate* isolate, FieldIndex index, 1572 StoreFieldStub(Isolate* isolate, FieldIndex index,
1565 Representation representation) 1573 Representation representation)
1566 : HandlerStub(isolate) { 1574 : HandlerStub(isolate) {
1567 int property_index_key = index.GetFieldAccessStubKey(); 1575 int property_index_key = index.GetFieldAccessStubKey();
1568 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); 1576 uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
1569 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | 1577 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 #undef DEFINE_HYDROGEN_CODE_STUB 3299 #undef DEFINE_HYDROGEN_CODE_STUB
3292 #undef DEFINE_CODE_STUB 3300 #undef DEFINE_CODE_STUB
3293 #undef DEFINE_CODE_STUB_BASE 3301 #undef DEFINE_CODE_STUB_BASE
3294 3302
3295 extern Representation RepresentationFromType(Type* type); 3303 extern Representation RepresentationFromType(Type* type);
3296 3304
3297 } // namespace internal 3305 } // namespace internal
3298 } // namespace v8 3306 } // namespace v8
3299 3307
3300 #endif // V8_CODE_STUBS_H_ 3308 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698