OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 LConstantOperand* const_op = LConstantOperand::cast(op); | 424 LConstantOperand* const_op = LConstantOperand::cast(op); |
425 HConstant* constant = chunk_->LookupConstant(const_op); | 425 HConstant* constant = chunk_->LookupConstant(const_op); |
426 Handle<Object> literal = constant->handle(); | 426 Handle<Object> literal = constant->handle(); |
427 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 427 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
428 if (r.IsInteger32()) { | 428 if (r.IsInteger32()) { |
429 ASSERT(literal->IsNumber()); | 429 ASSERT(literal->IsNumber()); |
430 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 430 __ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
431 } else if (r.IsDouble()) { | 431 } else if (r.IsDouble()) { |
432 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); | 432 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
433 } else { | 433 } else { |
434 ASSERT(r.IsTagged()); | 434 ASSERT(r.IsSmiOrTagged()); |
435 __ LoadObject(scratch, literal); | 435 __ LoadObject(scratch, literal); |
436 } | 436 } |
437 return scratch; | 437 return scratch; |
438 } else if (op->IsStackSlot() || op->IsArgument()) { | 438 } else if (op->IsStackSlot() || op->IsArgument()) { |
439 __ ldr(scratch, ToMemOperand(op)); | 439 __ ldr(scratch, ToMemOperand(op)); |
440 return scratch; | 440 return scratch; |
441 } | 441 } |
442 UNREACHABLE(); | 442 UNREACHABLE(); |
443 return scratch; | 443 return scratch; |
444 } | 444 } |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 Register result = ToRegister(instr->result()); | 1576 Register result = ToRegister(instr->result()); |
1577 // Note that result may alias left. | 1577 // Note that result may alias left. |
1578 Register left = ToRegister(instr->left()); | 1578 Register left = ToRegister(instr->left()); |
1579 LOperand* right_op = instr->right(); | 1579 LOperand* right_op = instr->right(); |
1580 | 1580 |
1581 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1581 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
1582 bool bailout_on_minus_zero = | 1582 bool bailout_on_minus_zero = |
1583 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero); | 1583 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero); |
1584 | 1584 |
1585 if (right_op->IsConstantOperand() && !can_overflow) { | 1585 if (right_op->IsConstantOperand() && !can_overflow) { |
1586 // Use optimized code for specific constants. | 1586 int32_t constant = ToInteger32(LConstantOperand::cast(right_op)); |
1587 int32_t constant = ToRepresentation( | |
1588 LConstantOperand::cast(right_op), | |
1589 instr->hydrogen()->right()->representation()); | |
1590 | 1587 |
1591 if (bailout_on_minus_zero && (constant < 0)) { | 1588 if (bailout_on_minus_zero && (constant < 0)) { |
1592 // The case of a null constant will be handled separately. | 1589 // The case of a null constant will be handled separately. |
1593 // If constant is negative and left is null, the result should be -0. | 1590 // If constant is negative and left is null, the result should be -0. |
1594 __ cmp(left, Operand::Zero()); | 1591 __ cmp(left, Operand::Zero()); |
1595 DeoptimizeIf(eq, instr->environment()); | 1592 DeoptimizeIf(eq, instr->environment()); |
1596 } | 1593 } |
1597 | 1594 |
1598 switch (constant) { | 1595 switch (constant) { |
1599 case -1: | 1596 case -1: |
(...skipping 4187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5787 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5784 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5788 __ ldr(result, FieldMemOperand(scratch, | 5785 __ ldr(result, FieldMemOperand(scratch, |
5789 FixedArray::kHeaderSize - kPointerSize)); | 5786 FixedArray::kHeaderSize - kPointerSize)); |
5790 __ bind(&done); | 5787 __ bind(&done); |
5791 } | 5788 } |
5792 | 5789 |
5793 | 5790 |
5794 #undef __ | 5791 #undef __ |
5795 | 5792 |
5796 } } // namespace v8::internal | 5793 } } // namespace v8::internal |
OLD | NEW |