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

Side by Side Diff: src/interpreter/bytecode-peephole-optimizer.h

Issue 2238853002: [Interpreter] Remove LdaConstant+ToName peephole optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_internalize
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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-peephole-table.h" 8 #include "src/interpreter/bytecode-peephole-table.h"
9 #include "src/interpreter/bytecode-pipeline.h" 9 #include "src/interpreter/bytecode-pipeline.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace interpreter { 13 namespace interpreter {
14 14
15 class ConstantArrayBuilder; 15 class ConstantArrayBuilder;
Michael Starzinger 2016/08/11 13:19:14 nit: Forward declaration should be obsolete. Lets
rmcilroy 2016/08/11 14:46:17 Done.
16 class BytecodePeepholeActionAndData; 16 class BytecodePeepholeActionAndData;
17 17
18 // An optimization stage for performing peephole optimizations on 18 // An optimization stage for performing peephole optimizations on
19 // generated bytecode. The optimizer may buffer one bytecode 19 // generated bytecode. The optimizer may buffer one bytecode
20 // internally. 20 // internally.
21 class BytecodePeepholeOptimizer final : public BytecodePipelineStage, 21 class BytecodePeepholeOptimizer final : public BytecodePipelineStage,
22 public ZoneObject { 22 public ZoneObject {
23 public: 23 public:
24 BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder, 24 explicit BytecodePeepholeOptimizer(BytecodePipelineStage* next_stage);
25 BytecodePipelineStage* next_stage);
26 25
27 // BytecodePipelineStage interface. 26 // BytecodePipelineStage interface.
28 void Write(BytecodeNode* node) override; 27 void Write(BytecodeNode* node) override;
29 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; 28 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override;
30 void BindLabel(BytecodeLabel* label) override; 29 void BindLabel(BytecodeLabel* label) override;
31 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; 30 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override;
32 Handle<BytecodeArray> ToBytecodeArray( 31 Handle<BytecodeArray> ToBytecodeArray(
33 int fixed_register_count, int parameter_count, 32 int fixed_register_count, int parameter_count,
34 Handle<FixedArray> handler_table) override; 33 Handle<FixedArray> handler_table) override;
35 34
36 private: 35 private:
37 #define DECLARE_ACTION(Action) \ 36 #define DECLARE_ACTION(Action) \
38 void Action(BytecodeNode* const node, \ 37 void Action(BytecodeNode* const node, \
39 const PeepholeActionAndData* const action_data = nullptr); 38 const PeepholeActionAndData* const action_data = nullptr);
40 PEEPHOLE_ACTION_LIST(DECLARE_ACTION) 39 PEEPHOLE_ACTION_LIST(DECLARE_ACTION)
41 #undef DECLARE_ACTION 40 #undef DECLARE_ACTION
42 41
43 void ApplyPeepholeAction(BytecodeNode* const node); 42 void ApplyPeepholeAction(BytecodeNode* const node);
44 void Flush(); 43 void Flush();
45 bool CanElideLastBasedOnSourcePosition( 44 bool CanElideLastBasedOnSourcePosition(
46 const BytecodeNode* const current) const; 45 const BytecodeNode* const current) const;
47 void InvalidateLast(); 46 void InvalidateLast();
48 bool LastIsValid() const; 47 bool LastIsValid() const;
49 void SetLast(const BytecodeNode* const node); 48 void SetLast(const BytecodeNode* const node);
50 49
51 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node,
52 int index) const;
53
54 BytecodePipelineStage* next_stage() const { return next_stage_; } 50 BytecodePipelineStage* next_stage() const { return next_stage_; }
55 BytecodeNode* last() { return &last_; } 51 BytecodeNode* last() { return &last_; }
56 52
57 ConstantArrayBuilder* constant_array_builder_;
58 BytecodePipelineStage* next_stage_; 53 BytecodePipelineStage* next_stage_;
59 BytecodeNode last_; 54 BytecodeNode last_;
60 55
61 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); 56 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer);
62 }; 57 };
63 58
64 } // namespace interpreter 59 } // namespace interpreter
65 } // namespace internal 60 } // namespace internal
66 } // namespace v8 61 } // namespace v8
67 62
68 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ 63 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698