Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 16116002: MIPS: Fix the hole loading optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4649 matching lines...) Expand 10 before | Expand all | Expand 10 after
4660 void LCodeGen::EmitNumberUntagD(Register input_reg, 4660 void LCodeGen::EmitNumberUntagD(Register input_reg,
4661 DoubleRegister result_reg, 4661 DoubleRegister result_reg,
4662 bool deoptimize_on_undefined, 4662 bool deoptimize_on_undefined,
4663 bool deoptimize_on_minus_zero, 4663 bool deoptimize_on_minus_zero,
4664 LEnvironment* env, 4664 LEnvironment* env,
4665 NumberUntagDMode mode) { 4665 NumberUntagDMode mode) {
4666 Register scratch = scratch0(); 4666 Register scratch = scratch0();
4667 4667
4668 Label load_smi, heap_number, done; 4668 Label load_smi, heap_number, done;
4669 4669
4670 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { 4670 STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE >
4671 NUMBER_CANDIDATE_IS_ANY_TAGGED);
4672 if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) {
4671 // Smi check. 4673 // Smi check.
4672 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); 4674 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi);
4673 4675
4674 // Heap number map check. 4676 // Heap number map check.
4675 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); 4677 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
4676 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 4678 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
4677 if (deoptimize_on_undefined) { 4679 if (deoptimize_on_undefined) {
4678 DeoptimizeIf(ne, env, scratch, Operand(at)); 4680 DeoptimizeIf(ne, env, scratch, Operand(at));
4679 } else { 4681 } else {
4680 Label heap_number; 4682 Label heap_number, convert;
4681 __ Branch(&heap_number, eq, scratch, Operand(at)); 4683 __ Branch(&heap_number, eq, scratch, Operand(at));
4682 4684
4685 // Convert undefined (and hole) to NaN.
4683 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 4686 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
4687 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) {
4688 __ Branch(&convert, eq, input_reg, Operand(at));
4689 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
4690 }
4684 DeoptimizeIf(ne, env, input_reg, Operand(at)); 4691 DeoptimizeIf(ne, env, input_reg, Operand(at));
4685 4692
4686 // Convert undefined to NaN. 4693 __ bind(&convert);
4687 __ LoadRoot(at, Heap::kNanValueRootIndex); 4694 __ LoadRoot(at, Heap::kNanValueRootIndex);
4688 __ ldc1(result_reg, FieldMemOperand(at, HeapNumber::kValueOffset)); 4695 __ ldc1(result_reg, FieldMemOperand(at, HeapNumber::kValueOffset));
4689 __ Branch(&done); 4696 __ Branch(&done);
4690 4697
4691 __ bind(&heap_number); 4698 __ bind(&heap_number);
4692 } 4699 }
4693 // Heap number to double register conversion. 4700 // Heap number to double register conversion.
4694 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset)); 4701 __ ldc1(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
4695 if (deoptimize_on_minus_zero) { 4702 if (deoptimize_on_minus_zero) {
4696 __ mfc1(at, result_reg.low()); 4703 __ mfc1(at, result_reg.low());
4697 __ Branch(&done, ne, at, Operand(zero_reg)); 4704 __ Branch(&done, ne, at, Operand(zero_reg));
4698 __ mfc1(scratch, result_reg.high()); 4705 __ mfc1(scratch, result_reg.high());
4699 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask)); 4706 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask));
4700 } 4707 }
4701 __ Branch(&done); 4708 __ Branch(&done);
4702 } else if (mode == NUMBER_CANDIDATE_IS_SMI_OR_HOLE) {
4703 __ SmiUntag(scratch, input_reg);
4704 DeoptimizeIf(Ugreater_equal, env, scratch, Operand(zero_reg));
4705 } else if (mode == NUMBER_CANDIDATE_IS_SMI_CONVERT_HOLE) {
4706 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi);
4707 __ Move(result_reg,
4708 FixedDoubleArray::hole_nan_as_double());
4709 __ Branch(&done);
4710 } else { 4709 } else {
4711 __ SmiUntag(scratch, input_reg); 4710 __ SmiUntag(scratch, input_reg);
4712 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); 4711 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI);
4713 } 4712 }
4714 4713
4715 // Smi to double register conversion 4714 // Smi to double register conversion
4716 __ bind(&load_smi); 4715 __ bind(&load_smi);
4717 // scratch: untagged value of input_reg 4716 // scratch: untagged value of input_reg
4718 __ mtc1(scratch, result_reg); 4717 __ mtc1(scratch, result_reg);
4719 __ cvt_d_w(result_reg, result_reg); 4718 __ cvt_d_w(result_reg, result_reg);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4832 ASSERT(input->IsRegister()); 4831 ASSERT(input->IsRegister());
4833 LOperand* result = instr->result(); 4832 LOperand* result = instr->result();
4834 ASSERT(result->IsDoubleRegister()); 4833 ASSERT(result->IsDoubleRegister());
4835 4834
4836 Register input_reg = ToRegister(input); 4835 Register input_reg = ToRegister(input);
4837 DoubleRegister result_reg = ToDoubleRegister(result); 4836 DoubleRegister result_reg = ToDoubleRegister(result);
4838 4837
4839 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED; 4838 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED;
4840 HValue* value = instr->hydrogen()->value(); 4839 HValue* value = instr->hydrogen()->value();
4841 if (value->type().IsSmi()) { 4840 if (value->type().IsSmi()) {
4842 if (value->IsLoadKeyed()) { 4841 mode = NUMBER_CANDIDATE_IS_SMI;
4843 HLoadKeyed* load = HLoadKeyed::cast(value); 4842 } else if (value->IsLoadKeyed()) {
4844 if (load->UsesMustHandleHole()) { 4843 HLoadKeyed* load = HLoadKeyed::cast(value);
4845 if (load->hole_mode() == ALLOW_RETURN_HOLE) { 4844 if (load->UsesMustHandleHole()) {
4846 mode = NUMBER_CANDIDATE_IS_SMI_CONVERT_HOLE; 4845 if (load->hole_mode() == ALLOW_RETURN_HOLE) {
4847 } else { 4846 mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE;
4848 mode = NUMBER_CANDIDATE_IS_SMI_OR_HOLE;
4849 }
4850 } else {
4851 mode = NUMBER_CANDIDATE_IS_SMI;
4852 } 4847 }
4853 } else {
4854 mode = NUMBER_CANDIDATE_IS_SMI;
4855 } 4848 }
4856 } 4849 }
4857 4850
4858 EmitNumberUntagD(input_reg, result_reg, 4851 EmitNumberUntagD(input_reg, result_reg,
4859 instr->hydrogen()->deoptimize_on_undefined(), 4852 instr->hydrogen()->deoptimize_on_undefined(),
4860 instr->hydrogen()->deoptimize_on_minus_zero(), 4853 instr->hydrogen()->deoptimize_on_minus_zero(),
4861 instr->environment(), 4854 instr->environment(),
4862 mode); 4855 mode);
4863 } 4856 }
4864 4857
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 __ Subu(scratch, result, scratch); 5738 __ Subu(scratch, result, scratch);
5746 __ lw(result, FieldMemOperand(scratch, 5739 __ lw(result, FieldMemOperand(scratch,
5747 FixedArray::kHeaderSize - kPointerSize)); 5740 FixedArray::kHeaderSize - kPointerSize));
5748 __ bind(&done); 5741 __ bind(&done);
5749 } 5742 }
5750 5743
5751 5744
5752 #undef __ 5745 #undef __
5753 5746
5754 } } // namespace v8::internal 5747 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698