Reviewers: Erik Corry, danno,
Message:
On 2012/04/03 09:14:42, danno wrote:
Can you just make OS::nan_value() return the right non-signaling qNaN for
MIPS when running with the simulator on ia32?
That does not work, since the MIPS qNaN encoding looks like sNaN to ia32.
Any FP
operation that uses that value then "quiets" the signaling NaN, which then
is
incorrect for MIPS.
I've removed the un-needed wrapper function here, just in case this version
is
needed.
But I will be uploading a new version shortly using Erik's suggestion.
https://chromiumcodereview.appspot.com/9910029/diff/1/src/runtime.js
File src/runtime.js (right):
https://chromiumcodereview.appspot.com/9910029/diff/1/src/runtime.js#newcode50
src/runtime.js:50: var $NaN = getCanonicalNan();
On 2012/04/03 09:14:43, danno wrote:
Why the extra wrapped function? Why not call %getCannonicalNaN here?
Not needed, removed.
Description:
MIPS: Fix NaN value inconsistency with snapshots (alternate implementation).
The NaN values from roots and global object NaN property are incorrect
for MIPS HW when snapshot generated on simulator is used. This due to
difference in qNaN encoding on MIPS and x86 architectures.
This fix unifies the two heap stored NaNs, so that the global-object
NaN refers to the roots-array NaN. Then that single roots-array NaN
is replaced (with OS::nan_value(), which is qNaN) on MIPS platforms
when deserialization is complete.
BUG=
TEST=cctest/test-api/QuietSignalingNaNs, mjsunit/harmony/collections.js
Please review this at https://chromiumcodereview.appspot.com/9910029/
Affected files:
M src/isolate.cc
M src/runtime.h
M src/runtime.cc
M src/runtime.js
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
bf9b345049ed7c6668c54891bd97c6a8c7b8665f..5e369104f853c84dc23b508cfe539e7ea3493e39
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1841,6 +1841,13 @@ bool Isolate::Init(Deserializer* des) {
// Deserializing may put strange things in the root array's copy of the
// stack guard.
heap_.SetStackLimits();
+#ifdef __mips__
+ // Reset NaN value which is incorrect for MIPS when snapshot is generated
+ // on simulator.
+ if(des != NULL) {
+ heap_.nan_value()->set_value(OS::nan_value());
+ }
+#endif
deoptimizer_data_ = new DeoptimizerData;
runtime_profiler_ = new RuntimeProfiler(this);
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
f9b5fde7ae3035e18651f59790b68ac004dcc7ac..83f57dfc7c4a881589ec7fa70de89757f96100c7
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8398,6 +8398,12 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_CheckIsBootstrapping) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetRootNan) {
+ RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
+ return isolate->heap()->nan_value();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) {
HandleScope scope(isolate);
ASSERT(args.length() >= 2);
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index
fe9cfd9b2f3956a807b5bff556a443a7a188f7c9..b83dd84e16f20c5d16474f30c81068f20f9398b0
100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -77,6 +77,7 @@ namespace internal {
\
/* Utilities */ \
F(CheckIsBootstrapping, 0, 1) \
+ F(GetRootNan, 0, 1) \
F(Call, -1 /* >= 2 */, 1) \
F(Apply, 5, 1) \
F(GetFunctionDelegate, 1, 1) \
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index
53d9a397310c9ff9cd9b29abf6b1dcd67234882f..49926624ee7b2a1a483749c62bd3d666725e277a
100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -47,9 +47,10 @@ var $String = global.String;
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.
function EQUALS(y) {
if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev