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

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

Issue 1656863002: [Interpreter] Adds support for with statement to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed cctest.status. Created 4 years, 11 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 af83799c50f02914d8d533e04411ca8858e3485c..2e4b43288f8521ca5bd224c5b0c11c5cf65929e7 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -7563,6 +7563,55 @@ TEST(DoExpression) {
FLAG_harmony_do_expressions = old_flag;
}
+TEST(WithStatement) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+
+ int deep_elements_flags =
+ ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos;
+ int context = Register::current_context().index();
+ int closure = Register::function_closure().index();
+ int new_target = Register::new_target().index();
+
+ ExpectedSnippet<InstanceType> snippets[] = {
+ {"with ({x:42}) { return x; }",
+ 5 * kPointerSize,
+ 1,
+ 46,
+ {
+ B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
+ U8(1), //
+ B(PushContext), R(0), //
+ B(Ldar), THIS(1), //
+ B(StaContextSlot), R(context), U8(4), //
+ B(CreateMappedArguments), //
+ B(StaContextSlot), R(context), U8(5), //
+ B(Ldar), R(new_target), //
+ B(StaContextSlot), R(context), U8(6), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(2), //
+ B(ToObject), //
+ B(Star), R(3), //
+ B(Ldar), R(closure), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kPushWithContext), R(3), U8(2), //
+ B(PushContext), R(1), //
+ B(LdaLookupSlot), U8(1), //
+ B(PopContext), R(0), //
+ B(Return), //
+ },
+ 2,
+ {InstanceType::FIXED_ARRAY_TYPE,
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698