| 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_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
| 6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 // When initializing arrays, we'll unfold the loop if the number of elements | 1302 // When initializing arrays, we'll unfold the loop if the number of elements |
| 1303 // is known at compile time and is <= kElementLoopUnrollThreshold. | 1303 // is known at compile time and is <= kElementLoopUnrollThreshold. |
| 1304 static const int kElementLoopUnrollThreshold = 8; | 1304 static const int kElementLoopUnrollThreshold = 8; |
| 1305 | 1305 |
| 1306 protected: | 1306 protected: |
| 1307 virtual bool BuildGraph() = 0; | 1307 virtual bool BuildGraph() = 0; |
| 1308 | 1308 |
| 1309 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1309 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| 1310 HBasicBlock* CreateLoopHeaderBlock(); | 1310 HBasicBlock* CreateLoopHeaderBlock(); |
| 1311 | 1311 |
| 1312 template <class BitFieldClass> | |
| 1313 HValue* BuildDecodeField(HValue* encoded_field) { | |
| 1314 HValue* shifted_field = AddUncasted<HShr>(encoded_field, | |
| 1315 Add<HConstant>(static_cast<int>(BitFieldClass::kShift))); | |
| 1316 HValue* mask_value = Add<HConstant>(static_cast<int>(BitFieldClass::kMask)); | |
| 1317 return AddUncasted<HBitwise>(Token::BIT_AND, shifted_field, mask_value); | |
| 1318 } | |
| 1319 | |
| 1320 HValue* BuildGetElementsKind(HValue* object); | |
| 1321 | |
| 1322 HValue* BuildCheckHeapObject(HValue* object); | 1312 HValue* BuildCheckHeapObject(HValue* object); |
| 1323 HValue* BuildCheckString(HValue* string); | 1313 HValue* BuildCheckString(HValue* string); |
| 1324 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1314 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
| 1325 | 1315 |
| 1326 // Building common constructs | 1316 // Building common constructs |
| 1327 HValue* BuildCheckForCapacityGrow(HValue* object, | 1317 HValue* BuildCheckForCapacityGrow(HValue* object, |
| 1328 HValue* elements, | 1318 HValue* elements, |
| 1329 ElementsKind kind, | 1319 ElementsKind kind, |
| 1330 HValue* length, | 1320 HValue* length, |
| 1331 HValue* key, | 1321 HValue* key, |
| 1332 bool is_js_array, | 1322 bool is_js_array, |
| 1333 PropertyAccessType access_type); | 1323 PropertyAccessType access_type); |
| 1334 | 1324 |
| 1335 HValue* BuildCopyElementsOnWrite(HValue* object, | 1325 HValue* BuildCopyElementsOnWrite(HValue* object, |
| 1336 HValue* elements, | 1326 HValue* elements, |
| 1337 ElementsKind kind, | 1327 ElementsKind kind, |
| 1338 HValue* length); | 1328 HValue* length); |
| 1339 | 1329 |
| 1340 void BuildTransitionElementsKind(HValue* object, | 1330 void BuildTransitionElementsKind(HValue* object, |
| 1341 HValue* map, | 1331 HValue* map, |
| 1342 ElementsKind from_kind, | 1332 ElementsKind from_kind, |
| 1343 ElementsKind to_kind, | 1333 ElementsKind to_kind, |
| 1344 bool is_jsarray); | 1334 bool is_jsarray); |
| 1345 | 1335 |
| 1346 HValue* BuildNumberToString(HValue* object, Type* type); | 1336 HValue* BuildNumberToString(HValue* object, Type* type); |
| 1347 | 1337 |
| 1348 void BuildJSObjectCheck(HValue* receiver, | |
| 1349 int bit_field_mask); | |
| 1350 | |
| 1351 // Checks a key value that's being used for a keyed element access context. If | |
| 1352 // the key is a index, i.e. a smi or a number in a unique string with a cached | |
| 1353 // numeric value, the "true" of the continuation is joined. Otherwise, | |
| 1354 // if the key is a name or a unique string, the "false" of the continuation is | |
| 1355 // joined. Otherwise, a deoptimization is triggered. In both paths of the | |
| 1356 // continuation, the key is pushed on the top of the environment. | |
| 1357 void BuildKeyedIndexCheck(HValue* key, | |
| 1358 HIfContinuation* join_continuation); | |
| 1359 | |
| 1360 // Checks the properties of an object if they are in dictionary case, in which | |
| 1361 // case "true" of continuation is taken, otherwise the "false" | |
| 1362 void BuildTestForDictionaryProperties(HValue* object, | |
| 1363 HIfContinuation* continuation); | |
| 1364 | |
| 1365 void BuildNonGlobalObjectCheck(HValue* receiver); | |
| 1366 | |
| 1367 HValue* BuildKeyedLookupCacheHash(HValue* object, | |
| 1368 HValue* key); | |
| 1369 | |
| 1370 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, | 1338 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, |
| 1371 HValue* elements, | 1339 HValue* key); |
| 1372 HValue* key, | |
| 1373 HValue* hash); | |
| 1374 | 1340 |
| 1375 HValue* BuildRegExpConstructResult(HValue* length, | 1341 HValue* BuildRegExpConstructResult(HValue* length, |
| 1376 HValue* index, | 1342 HValue* index, |
| 1377 HValue* input); | 1343 HValue* input); |
| 1378 | 1344 |
| 1379 // Allocates a new object according with the given allocation properties. | 1345 // Allocates a new object according with the given allocation properties. |
| 1380 HAllocate* BuildAllocate(HValue* object_size, | 1346 HAllocate* BuildAllocate(HValue* object_size, |
| 1381 HType type, | 1347 HType type, |
| 1382 InstanceType instance_type, | 1348 InstanceType instance_type, |
| 1383 HAllocationMode allocation_mode); | 1349 HAllocationMode allocation_mode); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 HInstruction* increment_; | 1667 HInstruction* increment_; |
| 1702 HPhi* phi_; | 1668 HPhi* phi_; |
| 1703 HBasicBlock* header_block_; | 1669 HBasicBlock* header_block_; |
| 1704 HBasicBlock* body_block_; | 1670 HBasicBlock* body_block_; |
| 1705 HBasicBlock* exit_block_; | 1671 HBasicBlock* exit_block_; |
| 1706 HBasicBlock* exit_trampoline_block_; | 1672 HBasicBlock* exit_trampoline_block_; |
| 1707 Direction direction_; | 1673 Direction direction_; |
| 1708 bool finished_; | 1674 bool finished_; |
| 1709 }; | 1675 }; |
| 1710 | 1676 |
| 1711 template <class A, class P1> | |
| 1712 void DeoptimizeIf(P1 p1, char* const reason) { | |
| 1713 IfBuilder builder(this); | |
| 1714 builder.If<A>(p1); | |
| 1715 builder.ThenDeopt(reason); | |
| 1716 } | |
| 1717 | |
| 1718 template <class A, class P1, class P2> | |
| 1719 void DeoptimizeIf(P1 p1, P2 p2, const char* reason) { | |
| 1720 IfBuilder builder(this); | |
| 1721 builder.If<A>(p1, p2); | |
| 1722 builder.ThenDeopt(reason); | |
| 1723 } | |
| 1724 | |
| 1725 template <class A, class P1, class P2, class P3> | |
| 1726 void DeoptimizeIf(P1 p1, P2 p2, P3 p3, const char* reason) { | |
| 1727 IfBuilder builder(this); | |
| 1728 builder.If<A>(p1, p2, p3); | |
| 1729 builder.ThenDeopt(reason); | |
| 1730 } | |
| 1731 | |
| 1732 HValue* BuildNewElementsCapacity(HValue* old_capacity); | 1677 HValue* BuildNewElementsCapacity(HValue* old_capacity); |
| 1733 | 1678 |
| 1734 class JSArrayBuilder V8_FINAL { | 1679 class JSArrayBuilder V8_FINAL { |
| 1735 public: | 1680 public: |
| 1736 JSArrayBuilder(HGraphBuilder* builder, | 1681 JSArrayBuilder(HGraphBuilder* builder, |
| 1737 ElementsKind kind, | 1682 ElementsKind kind, |
| 1738 HValue* allocation_site_payload, | 1683 HValue* allocation_site_payload, |
| 1739 HValue* constructor_function, | 1684 HValue* constructor_function, |
| 1740 AllocationSiteOverrideMode override_mode); | 1685 AllocationSiteOverrideMode override_mode); |
| 1741 | 1686 |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 } | 2839 } |
| 2895 | 2840 |
| 2896 private: | 2841 private: |
| 2897 HGraphBuilder* builder_; | 2842 HGraphBuilder* builder_; |
| 2898 }; | 2843 }; |
| 2899 | 2844 |
| 2900 | 2845 |
| 2901 } } // namespace v8::internal | 2846 } } // namespace v8::internal |
| 2902 | 2847 |
| 2903 #endif // V8_HYDROGEN_H_ | 2848 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |