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" |
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); | 1146 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction); |
1147 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); | 1147 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub); |
1148 }; | 1148 }; |
1149 | 1149 |
1150 | 1150 |
1151 class CallApiAccessorStub : public PlatformCodeStub { | 1151 class CallApiAccessorStub : public PlatformCodeStub { |
1152 public: | 1152 public: |
1153 CallApiAccessorStub(Isolate* isolate, bool is_store, bool call_data_undefined) | 1153 CallApiAccessorStub(Isolate* isolate, bool is_store, bool call_data_undefined) |
1154 : PlatformCodeStub(isolate) { | 1154 : PlatformCodeStub(isolate) { |
1155 minor_key_ = IsStoreBits::encode(is_store) | | 1155 minor_key_ = IsStoreBits::encode(is_store) | |
1156 CallDataUndefinedBits::encode(call_data_undefined); | 1156 CallDataUndefinedBits::encode(call_data_undefined) | |
| 1157 ArgumentBits::encode(is_store ? 1 : 0); |
| 1158 } |
| 1159 |
| 1160 protected: |
| 1161 // For CallApiFunctionWithFixedArgsStub, see below. |
| 1162 static const int kArgBits = 3; |
| 1163 CallApiAccessorStub(Isolate* isolate, int argc, bool call_data_undefined) |
| 1164 : PlatformCodeStub(isolate) { |
| 1165 minor_key_ = IsStoreBits::encode(false) | |
| 1166 CallDataUndefinedBits::encode(call_data_undefined) | |
| 1167 ArgumentBits::encode(argc); |
1157 } | 1168 } |
1158 | 1169 |
1159 private: | 1170 private: |
1160 bool is_store() const { return IsStoreBits::decode(minor_key_); } | 1171 bool is_store() const { return IsStoreBits::decode(minor_key_); } |
1161 bool call_data_undefined() const { | 1172 bool call_data_undefined() const { |
1162 return CallDataUndefinedBits::decode(minor_key_); | 1173 return CallDataUndefinedBits::decode(minor_key_); |
1163 } | 1174 } |
| 1175 int argc() const { return ArgumentBits::decode(minor_key_); } |
1164 | 1176 |
1165 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1177 class IsStoreBits: public BitField<bool, 0, 1> {}; |
1166 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1178 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
| 1179 class ArgumentBits : public BitField<int, 2, kArgBits> {}; |
1167 | 1180 |
1168 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiAccessor); | 1181 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiAccessor); |
1169 DEFINE_PLATFORM_CODE_STUB(CallApiAccessor, PlatformCodeStub); | 1182 DEFINE_PLATFORM_CODE_STUB(CallApiAccessor, PlatformCodeStub); |
1170 }; | 1183 }; |
1171 | 1184 |
1172 | 1185 |
| 1186 // TODO(dcarney): see if it's possible to remove this later without performance |
| 1187 // degradation. |
| 1188 // This is not a real stub, but a way of generating the CallApiAccessorStub |
| 1189 // (which has the same abi) which makes it clear that it is not an accessor. |
| 1190 class CallApiFunctionWithFixedArgsStub : public CallApiAccessorStub { |
| 1191 public: |
| 1192 static const int kMaxFixedArgs = (1 << kArgBits) - 1; |
| 1193 CallApiFunctionWithFixedArgsStub(Isolate* isolate, int argc, |
| 1194 bool call_data_undefined) |
| 1195 : CallApiAccessorStub(isolate, argc, call_data_undefined) { |
| 1196 DCHECK(0 <= argc && argc <= kMaxFixedArgs); |
| 1197 } |
| 1198 }; |
| 1199 |
| 1200 |
| 1201 typedef ApiAccessorDescriptor ApiFunctionWithFixedArgsDescriptor; |
| 1202 |
| 1203 |
1173 class CallApiGetterStub : public PlatformCodeStub { | 1204 class CallApiGetterStub : public PlatformCodeStub { |
1174 public: | 1205 public: |
1175 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1206 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1176 | 1207 |
1177 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); | 1208 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
1178 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); | 1209 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1179 }; | 1210 }; |
1180 | 1211 |
1181 | 1212 |
1182 class BinaryOpICStub : public HydrogenCodeStub { | 1213 class BinaryOpICStub : public HydrogenCodeStub { |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 | 2634 |
2604 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2635 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2605 #undef DEFINE_PLATFORM_CODE_STUB | 2636 #undef DEFINE_PLATFORM_CODE_STUB |
2606 #undef DEFINE_HANDLER_CODE_STUB | 2637 #undef DEFINE_HANDLER_CODE_STUB |
2607 #undef DEFINE_HYDROGEN_CODE_STUB | 2638 #undef DEFINE_HYDROGEN_CODE_STUB |
2608 #undef DEFINE_CODE_STUB | 2639 #undef DEFINE_CODE_STUB |
2609 #undef DEFINE_CODE_STUB_BASE | 2640 #undef DEFINE_CODE_STUB_BASE |
2610 } } // namespace v8::internal | 2641 } } // namespace v8::internal |
2611 | 2642 |
2612 #endif // V8_CODE_STUBS_H_ | 2643 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |