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

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

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « src/x64/codegen-x64.cc ('k') | src/x64/lithium-gap-resolver-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 1714
1715 void LCodeGen::DoConstantS(LConstantS* instr) { 1715 void LCodeGen::DoConstantS(LConstantS* instr) {
1716 __ Move(ToRegister(instr->result()), instr->value()); 1716 __ Move(ToRegister(instr->result()), instr->value());
1717 } 1717 }
1718 1718
1719 1719
1720 void LCodeGen::DoConstantD(LConstantD* instr) { 1720 void LCodeGen::DoConstantD(LConstantD* instr) {
1721 DCHECK(instr->result()->IsDoubleRegister()); 1721 DCHECK(instr->result()->IsDoubleRegister());
1722 XMMRegister res = ToDoubleRegister(instr->result()); 1722 XMMRegister res = ToDoubleRegister(instr->result());
1723 double v = instr->value(); 1723 double v = instr->value();
1724 uint64_t int_val = BitCast<uint64_t, double>(v); 1724 uint64_t int_val = bit_cast<uint64_t, double>(v);
1725 // Use xor to produce +0.0 in a fast and compact way, but avoid to 1725 // Use xor to produce +0.0 in a fast and compact way, but avoid to
1726 // do so if the constant is -0.0. 1726 // do so if the constant is -0.0.
1727 if (int_val == 0) { 1727 if (int_val == 0) {
1728 __ xorps(res, res); 1728 __ xorps(res, res);
1729 } else { 1729 } else {
1730 Register tmp = ToRegister(instr->temp()); 1730 Register tmp = ToRegister(instr->temp());
1731 __ Set(tmp, int_val); 1731 __ Set(tmp, int_val);
1732 __ movq(res, tmp); 1732 __ movq(res, tmp);
1733 } 1733 }
1734 } 1734 }
(...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 // Sign extend key because it could be a 32 bit negative value 4340 // Sign extend key because it could be a 32 bit negative value
4341 // and the dehoisted address computation happens in 64 bits 4341 // and the dehoisted address computation happens in 64 bits
4342 __ movsxlq(ToRegister(key), ToRegister(key)); 4342 __ movsxlq(ToRegister(key), ToRegister(key));
4343 } 4343 }
4344 if (instr->NeedsCanonicalization()) { 4344 if (instr->NeedsCanonicalization()) {
4345 Label have_value; 4345 Label have_value;
4346 4346
4347 __ ucomisd(value, value); 4347 __ ucomisd(value, value);
4348 __ j(parity_odd, &have_value, Label::kNear); // NaN. 4348 __ j(parity_odd, &have_value, Label::kNear); // NaN.
4349 4349
4350 __ Set(kScratchRegister, BitCast<uint64_t>( 4350 __ Set(kScratchRegister,
4351 FixedDoubleArray::canonical_not_the_hole_nan_as_double())); 4351 bit_cast<uint64_t>(
4352 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
4352 __ movq(value, kScratchRegister); 4353 __ movq(value, kScratchRegister);
4353 4354
4354 __ bind(&have_value); 4355 __ bind(&have_value);
4355 } 4356 }
4356 4357
4357 Operand double_store_operand = BuildFastArrayOperand( 4358 Operand double_store_operand = BuildFastArrayOperand(
4358 instr->elements(), 4359 instr->elements(),
4359 key, 4360 key,
4360 instr->hydrogen()->key()->representation(), 4361 instr->hydrogen()->key()->representation(),
4361 FAST_DOUBLE_ELEMENTS, 4362 FAST_DOUBLE_ELEMENTS,
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
5851 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5852 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5852 RecordSafepoint(Safepoint::kNoLazyDeopt); 5853 RecordSafepoint(Safepoint::kNoLazyDeopt);
5853 } 5854 }
5854 5855
5855 5856
5856 #undef __ 5857 #undef __
5857 5858
5858 } } // namespace v8::internal 5859 } } // namespace v8::internal
5859 5860
5860 #endif // V8_TARGET_ARCH_X64 5861 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | src/x64/lithium-gap-resolver-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698