OLD | NEW |
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" |
11 #include "src/globals.h" | 11 #include "src/globals.h" |
12 #include "src/ic/ic-state.h" | 12 #include "src/ic/ic-state.h" |
13 #include "src/interface-descriptors.h" | 13 #include "src/interface-descriptors.h" |
14 #include "src/macro-assembler.h" | 14 #include "src/macro-assembler.h" |
15 #include "src/ostreams.h" | 15 #include "src/ostreams.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 | 19 |
20 // List of code stubs used on all platforms. | 20 // List of code stubs used on all platforms. |
21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
22 /* PlatformCodeStubs */ \ | 22 /* PlatformCodeStubs */ \ |
23 V(ArgumentsAccess) \ | 23 V(ArgumentsAccess) \ |
24 V(ArrayConstructor) \ | 24 V(ArrayConstructor) \ |
25 V(BinaryOpICWithAllocationSite) \ | 25 V(BinaryOpICWithAllocationSite) \ |
26 V(CallApiFunction) \ | 26 V(CallApiFunction) \ |
| 27 V(CallApiAccessor) \ |
27 V(CallApiGetter) \ | 28 V(CallApiGetter) \ |
28 V(CallConstruct) \ | 29 V(CallConstruct) \ |
29 V(CallFunction) \ | 30 V(CallFunction) \ |
30 V(CallIC) \ | 31 V(CallIC) \ |
31 V(CallIC_Array) \ | 32 V(CallIC_Array) \ |
32 V(CEntry) \ | 33 V(CEntry) \ |
33 V(CompareIC) \ | 34 V(CompareIC) \ |
34 V(DoubleToI) \ | 35 V(DoubleToI) \ |
35 V(FunctionPrototype) \ | 36 V(FunctionPrototype) \ |
36 V(Instanceof) \ | 37 V(Instanceof) \ |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1124 class IsConstantBits: public BitField<bool, 0, 1> {}; |
1124 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1125 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
1125 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1126 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
1126 | 1127 |
1127 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1128 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); |
1128 }; | 1129 }; |
1129 | 1130 |
1130 | 1131 |
1131 class CallApiFunctionStub : public PlatformCodeStub { | 1132 class CallApiFunctionStub : public PlatformCodeStub { |
1132 public: | 1133 public: |
1133 CallApiFunctionStub(Isolate* isolate, | 1134 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) |
1134 bool is_store, | 1135 : PlatformCodeStub(isolate) { |
1135 bool call_data_undefined, | 1136 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); |
1136 int argc) : PlatformCodeStub(isolate) { | |
1137 minor_key_ = IsStoreBits::encode(is_store) | | |
1138 CallDataUndefinedBits::encode(call_data_undefined) | | |
1139 ArgumentBits::encode(argc); | |
1140 DCHECK(!is_store || argc == 1); | |
1141 } | 1137 } |
1142 | 1138 |
1143 private: | 1139 private: |
| 1140 bool call_data_undefined() const { |
| 1141 return CallDataUndefinedBits::decode(minor_key_); |
| 1142 } |
| 1143 |
| 1144 class CallDataUndefinedBits : public BitField<bool, 0, 1> {}; |
| 1145 |
| 1146 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); |
| 1147 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); |
| 1148 }; |
| 1149 |
| 1150 |
| 1151 class CallApiAccessorStub : public PlatformCodeStub { |
| 1152 public: |
| 1153 CallApiAccessorStub(Isolate* isolate, bool is_store, bool call_data_undefined) |
| 1154 : PlatformCodeStub(isolate) { |
| 1155 minor_key_ = IsStoreBits::encode(is_store) | |
| 1156 CallDataUndefinedBits::encode(call_data_undefined); |
| 1157 } |
| 1158 |
| 1159 private: |
1144 bool is_store() const { return IsStoreBits::decode(minor_key_); } | 1160 bool is_store() const { return IsStoreBits::decode(minor_key_); } |
1145 bool call_data_undefined() const { | 1161 bool call_data_undefined() const { |
1146 return CallDataUndefinedBits::decode(minor_key_); | 1162 return CallDataUndefinedBits::decode(minor_key_); |
1147 } | 1163 } |
1148 int argc() const { return ArgumentBits::decode(minor_key_); } | |
1149 | 1164 |
1150 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1165 class IsStoreBits: public BitField<bool, 0, 1> {}; |
1151 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1166 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
1152 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; | |
1153 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | |
1154 | 1167 |
1155 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); | 1168 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiAccessor); |
1156 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); | 1169 DEFINE_PLATFORM_CODE_STUB(CallApiAccessor, PlatformCodeStub); |
1157 }; | 1170 }; |
1158 | 1171 |
1159 | 1172 |
1160 class CallApiGetterStub : public PlatformCodeStub { | 1173 class CallApiGetterStub : public PlatformCodeStub { |
1161 public: | 1174 public: |
1162 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1175 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1163 | 1176 |
1164 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); | 1177 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
1165 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); | 1178 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1166 }; | 1179 }; |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 | 2603 |
2591 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2604 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2592 #undef DEFINE_PLATFORM_CODE_STUB | 2605 #undef DEFINE_PLATFORM_CODE_STUB |
2593 #undef DEFINE_HANDLER_CODE_STUB | 2606 #undef DEFINE_HANDLER_CODE_STUB |
2594 #undef DEFINE_HYDROGEN_CODE_STUB | 2607 #undef DEFINE_HYDROGEN_CODE_STUB |
2595 #undef DEFINE_CODE_STUB | 2608 #undef DEFINE_CODE_STUB |
2596 #undef DEFINE_CODE_STUB_BASE | 2609 #undef DEFINE_CODE_STUB_BASE |
2597 } } // namespace v8::internal | 2610 } } // namespace v8::internal |
2598 | 2611 |
2599 #endif // V8_CODE_STUBS_H_ | 2612 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |