From f3e5183347a4d2e7aae4158b76753bce4387b39a Mon Sep 17 00:00:00 2001 From: yangguo Date: Tue, 21 Apr 2015 06:44:09 -0700 Subject: [PATCH] Reintroduce %GetRootNaN to fix MIPS. R=dusan.milosavljevic@imgtec.com Review URL: https://codereview.chromium.org/1101503003 Cr-Commit-Position: refs/heads/master@{#27967} --- src/macros.py | 2 +- src/runtime.js | 1 + src/runtime/runtime-numbers.cc | 7 +++++++ src/runtime/runtime.h | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/macros.py b/src/macros.py index 6038a71ae5..2dab3b2bae 100644 --- a/src/macros.py +++ b/src/macros.py @@ -169,7 +169,7 @@ macro SET_PRIVATE(obj, sym, val) = (obj[sym] = val); macro DELETE_PRIVATE(obj, sym) = (delete obj[sym]); # Constants. The compiler constant folds them. -const NAN = (0/0); +const NAN = $NaN; const INFINITY = (1/0); const UNDEFINED = (void 0); diff --git a/src/runtime.js b/src/runtime.js index 0e6c68eb36..aaaa4fecba 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -22,6 +22,7 @@ var $String = global.String; var $Number = global.Number; var $Function = global.Function; var $Boolean = global.Boolean; +var $NaN = %GetRootNaN(); // ECMA-262 Section 11.9.3. function EQUALS(y) { diff --git a/src/runtime/runtime-numbers.cc b/src/runtime/runtime-numbers.cc index 78dd3cbef6..2bc3af1254 100644 --- a/src/runtime/runtime-numbers.cc +++ b/src/runtime/runtime-numbers.cc @@ -579,5 +579,12 @@ RUNTIME_FUNCTION(Runtime_IsNonNegativeSmi) { return isolate->heap()->ToBoolean(obj->IsSmi() && Smi::cast(obj)->value() >= 0); } + + +RUNTIME_FUNCTION(Runtime_GetRootNaN) { + SealHandleScope shs(isolate); + DCHECK(args.length() == 0); + return isolate->heap()->nan_value(); +} } } // namespace v8::internal diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 2d475bbec2..602a679e8b 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -380,7 +380,8 @@ namespace internal { F(MaxSmi, 0, 1) \ F(NumberToString, 1, 1) \ F(IsSmi, 1, 1) \ - F(IsNonNegativeSmi, 1, 1) + F(IsNonNegativeSmi, 1, 1) \ + F(GetRootNaN, 0, 1) #define FOR_EACH_INTRINSIC_OBJECT(F) \