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

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

Issue 1947403002: [interpreter] Introduce bytecode generation pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate review comments. Created 4 years, 7 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
(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,
17 public ZoneObject {
18 public:
19 BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder,
20 BytecodePipelineStage* next_stage);
21
22 // Flush internal state for a branch.
23 size_t FlushForOffset() override;
24
25 // Signal end of basic block.
26 void LeaveBasicBlock() override;
27
28 // Write bytecode into pipeline.
29 void Write(BytecodeNode* node) override;
30
31 private:
32 void UpdateCurrentBytecode(BytecodeNode* const current);
33 bool CanElideCurrent(const BytecodeNode* const current) const;
34 bool CanElideLast(const BytecodeNode* const current) const;
35 BytecodeNode* Optimize(BytecodeNode* current);
36
37 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node,
38 int index) const;
39
40 ConstantArrayBuilder* constant_array_builder_;
41 BytecodePipelineStage* next_stage_;
42 BytecodeNode* last_;
43 bool last_is_discardable_;
44
45 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer);
46 };
47
48 } // namespace interpreter
49 } // namespace internal
50 } // namespace v8
51
52 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698