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

Unified Diff: src/harmony-math.js

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again Created 7 years, 2 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 | « src/handles.cc ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-math.js
diff --git a/test/mjsunit/regress/readonly3.js b/src/harmony-math.js
similarity index 72%
copy from test/mjsunit/regress/readonly3.js
copy to src/harmony-math.js
index f81979d272217d768fa9c9c90a0b22ce34d1c15b..a4d3f2e8a5e9c5936630571644605402dee1199d 100644
--- a/test/mjsunit/regress/readonly3.js
+++ b/src/harmony-math.js
@@ -25,41 +25,36 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-this.x = 0;
-
-var p = {};
-Object.defineProperty(p, "x", {writable:false, value:5});
-this.__proto__ = p;
-
-function s(v) {
- v.x = 1;
+'use strict';
+
+// ES6 draft 09-27-13, section 20.2.2.28.
+function MathSign(x) {
+ x = TO_NUMBER_INLINE(x);
+ if (x > 0) return 1;
+ if (x < 0) return -1;
+ if (x === 0) return x;
+ return NAN;
}
-function s_strict(v) {
- "use strict";
- v.x = 1;
-}
-function c(p) {
- return {__proto__: p};
+// ES6 draft 09-27-13, section 20.2.2.34.
+function MathTrunc(x) {
+ x = TO_NUMBER_INLINE(x);
+ if (x > 0) return MathFloor(x);
+ if (x < 0) return MathCeil(x);
+ if (x === 0) return x;
+ return NAN;
}
-var o1 = c(this);
-var o2 = c(this);
-// Initialize the store IC.
-s(c(this));
-s(c(this));
-s_strict(c(this));
-s_strict(c(this));
+function ExtendMath() {
+ %CheckIsBootstrapping();
-delete this.x;
-
-// Verify that direct setting fails.
-o1.x = 20;
-assertEquals(5, o1.x);
+ // Set up the non-enumerable functions on the Math object.
+ InstallFunctions($Math, DONT_ENUM, $Array(
+ "sign", MathSign,
+ "trunc", MathTrunc
+ ));
+}
-// Verify that setting through the IC fails.
-s(o2);
-assertEquals(5, o2.x);
-assertThrows("s_strict(o2);", TypeError);
+ExtendMath();
« no previous file with comments | « src/handles.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698