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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 } else { | 1344 } else { |
1345 // This expression cannot throw a reference error at the top level. | 1345 // This expression cannot throw a reference error at the top level. |
1346 VisitForValue(expr->expression(), kStack); | 1346 VisitForValue(expr->expression(), kStack); |
1347 } | 1347 } |
1348 | 1348 |
1349 __ CallRuntime(Runtime::kTypeof, 1); | 1349 __ CallRuntime(Runtime::kTypeof, 1); |
1350 Apply(context_, r0); | 1350 Apply(context_, r0); |
1351 break; | 1351 break; |
1352 } | 1352 } |
1353 | 1353 |
| 1354 case Token::ADD: { |
| 1355 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
| 1356 VisitForValue(expr->expression(), kAccumulator); |
| 1357 Label no_conversion; |
| 1358 __ tst(result_register(), Operand(kSmiTagMask)); |
| 1359 __ b(eq, &no_conversion); |
| 1360 __ push(r0); |
| 1361 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS); |
| 1362 __ bind(&no_conversion); |
| 1363 Apply(context_, result_register()); |
| 1364 break; |
| 1365 } |
| 1366 |
1354 default: | 1367 default: |
1355 UNREACHABLE(); | 1368 UNREACHABLE(); |
1356 } | 1369 } |
1357 } | 1370 } |
1358 | 1371 |
1359 | 1372 |
1360 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 1373 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
1361 Comment cmnt(masm_, "[ CountOperation"); | 1374 Comment cmnt(masm_, "[ CountOperation"); |
1362 | 1375 |
1363 // Expression can only be a property, a global or a (parameter or local) | 1376 // Expression can only be a property, a global or a (parameter or local) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 __ pop(result_register()); | 1713 __ pop(result_register()); |
1701 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1714 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
1702 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1715 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
1703 __ add(pc, r1, Operand(masm_->CodeObject())); | 1716 __ add(pc, r1, Operand(masm_->CodeObject())); |
1704 } | 1717 } |
1705 | 1718 |
1706 | 1719 |
1707 #undef __ | 1720 #undef __ |
1708 | 1721 |
1709 } } // namespace v8::internal | 1722 } } // namespace v8::internal |
OLD | NEW |