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

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

Issue 145973022: A64: Truncate booleans to 0 or 1 in LTaggedToI. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: whitespace Created 6 years, 10 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 DoubleRegister dbl_scratch1 = double_scratch(); 5111 DoubleRegister dbl_scratch1 = double_scratch();
5112 5112
5113 Label done; 5113 Label done;
5114 5114
5115 // Load heap object map. 5115 // Load heap object map.
5116 __ Ldr(scratch1, FieldMemOperand(input, HeapObject::kMapOffset)); 5116 __ Ldr(scratch1, FieldMemOperand(input, HeapObject::kMapOffset));
5117 5117
5118 if (instr->truncating()) { 5118 if (instr->truncating()) {
5119 Register output = ToRegister(instr->result()); 5119 Register output = ToRegister(instr->result());
5120 Register scratch2 = ToRegister(temp2); 5120 Register scratch2 = ToRegister(temp2);
5121 Label check_bools, undefined; 5121 Label check_bools;
5122 5122
5123 // If it's not a heap number, jump to undefined check. 5123 // If it's not a heap number, jump to undefined check.
5124 __ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools); 5124 __ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools);
5125 5125
5126 // A heap number: load value and convert to int32 using truncating function. 5126 // A heap number: load value and convert to int32 using truncating function.
5127 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); 5127 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset));
5128 __ ECMA262ToInt32(output, dbl_scratch1, scratch1, scratch2); 5128 __ ECMA262ToInt32(output, dbl_scratch1, scratch1, scratch2);
5129 __ B(&done); 5129 __ B(&done);
5130 5130
5131 __ Bind(&check_bools); 5131 __ Bind(&check_bools);
5132 5132
5133 TODO_UNIMPLEMENTED("LTaggedToI: Truncate booleans to 0 or 1."); 5133 Register true_root = output;
5134 Register false_root = scratch2;
5135 __ LoadTrueFalseRoots(true_root, false_root);
5136 __ Cmp(scratch1, true_root);
5137 __ Cset(output, eq);
5138 __ Ccmp(scratch1, false_root, ZFlag, ne);
5139 __ B(eq, &done);
5134 5140
5135 // Check for undefined. Undefined is converted to zero for truncating 5141 // Output contains zero, undefined is converted to zero for truncating
5136 // conversions. 5142 // conversions.
5137 __ Bind(&undefined);
5138
5139 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, 5143 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
5140 instr->environment()); 5144 instr->environment());
5141 __ Mov(output, 0);
5142 } else { 5145 } else {
5143 Register output = ToRegister32(instr->result()); 5146 Register output = ToRegister32(instr->result());
5144 5147
5145 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); 5148 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2);
5146 Label converted; 5149 Label converted;
5147 5150
5148 // Deoptimized if it's not a heap number. 5151 // Deoptimized if it's not a heap number.
5149 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, 5152 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex,
5150 instr->environment()); 5153 instr->environment());
5151 5154
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 __ Bind(&out_of_object); 5547 __ Bind(&out_of_object);
5545 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5548 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5546 // Index is equal to negated out of object property index plus 1. 5549 // Index is equal to negated out of object property index plus 1.
5547 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5550 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5548 __ Ldr(result, FieldMemOperand(result, 5551 __ Ldr(result, FieldMemOperand(result,
5549 FixedArray::kHeaderSize - kPointerSize)); 5552 FixedArray::kHeaderSize - kPointerSize));
5550 __ Bind(&done); 5553 __ Bind(&done);
5551 } 5554 }
5552 5555
5553 } } // namespace v8::internal 5556 } } // 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