| 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 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2798 __ Jump(ra); | 2798 __ Jump(ra); |
| 2799 | 2799 |
| 2800 if (no_frame_start != -1) { | 2800 if (no_frame_start != -1) { |
| 2801 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2801 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 2802 } | 2802 } |
| 2803 } | 2803 } |
| 2804 | 2804 |
| 2805 | 2805 |
| 2806 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2806 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
| 2807 Register result = ToRegister(instr->result()); | 2807 Register result = ToRegister(instr->result()); |
| 2808 __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell()))); | 2808 __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell().handle()))); |
| 2809 __ lw(result, FieldMemOperand(at, Cell::kValueOffset)); | 2809 __ lw(result, FieldMemOperand(at, Cell::kValueOffset)); |
| 2810 if (instr->hydrogen()->RequiresHoleCheck()) { | 2810 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2811 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2811 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 2812 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); | 2812 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); |
| 2813 } | 2813 } |
| 2814 } | 2814 } |
| 2815 | 2815 |
| 2816 | 2816 |
| 2817 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2817 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 2818 ASSERT(ToRegister(instr->global_object()).is(a0)); | 2818 ASSERT(ToRegister(instr->global_object()).is(a0)); |
| 2819 ASSERT(ToRegister(instr->result()).is(v0)); | 2819 ASSERT(ToRegister(instr->result()).is(v0)); |
| 2820 | 2820 |
| 2821 __ li(a2, Operand(instr->name())); | 2821 __ li(a2, Operand(instr->name())); |
| 2822 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET | 2822 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET |
| 2823 : RelocInfo::CODE_TARGET_CONTEXT; | 2823 : RelocInfo::CODE_TARGET_CONTEXT; |
| 2824 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2824 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2825 CallCode(ic, mode, instr); | 2825 CallCode(ic, mode, instr); |
| 2826 } | 2826 } |
| 2827 | 2827 |
| 2828 | 2828 |
| 2829 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2829 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2830 Register value = ToRegister(instr->value()); | 2830 Register value = ToRegister(instr->value()); |
| 2831 Register cell = scratch0(); | 2831 Register cell = scratch0(); |
| 2832 | 2832 |
| 2833 // Load the cell. | 2833 // Load the cell. |
| 2834 __ li(cell, Operand(instr->hydrogen()->cell())); | 2834 __ li(cell, Operand(instr->hydrogen()->cell().handle())); |
| 2835 | 2835 |
| 2836 // If the cell we are storing to contains the hole it could have | 2836 // If the cell we are storing to contains the hole it could have |
| 2837 // been deleted from the property dictionary. In that case, we need | 2837 // been deleted from the property dictionary. In that case, we need |
| 2838 // to update the property details in the property dictionary to mark | 2838 // to update the property details in the property dictionary to mark |
| 2839 // it as no longer deleted. | 2839 // it as no longer deleted. |
| 2840 if (instr->hydrogen()->RequiresHoleCheck()) { | 2840 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2841 // We use a temp to check the payload. | 2841 // We use a temp to check the payload. |
| 2842 Register payload = ToRegister(instr->temp()); | 2842 Register payload = ToRegister(instr->temp()); |
| 2843 __ lw(payload, FieldMemOperand(cell, Cell::kValueOffset)); | 2843 __ lw(payload, FieldMemOperand(cell, Cell::kValueOffset)); |
| 2844 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2844 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| (...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4794 } | 4794 } |
| 4795 | 4795 |
| 4796 | 4796 |
| 4797 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4797 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4798 DoubleRegister result_reg, | 4798 DoubleRegister result_reg, |
| 4799 bool can_convert_undefined_to_nan, | 4799 bool can_convert_undefined_to_nan, |
| 4800 bool deoptimize_on_minus_zero, | 4800 bool deoptimize_on_minus_zero, |
| 4801 LEnvironment* env, | 4801 LEnvironment* env, |
| 4802 NumberUntagDMode mode) { | 4802 NumberUntagDMode mode) { |
| 4803 Register scratch = scratch0(); | 4803 Register scratch = scratch0(); |
| 4804 | 4804 Label convert, load_smi, done; |
| 4805 Label load_smi, heap_number, done; | |
| 4806 | |
| 4807 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { | 4805 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
| 4808 // Smi check. | 4806 // Smi check. |
| 4809 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); | 4807 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
| 4810 | |
| 4811 // Heap number map check. | 4808 // Heap number map check. |
| 4812 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4809 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4813 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 4810 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
| 4814 if (!can_convert_undefined_to_nan) { | 4811 if (can_convert_undefined_to_nan) { |
| 4812 __ Branch(&convert, ne, scratch, Operand(at)); |
| 4813 } else { |
| 4815 DeoptimizeIf(ne, env, scratch, Operand(at)); | 4814 DeoptimizeIf(ne, env, scratch, Operand(at)); |
| 4816 } else { | |
| 4817 Label heap_number, convert; | |
| 4818 __ Branch(&heap_number, eq, scratch, Operand(at)); | |
| 4819 | |
| 4820 // Convert undefined (and hole) to NaN. | |
| 4821 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
| 4822 DeoptimizeIf(ne, env, input_reg, Operand(at)); | |
| 4823 | |
| 4824 __ bind(&convert); | |
| 4825 __ LoadRoot(at, Heap::kNanValueRootIndex); | |
| 4826 __ ldc1(result_reg, FieldMemOperand(at, HeapNumber::kValueOffset)); | |
| 4827 __ Branch(&done); | |
| 4828 | |
| 4829 __ bind(&heap_number); | |
| 4830 } | 4815 } |
| 4831 // Heap number to double register conversion. | 4816 // Load heap number. |
| 4832 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4817 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
| 4833 if (deoptimize_on_minus_zero) { | 4818 if (deoptimize_on_minus_zero) { |
| 4834 __ mfc1(at, result_reg.low()); | 4819 __ mfc1(at, result_reg.low()); |
| 4835 __ Branch(&done, ne, at, Operand(zero_reg)); | 4820 __ Branch(&done, ne, at, Operand(zero_reg)); |
| 4836 __ mfc1(scratch, result_reg.high()); | 4821 __ mfc1(scratch, result_reg.high()); |
| 4837 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask)); | 4822 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask)); |
| 4838 } | 4823 } |
| 4839 __ Branch(&done); | 4824 __ Branch(&done); |
| 4825 if (can_convert_undefined_to_nan) { |
| 4826 __ bind(&convert); |
| 4827 // Convert undefined (and hole) to NaN. |
| 4828 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 4829 DeoptimizeIf(ne, env, input_reg, Operand(at)); |
| 4830 __ LoadRoot(scratch, Heap::kNanValueRootIndex); |
| 4831 __ ldc1(result_reg, FieldMemOperand(scratch, HeapNumber::kValueOffset)); |
| 4832 __ Branch(&done); |
| 4833 } |
| 4840 } else { | 4834 } else { |
| 4841 __ SmiUntag(scratch, input_reg); | 4835 __ SmiUntag(scratch, input_reg); |
| 4842 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 4836 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
| 4843 } | 4837 } |
| 4844 | |
| 4845 // Smi to double register conversion | 4838 // Smi to double register conversion |
| 4846 __ bind(&load_smi); | 4839 __ bind(&load_smi); |
| 4847 // scratch: untagged value of input_reg | 4840 // scratch: untagged value of input_reg |
| 4848 __ mtc1(scratch, result_reg); | 4841 __ mtc1(scratch, result_reg); |
| 4849 __ cvt_d_w(result_reg, result_reg); | 4842 __ cvt_d_w(result_reg, result_reg); |
| 4850 __ bind(&done); | 4843 __ bind(&done); |
| 4851 } | 4844 } |
| 4852 | 4845 |
| 4853 | 4846 |
| 4854 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 4847 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5780 __ Subu(scratch, result, scratch); | 5773 __ Subu(scratch, result, scratch); |
| 5781 __ lw(result, FieldMemOperand(scratch, | 5774 __ lw(result, FieldMemOperand(scratch, |
| 5782 FixedArray::kHeaderSize - kPointerSize)); | 5775 FixedArray::kHeaderSize - kPointerSize)); |
| 5783 __ bind(&done); | 5776 __ bind(&done); |
| 5784 } | 5777 } |
| 5785 | 5778 |
| 5786 | 5779 |
| 5787 #undef __ | 5780 #undef __ |
| 5788 | 5781 |
| 5789 } } // namespace v8::internal | 5782 } } // namespace v8::internal |
| OLD | NEW |