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

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1555063002: [Interpreter] Adds support for wide variant of load/store lookup slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated tests to address review comments. Created 4 years, 12 months 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/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index 3e7a1c470a57c1c73d9e51188827d8eea4837c54..ff5178df4f8667b97aef470897a123c08133f94d 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -3102,6 +3102,7 @@ TEST(InterpreterLookupSlot) {
std::pair<const char*, Handle<Object>> lookup_slot[] = {
{"return x;", handle(Smi::FromInt(1), isolate)},
{"return typeof x;", factory->NewStringFromStaticChars("number")},
+ {"return typeof dummy;", factory->NewStringFromStaticChars("undefined")},
{"x = 10; return x;", handle(Smi::FromInt(10), isolate)},
{"'use strict'; x = 20; return x;", handle(Smi::FromInt(20), isolate)},
};
@@ -3120,6 +3121,50 @@ TEST(InterpreterLookupSlot) {
}
+TEST(InterpreterLookupSlotWide) {
+ HandleAndZoneScope handles;
+ i::Isolate* isolate = handles.main_isolate();
+ i::Factory* factory = isolate->factory();
+
+ const char* function_prologue =
+ "var f;"
+ "var x = 1;"
+ "function f1() {"
+ " eval(\"function t() {";
+ const char* function_epilogue =
+ " }; f = t;\");"
+ "}"
+ "f1();";
+ std::ostringstream str;
+ str << "var y = 2.3;";
+ for (int i = 1; i < 256; i++) {
+ str << "y = " << 2.3 + i << ";";
+ }
+ std::string init_function_body = str.str();
+
+ std::pair<std::string, Handle<Object>> lookup_slot[] = {
+ {init_function_body + "return x;", handle(Smi::FromInt(1), isolate)},
+ {init_function_body + "return typeof x;",
+ factory->NewStringFromStaticChars("number")},
+ {init_function_body + "return x = 10;",
+ handle(Smi::FromInt(10), isolate)},
+ {"'use strict';" + init_function_body + "x = 20; return x;",
+ handle(Smi::FromInt(20), isolate)},
+ };
+
+ for (size_t i = 0; i < arraysize(lookup_slot); i++) {
+ std::string script = std::string(function_prologue) + lookup_slot[i].first +
+ std::string(function_epilogue);
+
+ InterpreterTester tester(handles.main_isolate(), script.c_str(), "t");
+ auto callable = tester.GetCallable<>();
+
+ Handle<i::Object> return_value = callable().ToHandleChecked();
+ CHECK(return_value->SameValue(*lookup_slot[i].second));
+ }
+}
+
+
TEST(TemporaryRegisterAllocation) {
HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate();
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698