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

Side by Side Diff: src/interpreter/bytecode-pipeline.h

Issue 2035813002: [Interpreter] Move jump processing to bytecode array writer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_fix_bytecode
Patch Set: Address comments Created 4 years, 6 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 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_PIPELINE_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_PIPELINE_H_
6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_ 6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_
7 7
8 #include "src/interpreter/bytecode-register-allocator.h" 8 #include "src/interpreter/bytecode-register-allocator.h"
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace interpreter { 14 namespace interpreter {
15 15
16 class BytecodeLabel;
16 class BytecodeNode; 17 class BytecodeNode;
17 class BytecodeSourceInfo; 18 class BytecodeSourceInfo;
18 19
19 // Interface for bytecode pipeline stages. 20 // Interface for bytecode pipeline stages.
20 class BytecodePipelineStage { 21 class BytecodePipelineStage {
21 public: 22 public:
22 virtual ~BytecodePipelineStage() {} 23 virtual ~BytecodePipelineStage() {}
23 24
24 // Write bytecode node |node| into pipeline. The node is only valid 25 // Write bytecode node |node| into pipeline. The node is only valid
25 // for the duration of the call. Callee's should clone it if 26 // for the duration of the call. Callee's should clone it if
26 // deferring Write() to the next stage. 27 // deferring Write() to the next stage.
27 virtual void Write(BytecodeNode* node) = 0; 28 virtual void Write(BytecodeNode* node) = 0;
28 29
29 // Flush state for bytecode array offset calculation. Returns the 30 // Write jump bytecode node |node| which jumps to |label| into pipeline.
30 // current size of bytecode array. 31 // The node and label are only valid for the duration of the call. This call
31 virtual size_t FlushForOffset() = 0; 32 // implicitly ends the current basic block so should always write to the next
33 // stage.
34 virtual void WriteJump(BytecodeNode* node, BytecodeLabel* label) = 0;
32 35
33 // Flush state to terminate basic block. 36 // Binds |label| to the current bytecode location. This call implicitly
34 virtual void FlushBasicBlock() = 0; 37 // ends the current basic block and so any deferred bytecodes should be
38 // written to the next stage.
39 virtual void BindLabel(BytecodeLabel* label) = 0;
40
41 // Binds |label| to the location of |target|. This call implicitly
42 // ends the current basic block and so any deferred bytecodes should be
43 // written to the next stage.
44 virtual void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) = 0;
45
46 // Flush the pipeline and generate a bytecode array.
47 virtual Handle<BytecodeArray> ToBytecodeArray(
48 int fixed_register_count, int parameter_count,
49 Handle<FixedArray> handler_table) = 0;
35 }; 50 };
36 51
37 // Source code position information. 52 // Source code position information.
38 class BytecodeSourceInfo final { 53 class BytecodeSourceInfo final {
39 public: 54 public:
40 static const int kUninitializedPosition = -1; 55 static const int kUninitializedPosition = -1;
41 56
42 BytecodeSourceInfo(int position = kUninitializedPosition, 57 BytecodeSourceInfo(int position = kUninitializedPosition,
43 bool is_statement = false) 58 bool is_statement = false)
44 : source_position_(position), is_statement_(is_statement) {} 59 : source_position_(position), is_statement_(is_statement) {}
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 }; 156 };
142 157
143 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info); 158 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info);
144 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node); 159 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node);
145 160
146 } // namespace interpreter 161 } // namespace interpreter
147 } // namespace internal 162 } // namespace internal
148 } // namespace v8 163 } // namespace v8
149 164
150 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_ 165 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-peephole-optimizer.cc ('k') | src/interpreter/bytecode-register-optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698