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

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

Issue 1406253008: [Interpreter] Add support for VisitThisFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_jsruntime
Patch Set: Add tests Created 5 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/interpreter/bytecode-generator.cc ('k') | test/cctest/interpreter/test-interpreter.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 11a88e93a97c960c8c2db8d950ff3ad03acf9fb8..631e6a902b69673b45094e15a1b3d88f75e5a26d 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -5147,6 +5147,47 @@ TEST(DeadCodeRemoval) {
}
}
+
+TEST(ThisFunction) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+
+ int closure = Register::function_closure().index();
+
+ ExpectedSnippet<int> snippets[] = {
+ {"var f;\n f = function f() { }",
+ 1 * kPointerSize,
+ 1,
+ 9,
+ {
+ B(LdaTheHole), //
+ B(Star), R(0), //
+ B(Ldar), R(closure), //
+ B(Star), R(0), //
+ B(LdaUndefined), //
+ B(Return), //
+ }},
+ {"var f;\n f = function f() { return f; }",
+ 1 * kPointerSize,
+ 1,
+ 10,
+ {
+ B(LdaTheHole), //
+ B(Star), R(0), //
+ B(Ldar), R(closure), //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(Return), //
+ }},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunction(snippets[i].code_snippet);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698