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

Unified Diff: test/unittests/interpreter/bytecode-array-builder-unittest.cc

Issue 1392933002: [Interpreter] Reduce temporary register usage in generated bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments from mstarzinger. Created 5 years, 2 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 | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/interpreter/bytecode-array-builder-unittest.cc
diff --git a/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/test/unittests/interpreter/bytecode-array-builder-unittest.cc
index 8ce32777c9e216381b32b5c206662a3848ffaad9..b4af7cd585668c52612ddaa78175b608fe666a14 100644
--- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc
+++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc
@@ -178,12 +178,12 @@ TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) {
builder.set_parameter_count(0);
builder.set_locals_count(locals);
builder.set_context_count(contexts);
- builder.Return();
TemporaryRegisterScope temporaries(&builder);
for (int i = 0; i < temps; i++) {
- temporaries.NewRegister();
+ builder.StoreAccumulatorInRegister(temporaries.NewRegister());
}
+ builder.Return();
Handle<BytecodeArray> the_array = builder.ToBytecodeArray();
int total_registers = locals + contexts + temps;
@@ -247,6 +247,32 @@ TEST_F(BytecodeArrayBuilderTest, Parameters) {
}
+TEST_F(BytecodeArrayBuilderTest, RegisterType) {
+ BytecodeArrayBuilder builder(isolate(), zone());
+ builder.set_parameter_count(10);
+ builder.set_locals_count(3);
+ builder.set_context_count(0);
+
+ TemporaryRegisterScope temporary_register_scope(&builder);
+ Register temp0 = temporary_register_scope.NewRegister();
+ Register param0(builder.Parameter(0));
+ Register param9(builder.Parameter(9));
+ Register temp1 = temporary_register_scope.NewRegister();
+ Register reg0(0);
+ Register reg1(1);
+ Register reg2(2);
+ Register temp2 = temporary_register_scope.NewRegister();
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(temp0), false);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(temp1), false);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(temp2), false);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(param0), true);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(param9), true);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(reg0), true);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(reg1), true);
+ CHECK_EQ(builder.RegisterIsParameterOrLocal(reg2), true);
+}
+
+
TEST_F(BytecodeArrayBuilderTest, Constants) {
BytecodeArrayBuilder builder(isolate(), zone());
builder.set_parameter_count(0);
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698