Chromium Code Reviews| 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 | |
| 1506 // convert the value to a number, we cannot reach this path. We can | |
| 1507 // only reach this path on the first pass. | |
| 1508 var_type_feedback.Bind(assembler->Int32Constant( | |
| 1509 BinaryOperationFeedback::kNumberOrOddball)); | |
| 1510 assembler->Goto(&start); | |
| 1511 } | |
| 1512 | |
| 1513 assembler->Bind(&if_valuenotoddball); | |
| 1514 { | |
| 1515 // Convert to a Number first and try again. | |
| 1516 Callable callable = | |
| 1517 CodeFactory::NonNumberToNumber(assembler->isolate()); | |
| 1518 var_type_feedback.Bind( | |
| 1519 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | |
| 1520 value_var.Bind(assembler->CallStub(callable, context, value)); | |
| 1521 assembler->Goto(&start); | |
| 1522 } | |
| 1501 } | 1523 } |
| 1502 } | 1524 } |
| 1503 } | 1525 } |
| 1504 | 1526 |
| 1505 assembler->Bind(&do_finc); | 1527 assembler->Bind(&do_finc); |
| 1506 { | 1528 { |
| 1507 Node* finc_value = var_finc_value.value(); | 1529 Node* finc_value = var_finc_value.value(); |
| 1508 Node* one = assembler->Float64Constant(1.0); | 1530 Node* one = assembler->Float64Constant(1.0); |
| 1509 Node* finc_result = assembler->Float64Add(finc_value, one); | 1531 Node* finc_result = assembler->Float64Add(finc_value, one); |
| 1510 var_type_feedback.Bind(assembler->Word32Or( | 1532 var_type_feedback.Bind(assembler->Word32Or( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1594 | 1616 |
| 1595 assembler->Bind(&if_valueisnumber); | 1617 assembler->Bind(&if_valueisnumber); |
| 1596 { | 1618 { |
| 1597 // Load the HeapNumber value. | 1619 // Load the HeapNumber value. |
| 1598 var_fdec_value.Bind(assembler->LoadHeapNumberValue(value)); | 1620 var_fdec_value.Bind(assembler->LoadHeapNumberValue(value)); |
| 1599 assembler->Goto(&do_fdec); | 1621 assembler->Goto(&do_fdec); |
| 1600 } | 1622 } |
| 1601 | 1623 |
| 1602 assembler->Bind(&if_valuenotnumber); | 1624 assembler->Bind(&if_valuenotnumber); |
| 1603 { | 1625 { |
| 1604 // Convert to a Number first and try again. | 1626 Label if_valueisoddball(assembler), if_valuenotoddball(assembler); |
| 1605 Callable callable = | 1627 Node* instance_type = assembler->LoadMapInstanceType(value_map); |
| 1606 CodeFactory::NonNumberToNumber(assembler->isolate()); | 1628 Node* is_oddball = assembler->Word32Equal( |
| 1607 var_type_feedback.Bind( | 1629 instance_type, assembler->Int32Constant(ODDBALL_TYPE)); |
| 1608 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | 1630 assembler->Branch(is_oddball, &if_valueisoddball, &if_valuenotoddball); |
| 1609 value_var.Bind(assembler->CallStub(callable, context, value)); | 1631 |
| 1610 assembler->Goto(&start); | 1632 assembler->Bind(&if_valueisoddball); |
| 1633 { | |
| 1634 // Convert Oddball to Number and check again. | |
| 1635 value_var.Bind( | |
| 1636 assembler->LoadObjectField(value, Oddball::kToNumberOffset)); | |
| 1637 // We do not require an Or with earlier feedback here because once we | |
| 1638 // convert the value to a number, we cannot reach this path. We can | |
| 1639 // only reach this path on the first pass. | |
|
Leszek Swirski
2016/10/19 11:34:01
Can we add an assert that var_type_feedback is not
Leszek Swirski
2016/10/19 11:35:30
Um, by not bound I mean "value is 0" or something
mythria
2016/10/19 14:35:41
Great suggestion. I wanted to some kind of check b
| |
| 1640 var_type_feedback.Bind(assembler->Int32Constant( | |
| 1641 BinaryOperationFeedback::kNumberOrOddball)); | |
| 1642 assembler->Goto(&start); | |
| 1643 } | |
| 1644 | |
| 1645 assembler->Bind(&if_valuenotoddball); | |
| 1646 { | |
| 1647 // Convert to a Number first and try again. | |
| 1648 Callable callable = | |
| 1649 CodeFactory::NonNumberToNumber(assembler->isolate()); | |
| 1650 var_type_feedback.Bind( | |
| 1651 assembler->Int32Constant(BinaryOperationFeedback::kAny)); | |
| 1652 value_var.Bind(assembler->CallStub(callable, context, value)); | |
| 1653 assembler->Goto(&start); | |
| 1654 } | |
| 1611 } | 1655 } |
| 1612 } | 1656 } |
| 1613 } | 1657 } |
| 1614 | 1658 |
| 1615 assembler->Bind(&do_fdec); | 1659 assembler->Bind(&do_fdec); |
| 1616 { | 1660 { |
| 1617 Node* fdec_value = var_fdec_value.value(); | 1661 Node* fdec_value = var_fdec_value.value(); |
| 1618 Node* one = assembler->Float64Constant(1.0); | 1662 Node* one = assembler->Float64Constant(1.0); |
| 1619 Node* fdec_result = assembler->Float64Sub(fdec_value, one); | 1663 Node* fdec_result = assembler->Float64Sub(fdec_value, one); |
| 1620 var_type_feedback.Bind(assembler->Word32Or( | 1664 var_type_feedback.Bind(assembler->Word32Or( |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3026 | 3070 |
| 3027 if (type == MachineType::Pointer()) { | 3071 if (type == MachineType::Pointer()) { |
| 3028 return Representation::External(); | 3072 return Representation::External(); |
| 3029 } | 3073 } |
| 3030 | 3074 |
| 3031 return Representation::Tagged(); | 3075 return Representation::Tagged(); |
| 3032 } | 3076 } |
| 3033 | 3077 |
| 3034 } // namespace internal | 3078 } // namespace internal |
| 3035 } // namespace v8 | 3079 } // namespace v8 |
| OLD | NEW |