OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 } else { | 1457 } else { |
1458 // This expression cannot throw a reference error at the top level. | 1458 // This expression cannot throw a reference error at the top level. |
1459 VisitForValue(expr->expression(), kStack); | 1459 VisitForValue(expr->expression(), kStack); |
1460 } | 1460 } |
1461 | 1461 |
1462 __ CallRuntime(Runtime::kTypeof, 1); | 1462 __ CallRuntime(Runtime::kTypeof, 1); |
1463 Apply(context_, rax); | 1463 Apply(context_, rax); |
1464 break; | 1464 break; |
1465 } | 1465 } |
1466 | 1466 |
| 1467 case Token::ADD: { |
| 1468 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
| 1469 VisitForValue(expr->expression(), kAccumulator); |
| 1470 Label no_conversion; |
| 1471 Condition is_smi; |
| 1472 is_smi = masm_->CheckSmi(result_register()); |
| 1473 __ j(is_smi, &no_conversion); |
| 1474 __ push(result_register()); |
| 1475 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); |
| 1476 __ bind(&no_conversion); |
| 1477 Apply(context_, result_register()); |
| 1478 break; |
| 1479 } |
| 1480 |
1467 default: | 1481 default: |
1468 UNREACHABLE(); | 1482 UNREACHABLE(); |
1469 } | 1483 } |
1470 } | 1484 } |
1471 | 1485 |
1472 | 1486 |
1473 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 1487 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
1474 Comment cmnt(masm_, "[ CountOperation"); | 1488 Comment cmnt(masm_, "[ CountOperation"); |
1475 | 1489 |
1476 // Expression can only be a property, a global or a (parameter or local) | 1490 // Expression can only be a property, a global or a (parameter or local) |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 __ movq(Operand(rsp, 0), rdx); | 1843 __ movq(Operand(rsp, 0), rdx); |
1830 // And return. | 1844 // And return. |
1831 __ ret(0); | 1845 __ ret(0); |
1832 } | 1846 } |
1833 | 1847 |
1834 | 1848 |
1835 #undef __ | 1849 #undef __ |
1836 | 1850 |
1837 | 1851 |
1838 } } // namespace v8::internal | 1852 } } // namespace v8::internal |
OLD | NEW |