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

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

Issue 6647019: Reuse backing store of two zone lists by using Rewind(0) instead of Clear(). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 void LAllocator::AllocateDoubleRegisters() { 1429 void LAllocator::AllocateDoubleRegisters() {
1430 HPhase phase("Allocate double registers", this); 1430 HPhase phase("Allocate double registers", this);
1431 num_registers_ = DoubleRegister::kNumAllocatableRegisters; 1431 num_registers_ = DoubleRegister::kNumAllocatableRegisters;
1432 mode_ = DOUBLE_REGISTERS; 1432 mode_ = DOUBLE_REGISTERS;
1433 AllocateRegisters(); 1433 AllocateRegisters();
1434 } 1434 }
1435 1435
1436 1436
1437 void LAllocator::AllocateRegisters() { 1437 void LAllocator::AllocateRegisters() {
1438 ASSERT(mode_ != NONE); 1438 ASSERT(mode_ != NONE);
1439 reusable_slots_.Clear(); 1439 ASSERT(unhandled_live_ranges_.is_empty());
1440 1440
1441 for (int i = 0; i < live_ranges_.length(); ++i) { 1441 for (int i = 0; i < live_ranges_.length(); ++i) {
1442 if (live_ranges_[i] != NULL) { 1442 if (live_ranges_[i] != NULL) {
1443 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) { 1443 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) {
1444 AddToUnhandledUnsorted(live_ranges_[i]); 1444 AddToUnhandledUnsorted(live_ranges_[i]);
1445 } 1445 }
1446 } 1446 }
1447 } 1447 }
1448 SortUnhandled(); 1448 SortUnhandled();
1449 ASSERT(UnhandledIsSorted()); 1449 ASSERT(UnhandledIsSorted());
1450 1450
1451 ASSERT(reusable_slots_.is_empty());
1451 ASSERT(active_live_ranges_.is_empty()); 1452 ASSERT(active_live_ranges_.is_empty());
1452 ASSERT(inactive_live_ranges_.is_empty()); 1453 ASSERT(inactive_live_ranges_.is_empty());
1453 1454
1454 if (mode_ == DOUBLE_REGISTERS) { 1455 if (mode_ == DOUBLE_REGISTERS) {
1455 for (int i = 0; i < fixed_double_live_ranges_.length(); ++i) { 1456 for (int i = 0; i < fixed_double_live_ranges_.length(); ++i) {
1456 LiveRange* current = fixed_double_live_ranges_.at(i); 1457 LiveRange* current = fixed_double_live_ranges_.at(i);
1457 if (current != NULL) { 1458 if (current != NULL) {
1458 AddToInactive(current); 1459 AddToInactive(current);
1459 } 1460 }
1460 } 1461 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 bool result = TryAllocateFreeReg(current); 1526 bool result = TryAllocateFreeReg(current);
1526 if (!result) { 1527 if (!result) {
1527 AllocateBlockedReg(current); 1528 AllocateBlockedReg(current);
1528 } 1529 }
1529 1530
1530 if (current->HasRegisterAssigned()) { 1531 if (current->HasRegisterAssigned()) {
1531 AddToActive(current); 1532 AddToActive(current);
1532 } 1533 }
1533 } 1534 }
1534 1535
1535 active_live_ranges_.Clear(); 1536 reusable_slots_.Rewind(0);
1536 inactive_live_ranges_.Clear(); 1537 active_live_ranges_.Rewind(0);
1538 inactive_live_ranges_.Rewind(0);
1537 } 1539 }
1538 1540
1539 1541
1540 void LAllocator::Setup() { 1542 void LAllocator::Setup() {
1541 LConstantOperand::SetupCache(); 1543 LConstantOperand::SetupCache();
1542 LStackSlot::SetupCache(); 1544 LStackSlot::SetupCache();
1543 LDoubleStackSlot::SetupCache(); 1545 LDoubleStackSlot::SetupCache();
1544 LRegister::SetupCache(); 1546 LRegister::SetupCache();
1545 LDoubleRegister::SetupCache(); 1547 LDoubleRegister::SetupCache();
1546 } 1548 }
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 LiveRange* current = live_ranges()->at(i); 2086 LiveRange* current = live_ranges()->at(i);
2085 if (current != NULL) current->Verify(); 2087 if (current != NULL) current->Verify();
2086 } 2088 }
2087 } 2089 }
2088 2090
2089 2091
2090 #endif 2092 #endif
2091 2093
2092 2094
2093 } } // namespace v8::internal 2095 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698