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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 | 1484 |
1485 assembler->Bind(&if_valueisnumber); | 1485 assembler->Bind(&if_valueisnumber); |
1486 { | 1486 { |
1487 // Load the HeapNumber value. | 1487 // Load the HeapNumber value. |
1488 var_finc_value.Bind(assembler->LoadHeapNumberValue(value)); | 1488 var_finc_value.Bind(assembler->LoadHeapNumberValue(value)); |
1489 assembler->Goto(&do_finc); | 1489 assembler->Goto(&do_finc); |
1490 } | 1490 } |
1491 | 1491 |
1492 assembler->Bind(&if_valuenotnumber); | 1492 assembler->Bind(&if_valuenotnumber); |
1493 { | 1493 { |
1494 // Convert to a Number first and try again. | 1494 Label if_valueisoddball(assembler), if_valuenotoddball(assembler); |
1495 Callable callable = | 1495 Node* instance_type = assembler->LoadMapInstanceType(value_map); |
1496 CodeFactory::NonNumberToNumber(assembler->isolate()); | 1496 Node* is_oddball = assembler->Word32Equal( |
1497 var_type_feedback.Bind( | 1497 instance_type, assembler->Int32Constant(ODDBALL_TYPE)); |
1498 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | 1498 assembler->Branch(is_oddball, &if_valueisoddball, &if_valuenotoddball); |
1499 value_var.Bind(assembler->CallStub(callable, context, value)); | 1499 |
1500 assembler->Goto(&start); | 1500 assembler->Bind(&if_valueisoddball); |
1501 { | |
1502 // Convert Oddball to Number and check again. | |
1503 value_var.Bind( | |
1504 assembler->LoadObjectField(value, Oddball::kToNumberOffset)); | |
1505 // We do not require an Or with earlier feedback here because once we | |
Leszek Swirski
2016/10/20 09:40:15
One last thing: can we move this assert outside of
mythria
2016/10/20 11:38:09
Done.
| |
1506 // convert the value to a number, we cannot reach this path. We can | |
1507 // only reach this path on the first pass. | |
1508 assembler->Assert(assembler->Word32Equal( | |
1509 var_type_feedback.value(), | |
1510 assembler->Int32Constant(BinaryOperationFeedback::kNone))); | |
1511 var_type_feedback.Bind(assembler->Int32Constant( | |
1512 BinaryOperationFeedback::kNumberOrOddball)); | |
1513 assembler->Goto(&start); | |
1514 } | |
1515 | |
1516 assembler->Bind(&if_valuenotoddball); | |
1517 { | |
1518 // Convert to a Number first and try again. | |
1519 Callable callable = | |
1520 CodeFactory::NonNumberToNumber(assembler->isolate()); | |
1521 var_type_feedback.Bind( | |
1522 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | |
1523 value_var.Bind(assembler->CallStub(callable, context, value)); | |
1524 assembler->Goto(&start); | |
1525 } | |
1501 } | 1526 } |
1502 } | 1527 } |
1503 } | 1528 } |
1504 | 1529 |
1505 assembler->Bind(&do_finc); | 1530 assembler->Bind(&do_finc); |
1506 { | 1531 { |
1507 Node* finc_value = var_finc_value.value(); | 1532 Node* finc_value = var_finc_value.value(); |
1508 Node* one = assembler->Float64Constant(1.0); | 1533 Node* one = assembler->Float64Constant(1.0); |
1509 Node* finc_result = assembler->Float64Add(finc_value, one); | 1534 Node* finc_result = assembler->Float64Add(finc_value, one); |
1510 var_type_feedback.Bind(assembler->Word32Or( | 1535 var_type_feedback.Bind(assembler->Word32Or( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1594 | 1619 |
1595 assembler->Bind(&if_valueisnumber); | 1620 assembler->Bind(&if_valueisnumber); |
1596 { | 1621 { |
1597 // Load the HeapNumber value. | 1622 // Load the HeapNumber value. |
1598 var_fdec_value.Bind(assembler->LoadHeapNumberValue(value)); | 1623 var_fdec_value.Bind(assembler->LoadHeapNumberValue(value)); |
1599 assembler->Goto(&do_fdec); | 1624 assembler->Goto(&do_fdec); |
1600 } | 1625 } |
1601 | 1626 |
1602 assembler->Bind(&if_valuenotnumber); | 1627 assembler->Bind(&if_valuenotnumber); |
1603 { | 1628 { |
1604 // Convert to a Number first and try again. | 1629 Label if_valueisoddball(assembler), if_valuenotoddball(assembler); |
1605 Callable callable = | 1630 Node* instance_type = assembler->LoadMapInstanceType(value_map); |
1606 CodeFactory::NonNumberToNumber(assembler->isolate()); | 1631 Node* is_oddball = assembler->Word32Equal( |
1607 var_type_feedback.Bind( | 1632 instance_type, assembler->Int32Constant(ODDBALL_TYPE)); |
1608 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | 1633 assembler->Branch(is_oddball, &if_valueisoddball, &if_valuenotoddball); |
1609 value_var.Bind(assembler->CallStub(callable, context, value)); | 1634 |
1610 assembler->Goto(&start); | 1635 assembler->Bind(&if_valueisoddball); |
1636 { | |
1637 // Convert Oddball to Number and check again. | |
1638 value_var.Bind( | |
1639 assembler->LoadObjectField(value, Oddball::kToNumberOffset)); | |
1640 // We do not require an Or with earlier feedback here because once we | |
1641 // convert the value to a number, we cannot reach this path. We can | |
1642 // only reach this path on the first pass. | |
1643 assembler->Assert(assembler->Word32Equal( | |
1644 var_type_feedback.value(), | |
1645 assembler->Int32Constant(BinaryOperationFeedback::kNone))); | |
1646 var_type_feedback.Bind(assembler->Int32Constant( | |
1647 BinaryOperationFeedback::kNumberOrOddball)); | |
1648 assembler->Goto(&start); | |
1649 } | |
1650 | |
1651 assembler->Bind(&if_valuenotoddball); | |
1652 { | |
1653 // Convert to a Number first and try again. | |
1654 Callable callable = | |
1655 CodeFactory::NonNumberToNumber(assembler->isolate()); | |
1656 var_type_feedback.Bind( | |
1657 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | |
1658 value_var.Bind(assembler->CallStub(callable, context, value)); | |
1659 assembler->Goto(&start); | |
1660 } | |
1611 } | 1661 } |
1612 } | 1662 } |
1613 } | 1663 } |
1614 | 1664 |
1615 assembler->Bind(&do_fdec); | 1665 assembler->Bind(&do_fdec); |
1616 { | 1666 { |
1617 Node* fdec_value = var_fdec_value.value(); | 1667 Node* fdec_value = var_fdec_value.value(); |
1618 Node* one = assembler->Float64Constant(1.0); | 1668 Node* one = assembler->Float64Constant(1.0); |
1619 Node* fdec_result = assembler->Float64Sub(fdec_value, one); | 1669 Node* fdec_result = assembler->Float64Sub(fdec_value, one); |
1620 var_type_feedback.Bind(assembler->Word32Or( | 1670 var_type_feedback.Bind(assembler->Word32Or( |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3026 | 3076 |
3027 if (type == MachineType::Pointer()) { | 3077 if (type == MachineType::Pointer()) { |
3028 return Representation::External(); | 3078 return Representation::External(); |
3029 } | 3079 } |
3030 | 3080 |
3031 return Representation::Tagged(); | 3081 return Representation::Tagged(); |
3032 } | 3082 } |
3033 | 3083 |
3034 } // namespace internal | 3084 } // namespace internal |
3035 } // namespace v8 | 3085 } // namespace v8 |
OLD | NEW |