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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1587033002: [Interpreter] Ensure we always have an outer register allocation scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_mythri
Patch Set: Similarity 20 Created 4 years, 11 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 | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index a14b5f3f6f14102b173d23cde301a065e1182133..1b15fc666866589257a593c0a232cbc1c3437900 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -1603,63 +1603,6 @@ bool BytecodeArrayBuilder::FitsInReg16Operand(Register value) {
return kMinInt16 <= value.index() && value.index() <= kMaxInt16;
}
-
-TemporaryRegisterScope::TemporaryRegisterScope(BytecodeArrayBuilder* builder)
- : builder_(builder),
- allocated_(builder->zone()),
- next_consecutive_register_(-1),
- next_consecutive_count_(-1) {}
-
-
-TemporaryRegisterScope::~TemporaryRegisterScope() {
- for (auto i = allocated_.rbegin(); i != allocated_.rend(); i++) {
- builder_->ReturnTemporaryRegister(*i);
- }
- allocated_.clear();
-}
-
-
-Register TemporaryRegisterScope::NewRegister() {
- int allocated = -1;
- if (next_consecutive_count_ <= 0) {
- allocated = builder_->BorrowTemporaryRegister();
- } else {
- allocated = builder_->BorrowTemporaryRegisterNotInRange(
- next_consecutive_register_,
- next_consecutive_register_ + next_consecutive_count_ - 1);
- }
- allocated_.push_back(allocated);
- return Register(allocated);
-}
-
-
-bool TemporaryRegisterScope::RegisterIsAllocatedInThisScope(
- Register reg) const {
- for (auto i = allocated_.begin(); i != allocated_.end(); i++) {
- if (*i == reg.index()) return true;
- }
- return false;
-}
-
-
-void TemporaryRegisterScope::PrepareForConsecutiveAllocations(size_t count) {
- if (static_cast<int>(count) > next_consecutive_count_) {
- next_consecutive_register_ =
- builder_->PrepareForConsecutiveTemporaryRegisters(count);
- next_consecutive_count_ = static_cast<int>(count);
- }
-}
-
-
-Register TemporaryRegisterScope::NextConsecutiveRegister() {
- DCHECK_GE(next_consecutive_register_, 0);
- DCHECK_GT(next_consecutive_count_, 0);
- builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
- allocated_.push_back(next_consecutive_register_);
- next_consecutive_count_--;
- return Register(next_consecutive_register_++);
-}
-
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698