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

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

Issue 2242193002: [Interpreter] Avoid accessing Isolate from during bytecode generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_sourceposition
Patch Set: Rebase 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
« no previous file with comments | « src/ast/scopes.h ('k') | src/interpreter/bytecode-array-builder.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_BUILDER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/interpreter/bytecode-array-writer.h" 9 #include "src/interpreter/bytecode-array-writer.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 16 matching lines...) Expand all
27 class Register; 27 class Register;
28 28
29 class BytecodeArrayBuilder final : public ZoneObject { 29 class BytecodeArrayBuilder final : public ZoneObject {
30 public: 30 public:
31 BytecodeArrayBuilder( 31 BytecodeArrayBuilder(
32 Isolate* isolate, Zone* zone, int parameter_count, int context_count, 32 Isolate* isolate, Zone* zone, int parameter_count, int context_count,
33 int locals_count, FunctionLiteral* literal = nullptr, 33 int locals_count, FunctionLiteral* literal = nullptr,
34 SourcePositionTableBuilder::RecordingMode source_position_mode = 34 SourcePositionTableBuilder::RecordingMode source_position_mode =
35 SourcePositionTableBuilder::RECORD_SOURCE_POSITIONS); 35 SourcePositionTableBuilder::RECORD_SOURCE_POSITIONS);
36 36
37 Handle<BytecodeArray> ToBytecodeArray(); 37 Handle<BytecodeArray> ToBytecodeArray(Isolate* isolate);
38 38
39 // Get the number of parameters expected by function. 39 // Get the number of parameters expected by function.
40 int parameter_count() const { 40 int parameter_count() const {
41 DCHECK_GE(parameter_count_, 0); 41 DCHECK_GE(parameter_count_, 0);
42 return parameter_count_; 42 return parameter_count_;
43 } 43 }
44 44
45 // Get the number of locals required for bytecode array. 45 // Get the number of locals required for bytecode array.
46 int locals_count() const { 46 int locals_count() const {
47 DCHECK_GE(local_register_count_, 0); 47 DCHECK_GE(local_register_count_, 0);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // Gets a constant pool entry for the |object|. 356 // Gets a constant pool entry for the |object|.
357 size_t GetConstantPoolEntry(Handle<Object> object); 357 size_t GetConstantPoolEntry(Handle<Object> object);
358 358
359 // Not implemented as the illegal bytecode is used inside internally 359 // Not implemented as the illegal bytecode is used inside internally
360 // to indicate a bytecode field is not valid or an error has occured 360 // to indicate a bytecode field is not valid or an error has occured
361 // during bytecode generation. 361 // during bytecode generation.
362 BytecodeArrayBuilder& Illegal(); 362 BytecodeArrayBuilder& Illegal();
363 363
364 void LeaveBasicBlock() { return_seen_in_block_ = false; } 364 void LeaveBasicBlock() { return_seen_in_block_ = false; }
365 365
366 Isolate* isolate() const { return isolate_; }
367 BytecodeArrayWriter* bytecode_array_writer() { 366 BytecodeArrayWriter* bytecode_array_writer() {
368 return &bytecode_array_writer_; 367 return &bytecode_array_writer_;
369 } 368 }
370 BytecodePipelineStage* pipeline() { return pipeline_; } 369 BytecodePipelineStage* pipeline() { return pipeline_; }
371 ConstantArrayBuilder* constant_array_builder() { 370 ConstantArrayBuilder* constant_array_builder() {
372 return &constant_array_builder_; 371 return &constant_array_builder_;
373 } 372 }
374 const ConstantArrayBuilder* constant_array_builder() const { 373 const ConstantArrayBuilder* constant_array_builder() const {
375 return &constant_array_builder_; 374 return &constant_array_builder_;
376 } 375 }
377 HandlerTableBuilder* handler_table_builder() { 376 HandlerTableBuilder* handler_table_builder() {
378 return &handler_table_builder_; 377 return &handler_table_builder_;
379 } 378 }
380 379
381 Isolate* isolate_;
382 Zone* zone_; 380 Zone* zone_;
383 bool bytecode_generated_; 381 bool bytecode_generated_;
384 ConstantArrayBuilder constant_array_builder_; 382 ConstantArrayBuilder constant_array_builder_;
385 HandlerTableBuilder handler_table_builder_; 383 HandlerTableBuilder handler_table_builder_;
386 bool return_seen_in_block_; 384 bool return_seen_in_block_;
387 int parameter_count_; 385 int parameter_count_;
388 int local_register_count_; 386 int local_register_count_;
389 int context_register_count_; 387 int context_register_count_;
390 int return_position_; 388 int return_position_;
391 TemporaryRegisterAllocator temporary_allocator_; 389 TemporaryRegisterAllocator temporary_allocator_;
392 BytecodeArrayWriter bytecode_array_writer_; 390 BytecodeArrayWriter bytecode_array_writer_;
393 BytecodePipelineStage* pipeline_; 391 BytecodePipelineStage* pipeline_;
394 BytecodeSourceInfo latest_source_info_; 392 BytecodeSourceInfo latest_source_info_;
395 393
396 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); 394 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder);
397 }; 395 };
398 396
399 } // namespace interpreter 397 } // namespace interpreter
400 } // namespace internal 398 } // namespace internal
401 } // namespace v8 399 } // namespace v8
402 400
403 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 401 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698