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

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

Issue 23129003: Arm support for DoubleToIStub (truncating). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sync and rebased. Created 7 years, 4 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
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 4883 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 __ vcvt_f64_s32(result_reg, flt_scratch); 4894 __ vcvt_f64_s32(result_reg, flt_scratch);
4895 __ bind(&done); 4895 __ bind(&done);
4896 } 4896 }
4897 4897
4898 4898
4899 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { 4899 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
4900 Register input_reg = ToRegister(instr->value()); 4900 Register input_reg = ToRegister(instr->value());
4901 Register scratch1 = scratch0(); 4901 Register scratch1 = scratch0();
4902 Register scratch2 = ToRegister(instr->temp()); 4902 Register scratch2 = ToRegister(instr->temp());
4903 LowDwVfpRegister double_scratch = double_scratch0(); 4903 LowDwVfpRegister double_scratch = double_scratch0();
4904 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp3()); 4904 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp2());
4905 4905
4906 ASSERT(!scratch1.is(input_reg) && !scratch1.is(scratch2)); 4906 ASSERT(!scratch1.is(input_reg) && !scratch1.is(scratch2));
4907 ASSERT(!scratch2.is(input_reg) && !scratch2.is(scratch1)); 4907 ASSERT(!scratch2.is(input_reg) && !scratch2.is(scratch1));
4908 4908
4909 Label done; 4909 Label done;
4910 4910
4911 // The input was optimistically untagged; revert it. 4911 // The input was optimistically untagged; revert it.
4912 // The carry flag is set when we reach this deferred code as we just executed 4912 // The carry flag is set when we reach this deferred code as we just executed
4913 // SmiUntag(heap_object, SetCC) 4913 // SmiUntag(heap_object, SetCC)
4914 STATIC_ASSERT(kHeapObjectTag == 1); 4914 STATIC_ASSERT(kHeapObjectTag == 1);
4915 __ adc(input_reg, input_reg, Operand(input_reg)); 4915 __ adc(scratch2, input_reg, Operand(input_reg));
4916 4916
4917 // Heap number map check. 4917 // Heap number map check.
4918 __ ldr(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); 4918 __ ldr(scratch1, FieldMemOperand(scratch2, HeapObject::kMapOffset));
4919 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 4919 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
4920 __ cmp(scratch1, Operand(ip)); 4920 __ cmp(scratch1, Operand(ip));
4921 4921
4922 if (instr->truncating()) { 4922 if (instr->truncating()) {
4923 Register scratch3 = ToRegister(instr->temp2());
4924 ASSERT(!scratch3.is(input_reg) &&
4925 !scratch3.is(scratch1) &&
4926 !scratch3.is(scratch2));
4927 // Performs a truncating conversion of a floating point number as used by 4923 // Performs a truncating conversion of a floating point number as used by
4928 // the JS bitwise operations. 4924 // the JS bitwise operations.
4929 Label heap_number; 4925 Label heap_number;
4930 __ b(eq, &heap_number); 4926 __ b(eq, &heap_number);
4931 // Check for undefined. Undefined is converted to zero for truncating 4927 // Check for undefined. Undefined is converted to zero for truncating
4932 // conversions. 4928 // conversions.
4933 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 4929 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
4934 __ cmp(input_reg, Operand(ip)); 4930 __ cmp(scratch2, Operand(ip));
4935 DeoptimizeIf(ne, instr->environment()); 4931 DeoptimizeIf(ne, instr->environment());
4936 __ mov(input_reg, Operand::Zero()); 4932 __ mov(input_reg, Operand::Zero());
4937 __ b(&done); 4933 __ b(&done);
4938 4934
4939 __ bind(&heap_number); 4935 __ bind(&heap_number);
4940 __ sub(scratch1, input_reg, Operand(kHeapObjectTag)); 4936 __ TruncateDoubleToI(input_reg, scratch2,
4941 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); 4937 HeapNumber::kValueOffset - kHeapObjectTag);
4942
4943 __ ECMAToInt32(input_reg, double_scratch2,
4944 scratch1, scratch2, scratch3, double_scratch);
4945
4946 } else { 4938 } else {
4947 // Deoptimize if we don't have a heap number. 4939 // Deoptimize if we don't have a heap number.
4948 DeoptimizeIf(ne, instr->environment()); 4940 DeoptimizeIf(ne, instr->environment());
4949 4941
4950 __ sub(ip, input_reg, Operand(kHeapObjectTag)); 4942 __ sub(ip, scratch2, Operand(kHeapObjectTag));
4951 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset); 4943 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset);
4952 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch); 4944 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch);
4953 DeoptimizeIf(ne, instr->environment()); 4945 DeoptimizeIf(ne, instr->environment());
4954 4946
4955 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 4947 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
4956 __ cmp(input_reg, Operand::Zero()); 4948 __ cmp(input_reg, Operand::Zero());
4957 __ b(ne, &done); 4949 __ b(ne, &done);
4958 __ VmovHigh(scratch1, double_scratch2); 4950 __ VmovHigh(scratch1, double_scratch2);
4959 __ tst(scratch1, Operand(HeapNumber::kSignMask)); 4951 __ tst(scratch1, Operand(HeapNumber::kSignMask));
4960 DeoptimizeIf(ne, instr->environment()); 4952 DeoptimizeIf(ne, instr->environment());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5010 instr->hydrogen()->can_convert_undefined_to_nan(), 5002 instr->hydrogen()->can_convert_undefined_to_nan(),
5011 instr->hydrogen()->deoptimize_on_minus_zero(), 5003 instr->hydrogen()->deoptimize_on_minus_zero(),
5012 instr->environment(), 5004 instr->environment(),
5013 mode); 5005 mode);
5014 } 5006 }
5015 5007
5016 5008
5017 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 5009 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
5018 Register result_reg = ToRegister(instr->result()); 5010 Register result_reg = ToRegister(instr->result());
5019 Register scratch1 = scratch0(); 5011 Register scratch1 = scratch0();
5020 Register scratch2 = ToRegister(instr->temp());
5021 DwVfpRegister double_input = ToDoubleRegister(instr->value()); 5012 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5022 LowDwVfpRegister double_scratch = double_scratch0(); 5013 LowDwVfpRegister double_scratch = double_scratch0();
5023 5014
5024 if (instr->truncating()) { 5015 if (instr->truncating()) {
5025 Register scratch3 = ToRegister(instr->temp2()); 5016 __ TruncateDoubleToI(result_reg, double_input);
5026 __ ECMAToInt32(result_reg, double_input,
5027 scratch1, scratch2, scratch3, double_scratch);
5028 } else { 5017 } else {
5029 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch); 5018 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch);
5030 // Deoptimize if the input wasn't a int32 (inside a double). 5019 // Deoptimize if the input wasn't a int32 (inside a double).
5031 DeoptimizeIf(ne, instr->environment()); 5020 DeoptimizeIf(ne, instr->environment());
5032 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 5021 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5033 Label done; 5022 Label done;
5034 __ cmp(result_reg, Operand::Zero()); 5023 __ cmp(result_reg, Operand::Zero());
5035 __ b(ne, &done); 5024 __ b(ne, &done);
5036 __ VmovHigh(scratch1, double_input); 5025 __ VmovHigh(scratch1, double_input);
5037 __ tst(scratch1, Operand(HeapNumber::kSignMask)); 5026 __ tst(scratch1, Operand(HeapNumber::kSignMask));
5038 DeoptimizeIf(ne, instr->environment()); 5027 DeoptimizeIf(ne, instr->environment());
5039 __ bind(&done); 5028 __ bind(&done);
5040 } 5029 }
5041 } 5030 }
5042 } 5031 }
5043 5032
5044 5033
5045 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { 5034 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5046 Register result_reg = ToRegister(instr->result()); 5035 Register result_reg = ToRegister(instr->result());
5047 Register scratch1 = scratch0(); 5036 Register scratch1 = scratch0();
5048 Register scratch2 = ToRegister(instr->temp());
5049 DwVfpRegister double_input = ToDoubleRegister(instr->value()); 5037 DwVfpRegister double_input = ToDoubleRegister(instr->value());
5050 LowDwVfpRegister double_scratch = double_scratch0(); 5038 LowDwVfpRegister double_scratch = double_scratch0();
5051 5039
5052 if (instr->truncating()) { 5040 if (instr->truncating()) {
5053 Register scratch3 = ToRegister(instr->temp2()); 5041 __ TruncateDoubleToI(result_reg, double_input);
5054 __ ECMAToInt32(result_reg, double_input,
5055 scratch1, scratch2, scratch3, double_scratch);
5056 } else { 5042 } else {
5057 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch); 5043 __ TryDoubleToInt32Exact(result_reg, double_input, double_scratch);
5058 // Deoptimize if the input wasn't a int32 (inside a double). 5044 // Deoptimize if the input wasn't a int32 (inside a double).
5059 DeoptimizeIf(ne, instr->environment()); 5045 DeoptimizeIf(ne, instr->environment());
5060 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 5046 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
5061 Label done; 5047 Label done;
5062 __ cmp(result_reg, Operand::Zero()); 5048 __ cmp(result_reg, Operand::Zero());
5063 __ b(ne, &done); 5049 __ b(ne, &done);
5064 __ VmovHigh(scratch1, double_input); 5050 __ VmovHigh(scratch1, double_input);
5065 __ tst(scratch1, Operand(HeapNumber::kSignMask)); 5051 __ tst(scratch1, Operand(HeapNumber::kSignMask));
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
5775 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5761 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5776 __ ldr(result, FieldMemOperand(scratch, 5762 __ ldr(result, FieldMemOperand(scratch,
5777 FixedArray::kHeaderSize - kPointerSize)); 5763 FixedArray::kHeaderSize - kPointerSize));
5778 __ bind(&done); 5764 __ bind(&done);
5779 } 5765 }
5780 5766
5781 5767
5782 #undef __ 5768 #undef __
5783 5769
5784 } } // namespace v8::internal 5770 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698