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

Side by Side Diff: src/lithium-allocator.cc

Issue 8462016: Make LiveRange objects 1 word smaller by using a bool instead of enum for register kind. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lithium-allocator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return false; 145 return false;
146 } 146 }
147 147
148 148
149 #endif 149 #endif
150 150
151 151
152 LiveRange::LiveRange(int id) 152 LiveRange::LiveRange(int id)
153 : id_(id), 153 : id_(id),
154 spilled_(false), 154 spilled_(false),
155 is_double_(false),
155 assigned_register_(kInvalidAssignment), 156 assigned_register_(kInvalidAssignment),
156 assigned_register_kind_(NONE),
157 last_interval_(NULL), 157 last_interval_(NULL),
158 first_interval_(NULL), 158 first_interval_(NULL),
159 first_pos_(NULL), 159 first_pos_(NULL),
160 parent_(NULL), 160 parent_(NULL),
161 next_(NULL), 161 next_(NULL),
162 current_interval_(NULL), 162 current_interval_(NULL),
163 last_processed_use_(NULL), 163 last_processed_use_(NULL),
164 spill_start_index_(kMaxInt) { 164 spill_start_index_(kMaxInt) {
165 spill_operand_ = new LUnallocated(LUnallocated::IGNORE); 165 spill_operand_ = new LUnallocated(LUnallocated::IGNORE);
166 } 166 }
167 167
168 168
169 void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) { 169 void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) {
170 ASSERT(!HasRegisterAssigned() && !IsSpilled()); 170 ASSERT(!HasRegisterAssigned() && !IsSpilled());
171 assigned_register_ = reg; 171 assigned_register_ = reg;
172 assigned_register_kind_ = register_kind; 172 is_double_ = (register_kind == DOUBLE_REGISTERS);
173 ConvertOperands(); 173 ConvertOperands();
174 } 174 }
175 175
176 176
177 void LiveRange::MakeSpilled() { 177 void LiveRange::MakeSpilled() {
178 ASSERT(!IsSpilled()); 178 ASSERT(!IsSpilled());
179 ASSERT(TopLevel()->HasAllocatedSpillOperand()); 179 ASSERT(TopLevel()->HasAllocatedSpillOperand());
180 spilled_ = true; 180 spilled_ = true;
181 assigned_register_ = kInvalidAssignment; 181 assigned_register_ = kInvalidAssignment;
182 ConvertOperands(); 182 ConvertOperands();
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 live_in_sets_(graph->blocks()->length()), 548 live_in_sets_(graph->blocks()->length()),
549 live_ranges_(num_values * 2), 549 live_ranges_(num_values * 2),
550 fixed_live_ranges_(NULL), 550 fixed_live_ranges_(NULL),
551 fixed_double_live_ranges_(NULL), 551 fixed_double_live_ranges_(NULL),
552 unhandled_live_ranges_(num_values * 2), 552 unhandled_live_ranges_(num_values * 2),
553 active_live_ranges_(8), 553 active_live_ranges_(8),
554 inactive_live_ranges_(8), 554 inactive_live_ranges_(8),
555 reusable_slots_(8), 555 reusable_slots_(8),
556 next_virtual_register_(num_values), 556 next_virtual_register_(num_values),
557 first_artificial_register_(num_values), 557 first_artificial_register_(num_values),
558 mode_(NONE), 558 mode_(GENERAL_REGISTERS),
559 num_registers_(-1), 559 num_registers_(-1),
560 graph_(graph), 560 graph_(graph),
561 has_osr_entry_(false) {} 561 has_osr_entry_(false) {}
562 562
563 563
564 void LAllocator::InitializeLivenessAnalysis() { 564 void LAllocator::InitializeLivenessAnalysis() {
565 // Initialize the live_in sets for each block to NULL. 565 // Initialize the live_in sets for each block to NULL.
566 int block_count = graph_->blocks()->length(); 566 int block_count = graph_->blocks()->length();
567 live_in_sets_.Initialize(block_count); 567 live_in_sets_.Initialize(block_count);
568 live_in_sets_.AddBlock(NULL, block_count); 568 live_in_sets_.AddBlock(NULL, block_count);
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 } 1459 }
1460 } 1460 }
1461 } 1461 }
1462 } 1462 }
1463 } 1463 }
1464 1464
1465 1465
1466 void LAllocator::AllocateGeneralRegisters() { 1466 void LAllocator::AllocateGeneralRegisters() {
1467 HPhase phase("Allocate general registers", this); 1467 HPhase phase("Allocate general registers", this);
1468 num_registers_ = Register::kNumAllocatableRegisters; 1468 num_registers_ = Register::kNumAllocatableRegisters;
1469 mode_ = GENERAL_REGISTERS;
1470 AllocateRegisters(); 1469 AllocateRegisters();
1471 } 1470 }
1472 1471
1473 1472
1474 void LAllocator::AllocateDoubleRegisters() { 1473 void LAllocator::AllocateDoubleRegisters() {
1475 HPhase phase("Allocate double registers", this); 1474 HPhase phase("Allocate double registers", this);
1476 num_registers_ = DoubleRegister::kNumAllocatableRegisters; 1475 num_registers_ = DoubleRegister::kNumAllocatableRegisters;
1477 mode_ = DOUBLE_REGISTERS; 1476 mode_ = DOUBLE_REGISTERS;
1478 AllocateRegisters(); 1477 AllocateRegisters();
1479 } 1478 }
1480 1479
1481 1480
1482 void LAllocator::AllocateRegisters() { 1481 void LAllocator::AllocateRegisters() {
1483 ASSERT(mode_ != NONE);
1484 ASSERT(unhandled_live_ranges_.is_empty()); 1482 ASSERT(unhandled_live_ranges_.is_empty());
1485 1483
1486 for (int i = 0; i < live_ranges_.length(); ++i) { 1484 for (int i = 0; i < live_ranges_.length(); ++i) {
1487 if (live_ranges_[i] != NULL) { 1485 if (live_ranges_[i] != NULL) {
1488 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) { 1486 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) {
1489 AddToUnhandledUnsorted(live_ranges_[i]); 1487 AddToUnhandledUnsorted(live_ranges_[i]);
1490 } 1488 }
1491 } 1489 }
1492 } 1490 }
1493 SortUnhandled(); 1491 SortUnhandled();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 } 1576 }
1579 } 1577 }
1580 1578
1581 reusable_slots_.Rewind(0); 1579 reusable_slots_.Rewind(0);
1582 active_live_ranges_.Rewind(0); 1580 active_live_ranges_.Rewind(0);
1583 inactive_live_ranges_.Rewind(0); 1581 inactive_live_ranges_.Rewind(0);
1584 } 1582 }
1585 1583
1586 1584
1587 const char* LAllocator::RegisterName(int allocation_index) { 1585 const char* LAllocator::RegisterName(int allocation_index) {
1588 ASSERT(mode_ != NONE);
1589 if (mode_ == GENERAL_REGISTERS) { 1586 if (mode_ == GENERAL_REGISTERS) {
1590 return Register::AllocationIndexToString(allocation_index); 1587 return Register::AllocationIndexToString(allocation_index);
1591 } else { 1588 } else {
1592 return DoubleRegister::AllocationIndexToString(allocation_index); 1589 return DoubleRegister::AllocationIndexToString(allocation_index);
1593 } 1590 }
1594 } 1591 }
1595 1592
1596 1593
1597 void LAllocator::TraceAlloc(const char* msg, ...) { 1594 void LAllocator::TraceAlloc(const char* msg, ...) {
1598 if (FLAG_trace_alloc) { 1595 if (FLAG_trace_alloc) {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 LiveRange* current = live_ranges()->at(i); 2121 LiveRange* current = live_ranges()->at(i);
2125 if (current != NULL) current->Verify(); 2122 if (current != NULL) current->Verify();
2126 } 2123 }
2127 } 2124 }
2128 2125
2129 2126
2130 #endif 2127 #endif
2131 2128
2132 2129
2133 } } // namespace v8::internal 2130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lithium-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698