Commit b543c2da authored by jarin's avatar jarin Committed by Commit Bot

[interpreter] Make sure allocated registers are always materialized in the register optimizer.

BUG=chromium:729369

Review-Url: https://codereview.chromium.org/2926063002
Cr-Commit-Position: refs/heads/master@{#45770}
parent 2851fede
......@@ -416,8 +416,15 @@ void BytecodeRegisterOptimizer::GrowRegisterMap(Register reg) {
}
}
void BytecodeRegisterOptimizer::AllocateRegister(RegisterInfo* info) {
info->set_allocated(true);
if (!info->materialized()) {
info->MoveToNewEquivalenceSet(NextEquivalenceId(), true);
}
}
void BytecodeRegisterOptimizer::RegisterAllocateEvent(Register reg) {
GetOrCreateRegisterInfo(reg)->set_allocated(true);
AllocateRegister(GetOrCreateRegisterInfo(reg));
}
void BytecodeRegisterOptimizer::RegisterListAllocateEvent(
......@@ -426,7 +433,7 @@ void BytecodeRegisterOptimizer::RegisterListAllocateEvent(
int first_index = reg_list.first_register().index();
GrowRegisterMap(Register(first_index + reg_list.register_count() - 1));
for (int i = 0; i < reg_list.register_count(); i++) {
GetRegisterInfo(Register(first_index + i))->set_allocated(true);
AllocateRegister(GetRegisterInfo(Register(first_index + i)));
}
}
}
......
......@@ -178,6 +178,8 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final
return equivalence_id_;
}
void AllocateRegister(RegisterInfo* info);
Zone* zone() { return zone_; }
const Register accumulator_;
......
......@@ -335,7 +335,7 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 40
bytecode array length: 38
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -345,7 +345,6 @@ bytecodes: [
B(LdaSmi), I8(1),
B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(5),
B(CreateObjectLiteral), U8(1), U8(3), U8(19), R(4),
B(Star), R(3),
B(Mov), R(1), R(2),
B(Mov), R(4), R(3),
B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2),
......@@ -365,7 +364,7 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 63
bytecode array length: 61
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -374,7 +373,6 @@ bytecodes: [
/* 60 E> */ B(ToName), R(2),
B(LdaConstant), U8(2),
B(StaDataPropertyInLiteral), R(1), R(2), U8(0), U8(6),
B(Star), R(3),
B(LdaConstant), U8(3),
B(Star), R(3),
B(CreateClosure), U8(4), U8(3), U8(2),
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function* f() {
x.__defineGetter__();
var x = 0;
for (let y of iterable) {
yield y;
}
}
f();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment