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

Unified Diff: test/cctest/test-decls.cc

Issue 712973002: harmony-scoping: Implement StoreIC handler for stores to global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments + rebased Created 6 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/ic/ic.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-decls.cc
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index ab5f192a08d6d861251ce83b217575ce9133b55a..94788fcae4460224ca874f6792167ff3668fbdd7 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -1008,7 +1008,7 @@ TEST(CrossScriptStaticLookupUndeclared) {
}
-TEST(CrossScriptICs) {
+TEST(CrossScriptLoadICs) {
i::FLAG_harmony_scoping = true;
i::FLAG_allow_natives_syntax = true;
@@ -1062,3 +1062,81 @@ TEST(CrossScriptICs) {
Number::New(CcTest::isolate(), 5));
}
}
+
+
+TEST(CrossScriptStoreICs) {
+ i::FLAG_harmony_scoping = true;
+ i::FLAG_allow_natives_syntax = true;
+
+ HandleScope handle_scope(CcTest::isolate());
+
+ {
+ SimpleContext context;
+ context.Check(
+ "var global = this;"
+ "x = 15;"
+ "function f(v) { x = v; }"
+ "function g(v) { x = v; }"
+ "f(10); x",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 10));
+ context.Check(
+ "'use strict';"
+ "let x = 5;"
+ "f(7); x",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 7));
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 10));
+ for (int k = 0; k < 3; k++) {
+ context.Check("g(31); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 31));
+ }
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 10));
+ for (int k = 0; k < 3; k++) {
+ context.Check("f(32); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 32));
+ }
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 10));
+ context.Check("%OptimizeFunctionOnNextCall(g); g(18); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 18));
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 10));
+ context.Check("%OptimizeFunctionOnNextCall(f); f(33); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 33));
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 10));
+ }
+ {
+ SimpleContext context;
+ context.Check(
+ "var global = this;"
+ "x = 15;"
+ "function f(v) { x = v; }"
+ "f(10); x",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 10));
+ for (int k = 0; k < 3; k++) {
+ context.Check("f(18); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 18));
+ }
+ context.Check("%OptimizeFunctionOnNextCall(f); f(20); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 20));
+ context.Check(
+ "'use strict';"
+ "let x = 5;"
+ "f(8); x",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 8));
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 20));
+ for (int k = 0; k < 3; k++) {
+ context.Check("f(13); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 13));
+ }
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 20));
+ context.Check("%OptimizeFunctionOnNextCall(f); f(41); x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 41));
+ context.Check("global.x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 20));
+ }
+}
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698