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

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

Issue 879693006: X87: Double field values need sNaN -> qNaN canonicalization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 instr->elements(), 4591 instr->elements(),
4592 key, 4592 key,
4593 instr->hydrogen()->key()->representation(), 4593 instr->hydrogen()->key()->representation(),
4594 elements_kind, 4594 elements_kind,
4595 instr->base_offset())); 4595 instr->base_offset()));
4596 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4596 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4597 elements_kind == FLOAT32_ELEMENTS) { 4597 elements_kind == FLOAT32_ELEMENTS) {
4598 X87Mov(operand, ToX87Register(instr->value()), kX87FloatOperand); 4598 X87Mov(operand, ToX87Register(instr->value()), kX87FloatOperand);
4599 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || 4599 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4600 elements_kind == FLOAT64_ELEMENTS) { 4600 elements_kind == FLOAT64_ELEMENTS) {
4601 X87Mov(operand, ToX87Register(instr->value())); 4601 uint64_t int_val = kHoleNanInt64;
4602 int32_t lower = static_cast<int32_t>(int_val);
4603 int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
4604 Operand operand2 = BuildFastArrayOperand(
4605 instr->elements(), instr->key(),
4606 instr->hydrogen()->key()->representation(), elements_kind,
4607 instr->base_offset() + kPointerSize);
4608
4609 Label no_special_nan_handling, done;
4610 X87Register value = ToX87Register(instr->value());
4611 X87Fxch(value);
4612 __ lea(esp, Operand(esp, -kDoubleSize));
4613 __ fst_d(MemOperand(esp, 0));
4614 __ lea(esp, Operand(esp, kDoubleSize));
4615 int offset = sizeof(kHoleNanUpper32);
4616 // x87 converts sNaN(0xfff7fffffff7ffff) to QNaN(0xfffffffffff7ffff),
4617 // so we check the upper with 0xffffffff for hole as a temporary fix.
4618 __ cmp(MemOperand(esp, -offset), Immediate(0xffffffff));
4619 __ j(not_equal, &no_special_nan_handling, Label::kNear);
4620 __ mov(operand, Immediate(lower));
4621 __ mov(operand2, Immediate(upper));
4622 __ jmp(&done, Label::kNear);
4623
4624 __ bind(&no_special_nan_handling);
4625 __ fst_d(operand);
4626 __ bind(&done);
4602 } else { 4627 } else {
4603 Register value = ToRegister(instr->value()); 4628 Register value = ToRegister(instr->value());
4604 switch (elements_kind) { 4629 switch (elements_kind) {
4605 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: 4630 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4606 case EXTERNAL_UINT8_ELEMENTS: 4631 case EXTERNAL_UINT8_ELEMENTS:
4607 case EXTERNAL_INT8_ELEMENTS: 4632 case EXTERNAL_INT8_ELEMENTS:
4608 case UINT8_ELEMENTS: 4633 case UINT8_ELEMENTS:
4609 case INT8_ELEMENTS: 4634 case INT8_ELEMENTS:
4610 case UINT8_CLAMPED_ELEMENTS: 4635 case UINT8_CLAMPED_ELEMENTS:
4611 __ mov_b(operand, value); 4636 __ mov_b(operand, value);
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
6333 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6358 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6334 RecordSafepoint(Safepoint::kNoLazyDeopt); 6359 RecordSafepoint(Safepoint::kNoLazyDeopt);
6335 } 6360 }
6336 6361
6337 6362
6338 #undef __ 6363 #undef __
6339 6364
6340 } } // namespace v8::internal 6365 } } // namespace v8::internal
6341 6366
6342 #endif // V8_TARGET_ARCH_X87 6367 #endif // V8_TARGET_ARCH_X87
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