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

Unified Diff: src/jump-target.cc

Issue 113837: Change the register allocator so that it no longer tracks references... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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
Index: src/jump-target.cc
===================================================================
--- src/jump-target.cc (revision 2055)
+++ src/jump-target.cc (working copy)
@@ -74,7 +74,7 @@
// A list of pointers to frame elements in the entry frame. NULL
// indicates that the element has not yet been determined.
- int length = initial_frame->elements_.length();
+ int length = initial_frame->element_count();
ZoneList<FrameElement*> elements(length);
// Convert the number of mergable elements (counted from the top
@@ -124,7 +124,7 @@
// return address). Replace those first.
entry_frame_ = new VirtualFrame();
int index = 0;
- for (; index < entry_frame_->elements_.length(); index++) {
+ for (; index < entry_frame_->element_count(); index++) {
FrameElement* target = elements[index];
// If the element is determined, set it now. Count registers. Mark
// elements as copied exactly when they have a copy. Undetermined
@@ -155,7 +155,7 @@
bool is_synced = true;
RegisterFile candidate_registers;
int best_count = kMinInt;
- int best_reg_code = no_reg.code_;
+ int best_reg_num = RegisterAllocator::kInvalidRegister;
StaticType type; // Initially invalid.
if (direction_ != BIDIRECTIONAL || i < high_water_mark) {
@@ -168,10 +168,11 @@
if (element.is_register() && !entry_frame_->is_used(element.reg())) {
// Count the register occurrence and remember it if better
// than the previous best.
- candidate_registers.Use(element.reg());
- if (candidate_registers.count(element.reg()) > best_count) {
- best_count = candidate_registers.count(element.reg());
- best_reg_code = element.reg().code();
+ int num = RegisterAllocator::ToNumber(element.reg());
+ candidate_registers.Use(num);
+ if (candidate_registers.count(num) > best_count) {
+ best_count = candidate_registers.count(num);
+ best_reg_num = num;
}
}
type = type.merge(element.static_type());
@@ -188,16 +189,16 @@
// Try to put it in a register. If there was no best choice
// consider any free register.
- if (best_reg_code == no_reg.code_) {
- for (int j = 0; j < kNumRegisters; j++) {
- if (!entry_frame_->is_used(j) && !RegisterAllocator::IsReserved(j)) {
- best_reg_code = j;
+ if (best_reg_num == RegisterAllocator::kInvalidRegister) {
+ for (int j = 0; j < RegisterAllocator::kNumRegisters; j++) {
+ if (!entry_frame_->is_used(j)) {
+ best_reg_num = j;
break;
}
}
}
- if (best_reg_code == no_reg.code_) {
+ if (best_reg_num == RegisterAllocator::kInvalidRegister) {
// If there was no register found, the element is already
// recorded as in memory.
entry_frame_->elements_[i].set_static_type(type);
@@ -205,13 +206,13 @@
// If there was a register choice, use it. Preserve the copied
// flag on the element. Set the static type as computed.
bool is_copied = entry_frame_->elements_[i].is_copied();
- Register reg = { best_reg_code };
+ Register reg = RegisterAllocator::ToRegister(best_reg_num);
entry_frame_->elements_[i] =
FrameElement::RegisterElement(reg,
FrameElement::NOT_SYNCED);
if (is_copied) entry_frame_->elements_[i].set_copied();
entry_frame_->elements_[i].set_static_type(type);
- entry_frame_->register_locations_[best_reg_code] = i;
+ entry_frame_->set_register_location(reg, i);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698