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

Unified Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1542083002: [Interpreter] Adds support for DeleteLookupSlot to Interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/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) {

Powered by Google App Engine
This is Rietveld 408576698