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

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: 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 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Gets a constant pool entry for the |object|. 352 // Gets a constant pool entry for the |object|.
353 size_t GetConstantPoolEntry(Handle<Object> object); 353 size_t GetConstantPoolEntry(Handle<Object> object);
354 354
355 // Not implemented as the illegal bytecode is used inside internally 355 // Not implemented as the illegal bytecode is used inside internally
356 // to indicate a bytecode field is not valid or an error has occured 356 // to indicate a bytecode field is not valid or an error has occured
357 // during bytecode generation. 357 // during bytecode generation.
358 BytecodeArrayBuilder& Illegal(); 358 BytecodeArrayBuilder& Illegal();
359 359
360 void LeaveBasicBlock() { return_seen_in_block_ = false; } 360 void LeaveBasicBlock() { return_seen_in_block_ = false; }
361 361
362 Isolate* isolate() const { return isolate_; }
363 BytecodeArrayWriter* bytecode_array_writer() { 362 BytecodeArrayWriter* bytecode_array_writer() {
364 return &bytecode_array_writer_; 363 return &bytecode_array_writer_;
365 } 364 }
366 BytecodePipelineStage* pipeline() { return pipeline_; } 365 BytecodePipelineStage* pipeline() { return pipeline_; }
367 ConstantArrayBuilder* constant_array_builder() { 366 ConstantArrayBuilder* constant_array_builder() {
368 return &constant_array_builder_; 367 return &constant_array_builder_;
369 } 368 }
370 const ConstantArrayBuilder* constant_array_builder() const { 369 const ConstantArrayBuilder* constant_array_builder() const {
371 return &constant_array_builder_; 370 return &constant_array_builder_;
372 } 371 }
373 HandlerTableBuilder* handler_table_builder() { 372 HandlerTableBuilder* handler_table_builder() {
374 return &handler_table_builder_; 373 return &handler_table_builder_;
375 } 374 }
376 375
377 Isolate* isolate_;
378 Zone* zone_; 376 Zone* zone_;
379 bool bytecode_generated_; 377 bool bytecode_generated_;
380 ConstantArrayBuilder constant_array_builder_; 378 ConstantArrayBuilder constant_array_builder_;
381 HandlerTableBuilder handler_table_builder_; 379 HandlerTableBuilder handler_table_builder_;
382 bool return_seen_in_block_; 380 bool return_seen_in_block_;
383 int parameter_count_; 381 int parameter_count_;
384 int local_register_count_; 382 int local_register_count_;
385 int context_register_count_; 383 int context_register_count_;
386 int return_position_; 384 int return_position_;
387 TemporaryRegisterAllocator temporary_allocator_; 385 TemporaryRegisterAllocator temporary_allocator_;
388 BytecodeArrayWriter bytecode_array_writer_; 386 BytecodeArrayWriter bytecode_array_writer_;
389 BytecodePipelineStage* pipeline_; 387 BytecodePipelineStage* pipeline_;
390 BytecodeSourceInfo latest_source_info_; 388 BytecodeSourceInfo latest_source_info_;
391 389
392 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); 390 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder);
393 }; 391 };
394 392
395 } // namespace interpreter 393 } // namespace interpreter
396 } // namespace internal 394 } // namespace internal
397 } // namespace v8 395 } // namespace v8
398 396
399 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 397 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698