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

Side by Side Diff: src/interpreter/bytecode-array-writer.h

Issue 2351763002: [Interpreter] Optimize BytecodeArrayBuilder and BytecodeArrayWriter. (Closed)
Patch Set: Fix Chromium Windows bots. Created 4 years, 3 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-array-writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ARRAY_WRITER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_
7 7
8 #include "src/interpreter/bytecode-pipeline.h" 8 #include "src/interpreter/bytecode-pipeline.h"
9 #include "src/source-position-table.h" 9 #include "src/source-position-table.h"
10 10
(...skipping 15 matching lines...) Expand all
26 Zone* zone, ConstantArrayBuilder* constant_array_builder, 26 Zone* zone, ConstantArrayBuilder* constant_array_builder,
27 SourcePositionTableBuilder::RecordingMode source_position_mode); 27 SourcePositionTableBuilder::RecordingMode source_position_mode);
28 virtual ~BytecodeArrayWriter(); 28 virtual ~BytecodeArrayWriter();
29 29
30 // BytecodePipelineStage interface. 30 // BytecodePipelineStage interface.
31 void Write(BytecodeNode* node) override; 31 void Write(BytecodeNode* node) override;
32 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; 32 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override;
33 void BindLabel(BytecodeLabel* label) override; 33 void BindLabel(BytecodeLabel* label) override;
34 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; 34 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override;
35 Handle<BytecodeArray> ToBytecodeArray( 35 Handle<BytecodeArray> ToBytecodeArray(
36 Isolate* isolate, int fixed_register_count, int parameter_count, 36 Isolate* isolate, int register_count, int parameter_count,
37 Handle<FixedArray> handler_table) override; 37 Handle<FixedArray> handler_table) override;
38 38
39 private: 39 private:
40 // Maximum sized packed bytecode is comprised of a prefix bytecode, 40 // Maximum sized packed bytecode is comprised of a prefix bytecode,
41 // plus the actual bytecode, plus the maximum number of operands times 41 // plus the actual bytecode, plus the maximum number of operands times
42 // the maximum operand size. 42 // the maximum operand size.
43 static const size_t kMaxSizeOfPackedBytecode = 43 static const size_t kMaxSizeOfPackedBytecode =
44 2 * sizeof(Bytecode) + 44 2 * sizeof(Bytecode) +
45 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast); 45 Bytecodes::kMaxOperands * static_cast<size_t>(OperandSize::kLast);
46 46
(...skipping 15 matching lines...) Expand all
62 void EmitJump(BytecodeNode* node, BytecodeLabel* label); 62 void EmitJump(BytecodeNode* node, BytecodeLabel* label);
63 void UpdateSourcePositionTable(const BytecodeNode* const node); 63 void UpdateSourcePositionTable(const BytecodeNode* const node);
64 64
65 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } 65 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; }
66 SourcePositionTableBuilder* source_position_table_builder() { 66 SourcePositionTableBuilder* source_position_table_builder() {
67 return &source_position_table_builder_; 67 return &source_position_table_builder_;
68 } 68 }
69 ConstantArrayBuilder* constant_array_builder() { 69 ConstantArrayBuilder* constant_array_builder() {
70 return constant_array_builder_; 70 return constant_array_builder_;
71 } 71 }
72 int max_register_count() { return max_register_count_; }
73 72
74 ZoneVector<uint8_t> bytecodes_; 73 ZoneVector<uint8_t> bytecodes_;
75 int max_register_count_;
76 int unbound_jumps_; 74 int unbound_jumps_;
77 SourcePositionTableBuilder source_position_table_builder_; 75 SourcePositionTableBuilder source_position_table_builder_;
78 ConstantArrayBuilder* constant_array_builder_; 76 ConstantArrayBuilder* constant_array_builder_;
79 77
80 friend class BytecodeArrayWriterUnittest; 78 friend class BytecodeArrayWriterUnittest;
81 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); 79 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter);
82 }; 80 };
83 81
84 } // namespace interpreter 82 } // namespace interpreter
85 } // namespace internal 83 } // namespace internal
86 } // namespace v8 84 } // namespace v8
87 85
88 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ 86 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-array-writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698