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

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1385623002: [Interpreter]: Add support for strict mode load / store ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index 3c50bea829c429e9b83d0d5e2824542f47027040..e13c4a08817ffa1135c61a580a2b3fecf8e50799 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -485,7 +485,40 @@ TEST(PropertyLoads) {
B(Return) //
},
1,
- {"name"}}};
+ {"name"}},
+ {"function f(a) { \"use strict\"; return a.name; }\nf({name : \"test\"})",
+ 1 * kPointerSize,
+ 2,
+ 12,
+ {
+ // TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
+ // expression, or any other unused literal expression.
+ B(LdaConstant), U8(0), //
+ B(Ldar), R(helper.kLastParamIndex), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(LoadICStrict), R(0), U8(vector->GetIndex(slot1)), //
+ B(Return) //
+ },
+ 2,
+ {"use strict", "name"}},
+ {"function f(a, b) { \"use strict\"; return a[b]; }\n"
+ "f({arg : \"test\"}, \"arg\")",
+ 1 * kPointerSize,
+ 3,
+ 12,
+ {
+ // TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
+ // expression, or any other unused literal expression.
+ B(LdaConstant), U8(0), //
+ B(Ldar), R(helper.kLastParamIndex - 1), //
+ B(Star), R(0), //
+ B(Ldar), R(helper.kLastParamIndex), //
+ B(KeyedLoadICStrict), R(0), U8(vector->GetIndex(slot1)), //
+ B(Return) //
+ },
+ 1,
+ {"use strict"}}};
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
@@ -590,7 +623,47 @@ TEST(PropertyStores) {
B(Return) //
},
1,
- {"name"}}};
+ {"name"}},
+ {"function f(a) { \"use strict\"; a.name = \"val\"; }\n"
+ "f({name : \"test\"})",
+ 2 * kPointerSize,
+ 2,
+ 18,
+ {
+ // TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
+ // expression, or any other unused literal expression.
+ B(LdaConstant), U8(0), //
+ B(Ldar), R(helper.kLastParamIndex), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(1), //
+ B(LdaConstant), U8(2), //
+ B(StoreICStrict), R(0), R(1), U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 3,
+ {"use strict", "name", "val"}},
+ {"function f(a, b) { \"use strict\"; a[b] = \"val\"; }\n"
+ "f({arg : \"test\"}, \"arg\")",
+ 2 * kPointerSize,
+ 3,
+ 18,
+ {
+ // TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
+ // expression, or any other unused literal expression.
+ B(LdaConstant), U8(0), //
+ B(Ldar), R(helper.kLastParamIndex - 1), //
+ B(Star), R(0), //
+ B(Ldar), R(helper.kLastParamIndex), //
+ B(Star), R(1), //
+ B(LdaConstant), U8(1), //
+ B(KeyedStoreICStrict), R(0), R(1), U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 2,
+ {"use strict", "val"}}};
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);

Powered by Google App Engine
This is Rietveld 408576698