| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 320 } |
| 321 // Check that the size of the code used for returning is large enough | 321 // Check that the size of the code used for returning is large enough |
| 322 // for the debugger's requirements. | 322 // for the debugger's requirements. |
| 323 ASSERT(Assembler::kJSReturnSequenceLength <= | 323 ASSERT(Assembler::kJSReturnSequenceLength <= |
| 324 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); | 324 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); |
| 325 #endif | 325 #endif |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 | 329 |
| 330 FullCodeGenerator::ConstantOperand FullCodeGenerator::GetConstantOperand( | |
| 331 Token::Value op, Expression* left, Expression* right) { | |
| 332 ASSERT(ShouldInlineSmiCase(op)); | |
| 333 return kNoConstants; | |
| 334 } | |
| 335 | |
| 336 | |
| 337 void FullCodeGenerator::EffectContext::Plug(Slot* slot) const { | 330 void FullCodeGenerator::EffectContext::Plug(Slot* slot) const { |
| 338 } | 331 } |
| 339 | 332 |
| 340 | 333 |
| 341 void FullCodeGenerator::AccumulatorValueContext::Plug(Slot* slot) const { | 334 void FullCodeGenerator::AccumulatorValueContext::Plug(Slot* slot) const { |
| 342 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); | 335 MemOperand slot_operand = codegen()->EmitSlotSearch(slot, result_register()); |
| 343 __ movq(result_register(), slot_operand); | 336 __ movq(result_register(), slot_operand); |
| 344 } | 337 } |
| 345 | 338 |
| 346 | 339 |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 } | 1565 } |
| 1573 } | 1566 } |
| 1574 | 1567 |
| 1575 // For property compound assignments we need another deoptimization | 1568 // For property compound assignments we need another deoptimization |
| 1576 // point after the property load. | 1569 // point after the property load. |
| 1577 if (property != NULL) { | 1570 if (property != NULL) { |
| 1578 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | 1571 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
| 1579 } | 1572 } |
| 1580 | 1573 |
| 1581 Token::Value op = expr->binary_op(); | 1574 Token::Value op = expr->binary_op(); |
| 1582 ConstantOperand constant = ShouldInlineSmiCase(op) | 1575 __ push(rax); // Left operand goes on the stack. |
| 1583 ? GetConstantOperand(op, expr->target(), expr->value()) | 1576 VisitForAccumulatorValue(expr->value()); |
| 1584 : kNoConstants; | |
| 1585 ASSERT(constant == kRightConstant || constant == kNoConstants); | |
| 1586 if (constant == kNoConstants) { | |
| 1587 __ push(rax); // Left operand goes on the stack. | |
| 1588 VisitForAccumulatorValue(expr->value()); | |
| 1589 } | |
| 1590 | 1577 |
| 1591 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1578 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
| 1592 ? OVERWRITE_RIGHT | 1579 ? OVERWRITE_RIGHT |
| 1593 : NO_OVERWRITE; | 1580 : NO_OVERWRITE; |
| 1594 SetSourcePosition(expr->position() + 1); | 1581 SetSourcePosition(expr->position() + 1); |
| 1595 AccumulatorValueContext context(this); | 1582 AccumulatorValueContext context(this); |
| 1596 if (ShouldInlineSmiCase(op)) { | 1583 if (ShouldInlineSmiCase(op)) { |
| 1597 EmitInlineSmiBinaryOp(expr, | 1584 EmitInlineSmiBinaryOp(expr, |
| 1598 op, | 1585 op, |
| 1599 mode, | 1586 mode, |
| 1600 expr->target(), | 1587 expr->target(), |
| 1601 expr->value(), | 1588 expr->value()); |
| 1602 constant); | |
| 1603 } else { | 1589 } else { |
| 1604 EmitBinaryOp(op, mode); | 1590 EmitBinaryOp(op, mode); |
| 1605 } | 1591 } |
| 1606 // Deoptimization point in case the binary operation may have side effects. | 1592 // Deoptimization point in case the binary operation may have side effects. |
| 1607 PrepareForBailout(expr->binary_operation(), TOS_REG); | 1593 PrepareForBailout(expr->binary_operation(), TOS_REG); |
| 1608 } else { | 1594 } else { |
| 1609 VisitForAccumulatorValue(expr->value()); | 1595 VisitForAccumulatorValue(expr->value()); |
| 1610 } | 1596 } |
| 1611 | 1597 |
| 1612 // Record source position before possible IC call. | 1598 // Record source position before possible IC call. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1643 SetSourcePosition(prop->position()); | 1629 SetSourcePosition(prop->position()); |
| 1644 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1630 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1645 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1631 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1646 } | 1632 } |
| 1647 | 1633 |
| 1648 | 1634 |
| 1649 void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr, | 1635 void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr, |
| 1650 Token::Value op, | 1636 Token::Value op, |
| 1651 OverwriteMode mode, | 1637 OverwriteMode mode, |
| 1652 Expression* left, | 1638 Expression* left, |
| 1653 Expression* right, | 1639 Expression* right) { |
| 1654 ConstantOperand constant) { | |
| 1655 ASSERT(constant == kNoConstants); // Only handled case. | |
| 1656 | |
| 1657 // Do combined smi check of the operands. Left operand is on the | 1640 // Do combined smi check of the operands. Left operand is on the |
| 1658 // stack (popped into rdx). Right operand is in rax but moved into | 1641 // stack (popped into rdx). Right operand is in rax but moved into |
| 1659 // rcx to make the shifts easier. | 1642 // rcx to make the shifts easier. |
| 1660 NearLabel done, stub_call, smi_case; | 1643 NearLabel done, stub_call, smi_case; |
| 1661 __ pop(rdx); | 1644 __ pop(rdx); |
| 1662 __ movq(rcx, rax); | 1645 __ movq(rcx, rax); |
| 1663 __ or_(rax, rdx); | 1646 __ or_(rax, rdx); |
| 1664 JumpPatchSite patch_site(masm_); | 1647 JumpPatchSite patch_site(masm_); |
| 1665 patch_site.EmitJumpIfSmi(rax, &smi_case); | 1648 patch_site.EmitJumpIfSmi(rax, &smi_case); |
| 1666 | 1649 |
| (...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 __ ret(0); | 3862 __ ret(0); |
| 3880 } | 3863 } |
| 3881 | 3864 |
| 3882 | 3865 |
| 3883 #undef __ | 3866 #undef __ |
| 3884 | 3867 |
| 3885 | 3868 |
| 3886 } } // namespace v8::internal | 3869 } } // namespace v8::internal |
| 3887 | 3870 |
| 3888 #endif // V8_TARGET_ARCH_X64 | 3871 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |