OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
6 #define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | 6 #define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
7 | 7 |
8 #include "src/interpreter/bytecode-pipeline.h" | 8 #include "src/interpreter/bytecode-pipeline.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 19 matching lines...) Loading... |
30 Handle<BytecodeArray> ToBytecodeArray( | 30 Handle<BytecodeArray> ToBytecodeArray( |
31 int fixed_register_count, int parameter_count, | 31 int fixed_register_count, int parameter_count, |
32 Handle<FixedArray> handler_table) override; | 32 Handle<FixedArray> handler_table) override; |
33 | 33 |
34 private: | 34 private: |
35 BytecodeNode* OptimizeAndEmitLast(BytecodeNode* current); | 35 BytecodeNode* OptimizeAndEmitLast(BytecodeNode* current); |
36 BytecodeNode* Optimize(BytecodeNode* current); | 36 BytecodeNode* Optimize(BytecodeNode* current); |
37 void Flush(); | 37 void Flush(); |
38 | 38 |
39 void TryToRemoveLastExpressionPosition(const BytecodeNode* const current); | 39 void TryToRemoveLastExpressionPosition(const BytecodeNode* const current); |
| 40 bool TransformCurrentBytecode(BytecodeNode* const current); |
40 bool TransformLastAndCurrentBytecodes(BytecodeNode* const current); | 41 bool TransformLastAndCurrentBytecodes(BytecodeNode* const current); |
41 bool CanElideCurrent(const BytecodeNode* const current) const; | 42 bool CanElideCurrent(const BytecodeNode* const current) const; |
42 bool CanElideLast(const BytecodeNode* const current) const; | 43 bool CanElideLast(const BytecodeNode* const current) const; |
43 bool CanElideLastBasedOnSourcePosition( | 44 bool CanElideLastBasedOnSourcePosition( |
44 const BytecodeNode* const current) const; | 45 const BytecodeNode* const current) const; |
45 | 46 |
46 // Simple substitution methods. | 47 // Simple substitution methods. |
47 bool RemoveToBooleanFromJump(BytecodeNode* const current); | 48 bool RemoveToBooleanFromJump(BytecodeNode* const current); |
48 bool RemoveToBooleanFromLogicalNot(BytecodeNode* const current); | 49 bool RemoveToBooleanFromLogicalNot(BytecodeNode* const current); |
49 bool ChangeLdaToLdr(BytecodeNode* const current); | |
50 | 50 |
51 void InvalidateLast(); | 51 void InvalidateLast(); |
52 bool LastIsValid() const; | 52 bool LastIsValid() const; |
53 void SetLast(const BytecodeNode* const node); | 53 void SetLast(const BytecodeNode* const node); |
54 | 54 |
55 bool LastBytecodePutsNameInAccumulator() const; | 55 bool LastBytecodePutsNameInAccumulator() const; |
56 | 56 |
57 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node, | 57 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node, |
58 int index) const; | 58 int index) const; |
59 | 59 |
60 ConstantArrayBuilder* constant_array_builder_; | 60 ConstantArrayBuilder* constant_array_builder_; |
61 BytecodePipelineStage* next_stage_; | 61 BytecodePipelineStage* next_stage_; |
62 BytecodeNode last_; | 62 BytecodeNode last_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); | 64 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace interpreter | 67 } // namespace interpreter |
68 } // namespace internal | 68 } // namespace internal |
69 } // namespace v8 | 69 } // namespace v8 |
70 | 70 |
71 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ | 71 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
OLD | NEW |