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