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

Unified Diff: src/lithium.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 5 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/lithium.h ('k') | src/lithium-allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lithium.cc
diff --git a/src/lithium.cc b/src/lithium.cc
index 61b7e6702c4dd5fb930e02e7e4cdde338bea94d7..89e10796d8ff23d5357b1342c9d10e52e46c4956 100644
--- a/src/lithium.cc
+++ b/src/lithium.cc
@@ -55,16 +55,26 @@ void LOperand::PrintTo(StringStream* stream) {
break;
case LUnallocated::FIXED_REGISTER: {
int reg_index = unalloc->fixed_register_index();
- const char* register_name =
- Register::AllocationIndexToString(reg_index);
- stream->Add("(=%s)", register_name);
+ if (reg_index < 0 ||
+ reg_index >= Register::kMaxNumAllocatableRegisters) {
+ stream->Add("(=invalid_reg#%d)", reg_index);
+ } else {
+ const char* register_name =
+ Register::AllocationIndexToString(reg_index);
+ stream->Add("(=%s)", register_name);
+ }
break;
}
case LUnallocated::FIXED_DOUBLE_REGISTER: {
int reg_index = unalloc->fixed_register_index();
- const char* double_register_name =
- DoubleRegister::AllocationIndexToString(reg_index);
- stream->Add("(=%s)", double_register_name);
+ if (reg_index < 0 ||
+ reg_index >= DoubleRegister::kMaxNumAllocatableRegisters) {
+ stream->Add("(=invalid_double_reg#%d)", reg_index);
+ } else {
+ const char* double_register_name =
+ DoubleRegister::AllocationIndexToString(reg_index);
+ stream->Add("(=%s)", double_register_name);
+ }
break;
}
case LUnallocated::MUST_HAVE_REGISTER:
@@ -93,12 +103,26 @@ void LOperand::PrintTo(StringStream* stream) {
case DOUBLE_STACK_SLOT:
stream->Add("[double_stack:%d]", index());
break;
- case REGISTER:
- stream->Add("[%s|R]", Register::AllocationIndexToString(index()));
+ case REGISTER: {
+ int reg_index = index();
+ if (reg_index < 0 || reg_index >= Register::kMaxNumAllocatableRegisters) {
+ stream->Add("(=invalid_reg#%d|R)", reg_index);
+ } else {
+ stream->Add("[%s|R]", Register::AllocationIndexToString(reg_index));
+ }
break;
- case DOUBLE_REGISTER:
- stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index()));
+ }
+ case DOUBLE_REGISTER: {
+ int reg_index = index();
+ if (reg_index < 0 ||
+ reg_index >= DoubleRegister::kMaxNumAllocatableRegisters) {
+ stream->Add("(=invalid_double_reg#%d|R)", reg_index);
+ } else {
+ stream->Add("[%s|R]",
+ DoubleRegister::AllocationIndexToString(reg_index));
+ }
break;
+ }
}
}
@@ -242,12 +266,11 @@ LChunk::LChunk(CompilationInfo* info, HGraph* graph)
: spill_slot_count_(0),
info_(info),
graph_(graph),
- instructions_(32, graph->zone()),
- pointer_maps_(8, graph->zone()),
- inlined_closures_(1, graph->zone()),
- deprecation_dependencies_(MapLess(), MapAllocator(graph->zone())),
- stability_dependencies_(MapLess(), MapAllocator(graph->zone())) {
-}
+ instructions_(32, info->zone()),
+ pointer_maps_(8, info->zone()),
+ inlined_closures_(1, info->zone()),
+ deprecation_dependencies_(MapLess(), MapAllocator(info->zone())),
+ stability_dependencies_(MapLess(), MapAllocator(info->zone())) {}
LLabel* LChunk::GetLabel(int block_id) const {
@@ -308,7 +331,7 @@ void LChunk::MarkEmptyBlocks() {
void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) {
- LInstructionGap* gap = new(graph_->zone()) LInstructionGap(block);
+ LInstructionGap* gap = new (zone()) LInstructionGap(block);
gap->set_hydrogen_value(instr->hydrogen_value());
int index = -1;
if (instr->IsControl()) {
« no previous file with comments | « src/lithium.h ('k') | src/lithium-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698