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 8c0922933c0b84b0077766316160e02536082117..8e8d860b9846e0e7b707df466f473fd236980e04 100644 |
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
@@ -978,6 +978,44 @@ TEST(BytecodeGraphBuilderDeleteGlobal) { |
} |
+TEST(BytecodeGraphBuilderDeleteLookupSlot) { |
+ HandleAndZoneScope scope; |
+ Isolate* isolate = scope.main_isolate(); |
+ Zone* zone = scope.main_zone(); |
+ Factory* factory = isolate->factory(); |
+ |
+ // TODO(mythria): Add more tests when we have support for LdaLookupSlot. |
+ const char* function_prologue = "var f;" |
+ "var x = 1;" |
+ "y = 10;" |
+ "var obj = {val:10};" |
+ "var z = 30;" |
+ "function f1() {" |
+ " var z = 20;" |
+ " eval(\"function t() {"; |
+ const char* function_epilogue = " }; f = t; t();\");" |
+ "}" |
+ "f1();"; |
+ |
+ ExpectedSnippet<0> snippets[] = { |
+ {"return delete y;", {factory->true_value()}}, |
+ {"return delete z;", {factory->false_value()}}, |
+ }; |
+ |
+ size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
+ for (size_t i = 0; i < num_snippets; i++) { |
+ ScopedVector<char> script(1024); |
+ 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) { |