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

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: 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, check_false, check_undefined;
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 __ JumpIfNotRoot(scratch1, Heap::kTrueValueRootIndex, &check_false);
m.m.capewell 2014/02/05 18:43:23 It may be better to load both roots at once and us
ulan 2014/02/05 19:21:29 Nice! Done.
5133 TODO_UNIMPLEMENTED("LTaggedToI: Truncate booleans to 0 or 1."); 5133 __ Mov(output, 1);
5134 __ B(&done);
5135 __ Bind(&check_false);
5136 __ JumpIfNotRoot(scratch1, Heap::kFalseValueRootIndex, &check_undefined);
5137 __ Mov(output, 0);
5138 __ B(&done);
5134 5139
5135 // Check for undefined. Undefined is converted to zero for truncating 5140 // Check for undefined. Undefined is converted to zero for truncating
5136 // conversions. 5141 // conversions.
5137 __ Bind(&undefined); 5142 __ Bind(&check_undefined);
5138 5143
5139 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, 5144 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
5140 instr->environment()); 5145 instr->environment());
5141 __ Mov(output, 0); 5146 __ Mov(output, 0);
5142 } else { 5147 } else {
5143 Register output = ToRegister32(instr->result()); 5148 Register output = ToRegister32(instr->result());
5144 5149
5145 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); 5150 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2);
5146 Label converted; 5151 Label converted;
5147 5152
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 __ Bind(&out_of_object); 5549 __ Bind(&out_of_object);
5545 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5550 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5546 // Index is equal to negated out of object property index plus 1. 5551 // Index is equal to negated out of object property index plus 1.
5547 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5552 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5548 __ Ldr(result, FieldMemOperand(result, 5553 __ Ldr(result, FieldMemOperand(result,
5549 FixedArray::kHeaderSize - kPointerSize)); 5554 FixedArray::kHeaderSize - kPointerSize));
5550 __ Bind(&done); 5555 __ Bind(&done);
5551 } 5556 }
5552 5557
5553 } } // namespace v8::internal 5558 } } // 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