Revision: 11405
Author: erikcorry
Date: Fri Apr 20 07:12:49 2012
Log: MIPS: Do the qNaN fixup at de-serialization time. This is a
commit of https://chromiumcodereview.appspot.com/10093007/ for Paul Lind
http://code.google.com/p/v8/source/detail?r=11405
Modified:
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/mips/assembler-mips.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/runtime.js
/branches/bleeding_edge/src/serialize.cc
=======================================
--- /branches/bleeding_edge/src/isolate.cc Wed Apr 18 10:49:53 2012
+++ /branches/bleeding_edge/src/isolate.cc Fri Apr 20 07:12:49 2012
@@ -1842,6 +1842,9 @@
// stack guard.
heap_.SetStackLimits();
+ // Quiet the heap NaN if needed on target platform.
+ if (des != NULL) Assembler::QuietNaN(heap_.nan_value());
+
deoptimizer_data_ = new DeoptimizerData;
runtime_profiler_ = new RuntimeProfiler(this);
runtime_profiler_->SetUp();
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.cc Thu Apr 12 02:23:26
2012
+++ /branches/bleeding_edge/src/mips/assembler-mips.cc Fri Apr 20 07:12:49
2012
@@ -2137,19 +2137,12 @@
}
-#define MIPS_QNAN_HI 0x7ff7ffff
-#define MIPS_QNAN_LO 0xffffffff
-
-
+// MIPS and ia32 use opposite encoding for qNaN and sNaN, such that ia32
+// qNaN is a MIPS sNaN, and ia32 sNaN is MIPS qNaN. If running from a heap
+// snapshot generated on ia32, the resulting MIPS sNaN must be quieted.
+// OS::nan_value() returns a qNaN.
void Assembler::QuietNaN(HeapObject* object) {
- // Mips has a different encoding of qNaN than ia32, so any heap NaN built
- // with simulator must be re-encoded for the snapshot. Performance hit
not
- // critical at mksnapshot/build time. We can't use set_value because
that
- // will put the NaN in an fp register, which changes the bits.
- uint64_t mips_qnan_bits =
- (static_cast<uint64_t>(MIPS_QNAN_HI) << 32) | MIPS_QNAN_LO;
- Address value_ptr = object->address() + HeapNumber::kValueOffset;
- memcpy(value_ptr, &mips_qnan_bits, sizeof(mips_qnan_bits));
+ HeapNumber::cast(object)->set_value(OS::nan_value());
}
=======================================
--- /branches/bleeding_edge/src/runtime.cc Fri Apr 20 06:35:09 2012
+++ /branches/bleeding_edge/src/runtime.cc Fri Apr 20 07:12:49 2012
@@ -8430,6 +8430,12 @@
RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
return isolate->heap()->undefined_value();
}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetRootNaN) {
+ RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
+ return isolate->heap()->nan_value();
+}
RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) {
=======================================
--- /branches/bleeding_edge/src/runtime.h Fri Apr 20 04:06:12 2012
+++ /branches/bleeding_edge/src/runtime.h Fri Apr 20 07:12:49 2012
@@ -77,6 +77,7 @@
\
/* Utilities */ \
F(CheckIsBootstrapping, 0, 1) \
+ F(GetRootNaN, 0, 1) \
F(Call, -1 /* >= 2 */, 1) \
F(Apply, 5, 1) \
F(GetFunctionDelegate, 1, 1) \
=======================================
--- /branches/bleeding_edge/src/runtime.js Mon Feb 20 05:48:24 2012
+++ /branches/bleeding_edge/src/runtime.js Fri Apr 20 07:12:49 2012
@@ -47,7 +47,7 @@
var $Number = global.Number;
var $Function = global.Function;
var $Boolean = global.Boolean;
-var $NaN = 0/0;
+var $NaN = %GetRootNaN();
var builtins = this;
// ECMA-262 Section 11.9.3.
=======================================
--- /branches/bleeding_edge/src/serialize.cc Thu Apr 12 02:23:26 2012
+++ /branches/bleeding_edge/src/serialize.cc Fri Apr 20 07:12:49 2012
@@ -1443,8 +1443,6 @@
sink_->Put(kNewPage, "NewPage");
sink_->PutSection(space, "NewPageSpace");
}
-
- if (object_->IsNaN()) Assembler::QuietNaN(object_);
// Serialize the map (first word of the object).
serializer_->SerializeObject(object_->map(), kPlain, kStartOfObject);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev