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

Unified Diff: test/mjsunit/arguments-deopt.js

Issue 2729163002: [turbofan] compute arguments length in deoptimizer (Closed)
Patch Set: fix comment Created 3 years, 10 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/objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/arguments-deopt.js
diff --git a/test/mjsunit/arguments-deopt.js b/test/mjsunit/arguments-deopt.js
index c669bb41e9ed42855a6a9be9d83e4c7d18717bdb..edc6aa44c55f088c52928a4f5ae8a57ecbbeb05a 100644
--- a/test/mjsunit/arguments-deopt.js
+++ b/test/mjsunit/arguments-deopt.js
@@ -96,8 +96,8 @@
var rest = arguments;
for (var i = 0; i < rest.length; ++i) {
var j = i;
- if (rest.length % 15 == 0 && i == 10) j += rest.length;
- sum += rest[j] || rest[j-rest.length];
+ if (rest.length % 15 == 0 && i == 10) j += 10000;
+ sum += rest[j] || i+1;
}
return sum;
};
@@ -113,11 +113,10 @@
(function ArgumentsAccessSloppy () {
function sum2(a,b,c) {
var sum = 0;
- var rest = arguments;
- for (var i = 0; i < rest.length; ++i) {
+ for (var i = 0; i < arguments.length; ++i) {
var j = i;
- if (rest.length % 15 == 0 && i == 10) j += rest.length;
- sum += rest[j] || rest[j-rest.length];
+ if (arguments.length % 15 == 0 && i == 10) j += 10000;
+ sum += arguments[j] || i+1;
}
return sum;
};
@@ -135,8 +134,8 @@
var sum = 0;
for (var i = 0; i < rest.length; ++i) {
var j = i;
- if (rest.length % 15 == 0 && i == 10) j += rest.length;
- sum += rest[j] || rest[j-rest.length];
+ if (rest.length % 15 == 0 && i == 10) j += 10000;
+ sum += rest[j] || i+1;
}
return sum;
};
@@ -154,8 +153,8 @@
var sum = 0;
for (var i = 0; i < rest.length; ++i) {
var j = i;
- if (rest.length % 15 == 0 && i == 10) j += rest.length;
- sum += rest[j] || rest[j-rest.length];
+ if (rest.length % 15 == 0 && i == 10) j += 10000;
+ sum += rest[j] || i+2;
}
return sum;
};
@@ -167,3 +166,18 @@
assertEquals(i*(i+1)/2-1, sum4(...args));
}
})();
+
+
+(function ReadArguments () {
+ function read() {
+ if (arguments.length % 10 == 5) %DeoptimizeNow();
+ return arguments[arguments.length-1];
+ };
+
+ var args = []
+ for (var i = 1; i < 30; ++i) {
+ args.push(i);
+ if (i%10 == 0) %OptimizeFunctionOnNextCall(read);
+ assertEquals(i, read(...args));
+ }
+})();
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698