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

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

Issue 26824002: Truncate booleans to 0/1 in truncating t-to-i. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add a testcase Created 7 years, 2 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 | src/code-stubs.cc » ('j') | 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 4952 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 __ adc(scratch2, input_reg, Operand(input_reg)); 4963 __ adc(scratch2, input_reg, Operand(input_reg));
4964 4964
4965 // Heap number map check. 4965 // Heap number map check.
4966 __ ldr(scratch1, FieldMemOperand(scratch2, HeapObject::kMapOffset)); 4966 __ ldr(scratch1, FieldMemOperand(scratch2, HeapObject::kMapOffset));
4967 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 4967 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
4968 __ cmp(scratch1, Operand(ip)); 4968 __ cmp(scratch1, Operand(ip));
4969 4969
4970 if (instr->truncating()) { 4970 if (instr->truncating()) {
4971 // Performs a truncating conversion of a floating point number as used by 4971 // Performs a truncating conversion of a floating point number as used by
4972 // the JS bitwise operations. 4972 // the JS bitwise operations.
4973 Label heap_number; 4973 Label no_heap_number, check_bools, check_false;
4974 __ b(eq, &heap_number); 4974 __ b(ne, &no_heap_number);
4975 // Check for undefined. Undefined is converted to zero for truncating 4975 __ TruncateHeapNumberToI(input_reg, scratch2);
4976 // conversions. 4976 __ b(&done);
4977
4978 // Check for Oddballs. Undefined/False is converted to zero and True to one
4979 // for truncating conversions.
4980 __ bind(&no_heap_number);
4977 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 4981 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
4978 __ cmp(scratch2, Operand(ip)); 4982 __ cmp(scratch2, Operand(ip));
4983 __ b(ne, &check_bools);
4984 __ mov(input_reg, Operand::Zero());
4985 __ b(&done);
4986
4987 __ bind(&check_bools);
4988 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
4989 __ cmp(scratch2, Operand(ip));
4990 __ b(ne, &check_false);
4991 __ mov(input_reg, Operand(1));
4992 __ b(&done);
4993
4994 __ bind(&check_false);
4995 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
4996 __ cmp(scratch2, Operand(ip));
4979 DeoptimizeIf(ne, instr->environment()); 4997 DeoptimizeIf(ne, instr->environment());
4980 __ mov(input_reg, Operand::Zero()); 4998 __ mov(input_reg, Operand::Zero());
4981 __ b(&done); 4999 __ b(&done);
4982
4983 __ bind(&heap_number);
4984 __ TruncateHeapNumberToI(input_reg, scratch2);
4985 } else { 5000 } else {
4986 // Deoptimize if we don't have a heap number. 5001 // Deoptimize if we don't have a heap number.
4987 DeoptimizeIf(ne, instr->environment()); 5002 DeoptimizeIf(ne, instr->environment());
4988 5003
4989 __ sub(ip, scratch2, Operand(kHeapObjectTag)); 5004 __ sub(ip, scratch2, Operand(kHeapObjectTag));
4990 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset); 5005 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset);
4991 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch); 5006 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch);
4992 DeoptimizeIf(ne, instr->environment()); 5007 DeoptimizeIf(ne, instr->environment());
4993 5008
4994 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 5009 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
5826 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5841 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5827 __ ldr(result, FieldMemOperand(scratch, 5842 __ ldr(result, FieldMemOperand(scratch,
5828 FixedArray::kHeaderSize - kPointerSize)); 5843 FixedArray::kHeaderSize - kPointerSize));
5829 __ bind(&done); 5844 __ bind(&done);
5830 } 5845 }
5831 5846
5832 5847
5833 #undef __ 5848 #undef __
5834 5849
5835 } } // namespace v8::internal 5850 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698