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 16dd47d1d14472edd4056751fb0a178fd703ba98..72224091519c2c97cb18dc87b7b7ddf37d13d740 100644 |
--- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc |
+++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc |
@@ -23,8 +23,11 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_locals_count(1); |
+ builder.set_context_count(1); |
builder.set_parameter_count(0); |
CHECK_EQ(builder.locals_count(), 1); |
+ CHECK_EQ(builder.context_count(), 1); |
+ CHECK_EQ(builder.fixed_register_count(), 2); |
// Emit constant loads. |
builder.LoadLiteral(Smi::FromInt(0)) |
@@ -48,6 +51,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
builder.PushContext(reg); |
builder.PopContext(reg); |
builder.LoadContextSlot(reg, 1); |
+ builder.StoreContextSlot(reg, 1); |
// Emit load / store property operations. |
builder.LoadNamedProperty(reg, 0, LanguageMode::SLOPPY) |
@@ -130,7 +134,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
// Generate BytecodeArray. |
Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
- CHECK_EQ(the_array->frame_size(), builder.locals_count() * kPointerSize); |
+ CHECK_EQ(the_array->frame_size(), |
+ builder.fixed_register_count() * kPointerSize); |
// Build scorecard of bytecodes encountered in the BytecodeArray. |
std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); |
@@ -157,20 +162,23 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { |
for (int locals = 0; locals < 5; locals++) { |
- for (int temps = 0; temps < 3; temps++) { |
- BytecodeArrayBuilder builder(isolate(), zone()); |
- builder.set_parameter_count(0); |
- builder.set_locals_count(locals); |
- builder.Return(); |
- |
- TemporaryRegisterScope temporaries(&builder); |
- for (int i = 0; i < temps; i++) { |
- temporaries.NewRegister(); |
+ for (int contexts = 0; contexts < 4; contexts++) { |
+ for (int temps = 0; temps < 3; temps++) { |
+ BytecodeArrayBuilder builder(isolate(), zone()); |
+ 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(); |
+ } |
+ |
+ Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
+ int total_registers = locals + contexts + temps; |
+ CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
} |
- |
- Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
- int total_registers = locals + temps; |
- CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize); |
} |
} |
} |
@@ -180,6 +188,7 @@ TEST_F(BytecodeArrayBuilderTest, TemporariesRecycled) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
builder.Return(); |
int first; |
@@ -220,6 +229,7 @@ TEST_F(BytecodeArrayBuilderTest, Parameters) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(10); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
Register param0(builder.Parameter(0)); |
Register param9(builder.Parameter(9)); |
@@ -231,6 +241,7 @@ TEST_F(BytecodeArrayBuilderTest, Constants) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
Factory* factory = isolate()->factory(); |
Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(3.14); |
@@ -256,6 +267,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
BytecodeLabel far0, far1, far2; |
BytecodeLabel near0, near1, near2; |
@@ -324,6 +336,7 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
BytecodeLabel label0, label1, label2; |
builder.Bind(&label0) |
@@ -375,6 +388,7 @@ TEST_F(BytecodeArrayBuilderTest, LabelReuse) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
// Labels can only have 1 forward reference, but |
// can be referred to mulitple times once bound. |
@@ -405,6 +419,7 @@ TEST_F(BytecodeArrayBuilderTest, LabelAddressReuse) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
for (int i = 0; i < kRepeats; i++) { |
BytecodeLabel label; |
@@ -436,6 +451,7 @@ TEST_F(BytecodeArrayBuilderTest, ToBoolean) { |
BytecodeArrayBuilder builder(isolate(), zone()); |
builder.set_parameter_count(0); |
builder.set_locals_count(0); |
+ builder.set_context_count(0); |
// Check ToBoolean emitted at start of block. |
builder.EnterBlock().CastAccumulatorToBoolean(); |