Commit bec64421 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[interpreter] Reduce ExpressionResultScope size

- Reduce ExpressionResultScope size by reusing accessing the generator
  from its RegisterAllocationScope member
- Mark the ExpressionResultScope destructor non-virtual since there are
  no destructors in subclasses

Change-Id: I3abe1856c091100217c668cd6bd5e7fd96eb8397
Reviewed-on: https://chromium-review.googlesource.com/c/1386485Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58398}
parent d2b96f1b
......@@ -553,6 +553,8 @@ class BytecodeGenerator::RegisterAllocationScope final {
outer_next_register_index_);
}
BytecodeGenerator* generator() const { return generator_; }
private:
BytecodeGenerator* generator_;
int outer_next_register_index_;
......@@ -565,16 +567,15 @@ class BytecodeGenerator::RegisterAllocationScope final {
class BytecodeGenerator::ExpressionResultScope {
public:
ExpressionResultScope(BytecodeGenerator* generator, Expression::Context kind)
: generator_(generator),
outer_(generator->execution_result()),
: outer_(generator->execution_result()),
allocator_(generator),
kind_(kind),
type_hint_(TypeHint::kAny) {
generator_->set_execution_result(this);
generator->set_execution_result(this);
}
virtual ~ExpressionResultScope() {
generator_->set_execution_result(outer_);
~ExpressionResultScope() {
allocator_.generator()->set_execution_result(outer_);
}
bool IsEffect() const { return kind_ == Expression::kEffect; }
......@@ -600,7 +601,6 @@ class BytecodeGenerator::ExpressionResultScope {
TypeHint type_hint() const { return type_hint_; }
private:
BytecodeGenerator* generator_;
ExpressionResultScope* outer_;
RegisterAllocationScope allocator_;
Expression::Context kind_;
......
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