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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1111 class IsConstantBits: public BitField<bool, 0, 1> {}; |
1111 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1112 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
1112 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1113 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
1113 | 1114 |
1114 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1115 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); |
1115 }; | 1116 }; |
1116 | 1117 |
1117 | 1118 |
1118 class CallApiFunctionStub : public PlatformCodeStub { | 1119 class CallApiFunctionStub : public PlatformCodeStub { |
1119 public: | 1120 public: |
1120 CallApiFunctionStub(Isolate* isolate, | 1121 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) |
1121 bool is_store, | 1122 : PlatformCodeStub(isolate) { |
1122 bool call_data_undefined, | 1123 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); |
1123 int argc) : PlatformCodeStub(isolate) { | |
1124 minor_key_ = IsStoreBits::encode(is_store) | | |
1125 CallDataUndefinedBits::encode(call_data_undefined) | | |
1126 ArgumentBits::encode(argc); | |
1127 DCHECK(!is_store || argc == 1); | |
1128 } | 1124 } |
1129 | 1125 |
1130 private: | 1126 private: |
| 1127 bool call_data_undefined() const { |
| 1128 return CallDataUndefinedBits::decode(minor_key_); |
| 1129 } |
| 1130 |
| 1131 class CallDataUndefinedBits : public BitField<bool, 0, 1> {}; |
| 1132 |
| 1133 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); |
| 1134 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); |
| 1135 }; |
| 1136 |
| 1137 |
| 1138 class CallApiAccessorStub : public PlatformCodeStub { |
| 1139 public: |
| 1140 CallApiAccessorStub(Isolate* isolate, bool is_store, bool call_data_undefined) |
| 1141 : PlatformCodeStub(isolate) { |
| 1142 minor_key_ = IsStoreBits::encode(is_store) | |
| 1143 CallDataUndefinedBits::encode(call_data_undefined); |
| 1144 } |
| 1145 |
| 1146 private: |
1131 bool is_store() const { return IsStoreBits::decode(minor_key_); } | 1147 bool is_store() const { return IsStoreBits::decode(minor_key_); } |
1132 bool call_data_undefined() const { | 1148 bool call_data_undefined() const { |
1133 return CallDataUndefinedBits::decode(minor_key_); | 1149 return CallDataUndefinedBits::decode(minor_key_); |
1134 } | 1150 } |
1135 int argc() const { return ArgumentBits::decode(minor_key_); } | |
1136 | 1151 |
1137 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1152 class IsStoreBits: public BitField<bool, 0, 1> {}; |
1138 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1153 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
1139 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; | |
1140 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | |
1141 | 1154 |
1142 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); | 1155 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiAccessor); |
1143 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); | 1156 DEFINE_PLATFORM_CODE_STUB(CallApiAccessor, PlatformCodeStub); |
1144 }; | 1157 }; |
1145 | 1158 |
1146 | 1159 |
1147 class CallApiGetterStub : public PlatformCodeStub { | 1160 class CallApiGetterStub : public PlatformCodeStub { |
1148 public: | 1161 public: |
1149 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1162 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1150 | 1163 |
1151 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); | 1164 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
1152 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); | 1165 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1153 }; | 1166 }; |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 | 2590 |
2578 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2591 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2579 #undef DEFINE_PLATFORM_CODE_STUB | 2592 #undef DEFINE_PLATFORM_CODE_STUB |
2580 #undef DEFINE_HANDLER_CODE_STUB | 2593 #undef DEFINE_HANDLER_CODE_STUB |
2581 #undef DEFINE_HYDROGEN_CODE_STUB | 2594 #undef DEFINE_HYDROGEN_CODE_STUB |
2582 #undef DEFINE_CODE_STUB | 2595 #undef DEFINE_CODE_STUB |
2583 #undef DEFINE_CODE_STUB_BASE | 2596 #undef DEFINE_CODE_STUB_BASE |
2584 } } // namespace v8::internal | 2597 } } // namespace v8::internal |
2585 | 2598 |
2586 #endif // V8_CODE_STUBS_H_ | 2599 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |