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

Unified Diff: test/mjsunit/keyed-array-call.js

Issue 71783003: Reland and fix "Add support for keyed-call on arrays of fast elements" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test + fix Created 7 years, 1 month 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/x64/lithium-x64.cc ('k') | test/mjsunit/regress/clear-keyed-call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/keyed-array-call.js
diff --git a/src/harmony-math.js b/test/mjsunit/keyed-array-call.js
similarity index 67%
copy from src/harmony-math.js
copy to test/mjsunit/keyed-array-call.js
index a4d3f2e8a5e9c5936630571644605402dee1199d..b97da3cf1b08511d05d41eb0f3e4a4b467702a3b 100644
--- a/src/harmony-math.js
+++ b/test/mjsunit/keyed-array-call.js
@@ -25,36 +25,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-'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;
+var a = [function(a) { return a+10; },
+ function(a) { return a+20; }];
+a.__proto__.test = function(a) { return a+30; }
+function f(i) {
+ return "r" + (1, a[i](i+1), a[i](i+2));
}
+assertEquals("r12", f(0));
+assertEquals("r12", f(0));
+assertEquals("r23", f(1));
+assertEquals("r23", f(1));
-// 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;
-}
-
+// Deopt the stub.
+assertEquals("rtest230", f("test"));
-function ExtendMath() {
- %CheckIsBootstrapping();
-
- // Set up the non-enumerable functions on the Math object.
- InstallFunctions($Math, DONT_ENUM, $Array(
- "sign", MathSign,
- "trunc", MathTrunc
- ));
+var a2 = [function(a) { return a+10; },,
+ function(a) { return a+20; }];
+a2.__proto__.test = function(a) { return a+30; }
+function f2(i) {
+ return "r" + (1, a2[i](i+1), a2[i](i+2));
}
-ExtendMath();
+assertEquals("r12", f2(0));
+assertEquals("r12", f2(0));
+assertEquals("r24", f2(2));
+assertEquals("r24", f2(2));
+
+// Deopt the stub. This will throw given that undefined is not a function.
+assertThrows(function() { f2(1) });
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | test/mjsunit/regress/clear-keyed-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698