Chromium Code Reviews| Index: src/interpreter/bytecode-peephole-optimizer.h |
| diff --git a/src/interpreter/bytecode-peephole-optimizer.h b/src/interpreter/bytecode-peephole-optimizer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2918e60f5eeef0a6c82aca685caec4d76658ac4c |
| --- /dev/null |
| +++ b/src/interpreter/bytecode-peephole-optimizer.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2015 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. |
| + |
| +#ifndef V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
| +#define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
| + |
| +#include "src/interpreter/bytecode-pipeline.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| +namespace interpreter { |
| + |
| +class ConstantArrayBuilder; |
| + |
| +class BytecodePeepholeOptimizer : public BytecodePipelineStage, |
|
rmcilroy
2016/05/12 12:15:13
nit - add class comment
oth
2016/05/12 14:59:53
Done.
|
| + public ZoneObject { |
| + public: |
| + BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder, |
| + BytecodePipelineStage* next_stage); |
| + |
| + size_t FlushForOffset() override; |
| + void FlushBasicBlock() override; |
| + void Write(BytecodeNode* node) override; |
| + |
| + private: |
| + void UpdateCurrentBytecode(BytecodeNode* const current); |
| + bool CanElideCurrent(const BytecodeNode* const current) const; |
| + bool CanElideLast(const BytecodeNode* const current) const; |
| + BytecodeNode* Optimize(BytecodeNode* current); |
|
rmcilroy
2016/05/12 12:15:13
nit - move Optimize up top and put a newline betwe
oth
2016/05/12 14:59:52
Done.
|
| + |
| + void InvalidateLast(); |
| + bool LastIsValid() const; |
| + void SetLast(const BytecodeNode* const node); |
| + |
| + bool LastBytecodePutsNameInAccumulator() const; |
| + |
| + Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node, |
| + int index) const; |
| + |
| + ConstantArrayBuilder* constant_array_builder_; |
| + BytecodePipelineStage* next_stage_; |
| + BytecodeNode last_; |
| + bool last_is_valid_; |
| + bool last_is_discardable_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); |
| +}; |
| + |
| +} // namespace interpreter |
| +} // namespace internal |
| +} // namespace v8 |
| + |
| +#endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |