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

Unified Diff: test/cctest/interpreter/test-bytecode-generator.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, 11 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-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index cbd689c1c77042374efd10ffe12f6c5992ffbac7..2064d4642d6d44ce97d6c5dd4f3a6eb50a0aff88 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -5838,6 +5838,103 @@ TEST(LookupSlotInEval) {
}
+TEST(LookupSlotWideInEval) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+
+ const char* function_prologue =
+ "var f;"
+ "var x = 1;"
+ "function f1() {"
+ " eval(\"function t() {";
+ const char* function_epilogue =
+ " }; f = t; f();\");"
+ "}"
+ "f1();";
+
+ int const_count[] = {0, 0, 0, 0};
+ ExpectedSnippet<InstanceType, 257> snippets[] = {
+ {REPEAT_256(SPACE, "var y = 2.3;")
+ "return x;",
+ 1 * kPointerSize,
+ 1,
+ 1028,
+ {
+ REPEAT_256(SPACE, //
+ B(LdaConstant), U8(const_count[0]++), //
+ B(Star), R(0), ) //
+ B(LdaLookupSlotWide), U16(256), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ {REPEAT_256(SPACE, "var y = 2.3;")
+ "return typeof x;",
+ 1 * kPointerSize,
+ 1,
+ 1029,
+ {
+ REPEAT_256(SPACE, //
+ B(LdaConstant), U8(const_count[1]++), //
+ B(Star), R(0), ) //
+ B(LdaLookupSlotInsideTypeofWide), U16(256), //
+ B(TypeOf), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ {REPEAT_256(SPACE, "var y = 2.3;")
+ "x = 10;",
+ 1 * kPointerSize,
+ 1,
+ 1031,
+ {
+ REPEAT_256(SPACE, //
+ B(LdaConstant), U8(const_count[2]++), //
+ B(Star), R(0), ) //
+ B(LdaSmi8), U8(10), //
+ B(StaLookupSlotSloppyWide), U16(256), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ {"'use strict';"
+ REPEAT_256(SPACE, "var y = 2.3;")
+ "x = 10;",
+ 1 * kPointerSize,
+ 1,
+ 1031,
+ {
+ REPEAT_256(SPACE,
+ B(LdaConstant), U8(const_count[3]++), //
+ B(Star), R(0), ) //
+ B(LdaSmi8), U8(10), //
+ B(StaLookupSlotStrictWide), U16(256), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ std::string script = std::string(function_prologue) +
+ std::string(snippets[i].code_snippet) +
+ std::string(function_epilogue);
+ // TODO(mythria): use * as filter when function declarations are supported
+ // inside eval.
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecode(script.c_str(), "t", "f");
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
+
TEST(DeleteLookupSlot) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698