| Index: test/cctest/compiler/test-run-bytecode-graph-builder.cc
|
| diff --git a/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
|
| index cadd4363857a833930b88fe98a40904f0d38d06c..e22292c4d21398cf1338fd2bd9a8081f594fe8dd 100644
|
| --- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
|
| +++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
|
| @@ -254,6 +254,31 @@ TEST(BytecodeGraphBuilderTwoParameterTests) {
|
| }
|
| }
|
|
|
| +
|
| +TEST(BytecodeGraphBuilderNamedLoad) {
|
| + HandleAndZoneScope scope;
|
| + Isolate* isolate = scope.main_isolate();
|
| + Zone* zone = scope.main_zone();
|
| + Factory* factory = isolate->factory();
|
| +
|
| + ExpectedSnippet<0> snippets[] = {
|
| + {"var a = { val: 10 }; return a.val;", {factory->NewNumberFromInt(10)}},
|
| + {"var a = { val: 10, name:'abc' }; return a.name;",
|
| + {factory->NewStringFromStaticChars("abc")}}};
|
| +
|
| + size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
|
| + for (size_t i = 0; i < num_snippets; i++) {
|
| + ScopedVector<char> script(1024);
|
| + SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
| + snippets[i].code_snippet, kFunctionName);
|
| +
|
| + BytecodeGraphTester tester(isolate, zone, script.start());
|
| + auto callable = tester.GetCallable<>();
|
| + Handle<Object> return_value = callable().ToHandleChecked();
|
| + CHECK(return_value->SameValue(*snippets[i].return_value()));
|
| + }
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|