| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 402 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
| 403 if (r.IsInteger32()) { | 403 if (r.IsInteger32()) { |
| 404 ASSERT(literal->IsNumber()); | 404 ASSERT(literal->IsNumber()); |
| 405 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); | 405 __ li(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
| 406 } else if (r.IsSmi()) { | 406 } else if (r.IsSmi()) { |
| 407 ASSERT(constant->HasSmiValue()); | 407 ASSERT(constant->HasSmiValue()); |
| 408 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value()))); | 408 __ li(scratch, Operand(Smi::FromInt(constant->Integer32Value()))); |
| 409 } else if (r.IsDouble()) { | 409 } else if (r.IsDouble()) { |
| 410 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); | 410 Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
| 411 } else { | 411 } else { |
| 412 ASSERT(r.IsTagged()); | 412 ASSERT(r.IsSmiOrTagged()); |
| 413 __ LoadObject(scratch, literal); | 413 __ LoadObject(scratch, literal); |
| 414 } | 414 } |
| 415 return scratch; | 415 return scratch; |
| 416 } else if (op->IsStackSlot() || op->IsArgument()) { | 416 } else if (op->IsStackSlot() || op->IsArgument()) { |
| 417 __ lw(scratch, ToMemOperand(op)); | 417 __ lw(scratch, ToMemOperand(op)); |
| 418 return scratch; | 418 return scratch; |
| 419 } | 419 } |
| 420 UNREACHABLE(); | 420 UNREACHABLE(); |
| 421 return scratch; | 421 return scratch; |
| 422 } | 422 } |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 Register result = ToRegister(instr->result()); | 1391 Register result = ToRegister(instr->result()); |
| 1392 // Note that result may alias left. | 1392 // Note that result may alias left. |
| 1393 Register left = ToRegister(instr->left()); | 1393 Register left = ToRegister(instr->left()); |
| 1394 LOperand* right_op = instr->right(); | 1394 LOperand* right_op = instr->right(); |
| 1395 | 1395 |
| 1396 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1396 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1397 bool bailout_on_minus_zero = | 1397 bool bailout_on_minus_zero = |
| 1398 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero); | 1398 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero); |
| 1399 | 1399 |
| 1400 if (right_op->IsConstantOperand() && !can_overflow) { | 1400 if (right_op->IsConstantOperand() && !can_overflow) { |
| 1401 // Use optimized code for specific constants. | 1401 int32_t constant = ToInteger32(LConstantOperand::cast(right_op)); |
| 1402 int32_t constant = ToRepresentation( | |
| 1403 LConstantOperand::cast(right_op), | |
| 1404 instr->hydrogen()->right()->representation()); | |
| 1405 | 1402 |
| 1406 if (bailout_on_minus_zero && (constant < 0)) { | 1403 if (bailout_on_minus_zero && (constant < 0)) { |
| 1407 // The case of a null constant will be handled separately. | 1404 // The case of a null constant will be handled separately. |
| 1408 // If constant is negative and left is null, the result should be -0. | 1405 // If constant is negative and left is null, the result should be -0. |
| 1409 DeoptimizeIf(eq, instr->environment(), left, Operand(zero_reg)); | 1406 DeoptimizeIf(eq, instr->environment(), left, Operand(zero_reg)); |
| 1410 } | 1407 } |
| 1411 | 1408 |
| 1412 switch (constant) { | 1409 switch (constant) { |
| 1413 case -1: | 1410 case -1: |
| 1414 __ Subu(result, zero_reg, left); | 1411 __ Subu(result, zero_reg, left); |
| (...skipping 4380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5795 __ Subu(scratch, result, scratch); | 5792 __ Subu(scratch, result, scratch); |
| 5796 __ lw(result, FieldMemOperand(scratch, | 5793 __ lw(result, FieldMemOperand(scratch, |
| 5797 FixedArray::kHeaderSize - kPointerSize)); | 5794 FixedArray::kHeaderSize - kPointerSize)); |
| 5798 __ bind(&done); | 5795 __ bind(&done); |
| 5799 } | 5796 } |
| 5800 | 5797 |
| 5801 | 5798 |
| 5802 #undef __ | 5799 #undef __ |
| 5803 | 5800 |
| 5804 } } // namespace v8::internal | 5801 } } // namespace v8::internal |
| OLD | NEW |