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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } else { | 1450 } else { |
1451 // This expression cannot throw a reference error at the top level. | 1451 // This expression cannot throw a reference error at the top level. |
1452 VisitForValue(expr->expression(), kStack); | 1452 VisitForValue(expr->expression(), kStack); |
1453 } | 1453 } |
1454 | 1454 |
1455 __ CallRuntime(Runtime::kTypeof, 1); | 1455 __ CallRuntime(Runtime::kTypeof, 1); |
1456 Apply(context_, eax); | 1456 Apply(context_, eax); |
1457 break; | 1457 break; |
1458 } | 1458 } |
1459 | 1459 |
| 1460 case Token::ADD: { |
| 1461 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
| 1462 VisitForValue(expr->expression(), kAccumulator); |
| 1463 Label no_conversion; |
| 1464 __ test(result_register(), Immediate(kSmiTagMask)); |
| 1465 __ j(zero, &no_conversion); |
| 1466 __ push(result_register()); |
| 1467 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_FUNCTION); |
| 1468 __ bind(&no_conversion); |
| 1469 Apply(context_, result_register()); |
| 1470 break; |
| 1471 } |
| 1472 |
1460 default: | 1473 default: |
1461 UNREACHABLE(); | 1474 UNREACHABLE(); |
1462 } | 1475 } |
1463 } | 1476 } |
1464 | 1477 |
1465 | 1478 |
1466 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 1479 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
1467 Comment cmnt(masm_, "[ CountOperation"); | 1480 Comment cmnt(masm_, "[ CountOperation"); |
1468 | 1481 |
1469 // Expression can only be a property, a global or a (parameter or local) | 1482 // Expression can only be a property, a global or a (parameter or local) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 __ add(Operand(edx), Immediate(masm_->CodeObject())); | 1834 __ add(Operand(edx), Immediate(masm_->CodeObject())); |
1822 __ mov(Operand(esp, 0), edx); | 1835 __ mov(Operand(esp, 0), edx); |
1823 // And return. | 1836 // And return. |
1824 __ ret(0); | 1837 __ ret(0); |
1825 } | 1838 } |
1826 | 1839 |
1827 | 1840 |
1828 #undef __ | 1841 #undef __ |
1829 | 1842 |
1830 } } // namespace v8::internal | 1843 } } // namespace v8::internal |
OLD | NEW |