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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1651133002: [interpreter] Move temporary register allocator into own file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ASAN fix. 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
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 4ef0506a12388cf0f534058b33b98e21f3689169..599af0dbb8bd82431aecf4e300ffab9017d027b4 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -373,7 +373,8 @@ class BytecodeGenerator::RegisterAllocationScope {
explicit RegisterAllocationScope(BytecodeGenerator* generator)
: generator_(generator),
outer_(generator->register_allocator()),
- allocator_(builder()) {
+ allocator_(builder()->zone(),
+ builder()->temporary_register_allocator()) {
generator_->set_register_allocator(this);
}
@@ -395,11 +396,11 @@ class BytecodeGenerator::RegisterAllocationScope {
// walk the full context chain and compute the list of consecutive
// reservations in the innerscopes.
UNIMPLEMENTED();
- return Register(-1);
+ return Register::invalid_value();
}
}
- void PrepareForConsecutiveAllocations(size_t count) {
+ void PrepareForConsecutiveAllocations(int count) {
allocator_.PrepareForConsecutiveAllocations(count);
}
@@ -520,7 +521,7 @@ class BytecodeGenerator::RegisterResultScope final
virtual void SetResultInRegister(Register reg) {
DCHECK(builder()->RegisterIsParameterOrLocal(reg) ||
- (builder()->RegisterIsTemporary(reg) &&
+ (builder()->TemporaryRegisterIsLive(reg) &&
!allocator()->RegisterIsAllocatedInThisScope(reg)));
result_register_ = reg;
set_result_identified();
@@ -536,7 +537,6 @@ class BytecodeGenerator::RegisterResultScope final
BytecodeGenerator::BytecodeGenerator(Isolate* isolate, Zone* zone)
: isolate_(isolate),
zone_(zone),
- builder_(isolate, zone),
info_(nullptr),
scope_(nullptr),
globals_(0, zone),
@@ -558,9 +558,10 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
// Initialize control scope.
ControlScopeForTopLevel control(this);
- builder()->set_parameter_count(info->num_parameters_including_this());
- builder()->set_locals_count(scope()->num_stack_slots());
- builder()->set_context_count(scope()->MaxNestedContextChainLength());
+ // Initialize bytecode array builder.
+ set_builder(new (zone()) BytecodeArrayBuilder(
+ isolate(), zone(), info->num_parameters_including_this(),
+ scope()->MaxNestedContextChainLength(), scope()->num_stack_slots()));
rmcilroy 2016/02/02 10:53:28 optional nit - could we do this before allocating
oth 2016/02/02 11:20:24 Done.
// Build function context only if there are context allocated variables.
if (scope()->NeedsContext()) {
@@ -575,7 +576,7 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
set_scope(nullptr);
set_info(nullptr);
- return builder_.ToBytecodeArray();
+ return builder()->ToBytecodeArray();
}

Powered by Google App Engine
This is Rietveld 408576698