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

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

Issue 2248673002: Avoid accessing Isolate in source position logging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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/full-codegen/full-codegen.cc ('k') | src/log.h » ('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 #include "src/interpreter/bytecode-array-writer.h" 5 #include "src/interpreter/bytecode-array-writer.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/interpreter/bytecode-label.h" 8 #include "src/interpreter/bytecode-label.h"
9 #include "src/interpreter/bytecode-register.h" 9 #include "src/interpreter/bytecode-register.h"
10 #include "src/interpreter/constant-array-builder.h" 10 #include "src/interpreter/constant-array-builder.h"
11 #include "src/log.h" 11 #include "src/log.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace interpreter { 15 namespace interpreter {
16 16
17 STATIC_CONST_MEMBER_DEFINITION const size_t 17 STATIC_CONST_MEMBER_DEFINITION const size_t
18 BytecodeArrayWriter::kMaxSizeOfPackedBytecode; 18 BytecodeArrayWriter::kMaxSizeOfPackedBytecode;
19 19
20 BytecodeArrayWriter::BytecodeArrayWriter( 20 BytecodeArrayWriter::BytecodeArrayWriter(
21 Isolate* isolate, Zone* zone, ConstantArrayBuilder* constant_array_builder, 21 Isolate* isolate, Zone* zone, ConstantArrayBuilder* constant_array_builder,
22 SourcePositionTableBuilder::RecordingMode source_position_mode) 22 SourcePositionTableBuilder::RecordingMode source_position_mode)
23 : isolate_(isolate), 23 : isolate_(isolate),
24 bytecodes_(zone), 24 bytecodes_(zone),
25 max_register_count_(0), 25 max_register_count_(0),
26 unbound_jumps_(0), 26 unbound_jumps_(0),
27 source_position_table_builder_(isolate, zone, source_position_mode), 27 source_position_table_builder_(zone, source_position_mode),
28 constant_array_builder_(constant_array_builder) {} 28 constant_array_builder_(constant_array_builder) {}
29 29
30 // override 30 // override
31 BytecodeArrayWriter::~BytecodeArrayWriter() {} 31 BytecodeArrayWriter::~BytecodeArrayWriter() {}
32 32
33 // override 33 // override
34 Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray( 34 Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray(
35 int fixed_register_count, int parameter_count, 35 int fixed_register_count, int parameter_count,
36 Handle<FixedArray> handler_table) { 36 Handle<FixedArray> handler_table) {
37 DCHECK_EQ(0, unbound_jumps_); 37 DCHECK_EQ(0, unbound_jumps_);
38 38
39 int bytecode_size = static_cast<int>(bytecodes()->size()); 39 int bytecode_size = static_cast<int>(bytecodes()->size());
40 40
41 // All locals need a frame slot for the debugger, but may not be 41 // All locals need a frame slot for the debugger, but may not be
42 // present in generated code. 42 // present in generated code.
43 int frame_size_for_locals = fixed_register_count * kPointerSize; 43 int frame_size_for_locals = fixed_register_count * kPointerSize;
44 int frame_size_used = max_register_count() * kPointerSize; 44 int frame_size_used = max_register_count() * kPointerSize;
45 int frame_size = std::max(frame_size_for_locals, frame_size_used); 45 int frame_size = std::max(frame_size_for_locals, frame_size_used);
46 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray(); 46 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray();
47 Handle<BytecodeArray> bytecode_array = isolate_->factory()->NewBytecodeArray( 47 Handle<BytecodeArray> bytecode_array = isolate_->factory()->NewBytecodeArray(
48 bytecode_size, &bytecodes()->front(), frame_size, parameter_count, 48 bytecode_size, &bytecodes()->front(), frame_size, parameter_count,
49 constant_pool); 49 constant_pool);
50 bytecode_array->set_handler_table(*handler_table); 50 bytecode_array->set_handler_table(*handler_table);
51 Handle<ByteArray> source_position_table = 51 Handle<ByteArray> source_position_table =
52 source_position_table_builder()->ToSourcePositionTable(); 52 source_position_table_builder()->ToSourcePositionTable(
53 isolate(), Handle<AbstractCode>::cast(bytecode_array));
53 bytecode_array->set_source_position_table(*source_position_table); 54 bytecode_array->set_source_position_table(*source_position_table);
54 source_position_table_builder()->EndJitLogging(
55 AbstractCode::cast(*bytecode_array));
56 return bytecode_array; 55 return bytecode_array;
57 } 56 }
58 57
59 // override 58 // override
60 void BytecodeArrayWriter::Write(BytecodeNode* node) { 59 void BytecodeArrayWriter::Write(BytecodeNode* node) {
61 DCHECK(!Bytecodes::IsJump(node->bytecode())); 60 DCHECK(!Bytecodes::IsJump(node->bytecode()));
62 UpdateSourcePositionTable(node); 61 UpdateSourcePositionTable(node);
63 EmitBytecode(node); 62 EmitBytecode(node);
64 } 63 }
65 64
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); 383 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder);
385 break; 384 break;
386 } 385 }
387 } 386 }
388 EmitBytecode(node); 387 EmitBytecode(node);
389 } 388 }
390 389
391 } // namespace interpreter 390 } // namespace interpreter
392 } // namespace internal 391 } // namespace internal
393 } // namespace v8 392 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698