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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 __ str(r0, MemOperand(sp, 2 * kPointerSize)); | 1585 __ str(r0, MemOperand(sp, 2 * kPointerSize)); |
1586 break; | 1586 break; |
1587 } | 1587 } |
1588 break; | 1588 break; |
1589 } | 1589 } |
1590 } | 1590 } |
1591 | 1591 |
1592 | 1592 |
1593 // Inline smi case if we are in a loop. | 1593 // Inline smi case if we are in a loop. |
1594 Label stub_call, done; | 1594 Label stub_call, done; |
| 1595 int count_value = expr->op() == Token::INC ? 1 : -1; |
1595 if (loop_depth() > 0) { | 1596 if (loop_depth() > 0) { |
1596 __ add(r0, r0, Operand(expr->op() == Token::INC | 1597 __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC); |
1597 ? Smi::FromInt(1) | |
1598 : Smi::FromInt(-1))); | |
1599 __ b(vs, &stub_call); | 1598 __ b(vs, &stub_call); |
1600 // We could eliminate this smi check if we split the code at | 1599 // We could eliminate this smi check if we split the code at |
1601 // the first smi check before calling ToNumber. | 1600 // the first smi check before calling ToNumber. |
1602 __ tst(r0, Operand(kSmiTagMask)); | 1601 __ tst(r0, Operand(kSmiTagMask)); |
1603 __ b(eq, &done); | 1602 __ b(eq, &done); |
1604 __ bind(&stub_call); | 1603 __ bind(&stub_call); |
1605 // Call stub. Undo operation first. | 1604 // Call stub. Undo operation first. |
1606 __ sub(r0, r0, Operand(r1)); | 1605 __ sub(r0, r0, Operand(Smi::FromInt(count_value))); |
1607 } | 1606 } |
1608 __ mov(r1, Operand(expr->op() == Token::INC | 1607 __ mov(r1, Operand(Smi::FromInt(count_value))); |
1609 ? Smi::FromInt(1) | |
1610 : Smi::FromInt(-1))); | |
1611 GenericBinaryOpStub stub(Token::ADD, NO_OVERWRITE, r1, r0); | 1608 GenericBinaryOpStub stub(Token::ADD, NO_OVERWRITE, r1, r0); |
1612 __ CallStub(&stub); | 1609 __ CallStub(&stub); |
1613 __ bind(&done); | 1610 __ bind(&done); |
1614 | 1611 |
1615 // Store the value returned in r0. | 1612 // Store the value returned in r0. |
1616 switch (assign_type) { | 1613 switch (assign_type) { |
1617 case VARIABLE: | 1614 case VARIABLE: |
1618 if (expr->is_postfix()) { | 1615 if (expr->is_postfix()) { |
1619 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 1616 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
1620 Expression::kEffect); | 1617 Expression::kEffect); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 __ pop(result_register()); | 1853 __ pop(result_register()); |
1857 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1854 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
1858 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1855 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
1859 __ add(pc, r1, Operand(masm_->CodeObject())); | 1856 __ add(pc, r1, Operand(masm_->CodeObject())); |
1860 } | 1857 } |
1861 | 1858 |
1862 | 1859 |
1863 #undef __ | 1860 #undef __ |
1864 | 1861 |
1865 } } // namespace v8::internal | 1862 } } // namespace v8::internal |
OLD | NEW |