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

Unified Diff: src/register-allocator.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/register-allocator.cc
===================================================================
--- src/register-allocator.cc (revision 2055)
+++ src/register-allocator.cc (working copy)
@@ -38,7 +38,7 @@
Result::Result(Register reg) {
- ASSERT(reg.is_valid());
+ ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg));
CodeGeneratorScope::Current()->allocator()->Use(reg);
value_ = StaticTypeField::encode(StaticType::UNKNOWN_TYPE)
| TypeField::encode(REGISTER)
@@ -47,7 +47,7 @@
Result::Result(Register reg, StaticType type) {
- ASSERT(reg.is_valid());
+ ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg));
CodeGeneratorScope::Current()->allocator()->Use(reg);
value_ = StaticTypeField::encode(type.static_type_)
| TypeField::encode(REGISTER)
@@ -61,12 +61,11 @@
Result RegisterAllocator::AllocateWithoutSpilling() {
// Return the first free register, if any.
- int free_reg = registers_.ScanForFreeRegister();
- if (free_reg < kNumRegisters) {
- Register free_result = { free_reg };
- return Result(free_result);
+ int num = registers_.ScanForFreeRegister();
+ if (num == RegisterAllocator::kInvalidRegister) {
+ return Result();
}
- return Result();
+ return Result(RegisterAllocator::ToRegister(num));
}

Powered by Google App Engine
This is Rietveld 408576698