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

Unified Diff: test/mjsunit/omit-constant-mapcheck.js

Issue 19954005: Eliminate map checks of constant values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Naming Created 7 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/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/omit-constant-mapcheck.js
diff --git a/test/mjsunit/regress/regress-int32-truncation.js b/test/mjsunit/omit-constant-mapcheck.js
similarity index 79%
copy from test/mjsunit/regress/regress-int32-truncation.js
copy to test/mjsunit/omit-constant-mapcheck.js
index dec4ac1195a6c4928d84eac8cc8dc9496bf66600..6894275db714875bedd6790036d4ada02812425e 100644
--- a/test/mjsunit/regress/regress-int32-truncation.js
+++ b/test/mjsunit/omit-constant-mapcheck.js
@@ -27,35 +27,29 @@
// Flags: --allow-natives-syntax
-function f(i, b) {
- var a = 0;
- if (b) {
- var c = 1 << i;
- a = c + c;
- }
- var x = a >> 3;
- return a;
-}
+var g1 = { a:1 }
-f(1, false);
-f(1, true);
-%OptimizeFunctionOnNextCall(f);
-assertEquals((1 << 30) * 2, f(30, true));
+function load() {
+ return g1.a;
+}
+assertEquals(1, load());
+assertEquals(1, load());
+%OptimizeFunctionOnNextCall(load);
+assertEquals(1, load());
+delete g1.a;
+assertEquals(undefined, load());
-var global = 1;
+var g2 = { a:2 }
-function f2(b) {
- var a = 0;
- if (b) {
- a = global;
- }
- var x = a >> 3;
- return a;
+function load2() {
+ return g2.a;
}
-f2(false);
-f2(true);
-%OptimizeFunctionOnNextCall(f2);
-global = 2.5;
-assertEquals(global, f2(true));
+assertEquals(2, load2());
+assertEquals(2, load2());
+%OptimizeFunctionOnNextCall(load2);
+assertEquals(2, load2());
+g2.b = 10;
+g2.a = 5;
+assertEquals(5, load2());
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698