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

Unified Diff: src/register-allocator.h

Issue 42296: Speed up the inner loop of free register allocation. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « no previous file | src/register-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/register-allocator.h
===================================================================
--- src/register-allocator.h (revision 1525)
+++ src/register-allocator.h (working copy)
@@ -149,10 +149,9 @@
// Record that a register will no longer be used by decrementing its
// reference count.
void Unuse(Register reg) {
+ ASSERT(!reg.is(no_reg));
ASSERT(is_used(reg.code()));
- if (is_used(reg.code())) {
- ref_counts_[reg.code()]--;
- }
+ ref_counts_[reg.code()]--;
}
// Copy the reference counts from this register file to the other.
@@ -161,6 +160,17 @@
private:
int ref_counts_[kNumRegisters];
+ // Very fast inlined loop to find a free register.
+ // Used in RegisterAllocator::AllocateWithoutSpilling.
+ // Returns kNumRegisters if no free register found.
+ inline int ScanForFreeRegister() {
+ int i = 0;
+ for (; i < kNumRegisters ; ++i ) {
+ if (ref_counts_[i] == 0) break;
+ }
+ return i;
+ }
+
friend class RegisterAllocator;
};
« no previous file with comments | « no previous file | src/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698