| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 : public BitField<Lifetime, kLifetimeShift, kLifetimeWidth> { | 137 : public BitField<Lifetime, kLifetimeShift, kLifetimeWidth> { |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 class VirtualRegisterField | 140 class VirtualRegisterField |
| 141 : public BitField<unsigned, | 141 : public BitField<unsigned, |
| 142 kVirtualRegisterShift, | 142 kVirtualRegisterShift, |
| 143 kVirtualRegisterWidth> { | 143 kVirtualRegisterWidth> { |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 static const int kMaxVirtualRegisters = 1 << (kVirtualRegisterWidth + 1); | 146 static const int kMaxVirtualRegisters = 1 << (kVirtualRegisterWidth + 1); |
| 147 static const int kMaxFixedIndices = 128; | 147 static const int kMaxFixedIndex = 63; |
| 148 static const int kMinFixedIndex = -64; |
| 148 | 149 |
| 149 bool HasIgnorePolicy() const { return policy() == IGNORE; } | 150 bool HasIgnorePolicy() const { return policy() == IGNORE; } |
| 150 bool HasNoPolicy() const { return policy() == NONE; } | 151 bool HasNoPolicy() const { return policy() == NONE; } |
| 151 bool HasAnyPolicy() const { | 152 bool HasAnyPolicy() const { |
| 152 return policy() == ANY; | 153 return policy() == ANY; |
| 153 } | 154 } |
| 154 bool HasFixedPolicy() const { | 155 bool HasFixedPolicy() const { |
| 155 return policy() == FIXED_REGISTER || | 156 return policy() == FIXED_REGISTER || |
| 156 policy() == FIXED_DOUBLE_REGISTER || | 157 policy() == FIXED_DOUBLE_REGISTER || |
| 157 policy() == FIXED_SLOT; | 158 policy() == FIXED_SLOT; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 }; | 524 }; |
| 524 | 525 |
| 525 | 526 |
| 526 // Iterates over the non-null, non-constant operands in an environment. | 527 // Iterates over the non-null, non-constant operands in an environment. |
| 527 class ShallowIterator BASE_EMBEDDED { | 528 class ShallowIterator BASE_EMBEDDED { |
| 528 public: | 529 public: |
| 529 explicit ShallowIterator(LEnvironment* env) | 530 explicit ShallowIterator(LEnvironment* env) |
| 530 : env_(env), | 531 : env_(env), |
| 531 limit_(env != NULL ? env->values()->length() : 0), | 532 limit_(env != NULL ? env->values()->length() : 0), |
| 532 current_(0) { | 533 current_(0) { |
| 533 current_ = AdvanceToNext(0); | 534 SkipUninteresting(); |
| 534 } | 535 } |
| 535 | 536 |
| 536 inline bool HasNext() { | 537 bool Done() { return current_ >= limit_; } |
| 537 return env_ != NULL && current_ < limit_; | |
| 538 } | |
| 539 | 538 |
| 540 inline LOperand* Next() { | 539 LOperand* Current() { |
| 541 ASSERT(HasNext()); | 540 ASSERT(!Done()); |
| 542 return env_->values()->at(current_); | 541 return env_->values()->at(current_); |
| 543 } | 542 } |
| 544 | 543 |
| 545 inline void Advance() { | 544 void Advance() { |
| 546 current_ = AdvanceToNext(current_ + 1); | 545 ASSERT(!Done()); |
| 546 ++current_; |
| 547 SkipUninteresting(); |
| 547 } | 548 } |
| 548 | 549 |
| 549 inline LEnvironment* env() { return env_; } | 550 LEnvironment* env() { return env_; } |
| 550 | 551 |
| 551 private: | 552 private: |
| 552 inline bool ShouldSkip(LOperand* op) { | 553 bool ShouldSkip(LOperand* op) { |
| 553 return op == NULL || op->IsConstantOperand() || op->IsArgument(); | 554 return op == NULL || op->IsConstantOperand() || op->IsArgument(); |
| 554 } | 555 } |
| 555 | 556 |
| 556 inline int AdvanceToNext(int start) { | 557 // Skip until something interesting, beginning with and including current_. |
| 557 while (start < limit_ && ShouldSkip(env_->values()->at(start))) { | 558 void SkipUninteresting() { |
| 558 start++; | 559 while (current_ < limit_ && ShouldSkip(env_->values()->at(current_))) { |
| 560 ++current_; |
| 559 } | 561 } |
| 560 return start; | |
| 561 } | 562 } |
| 562 | 563 |
| 563 LEnvironment* env_; | 564 LEnvironment* env_; |
| 564 int limit_; | 565 int limit_; |
| 565 int current_; | 566 int current_; |
| 566 }; | 567 }; |
| 567 | 568 |
| 568 | 569 |
| 569 // Iterator for non-null, non-constant operands incl. outer environments. | 570 // Iterator for non-null, non-constant operands incl. outer environments. |
| 570 class DeepIterator BASE_EMBEDDED { | 571 class DeepIterator BASE_EMBEDDED { |
| 571 public: | 572 public: |
| 572 explicit DeepIterator(LEnvironment* env) | 573 explicit DeepIterator(LEnvironment* env) |
| 573 : current_iterator_(env) { } | 574 : current_iterator_(env) { |
| 574 | 575 SkipUninteresting(); |
| 575 inline bool HasNext() { | |
| 576 if (current_iterator_.HasNext()) return true; | |
| 577 if (current_iterator_.env() == NULL) return false; | |
| 578 AdvanceToOuter(); | |
| 579 return current_iterator_.HasNext(); | |
| 580 } | 576 } |
| 581 | 577 |
| 582 inline LOperand* Next() { | 578 bool Done() { return current_iterator_.Done(); } |
| 583 ASSERT(current_iterator_.HasNext()); | 579 |
| 584 return current_iterator_.Next(); | 580 LOperand* Current() { |
| 581 ASSERT(!current_iterator_.Done()); |
| 582 return current_iterator_.Current(); |
| 585 } | 583 } |
| 586 | 584 |
| 587 inline void Advance() { | 585 void Advance() { |
| 588 if (current_iterator_.HasNext()) { | 586 current_iterator_.Advance(); |
| 589 current_iterator_.Advance(); | 587 SkipUninteresting(); |
| 590 } else { | |
| 591 AdvanceToOuter(); | |
| 592 } | |
| 593 } | 588 } |
| 594 | 589 |
| 595 private: | 590 private: |
| 596 inline void AdvanceToOuter() { | 591 void SkipUninteresting() { |
| 597 current_iterator_ = ShallowIterator(current_iterator_.env()->outer()); | 592 while (current_iterator_.env() != NULL && current_iterator_.Done()) { |
| 593 current_iterator_ = ShallowIterator(current_iterator_.env()->outer()); |
| 594 } |
| 598 } | 595 } |
| 599 | 596 |
| 600 ShallowIterator current_iterator_; | 597 ShallowIterator current_iterator_; |
| 601 }; | 598 }; |
| 602 | 599 |
| 603 | 600 |
| 604 int ExternalArrayTypeToShiftSize(ExternalArrayType type); | 601 int ElementsKindToShiftSize(JSObject::ElementsKind elements_kind); |
| 605 | 602 |
| 606 | 603 |
| 607 } } // namespace v8::internal | 604 } } // namespace v8::internal |
| 608 | 605 |
| 609 #endif // V8_LITHIUM_H_ | 606 #endif // V8_LITHIUM_H_ |
| OLD | NEW |