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

Unified Diff: test/mjsunit/harmony/atomics.js

Issue 1227913006: Don't use length property when bounds checking atomics functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: modify regression test Created 5 years, 5 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/harmony-atomics.js ('k') | test/mjsunit/regress/regress-crbug-501809.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/atomics.js
diff --git a/test/mjsunit/harmony/atomics.js b/test/mjsunit/harmony/atomics.js
index ff403b8bd1d47cc0b53d994220abc90025ec52f7..f59dffd1eea4656ff38dc24b48024aa52e501f7a 100644
--- a/test/mjsunit/harmony/atomics.js
+++ b/test/mjsunit/harmony/atomics.js
@@ -123,6 +123,21 @@ function testAtomicOp(op, ia, index, expectedIndex, name) {
assertEquals(undefined, Atomics.xor(si32a, i, 0), name);
assertEquals(undefined, Atomics.exchange(si32a, i, 0), name);
});
+
+ // Monkey-patch length and make sure these functions still return undefined.
+ Object.defineProperty(si32a, 'length', {get: function() { return 1000; }});
+ [2, 100].forEach(function(i) {
+ var name = String(i);
+ assertEquals(undefined, Atomics.compareExchange(si32a, i, 0, 0), name);
+ assertEquals(undefined, Atomics.load(si32a, i), name);
+ assertEquals(undefined, Atomics.store(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.add(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.sub(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.and(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.or(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.xor(si32a, i, 0), name);
+ assertEquals(undefined, Atomics.exchange(si32a, i, 0), name);
+ });
})();
(function TestGoodIndex() {
« no previous file with comments | « src/harmony-atomics.js ('k') | test/mjsunit/regress/regress-crbug-501809.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698