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 be1fefeee52e9a338489251acd607680c3e76473..8d21629b26e397266222fca9cbf50a5ba1c20d41 100644 |
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
@@ -1038,6 +1038,8 @@ TEST(BytecodeGraphBuilderLookupSlot) { |
{"return x;", {factory->NewNumber(12)}}, |
{"return obj.val;", {factory->NewNumber(3.1414)}}, |
{"return typeof x;", {factory->NewStringFromStaticChars("number")}}, |
+ {"return typeof dummy;", |
+ {factory->NewStringFromStaticChars("undefined")}}, |
{"x = 23; return x;", {factory->NewNumber(23)}}, |
{"'use strict'; obj.val = 23.456; return obj.val;", |
{factory->NewNumber(23.456)}}}; |
@@ -1056,6 +1058,50 @@ TEST(BytecodeGraphBuilderLookupSlot) { |
} |
+TEST(BytecodeGraphBuilderLookupSlotWide) { |
+ HandleAndZoneScope scope; |
+ Isolate* isolate = scope.main_isolate(); |
+ Zone* zone = scope.main_zone(); |
+ Factory* factory = isolate->factory(); |
+ |
+ const char* function_prologue = |
+ "var f;" |
+ "var x = 12;" |
+ "y = 10;" |
+ "var obj = {val:3.1414};" |
+ "var z = 30;" |
+ "function f1() {" |
+ " var z = 20;" |
+ " eval(\"function t() {"; |
+ const char* function_epilogue = |
+ " }; f = t; t();\");" |
+ "}" |
+ "f1();"; |
+ |
+ ExpectedSnippet<0> snippets[] = { |
+ {"var y = 2.3;" REPEAT_256(SPACE, "y = 2.3;") "return x;", |
+ {factory->NewNumber(12)}}, |
+ {"var y = 2.3;" REPEAT_256(SPACE, "y = 2.3;") "return typeof x;", |
+ {factory->NewStringFromStaticChars("number")}}, |
+ {"var y = 2.3;" REPEAT_256(SPACE, "y = 2.3;") "return x = 23;", |
+ {factory->NewNumber(23)}}, |
+ {"'use strict';" REPEAT_256(SPACE, "y = 2.3;") "return obj.val = 23.456;", |
+ {factory->NewNumber(23.456)}}}; |
+ |
+ size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
+ for (size_t i = 0; i < num_snippets; i++) { |
+ ScopedVector<char> script(3072); |
+ SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet, |
+ function_epilogue); |
+ |
+ BytecodeGraphTester tester(isolate, zone, script.start(), "t"); |
+ auto callable = tester.GetCallable<>(); |
+ Handle<Object> return_value = callable().ToHandleChecked(); |
+ CHECK(return_value->SameValue(*snippets[i].return_value())); |
+ } |
+} |
+ |
+ |
bool get_compare_result(Token::Value opcode, Handle<Object> lhs_value, |
Handle<Object> rhs_value) { |
switch (opcode) { |