Index: src/harmony-math.js |
diff --git a/test/mjsunit/regress/regress-2489.js b/src/harmony-math.js |
similarity index 79% |
copy from test/mjsunit/regress/regress-2489.js |
copy to src/harmony-math.js |
index 882c4f794a88e24d1d64e86a466b27c39f51e625..2e9b42a75e7cf368af023c29baaf9cd24663a3b8 100644 |
--- a/test/mjsunit/regress/regress-2489.js |
+++ b/src/harmony-math.js |
@@ -25,26 +25,25 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+'use strict'; |
-"use strict"; |
- |
-function f(a, b) { |
- return g("c", "d"); |
+// ES6 draft 09-27-13, section 20.2.2.28. |
+function MathSign(x) { |
+ if (!IS_NUMBER(x)) x = NonNumberToNumber(x); |
+ if (x > 0) return 1; |
+ if (x < 0) return -1; |
+ if (x === 0) return x; |
+ return NAN; |
} |
-function g(a, b) { |
- g.constructor.apply(this, arguments); |
-} |
-g.constructor = function(a, b) { |
- assertEquals("c", a); |
- assertEquals("d", b); |
+function ExtendMath() { |
+ %CheckIsBootstrapping(); |
+ |
+ // Set up the non-enumerable functions on the Math object. |
+ InstallFunctions($Math, DONT_ENUM, $Array( |
+ "sign", MathSign |
+ )); |
} |
-f("a", "b"); |
-f("a", "b"); |
-%OptimizeFunctionOnNextCall(f); |
-f("a", "b"); |
-g.x = "deopt"; |
-f("a", "b"); |
+ExtendMath(); |