| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 // Check whether object is a smi. | 1303 // Check whether object is a smi. |
| 1304 IfBuilder if_objectissmi(this); | 1304 IfBuilder if_objectissmi(this); |
| 1305 if_objectissmi.If<HIsSmiAndBranch>(object); | 1305 if_objectissmi.If<HIsSmiAndBranch>(object); |
| 1306 if_objectissmi.Then(); | 1306 if_objectissmi.Then(); |
| 1307 { | 1307 { |
| 1308 // Compute hash for smi similar to smi_get_hash(). | 1308 // Compute hash for smi similar to smi_get_hash(). |
| 1309 HValue* hash = Add<HBitwise>(Token::BIT_AND, object, mask); | 1309 HValue* hash = Add<HBitwise>(Token::BIT_AND, object, mask); |
| 1310 | 1310 |
| 1311 // Load the key. | 1311 // Load the key. |
| 1312 HValue* key_index = Add<HShl>(hash, graph()->GetConstant1()); | 1312 HValue* key_index = Add<HShl>(hash, graph()->GetConstant1()); |
| 1313 HValue* key = AddFastElementAccess(number_string_cache, key_index, | 1313 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, |
| 1314 NULL, NULL, FAST_ELEMENTS, false, | 1314 static_cast<HValue*>(NULL), |
| 1315 ALLOW_RETURN_HOLE, STANDARD_STORE); | 1315 FAST_ELEMENTS, ALLOW_RETURN_HOLE); |
| 1316 | 1316 |
| 1317 // Check if object == key. | 1317 // Check if object == key. |
| 1318 IfBuilder if_objectiskey(this); | 1318 IfBuilder if_objectiskey(this); |
| 1319 if_objectiskey.If<HCompareObjectEqAndBranch>(key, object); | 1319 if_objectiskey.If<HCompareObjectEqAndBranch>(key, object); |
| 1320 if_objectiskey.Then(); | 1320 if_objectiskey.Then(); |
| 1321 { | 1321 { |
| 1322 // Make the key_index available. | 1322 // Make the key_index available. |
| 1323 Push(key_index); | 1323 Push(key_index); |
| 1324 } | 1324 } |
| 1325 if_objectiskey.JoinContinuation(&found); | 1325 if_objectiskey.JoinContinuation(&found); |
| 1326 } | 1326 } |
| 1327 if_objectissmi.Else(); | 1327 if_objectissmi.Else(); |
| 1328 { | 1328 { |
| 1329 // Check if object is a heap number. | 1329 // Check if object is a heap number. |
| 1330 IfBuilder if_objectisnumber(this); | 1330 IfBuilder if_objectisnumber(this); |
| 1331 if_objectisnumber.If<HCompareMap>( | 1331 if_objectisnumber.If<HCompareMap>( |
| 1332 object, isolate()->factory()->heap_number_map()); | 1332 object, isolate()->factory()->heap_number_map()); |
| 1333 if_objectisnumber.Then(); | 1333 if_objectisnumber.Then(); |
| 1334 { | 1334 { |
| 1335 // Compute hash for heap number similar to double_get_hash(). | 1335 // Compute hash for heap number similar to double_get_hash(). |
| 1336 HValue* low = Add<HLoadNamedField>( | 1336 HValue* low = Add<HLoadNamedField>( |
| 1337 object, HObjectAccess::ForHeapNumberValueLowestBits()); | 1337 object, HObjectAccess::ForHeapNumberValueLowestBits()); |
| 1338 HValue* high = Add<HLoadNamedField>( | 1338 HValue* high = Add<HLoadNamedField>( |
| 1339 object, HObjectAccess::ForHeapNumberValueHighestBits()); | 1339 object, HObjectAccess::ForHeapNumberValueHighestBits()); |
| 1340 HValue* hash = Add<HBitwise>(Token::BIT_XOR, low, high); | 1340 HValue* hash = Add<HBitwise>(Token::BIT_XOR, low, high); |
| 1341 hash = Add<HBitwise>(Token::BIT_AND, hash, mask); | 1341 hash = Add<HBitwise>(Token::BIT_AND, hash, mask); |
| 1342 | 1342 |
| 1343 // Load the key. | 1343 // Load the key. |
| 1344 HValue* key_index = Add<HShl>(hash, graph()->GetConstant1()); | 1344 HValue* key_index = Add<HShl>(hash, graph()->GetConstant1()); |
| 1345 HValue* key = AddFastElementAccess(number_string_cache, key_index, | 1345 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, |
| 1346 NULL, NULL, FAST_ELEMENTS, false, | 1346 static_cast<HValue*>(NULL), |
| 1347 ALLOW_RETURN_HOLE, STANDARD_STORE); | 1347 FAST_ELEMENTS, ALLOW_RETURN_HOLE); |
| 1348 | 1348 |
| 1349 // Check if key is a heap number. | 1349 // Check if key is a heap number. |
| 1350 IfBuilder if_keyisnumber(this); | 1350 IfBuilder if_keyisnumber(this); |
| 1351 if_keyisnumber.IfNot<HIsSmiAndBranch>(key); | 1351 if_keyisnumber.IfNot<HIsSmiAndBranch>(key); |
| 1352 if_keyisnumber.AndIf<HCompareMap>( | 1352 if_keyisnumber.AndIf<HCompareMap>( |
| 1353 key, isolate()->factory()->heap_number_map()); | 1353 key, isolate()->factory()->heap_number_map()); |
| 1354 if_keyisnumber.Then(); | 1354 if_keyisnumber.Then(); |
| 1355 { | 1355 { |
| 1356 // Check if values of key and object match. | 1356 // Check if values of key and object match. |
| 1357 IfBuilder if_keyeqobject(this); | 1357 IfBuilder if_keyeqobject(this); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1372 } | 1372 } |
| 1373 if_objectissmi.End(); | 1373 if_objectissmi.End(); |
| 1374 | 1374 |
| 1375 // Check for cache hit. | 1375 // Check for cache hit. |
| 1376 IfBuilder if_found(this, &found); | 1376 IfBuilder if_found(this, &found); |
| 1377 if_found.Then(); | 1377 if_found.Then(); |
| 1378 | 1378 |
| 1379 // Load the value in case of cache hit. | 1379 // Load the value in case of cache hit. |
| 1380 HValue* key_index = Pop(); | 1380 HValue* key_index = Pop(); |
| 1381 HValue* value_index = Add<HAdd>(key_index, graph()->GetConstant1()); | 1381 HValue* value_index = Add<HAdd>(key_index, graph()->GetConstant1()); |
| 1382 HValue* value = AddFastElementAccess(number_string_cache, value_index, | 1382 HValue* value = Add<HLoadKeyed>(number_string_cache, value_index, |
| 1383 NULL, NULL, FAST_ELEMENTS, false, | 1383 static_cast<HValue*>(NULL), |
| 1384 ALLOW_RETURN_HOLE, STANDARD_STORE); | 1384 FAST_ELEMENTS, ALLOW_RETURN_HOLE); |
| 1385 AddIncrementCounter(isolate()->counters()->number_to_string_native()); | 1385 AddIncrementCounter(isolate()->counters()->number_to_string_native()); |
| 1386 | 1386 |
| 1387 if_found.CaptureContinuation(continuation); | 1387 if_found.CaptureContinuation(continuation); |
| 1388 | 1388 |
| 1389 // The value is only available in true branch of continuation. | 1389 // The value is only available in true branch of continuation. |
| 1390 return value; | 1390 return value; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 | 1393 |
| 1394 HValue* HGraphBuilder::BuildNumberToString(HValue* number) { | 1394 HValue* HGraphBuilder::BuildNumberToString(HValue* number) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 NoObservableSideEffectsScope no_effects(this); | 1462 NoObservableSideEffectsScope no_effects(this); |
| 1463 HLoadExternalArrayPointer* external_elements = | 1463 HLoadExternalArrayPointer* external_elements = |
| 1464 Add<HLoadExternalArrayPointer>(elements); | 1464 Add<HLoadExternalArrayPointer>(elements); |
| 1465 IfBuilder length_checker(this); | 1465 IfBuilder length_checker(this); |
| 1466 length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT); | 1466 length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT); |
| 1467 length_checker.Then(); | 1467 length_checker.Then(); |
| 1468 IfBuilder negative_checker(this); | 1468 IfBuilder negative_checker(this); |
| 1469 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>( | 1469 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>( |
| 1470 key, graph()->GetConstant0(), Token::GTE); | 1470 key, graph()->GetConstant0(), Token::GTE); |
| 1471 negative_checker.Then(); | 1471 negative_checker.Then(); |
| 1472 HInstruction* result = AddExternalArrayElementAccess( | 1472 HInstruction* result = AddElementAccess( |
| 1473 external_elements, key, val, bounds_check, elements_kind, is_store); | 1473 external_elements, key, val, bounds_check, elements_kind, is_store); |
| 1474 negative_checker.ElseDeopt("Negative key encountered"); | 1474 negative_checker.ElseDeopt("Negative key encountered"); |
| 1475 length_checker.End(); | 1475 length_checker.End(); |
| 1476 return result; | 1476 return result; |
| 1477 } else { | 1477 } else { |
| 1478 ASSERT(store_mode == STANDARD_STORE); | 1478 ASSERT(store_mode == STANDARD_STORE); |
| 1479 checked_key = Add<HBoundsCheck>(key, length); | 1479 checked_key = Add<HBoundsCheck>(key, length); |
| 1480 HLoadExternalArrayPointer* external_elements = | 1480 HLoadExternalArrayPointer* external_elements = |
| 1481 Add<HLoadExternalArrayPointer>(elements); | 1481 Add<HLoadExternalArrayPointer>(elements); |
| 1482 return AddExternalArrayElementAccess( | 1482 return AddElementAccess( |
| 1483 external_elements, checked_key, val, | 1483 external_elements, checked_key, val, |
| 1484 checked_object, elements_kind, is_store); | 1484 checked_object, elements_kind, is_store); |
| 1485 } | 1485 } |
| 1486 } | 1486 } |
| 1487 ASSERT(fast_smi_only_elements || | 1487 ASSERT(fast_smi_only_elements || |
| 1488 fast_elements || | 1488 fast_elements || |
| 1489 IsFastDoubleElementsKind(elements_kind)); | 1489 IsFastDoubleElementsKind(elements_kind)); |
| 1490 | 1490 |
| 1491 // In case val is stored into a fast smi array, assure that the value is a smi | 1491 // In case val is stored into a fast smi array, assure that the value is a smi |
| 1492 // before manipulating the backing store. Otherwise the actual store may | 1492 // before manipulating the backing store. Otherwise the actual store may |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1505 } else { | 1505 } else { |
| 1506 checked_key = Add<HBoundsCheck>(key, length); | 1506 checked_key = Add<HBoundsCheck>(key, length); |
| 1507 | 1507 |
| 1508 if (is_store && (fast_elements || fast_smi_only_elements)) { | 1508 if (is_store && (fast_elements || fast_smi_only_elements)) { |
| 1509 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 1509 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
| 1510 NoObservableSideEffectsScope no_effects(this); | 1510 NoObservableSideEffectsScope no_effects(this); |
| 1511 elements = BuildCopyElementsOnWrite(checked_object, elements, | 1511 elements = BuildCopyElementsOnWrite(checked_object, elements, |
| 1512 elements_kind, length); | 1512 elements_kind, length); |
| 1513 } else { | 1513 } else { |
| 1514 HCheckMaps* check_cow_map = Add<HCheckMaps>( | 1514 HCheckMaps* check_cow_map = Add<HCheckMaps>( |
| 1515 elements, isolate()->factory()->fixed_array_map(), | 1515 elements, isolate()->factory()->fixed_array_map(), top_info()); |
| 1516 top_info()); | |
| 1517 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); | 1516 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); |
| 1518 } | 1517 } |
| 1519 } | 1518 } |
| 1520 } | 1519 } |
| 1521 return AddFastElementAccess(elements, checked_key, val, checked_object, | 1520 return AddElementAccess(elements, checked_key, val, checked_object, |
| 1522 elements_kind, is_store, load_mode, store_mode); | 1521 elements_kind, is_store, load_mode); |
| 1523 } | 1522 } |
| 1524 | 1523 |
| 1525 | 1524 |
| 1526 HValue* HGraphBuilder::BuildAllocateElements(ElementsKind kind, | 1525 HValue* HGraphBuilder::BuildAllocateElements(ElementsKind kind, |
| 1527 HValue* capacity) { | 1526 HValue* capacity) { |
| 1528 int elements_size; | 1527 int elements_size; |
| 1529 InstanceType instance_type; | 1528 InstanceType instance_type; |
| 1530 | 1529 |
| 1531 if (IsFastDoubleElementsKind(kind)) { | 1530 if (IsFastDoubleElementsKind(kind)) { |
| 1532 elements_size = kDoubleSize; | 1531 elements_size = kDoubleSize; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 if (mode == TRACK_ALLOCATION_SITE) { | 1601 if (mode == TRACK_ALLOCATION_SITE) { |
| 1603 elements_location += AllocationMemento::kSize; | 1602 elements_location += AllocationMemento::kSize; |
| 1604 } | 1603 } |
| 1605 | 1604 |
| 1606 HValue* elements = Add<HInnerAllocatedObject>(array, elements_location); | 1605 HValue* elements = Add<HInnerAllocatedObject>(array, elements_location); |
| 1607 Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements); | 1606 Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements); |
| 1608 return static_cast<HInnerAllocatedObject*>(elements); | 1607 return static_cast<HInnerAllocatedObject*>(elements); |
| 1609 } | 1608 } |
| 1610 | 1609 |
| 1611 | 1610 |
| 1612 HInstruction* HGraphBuilder::AddExternalArrayElementAccess( | 1611 HInstruction* HGraphBuilder::AddElementAccess( |
| 1613 HValue* external_elements, | 1612 HValue* elements, |
| 1614 HValue* checked_key, | 1613 HValue* checked_key, |
| 1615 HValue* val, | 1614 HValue* val, |
| 1616 HValue* dependency, | 1615 HValue* dependency, |
| 1617 ElementsKind elements_kind, | 1616 ElementsKind elements_kind, |
| 1618 bool is_store) { | 1617 bool is_store, |
| 1618 LoadKeyedHoleMode load_mode) { |
| 1619 if (is_store) { | 1619 if (is_store) { |
| 1620 ASSERT(val != NULL); | 1620 ASSERT(val != NULL); |
| 1621 switch (elements_kind) { | 1621 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) { |
| 1622 case EXTERNAL_PIXEL_ELEMENTS: { | 1622 val = Add<HClampToUint8>(val); |
| 1623 val = Add<HClampToUint8>(val); | |
| 1624 break; | |
| 1625 } | |
| 1626 case EXTERNAL_BYTE_ELEMENTS: | |
| 1627 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | |
| 1628 case EXTERNAL_SHORT_ELEMENTS: | |
| 1629 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | |
| 1630 case EXTERNAL_INT_ELEMENTS: | |
| 1631 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | |
| 1632 break; | |
| 1633 } | |
| 1634 case EXTERNAL_FLOAT_ELEMENTS: | |
| 1635 case EXTERNAL_DOUBLE_ELEMENTS: | |
| 1636 break; | |
| 1637 case FAST_SMI_ELEMENTS: | |
| 1638 case FAST_ELEMENTS: | |
| 1639 case FAST_DOUBLE_ELEMENTS: | |
| 1640 case FAST_HOLEY_SMI_ELEMENTS: | |
| 1641 case FAST_HOLEY_ELEMENTS: | |
| 1642 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
| 1643 case DICTIONARY_ELEMENTS: | |
| 1644 case NON_STRICT_ARGUMENTS_ELEMENTS: | |
| 1645 UNREACHABLE(); | |
| 1646 break; | |
| 1647 } | 1623 } |
| 1648 return Add<HStoreKeyed>(external_elements, checked_key, val, elements_kind); | 1624 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind); |
| 1649 } else { | |
| 1650 ASSERT(val == NULL); | |
| 1651 HLoadKeyed* load = Add<HLoadKeyed>(external_elements, | |
| 1652 checked_key, | |
| 1653 dependency, | |
| 1654 elements_kind); | |
| 1655 if (FLAG_opt_safe_uint32_operations && | |
| 1656 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { | |
| 1657 graph()->RecordUint32Instruction(load); | |
| 1658 } | |
| 1659 return load; | |
| 1660 } | 1625 } |
| 1626 |
| 1627 ASSERT(!is_store); |
| 1628 ASSERT(val == NULL); |
| 1629 HLoadKeyed* load = Add<HLoadKeyed>( |
| 1630 elements, checked_key, dependency, elements_kind, load_mode); |
| 1631 if (FLAG_opt_safe_uint32_operations && |
| 1632 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
| 1633 graph()->RecordUint32Instruction(load); |
| 1634 } |
| 1635 return load; |
| 1661 } | 1636 } |
| 1662 | 1637 |
| 1663 | 1638 |
| 1664 HInstruction* HGraphBuilder::AddFastElementAccess( | |
| 1665 HValue* elements, | |
| 1666 HValue* checked_key, | |
| 1667 HValue* val, | |
| 1668 HValue* load_dependency, | |
| 1669 ElementsKind elements_kind, | |
| 1670 bool is_store, | |
| 1671 LoadKeyedHoleMode load_mode, | |
| 1672 KeyedAccessStoreMode store_mode) { | |
| 1673 if (is_store) { | |
| 1674 ASSERT(val != NULL); | |
| 1675 switch (elements_kind) { | |
| 1676 case FAST_SMI_ELEMENTS: | |
| 1677 case FAST_HOLEY_SMI_ELEMENTS: | |
| 1678 case FAST_ELEMENTS: | |
| 1679 case FAST_HOLEY_ELEMENTS: | |
| 1680 case FAST_DOUBLE_ELEMENTS: | |
| 1681 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
| 1682 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind); | |
| 1683 default: | |
| 1684 UNREACHABLE(); | |
| 1685 return NULL; | |
| 1686 } | |
| 1687 } | |
| 1688 // It's an element load (!is_store). | |
| 1689 return Add<HLoadKeyed>( | |
| 1690 elements, checked_key, load_dependency, elements_kind, load_mode); | |
| 1691 } | |
| 1692 | |
| 1693 | |
| 1694 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object) { | 1639 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object) { |
| 1695 return Add<HLoadNamedField>(object, HObjectAccess::ForElementsPointer()); | 1640 return Add<HLoadNamedField>(object, HObjectAccess::ForElementsPointer()); |
| 1696 } | 1641 } |
| 1697 | 1642 |
| 1698 | 1643 |
| 1699 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) { | 1644 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) { |
| 1700 return Add<HLoadNamedField>(object, | 1645 return Add<HLoadNamedField>(object, |
| 1701 HObjectAccess::ForFixedArrayLength()); | 1646 HObjectAccess::ForFixedArrayLength()); |
| 1702 } | 1647 } |
| 1703 | 1648 |
| (...skipping 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5119 BailoutId ast_id, | 5064 BailoutId ast_id, |
| 5120 BailoutId return_id, | 5065 BailoutId return_id, |
| 5121 bool is_uninitialized) { | 5066 bool is_uninitialized) { |
| 5122 HValue* value = environment()->ExpressionStackAt(0); | 5067 HValue* value = environment()->ExpressionStackAt(0); |
| 5123 | 5068 |
| 5124 if (!prop->key()->IsPropertyName()) { | 5069 if (!prop->key()->IsPropertyName()) { |
| 5125 // Keyed store. | 5070 // Keyed store. |
| 5126 HValue* key = environment()->ExpressionStackAt(1); | 5071 HValue* key = environment()->ExpressionStackAt(1); |
| 5127 HValue* object = environment()->ExpressionStackAt(2); | 5072 HValue* object = environment()->ExpressionStackAt(2); |
| 5128 bool has_side_effects = false; | 5073 bool has_side_effects = false; |
| 5129 HandleKeyedElementAccess(object, key, value, expr, return_id, | 5074 HandleKeyedElementAccess(object, key, value, expr, expr->position(), |
| 5130 expr->position(), | |
| 5131 true, // is_store | 5075 true, // is_store |
| 5132 &has_side_effects); | 5076 &has_side_effects); |
| 5133 Drop(3); | 5077 Drop(3); |
| 5134 Push(value); | 5078 Push(value); |
| 5135 Add<HSimulate>(return_id, REMOVABLE_SIMULATE); | 5079 Add<HSimulate>(return_id, REMOVABLE_SIMULATE); |
| 5136 return ast_context()->ReturnValue(Pop()); | 5080 return ast_context()->ReturnValue(Pop()); |
| 5137 } | 5081 } |
| 5138 | 5082 |
| 5139 // Named store. | 5083 // Named store. |
| 5140 HValue* object = environment()->ExpressionStackAt(1); | 5084 HValue* object = environment()->ExpressionStackAt(1); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5669 false, NEVER_RETURN_HOLE, STANDARD_STORE); | 5613 false, NEVER_RETURN_HOLE, STANDARD_STORE); |
| 5670 return instr; | 5614 return instr; |
| 5671 } | 5615 } |
| 5672 | 5616 |
| 5673 | 5617 |
| 5674 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( | 5618 HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
| 5675 HValue* object, | 5619 HValue* object, |
| 5676 HValue* key, | 5620 HValue* key, |
| 5677 HValue* val, | 5621 HValue* val, |
| 5678 SmallMapList* maps, | 5622 SmallMapList* maps, |
| 5679 BailoutId ast_id, | |
| 5680 int position, | 5623 int position, |
| 5681 bool is_store, | 5624 bool is_store, |
| 5682 KeyedAccessStoreMode store_mode, | 5625 KeyedAccessStoreMode store_mode, |
| 5683 bool* has_side_effects) { | 5626 bool* has_side_effects) { |
| 5684 *has_side_effects = false; | 5627 *has_side_effects = false; |
| 5685 BuildCheckHeapObject(object); | 5628 BuildCheckHeapObject(object); |
| 5686 | 5629 |
| 5687 if (!is_store) { | 5630 if (!is_store) { |
| 5688 HInstruction* consolidated_load = | 5631 HInstruction* consolidated_load = |
| 5689 TryBuildConsolidatedElementLoad(object, key, val, maps); | 5632 TryBuildConsolidatedElementLoad(object, key, val, maps); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5801 set_current_block(join); | 5744 set_current_block(join); |
| 5802 return is_store ? NULL : Pop(); | 5745 return is_store ? NULL : Pop(); |
| 5803 } | 5746 } |
| 5804 | 5747 |
| 5805 | 5748 |
| 5806 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( | 5749 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
| 5807 HValue* obj, | 5750 HValue* obj, |
| 5808 HValue* key, | 5751 HValue* key, |
| 5809 HValue* val, | 5752 HValue* val, |
| 5810 Expression* expr, | 5753 Expression* expr, |
| 5811 BailoutId ast_id, | |
| 5812 int position, | 5754 int position, |
| 5813 bool is_store, | 5755 bool is_store, |
| 5814 bool* has_side_effects) { | 5756 bool* has_side_effects) { |
| 5815 ASSERT(!expr->IsPropertyName()); | 5757 ASSERT(!expr->IsPropertyName()); |
| 5816 HInstruction* instr = NULL; | 5758 HInstruction* instr = NULL; |
| 5817 | 5759 |
| 5818 SmallMapList* types; | 5760 SmallMapList* types; |
| 5819 bool monomorphic = ComputeReceiverTypes(expr, obj, &types); | 5761 bool monomorphic = ComputeReceiverTypes(expr, obj, &types); |
| 5820 | 5762 |
| 5821 if (monomorphic) { | 5763 if (monomorphic) { |
| 5822 Handle<Map> map = types->first(); | 5764 Handle<Map> map = types->first(); |
| 5823 if (map->has_slow_elements_kind()) { | 5765 if (map->has_slow_elements_kind()) { |
| 5824 instr = is_store ? BuildStoreKeyedGeneric(obj, key, val) | 5766 instr = is_store ? BuildStoreKeyedGeneric(obj, key, val) |
| 5825 : BuildLoadKeyedGeneric(obj, key); | 5767 : BuildLoadKeyedGeneric(obj, key); |
| 5826 AddInstruction(instr); | 5768 AddInstruction(instr); |
| 5827 } else { | 5769 } else { |
| 5828 BuildCheckHeapObject(obj); | 5770 BuildCheckHeapObject(obj); |
| 5829 instr = BuildMonomorphicElementAccess( | 5771 instr = BuildMonomorphicElementAccess( |
| 5830 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); | 5772 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); |
| 5831 } | 5773 } |
| 5832 } else if (types != NULL && !types->is_empty()) { | 5774 } else if (types != NULL && !types->is_empty()) { |
| 5833 return HandlePolymorphicElementAccess( | 5775 return HandlePolymorphicElementAccess( |
| 5834 obj, key, val, types, ast_id, position, is_store, | 5776 obj, key, val, types, position, is_store, |
| 5835 expr->GetStoreMode(), has_side_effects); | 5777 expr->GetStoreMode(), has_side_effects); |
| 5836 } else { | 5778 } else { |
| 5837 if (is_store) { | 5779 if (is_store) { |
| 5838 if (expr->IsAssignment() && expr->AsAssignment()->IsUninitialized()) { | 5780 if (expr->IsAssignment() && expr->AsAssignment()->IsUninitialized()) { |
| 5839 Add<HDeoptimize>("Insufficient type feedback for keyed store", | 5781 Add<HDeoptimize>("Insufficient type feedback for keyed store", |
| 5840 Deoptimizer::SOFT); | 5782 Deoptimizer::SOFT); |
| 5841 } | 5783 } |
| 5842 instr = BuildStoreKeyedGeneric(obj, key, val); | 5784 instr = BuildStoreKeyedGeneric(obj, key, val); |
| 5843 } else { | 5785 } else { |
| 5844 if (expr->AsProperty()->IsUninitialized()) { | 5786 if (expr->AsProperty()->IsUninitialized()) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6013 } else { | 5955 } else { |
| 6014 instr = BuildLoadNamedGeneric(object, name, expr); | 5956 instr = BuildLoadNamedGeneric(object, name, expr); |
| 6015 } | 5957 } |
| 6016 | 5958 |
| 6017 } else { | 5959 } else { |
| 6018 HValue* key = Pop(); | 5960 HValue* key = Pop(); |
| 6019 HValue* obj = Pop(); | 5961 HValue* obj = Pop(); |
| 6020 | 5962 |
| 6021 bool has_side_effects = false; | 5963 bool has_side_effects = false; |
| 6022 HValue* load = HandleKeyedElementAccess( | 5964 HValue* load = HandleKeyedElementAccess( |
| 6023 obj, key, NULL, expr, ast_id, position, | 5965 obj, key, NULL, expr, position, |
| 6024 false, // is_store | 5966 false, // is_store |
| 6025 &has_side_effects); | 5967 &has_side_effects); |
| 6026 if (has_side_effects) { | 5968 if (has_side_effects) { |
| 6027 if (ast_context()->IsEffect()) { | 5969 if (ast_context()->IsEffect()) { |
| 6028 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 5970 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6029 } else { | 5971 } else { |
| 6030 Push(load); | 5972 Push(load); |
| 6031 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 5973 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6032 Drop(1); | 5974 Drop(1); |
| 6033 } | 5975 } |
| (...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9867 if (ShouldProduceTraceOutput()) { | 9809 if (ShouldProduceTraceOutput()) { |
| 9868 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9810 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9869 } | 9811 } |
| 9870 | 9812 |
| 9871 #ifdef DEBUG | 9813 #ifdef DEBUG |
| 9872 graph_->Verify(false); // No full verify. | 9814 graph_->Verify(false); // No full verify. |
| 9873 #endif | 9815 #endif |
| 9874 } | 9816 } |
| 9875 | 9817 |
| 9876 } } // namespace v8::internal | 9818 } } // namespace v8::internal |
| OLD | NEW |