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

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

Issue 1379793004: [Interpreter] Add support for new local function context creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_decl
Patch Set: Fix interpreter-assembler-unittest 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
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e054f970991e3053e48d31c0272749736493a3c8..55fe9e8a54fc2da45eb299efe21d7db26c4fa960 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -1102,7 +1102,7 @@ TEST(LoadUnallocated) {
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, "f");
- CheckBytecodeArrayEqual(snippets[i], bytecode_array, true);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
}
}
@@ -1159,7 +1159,7 @@ TEST(StoreUnallocated) {
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, "f");
- CheckBytecodeArrayEqual(snippets[i], bytecode_array, true);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
}
}
@@ -1211,7 +1211,7 @@ TEST(CallRuntime) {
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, "f");
- CheckBytecodeArrayEqual(snippets[i], bytecode_array, true);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
}
}
@@ -1393,39 +1393,108 @@ TEST(DeclareGlobals) {
ExpectedSnippet<int> snippets[] = {
{"var a = 1;",
- 4 * kPointerSize,
+ 5 * kPointerSize,
1,
- 30,
+ 45,
{
- B(LdaConstant), U8(0), //
- B(Star), R(1), //
- B(LdaZero), //
- B(Star), R(2), //
- B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
- B(LdaConstant), U8(1), //
- B(Star), R(1), //
- B(LdaZero), //
- B(Star), R(2), //
- B(LdaSmi8), U8(1), //
- B(Star), R(3), //
- B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), //
- U8(3), //
- B(LdaUndefined), //
- B(Return) //
+ B(Ldar), R(Register::function_closure().index()), //
+ B(Star), R(2), //
+ B(LdaConstant), U8(0), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kNewScriptContext), R(2), U8(2), //
+ B(PushContext), R(1), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(2), U8(2), //
+ B(LdaConstant), U8(2), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), //
+ U8(3), //
+ B(LdaUndefined), //
+ B(Return) //
},
-1},
{"function f() {}",
- 2 * kPointerSize,
+ 3 * kPointerSize,
1,
- 14,
+ 29,
+ {
+ B(Ldar), R(Register::function_closure().index()), //
+ B(Star), R(1), //
+ B(LdaConstant), U8(0), //
+ B(Star), R(2), //
+ B(CallRuntime), U16(Runtime::kNewScriptContext), R(1), U8(2), //
+ B(PushContext), R(0), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(1), //
+ B(LdaZero), //
+ B(Star), R(2), //
+ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ -1},
+ {"var a = 1;\na=2;",
+ 5 * kPointerSize,
+ 1,
+ 52,
+ {
+ B(Ldar), R(Register::function_closure().index()), //
+ B(Star), R(2), //
+ B(LdaConstant), U8(0), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kNewScriptContext), R(2), U8(2), //
+ B(PushContext), R(1), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(2), U8(2), //
+ B(LdaConstant), U8(2), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), //
+ U8(3), //
+ B(LdaSmi8), U8(2), //
+ B(StaGlobal), _, //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(Return) //
+ },
+ -1},
+ {"function f() {}\nf();",
+ 4 * kPointerSize,
+ 1,
+ 43,
{
- B(LdaConstant), U8(0), //
- B(Star), R(0), //
- B(LdaZero), //
- B(Star), R(1), //
- B(CallRuntime), U16(Runtime::kDeclareGlobals), R(0), U8(2), //
- B(LdaUndefined), //
- B(Return) //
+ B(Ldar), R(Register::function_closure().index()), //
+ B(Star), R(2), //
+ B(LdaConstant), U8(0), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kNewScriptContext), R(2), U8(2), //
+ B(PushContext), R(1), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(2), U8(2), //
+ B(LdaUndefined), //
+ B(Star), R(3), //
+ B(LdaGlobal), _, //
+ B(Star), R(2), //
+ B(Call), R(2), R(3), U8(0), //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(Return) //
},
-1},
};
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698