| 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 4490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4501 Register scratch = scratch0(); | 4501 Register scratch = scratch0(); |
| 4502 __ ldr(scratch, ToMemOperand(input)); | 4502 __ ldr(scratch, ToMemOperand(input)); |
| 4503 __ vmov(single_scratch, scratch); | 4503 __ vmov(single_scratch, scratch); |
| 4504 } else { | 4504 } else { |
| 4505 __ vmov(single_scratch, ToRegister(input)); | 4505 __ vmov(single_scratch, ToRegister(input)); |
| 4506 } | 4506 } |
| 4507 __ vcvt_f64_s32(ToDoubleRegister(output), single_scratch); | 4507 __ vcvt_f64_s32(ToDoubleRegister(output), single_scratch); |
| 4508 } | 4508 } |
| 4509 | 4509 |
| 4510 | 4510 |
| 4511 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | |
| 4512 LOperand* input = instr->value(); | |
| 4513 LOperand* output = instr->result(); | |
| 4514 ASSERT(output->IsRegister()); | |
| 4515 if (!instr->hydrogen()->value()->HasRange() || | |
| 4516 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | |
| 4517 __ SmiTag(ToRegister(output), ToRegister(input), SetCC); | |
| 4518 DeoptimizeIf(vs, instr->environment()); | |
| 4519 } else { | |
| 4520 __ SmiTag(ToRegister(output), ToRegister(input)); | |
| 4521 } | |
| 4522 } | |
| 4523 | |
| 4524 | |
| 4525 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4511 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 4526 LOperand* input = instr->value(); | 4512 LOperand* input = instr->value(); |
| 4527 LOperand* output = instr->result(); | 4513 LOperand* output = instr->result(); |
| 4528 | 4514 |
| 4529 SwVfpRegister flt_scratch = double_scratch0().low(); | 4515 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 4530 __ vmov(flt_scratch, ToRegister(input)); | 4516 __ vmov(flt_scratch, ToRegister(input)); |
| 4531 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); | 4517 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); |
| 4532 } | 4518 } |
| 4533 | 4519 |
| 4534 | 4520 |
| 4535 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { | |
| 4536 LOperand* input = instr->value(); | |
| 4537 LOperand* output = instr->result(); | |
| 4538 if (!instr->hydrogen()->value()->HasRange() || | |
| 4539 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | |
| 4540 __ tst(ToRegister(input), Operand(0xc0000000)); | |
| 4541 DeoptimizeIf(ne, instr->environment()); | |
| 4542 } | |
| 4543 __ SmiTag(ToRegister(output), ToRegister(input)); | |
| 4544 } | |
| 4545 | |
| 4546 | |
| 4547 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4521 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4548 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4522 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
| 4549 public: | 4523 public: |
| 4550 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4524 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
| 4551 : LDeferredCode(codegen), instr_(instr) { } | 4525 : LDeferredCode(codegen), instr_(instr) { } |
| 4552 virtual void Generate() V8_OVERRIDE { | 4526 virtual void Generate() V8_OVERRIDE { |
| 4553 codegen()->DoDeferredNumberTagIU(instr_, | 4527 codegen()->DoDeferredNumberTagIU(instr_, |
| 4554 instr_->value(), | 4528 instr_->value(), |
| 4555 instr_->temp1(), | 4529 instr_->temp1(), |
| 4556 instr_->temp2(), | 4530 instr_->temp2(), |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4716 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4690 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 4717 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4691 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 4718 RecordSafepointWithRegisters( | 4692 RecordSafepointWithRegisters( |
| 4719 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4693 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4720 __ sub(r0, r0, Operand(kHeapObjectTag)); | 4694 __ sub(r0, r0, Operand(kHeapObjectTag)); |
| 4721 __ StoreToSafepointRegisterSlot(r0, reg); | 4695 __ StoreToSafepointRegisterSlot(r0, reg); |
| 4722 } | 4696 } |
| 4723 | 4697 |
| 4724 | 4698 |
| 4725 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4699 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| 4726 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 4700 HChange* hchange = instr->hydrogen(); |
| 4727 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value())); | 4701 Register input = ToRegister(instr->value()); |
| 4702 Register output = ToRegister(instr->result()); |
| 4703 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4704 hchange->value()->CheckFlag(HValue::kUint32)) { |
| 4705 __ tst(input, Operand(0xc0000000)); |
| 4706 DeoptimizeIf(ne, instr->environment()); |
| 4707 } |
| 4708 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4709 !hchange->value()->CheckFlag(HValue::kUint32)) { |
| 4710 __ SmiTag(output, input, SetCC); |
| 4711 DeoptimizeIf(vs, instr->environment()); |
| 4712 } else { |
| 4713 __ SmiTag(output, input); |
| 4714 } |
| 4728 } | 4715 } |
| 4729 | 4716 |
| 4730 | 4717 |
| 4731 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4718 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
| 4732 Register input = ToRegister(instr->value()); | 4719 Register input = ToRegister(instr->value()); |
| 4733 Register result = ToRegister(instr->result()); | 4720 Register result = ToRegister(instr->result()); |
| 4734 if (instr->needs_check()) { | 4721 if (instr->needs_check()) { |
| 4735 STATIC_ASSERT(kHeapObjectTag == 1); | 4722 STATIC_ASSERT(kHeapObjectTag == 1); |
| 4736 // If the input is a HeapObject, SmiUntag will set the carry flag. | 4723 // If the input is a HeapObject, SmiUntag will set the carry flag. |
| 4737 __ SmiUntag(result, input, SetCC); | 4724 __ SmiUntag(result, input, SetCC); |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5720 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5707 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5721 __ ldr(result, FieldMemOperand(scratch, | 5708 __ ldr(result, FieldMemOperand(scratch, |
| 5722 FixedArray::kHeaderSize - kPointerSize)); | 5709 FixedArray::kHeaderSize - kPointerSize)); |
| 5723 __ bind(&done); | 5710 __ bind(&done); |
| 5724 } | 5711 } |
| 5725 | 5712 |
| 5726 | 5713 |
| 5727 #undef __ | 5714 #undef __ |
| 5728 | 5715 |
| 5729 } } // namespace v8::internal | 5716 } } // namespace v8::internal |
| OLD | NEW |