Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | |
| 6 #define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | |
| 7 | |
| 8 #include "src/interpreter/bytecode-pipeline.h" | |
| 9 | |
| 10 namespace v8 { | |
| 11 namespace internal { | |
| 12 namespace interpreter { | |
| 13 | |
| 14 class ConstantArrayBuilder; | |
| 15 | |
| 16 class BytecodePeepholeOptimizer : public BytecodePipelineStage, | |
|
rmcilroy
2016/05/12 12:15:13
nit - add class comment
oth
2016/05/12 14:59:53
Done.
| |
| 17 public ZoneObject { | |
| 18 public: | |
| 19 BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder, | |
| 20 BytecodePipelineStage* next_stage); | |
| 21 | |
| 22 size_t FlushForOffset() override; | |
| 23 void FlushBasicBlock() override; | |
| 24 void Write(BytecodeNode* node) override; | |
| 25 | |
| 26 private: | |
| 27 void UpdateCurrentBytecode(BytecodeNode* const current); | |
| 28 bool CanElideCurrent(const BytecodeNode* const current) const; | |
| 29 bool CanElideLast(const BytecodeNode* const current) const; | |
| 30 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.
| |
| 31 | |
| 32 void InvalidateLast(); | |
| 33 bool LastIsValid() const; | |
| 34 void SetLast(const BytecodeNode* const node); | |
| 35 | |
| 36 bool LastBytecodePutsNameInAccumulator() const; | |
| 37 | |
| 38 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node, | |
| 39 int index) const; | |
| 40 | |
| 41 ConstantArrayBuilder* constant_array_builder_; | |
| 42 BytecodePipelineStage* next_stage_; | |
| 43 BytecodeNode last_; | |
| 44 bool last_is_valid_; | |
| 45 bool last_is_discardable_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); | |
| 48 }; | |
| 49 | |
| 50 } // namespace interpreter | |
| 51 } // namespace internal | |
| 52 } // namespace v8 | |
| 53 | |
| 54 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | |
| OLD | NEW |