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

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

Issue 1572283002: [Interpreter] Add wide context slot load / store operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f2763558afa054f2fd384d24e6a8a4a8c1e1b8c9..38c8cca49f85a0344e9a35f7059dcae0d037bf57 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -111,6 +111,7 @@ class BytecodeGeneratorHelper {
#define COMMA() ,
#define SPACE()
+#define UNIQUE_VAR() "var a" XSTR(__COUNTER__) " = 0;\n"
oth 2016/01/11 11:31:11 Does this need to be flagged with the core v8 team
rmcilroy 2016/01/11 15:47:19 I think this is OK (assuming it passes the bots) -
#define REPEAT_2(SEP, ...) \
__VA_ARGS__ SEP() __VA_ARGS__
@@ -135,6 +136,16 @@ class BytecodeGeneratorHelper {
REPEAT_4(SEP, __VA_ARGS__) SEP() REPEAT_2(SEP, __VA_ARGS__) SEP() \
__VA_ARGS__
+#define REPEAT_249(SEP, ...) \
+ REPEAT_127(SEP, __VA_ARGS__) SEP() REPEAT_64(SEP, __VA_ARGS__) SEP() \
+ REPEAT_32(SEP, __VA_ARGS__) SEP() REPEAT_16(SEP, __VA_ARGS__) SEP() \
+ REPEAT_8(SEP, __VA_ARGS__) SEP() REPEAT_2(SEP, __VA_ARGS__)
+
+#define REPEAT_249_UNIQUE_VARS() \
+UNIQUE_VAR() REPEAT_127(UNIQUE_VAR) UNIQUE_VAR() REPEAT_64(UNIQUE_VAR) \
+UNIQUE_VAR() REPEAT_32(UNIQUE_VAR) UNIQUE_VAR() REPEAT_16(UNIQUE_VAR) \
+UNIQUE_VAR() REPEAT_8(UNIQUE_VAR) UNIQUE_VAR() REPEAT_2(UNIQUE_VAR)
+
// Structure for containing expected bytecode snippets.
template<typename T, int C = 6>
struct ExpectedSnippet {
@@ -4016,7 +4027,10 @@ TEST(ContextVariables) {
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
int closure = Register::function_closure().index();
+ int new_target = Register::new_target().index();
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
+
+ int wide_slot = first_context_slot + 3;
oth 2016/01/11 11:31:11 This code could STATIC_ASSERT that the limit of wi
rmcilroy 2016/01/11 15:47:19 Done.
ExpectedSnippet<InstanceType> snippets[] = {
{"var a; return function() { a = 1; };",
1 * kPointerSize,
@@ -4109,6 +4123,39 @@ TEST(ContextVariables) {
2,
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
+ {"'use strict';\n"
+ REPEAT_249_UNIQUE_VARS()
+ "eval();"
+ "var b = 100;"
+ "return b",
+ 3 * kPointerSize,
+ 1,
+ 1041,
+ {
+ B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
+ U8(1), //
+ B(PushContext), R(0), //
+ B(Ldar), THIS(1), //
+ B(StaContextSlot), R(0), U8(first_context_slot), //
+ B(CreateUnmappedArguments), //
+ B(StaContextSlot), R(0), U8(first_context_slot + 1), //
+ B(Ldar), R(new_target), //
+ B(StaContextSlot), R(0), U8(first_context_slot + 2), //
+ REPEAT_249(COMMA, //
+ B(LdaZero), //
+ B(StaContextSlot), R(0), U8(wide_slot++)), //
+ B(LdaUndefined), //
+ B(Star), R(2), //
+ B(LdaGlobalStrict), U8(0), U8(1), //
+ B(Star), R(1), //
+ B(Call), R(1), R(2), U8(0), U8(0), //
+ B(LdaSmi8), U8(100), //
+ B(StaContextSlotWide), R(0), U16(256), //
+ B(LdaContextSlotWide), R(0), U16(256), //
+ B(Return), //
+ },
+ 1,
+ {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
for (size_t i = 0; i < arraysize(snippets); i++) {
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698