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

Unified Diff: test/mjsunit/generic-monorphic-keyed-load.js

Issue 755513003: Hydrogen: fix keyed loads with string keys (Closed) Base URL: gh:v8/v8@master
Patch Set: fixes Created 6 years 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
« src/ic/ic-state.h ('K') | « src/typing.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/generic-monorphic-keyed-load.js
diff --git a/test/mjsunit/regress/regress-351315.js b/test/mjsunit/generic-monorphic-keyed-load.js
similarity index 81%
copy from test/mjsunit/regress/regress-351315.js
copy to test/mjsunit/generic-monorphic-keyed-load.js
index e2580fc34beab641655ba2a58c3e09e007890fd0..7ceca4cb2fc838af0eda908d2966758823248aad 100644
--- a/test/mjsunit/regress/regress-351315.js
+++ b/test/mjsunit/generic-monorphic-keyed-load.js
@@ -27,23 +27,23 @@
// Flags: --allow-natives-syntax
-function f_13(x, y, z) { }
-v_5 = f_13.bind({}, -7);
-
-function f_0(z) {
- return %NewObjectFromBound(v_5);
+var o = {
+ "foo": "bar",
}
-function f_8(z2, y2) {
- var v_0 = { f1 : 0.5, f2 : 0.25 };
- return f_0(v_0);
+function get(obj, key) {
+ return obj[key];
}
-function f_12(f, args) {
- f.apply(this, args);
- %OptimizeFunctionOnNextCall(f);
- f.apply(this, args);
-}
+get(o, "foo");
+get(o, "foo");
+get(o, "foo");
+
+// At this point, lookup in `get` should be aware of the key type and
+// generate KeyedLoadGeneric, instead of element access and deopt check
Jakob Kummerow 2014/12/11 09:52:42 nit: missing punctuation at the end. Or you could
+%OptimizeFunctionOnNextCall(get);
+get(o, "foo");
-f_12(f_8, [6, 4]);
+// Should not deoptimize
Jakob Kummerow 2014/12/11 09:52:42 nit: same here. Again, just drop it. It's obvious
+assertTrue(%GetOptimizationStatus(get) != 2);
Jakob Kummerow 2014/12/11 09:52:42 Use "assertOptimized(get);" here.
« src/ic/ic-state.h ('K') | « src/typing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698