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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 V(ElementsTransitionAndStore) \ | 71 V(ElementsTransitionAndStore) \ |
72 V(FastCloneShallowArray) \ | 72 V(FastCloneShallowArray) \ |
73 V(FastCloneShallowObject) \ | 73 V(FastCloneShallowObject) \ |
74 V(FastNewClosure) \ | 74 V(FastNewClosure) \ |
75 V(FastNewContext) \ | 75 V(FastNewContext) \ |
76 V(GrowArrayElements) \ | 76 V(GrowArrayElements) \ |
77 V(InternalArrayNArgumentsConstructor) \ | 77 V(InternalArrayNArgumentsConstructor) \ |
78 V(InternalArrayNoArgumentConstructor) \ | 78 V(InternalArrayNoArgumentConstructor) \ |
79 V(InternalArraySingleArgumentConstructor) \ | 79 V(InternalArraySingleArgumentConstructor) \ |
80 V(KeyedLoadGeneric) \ | 80 V(KeyedLoadGeneric) \ |
| 81 V(LoadGlobalViaContext) \ |
81 V(LoadScriptContextField) \ | 82 V(LoadScriptContextField) \ |
82 V(LoadDictionaryElement) \ | 83 V(LoadDictionaryElement) \ |
83 V(NameDictionaryLookup) \ | 84 V(NameDictionaryLookup) \ |
84 V(NumberToString) \ | 85 V(NumberToString) \ |
85 V(Typeof) \ | 86 V(Typeof) \ |
86 V(RegExpConstructResult) \ | 87 V(RegExpConstructResult) \ |
87 V(StoreFastElement) \ | 88 V(StoreFastElement) \ |
| 89 V(StoreGlobalViaContext) \ |
88 V(StoreScriptContextField) \ | 90 V(StoreScriptContextField) \ |
89 V(StringAdd) \ | 91 V(StringAdd) \ |
90 V(ToBoolean) \ | 92 V(ToBoolean) \ |
91 V(TransitionElementsKind) \ | 93 V(TransitionElementsKind) \ |
92 V(KeyedLoadIC) \ | 94 V(KeyedLoadIC) \ |
93 V(LoadIC) \ | 95 V(LoadIC) \ |
94 /* TurboFanCodeStubs */ \ | 96 /* TurboFanCodeStubs */ \ |
95 V(StringLengthTF) \ | 97 V(StringLengthTF) \ |
96 V(StringAddTF) \ | 98 V(StringAddTF) \ |
97 V(MathFloor) \ | 99 V(MathFloor) \ |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 private: | 1336 private: |
1335 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; | 1337 class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; |
1336 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; | 1338 class ConstantTypeBits : public BitField<PropertyCellConstantType, 2, 2> {}; |
1337 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; | 1339 class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; |
1338 class CheckGlobalBits : public BitField<bool, 12, 1> {}; | 1340 class CheckGlobalBits : public BitField<bool, 12, 1> {}; |
1339 | 1341 |
1340 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); | 1342 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); |
1341 }; | 1343 }; |
1342 | 1344 |
1343 | 1345 |
| 1346 class LoadGlobalViaContextStub : public HydrogenCodeStub { |
| 1347 public: |
| 1348 // Use the loop version for depths higher than this one. |
| 1349 static const int kDynamicDepth = 7; |
| 1350 |
| 1351 LoadGlobalViaContextStub(Isolate* isolate, int depth) |
| 1352 : HydrogenCodeStub(isolate) { |
| 1353 if (depth > kDynamicDepth) depth = kDynamicDepth; |
| 1354 set_sub_minor_key(DepthBits::encode(depth)); |
| 1355 } |
| 1356 |
| 1357 int depth() const { return DepthBits::decode(sub_minor_key()); } |
| 1358 |
| 1359 private: |
| 1360 class DepthBits : public BitField<unsigned int, 0, 3> {}; |
| 1361 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); |
| 1362 |
| 1363 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext); |
| 1364 DEFINE_HYDROGEN_CODE_STUB(LoadGlobalViaContext, HydrogenCodeStub); |
| 1365 }; |
| 1366 |
| 1367 |
| 1368 class StoreGlobalViaContextStub : public HydrogenCodeStub { |
| 1369 public: |
| 1370 // Use the loop version for depths higher than this one. |
| 1371 static const int kDynamicDepth = 7; |
| 1372 |
| 1373 StoreGlobalViaContextStub(Isolate* isolate, int depth, |
| 1374 LanguageMode language_mode) |
| 1375 : HydrogenCodeStub(isolate) { |
| 1376 if (depth > kDynamicDepth) depth = kDynamicDepth; |
| 1377 set_sub_minor_key(DepthBits::encode(depth) | |
| 1378 LanguageModeBits::encode(language_mode)); |
| 1379 } |
| 1380 |
| 1381 int depth() const { return DepthBits::decode(sub_minor_key()); } |
| 1382 |
| 1383 LanguageMode language_mode() const { |
| 1384 return LanguageModeBits::decode(sub_minor_key()); |
| 1385 } |
| 1386 |
| 1387 private: |
| 1388 class DepthBits : public BitField<unsigned int, 0, 4> {}; |
| 1389 STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); |
| 1390 |
| 1391 class LanguageModeBits : public BitField<LanguageMode, 4, 2> {}; |
| 1392 STATIC_ASSERT(LANGUAGE_END == 3); |
| 1393 |
| 1394 private: |
| 1395 DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext); |
| 1396 DEFINE_HYDROGEN_CODE_STUB(StoreGlobalViaContext, HydrogenCodeStub); |
| 1397 }; |
| 1398 |
| 1399 |
1344 class CallApiFunctionStub : public PlatformCodeStub { | 1400 class CallApiFunctionStub : public PlatformCodeStub { |
1345 public: | 1401 public: |
1346 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) | 1402 explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) |
1347 : PlatformCodeStub(isolate) { | 1403 : PlatformCodeStub(isolate) { |
1348 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); | 1404 minor_key_ = CallDataUndefinedBits::encode(call_data_undefined); |
1349 } | 1405 } |
1350 | 1406 |
1351 private: | 1407 private: |
1352 bool call_data_undefined() const { | 1408 bool call_data_undefined() const { |
1353 return CallDataUndefinedBits::decode(minor_key_); | 1409 return CallDataUndefinedBits::decode(minor_key_); |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 #undef DEFINE_PLATFORM_CODE_STUB | 3042 #undef DEFINE_PLATFORM_CODE_STUB |
2987 #undef DEFINE_HANDLER_CODE_STUB | 3043 #undef DEFINE_HANDLER_CODE_STUB |
2988 #undef DEFINE_HYDROGEN_CODE_STUB | 3044 #undef DEFINE_HYDROGEN_CODE_STUB |
2989 #undef DEFINE_CODE_STUB | 3045 #undef DEFINE_CODE_STUB |
2990 #undef DEFINE_CODE_STUB_BASE | 3046 #undef DEFINE_CODE_STUB_BASE |
2991 | 3047 |
2992 extern Representation RepresentationFromType(Type* type); | 3048 extern Representation RepresentationFromType(Type* type); |
2993 } } // namespace v8::internal | 3049 } } // namespace v8::internal |
2994 | 3050 |
2995 #endif // V8_CODE_STUBS_H_ | 3051 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |