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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index 5ae5081862eda805bd732494a4116c7ff4095206..1a3894666e3041ef56817736f72dcc1e3bb6fc49 100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -4598,7 +4598,32 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
X87Mov(operand, ToX87Register(instr->value()), kX87FloatOperand);
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
elements_kind == FLOAT64_ELEMENTS) {
- X87Mov(operand, ToX87Register(instr->value()));
+ uint64_t int_val = kHoleNanInt64;
+ int32_t lower = static_cast<int32_t>(int_val);
+ int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
+ Operand operand2 = BuildFastArrayOperand(
+ instr->elements(), instr->key(),
+ instr->hydrogen()->key()->representation(), elements_kind,
+ instr->base_offset() + kPointerSize);
+
+ Label no_special_nan_handling, done;
+ X87Register value = ToX87Register(instr->value());
+ X87Fxch(value);
+ __ lea(esp, Operand(esp, -kDoubleSize));
+ __ fst_d(MemOperand(esp, 0));
+ __ lea(esp, Operand(esp, kDoubleSize));
+ int offset = sizeof(kHoleNanUpper32);
+ // x87 converts sNaN(0xfff7fffffff7ffff) to QNaN(0xfffffffffff7ffff),
+ // so we check the upper with 0xffffffff for hole as a temporary fix.
+ __ cmp(MemOperand(esp, -offset), Immediate(0xffffffff));
+ __ j(not_equal, &no_special_nan_handling, Label::kNear);
+ __ mov(operand, Immediate(lower));
+ __ mov(operand2, Immediate(upper));
+ __ jmp(&done, Label::kNear);
+
+ __ bind(&no_special_nan_handling);
+ __ fst_d(operand);
+ __ bind(&done);
} else {
Register value = ToRegister(instr->value());
switch (elements_kind) {
« 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