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

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

Issue 1541143003: [Interpreter] Adds support for Load/Store LookupSlots to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an extra line in bytecode-graph-builder.h. 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 be3cd24fa264422aa85ee174165af4809c410cf5..be1fefeee52e9a338489251acd607680c3e76473 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -1016,6 +1016,46 @@ TEST(BytecodeGraphBuilderDeleteLookupSlot) {
}
+TEST(BytecodeGraphBuilderLookupSlot) {
+ 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[] = {
+ {"return x;", {factory->NewNumber(12)}},
+ {"return obj.val;", {factory->NewNumber(3.1414)}},
+ {"return typeof x;", {factory->NewStringFromStaticChars("number")}},
+ {"x = 23; return x;", {factory->NewNumber(23)}},
+ {"'use strict'; obj.val = 23.456; return obj.val;",
+ {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(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) {
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698