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

Unified Diff: test/cctest/compiler/test-instruction.cc

Issue 639123009: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 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/compiler/test-control-reducer.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-instruction.cc
diff --git a/test/cctest/compiler/test-instruction.cc b/test/cctest/compiler/test-instruction.cc
index d0e4762f45443d22803e96b75449f2070e613534..d61f34c4bffbb4659a4bf6a64377fe9c87898a04 100644
--- a/test/cctest/compiler/test-instruction.cc
+++ b/test/cctest/compiler/test-instruction.cc
@@ -31,7 +31,7 @@ class InstructionTester : public HandleAndZoneScope {
graph(zone()),
schedule(zone()),
info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()),
- linkage(&info),
+ linkage(zone(), &info),
common(zone()),
code(NULL) {}
@@ -51,10 +51,11 @@ class InstructionTester : public HandleAndZoneScope {
void allocCode() {
if (schedule.rpo_order()->size() == 0) {
// Compute the RPO order.
- Scheduler::ComputeSpecialRPO(&schedule);
+ ZonePool zone_pool(isolate);
+ Scheduler::ComputeSpecialRPO(&zone_pool, &schedule);
DCHECK(schedule.rpo_order()->size() > 0);
}
- code = new TestInstrSeq(&linkage, &graph, &schedule);
+ code = new TestInstrSeq(main_zone(), &graph, &schedule);
}
Node* Int32Constant(int32_t val) {
@@ -93,6 +94,21 @@ class InstructionTester : public HandleAndZoneScope {
unallocated->set_virtual_register(vreg);
return unallocated;
}
+
+ InstructionBlock* BlockAt(BasicBlock* block) {
+ return code->InstructionBlockAt(block->GetRpoNumber());
+ }
+ BasicBlock* GetBasicBlock(int instruction_index) {
+ const InstructionBlock* block =
+ code->GetInstructionBlock(instruction_index);
+ return schedule.rpo_order()->at(block->rpo_number().ToSize());
+ }
+ int first_instruction_index(BasicBlock* block) {
+ return BlockAt(block)->first_instruction_index();
+ }
+ int last_instruction_index(BasicBlock* block) {
+ return BlockAt(block)->last_instruction_index();
+ }
};
@@ -115,13 +131,14 @@ TEST(InstructionBasic) {
CHECK_EQ(R.graph.NodeCount(), R.code->node_count());
BasicBlockVector* blocks = R.schedule.rpo_order();
- CHECK_EQ(static_cast<int>(blocks->size()), R.code->BasicBlockCount());
+ CHECK_EQ(static_cast<int>(blocks->size()), R.code->InstructionBlockCount());
int index = 0;
for (BasicBlockVectorIter i = blocks->begin(); i != blocks->end();
i++, index++) {
BasicBlock* block = *i;
- CHECK_EQ(block, R.code->BlockAt(index));
+ CHECK_EQ(block->rpo_number(), R.BlockAt(block)->rpo_number().ToInt());
+ CHECK_EQ(block->id().ToInt(), R.BlockAt(block)->id().ToInt());
CHECK_EQ(-1, block->loop_end());
}
}
@@ -159,29 +176,29 @@ TEST(InstructionGetBasicBlock) {
R.code->StartBlock(b3);
R.code->EndBlock(b3);
- CHECK_EQ(b0, R.code->GetBasicBlock(i0));
- CHECK_EQ(b0, R.code->GetBasicBlock(i1));
+ CHECK_EQ(b0, R.GetBasicBlock(i0));
+ CHECK_EQ(b0, R.GetBasicBlock(i1));
- CHECK_EQ(b1, R.code->GetBasicBlock(i2));
- CHECK_EQ(b1, R.code->GetBasicBlock(i3));
- CHECK_EQ(b1, R.code->GetBasicBlock(i4));
- CHECK_EQ(b1, R.code->GetBasicBlock(i5));
+ CHECK_EQ(b1, R.GetBasicBlock(i2));
+ CHECK_EQ(b1, R.GetBasicBlock(i3));
+ CHECK_EQ(b1, R.GetBasicBlock(i4));
+ CHECK_EQ(b1, R.GetBasicBlock(i5));
- CHECK_EQ(b2, R.code->GetBasicBlock(i6));
- CHECK_EQ(b2, R.code->GetBasicBlock(i7));
- CHECK_EQ(b2, R.code->GetBasicBlock(i8));
+ CHECK_EQ(b2, R.GetBasicBlock(i6));
+ CHECK_EQ(b2, R.GetBasicBlock(i7));
+ CHECK_EQ(b2, R.GetBasicBlock(i8));
- CHECK_EQ(b0, R.code->GetBasicBlock(R.code->first_instruction_index(b0)));
- CHECK_EQ(b0, R.code->GetBasicBlock(R.code->last_instruction_index(b0)));
+ CHECK_EQ(b0, R.GetBasicBlock(R.first_instruction_index(b0)));
+ CHECK_EQ(b0, R.GetBasicBlock(R.last_instruction_index(b0)));
- CHECK_EQ(b1, R.code->GetBasicBlock(R.code->first_instruction_index(b1)));
- CHECK_EQ(b1, R.code->GetBasicBlock(R.code->last_instruction_index(b1)));
+ CHECK_EQ(b1, R.GetBasicBlock(R.first_instruction_index(b1)));
+ CHECK_EQ(b1, R.GetBasicBlock(R.last_instruction_index(b1)));
- CHECK_EQ(b2, R.code->GetBasicBlock(R.code->first_instruction_index(b2)));
- CHECK_EQ(b2, R.code->GetBasicBlock(R.code->last_instruction_index(b2)));
+ CHECK_EQ(b2, R.GetBasicBlock(R.first_instruction_index(b2)));
+ CHECK_EQ(b2, R.GetBasicBlock(R.last_instruction_index(b2)));
- CHECK_EQ(b3, R.code->GetBasicBlock(R.code->first_instruction_index(b3)));
- CHECK_EQ(b3, R.code->GetBasicBlock(R.code->last_instruction_index(b3)));
+ CHECK_EQ(b3, R.GetBasicBlock(R.first_instruction_index(b3)));
+ CHECK_EQ(b3, R.GetBasicBlock(R.last_instruction_index(b3)));
}
« no previous file with comments | « test/cctest/compiler/test-control-reducer.cc ('k') | test/cctest/compiler/test-linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698