| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 LiveRange* parent_; | 392 LiveRange* parent_; |
| 393 LiveRange* next_; | 393 LiveRange* next_; |
| 394 // This is used as a cache, it doesn't affect correctness. | 394 // This is used as a cache, it doesn't affect correctness. |
| 395 mutable UseInterval* current_interval_; | 395 mutable UseInterval* current_interval_; |
| 396 UsePosition* last_processed_use_; | 396 UsePosition* last_processed_use_; |
| 397 LOperand* spill_operand_; | 397 LOperand* spill_operand_; |
| 398 int spill_start_index_; | 398 int spill_start_index_; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 | 401 |
| 402 class GrowableBitVector BASE_EMBEDDED { | |
| 403 public: | |
| 404 GrowableBitVector() : bits_(NULL) { } | |
| 405 | |
| 406 bool Contains(int value) const { | |
| 407 if (!InBitsRange(value)) return false; | |
| 408 return bits_->Contains(value); | |
| 409 } | |
| 410 | |
| 411 void Add(int value, Zone* zone) { | |
| 412 EnsureCapacity(value, zone); | |
| 413 bits_->Add(value); | |
| 414 } | |
| 415 | |
| 416 private: | |
| 417 static const int kInitialLength = 1024; | |
| 418 | |
| 419 bool InBitsRange(int value) const { | |
| 420 return bits_ != NULL && bits_->length() > value; | |
| 421 } | |
| 422 | |
| 423 void EnsureCapacity(int value, Zone* zone) { | |
| 424 if (InBitsRange(value)) return; | |
| 425 int new_length = bits_ == NULL ? kInitialLength : bits_->length(); | |
| 426 while (new_length <= value) new_length *= 2; | |
| 427 BitVector* new_bits = new(zone) BitVector(new_length, zone); | |
| 428 if (bits_ != NULL) new_bits->CopyFrom(*bits_); | |
| 429 bits_ = new_bits; | |
| 430 } | |
| 431 | |
| 432 BitVector* bits_; | |
| 433 }; | |
| 434 | |
| 435 | |
| 436 class LAllocator BASE_EMBEDDED { | 402 class LAllocator BASE_EMBEDDED { |
| 437 public: | 403 public: |
| 438 LAllocator(int first_virtual_register, HGraph* graph); | 404 LAllocator(int first_virtual_register, HGraph* graph); |
| 439 | 405 |
| 440 static void TraceAlloc(const char* msg, ...); | 406 static void TraceAlloc(const char* msg, ...); |
| 441 | 407 |
| 442 // Checks whether the value of a given virtual register is tagged. | 408 // Checks whether the value of a given virtual register is tagged. |
| 443 bool HasTaggedValue(int virtual_register) const; | 409 bool HasTaggedValue(int virtual_register) const; |
| 444 | 410 |
| 445 // Returns the register kind required by the given virtual register. | 411 // Returns the register kind required by the given virtual register. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // Indicates success or failure during register allocation. | 598 // Indicates success or failure during register allocation. |
| 633 bool allocation_ok_; | 599 bool allocation_ok_; |
| 634 | 600 |
| 635 DISALLOW_COPY_AND_ASSIGN(LAllocator); | 601 DISALLOW_COPY_AND_ASSIGN(LAllocator); |
| 636 }; | 602 }; |
| 637 | 603 |
| 638 | 604 |
| 639 } } // namespace v8::internal | 605 } } // namespace v8::internal |
| 640 | 606 |
| 641 #endif // V8_LITHIUM_ALLOCATOR_H_ | 607 #endif // V8_LITHIUM_ALLOCATOR_H_ |
| OLD | NEW |