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

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

Issue 2111793002: Simplify JIT event logging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix forward declaration Created 4 years, 5 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/constant-array-builder.h" 9 #include "src/interpreter/constant-array-builder.h"
10 #include "src/log.h" 10 #include "src/log.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace interpreter { 14 namespace interpreter {
15 15
16 STATIC_CONST_MEMBER_DEFINITION const size_t 16 STATIC_CONST_MEMBER_DEFINITION const size_t
17 BytecodeArrayWriter::kMaxSizeOfPackedBytecode; 17 BytecodeArrayWriter::kMaxSizeOfPackedBytecode;
18 18
19 BytecodeArrayWriter::BytecodeArrayWriter( 19 BytecodeArrayWriter::BytecodeArrayWriter(
20 Isolate* isolate, Zone* zone, ConstantArrayBuilder* constant_array_builder) 20 Isolate* isolate, Zone* zone, ConstantArrayBuilder* constant_array_builder)
21 : isolate_(isolate), 21 : isolate_(isolate),
22 bytecodes_(zone), 22 bytecodes_(zone),
23 max_register_count_(0), 23 max_register_count_(0),
24 unbound_jumps_(0), 24 unbound_jumps_(0),
25 source_position_table_builder_(isolate, zone), 25 source_position_table_builder_(isolate, zone),
26 constant_array_builder_(constant_array_builder) { 26 constant_array_builder_(constant_array_builder) {}
27 LOG_CODE_EVENT(isolate_, CodeStartLinePosInfoRecordEvent(
28 source_position_table_builder()));
29 }
30 27
31 // override 28 // override
32 BytecodeArrayWriter::~BytecodeArrayWriter() {} 29 BytecodeArrayWriter::~BytecodeArrayWriter() {}
33 30
34 // override 31 // override
35 Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray( 32 Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray(
36 int fixed_register_count, int parameter_count, 33 int fixed_register_count, int parameter_count,
37 Handle<FixedArray> handler_table) { 34 Handle<FixedArray> handler_table) {
38 DCHECK_EQ(0, unbound_jumps_); 35 DCHECK_EQ(0, unbound_jumps_);
39 36
40 int bytecode_size = static_cast<int>(bytecodes()->size()); 37 int bytecode_size = static_cast<int>(bytecodes()->size());
41 38
42 // All locals need a frame slot for the debugger, but may not be 39 // All locals need a frame slot for the debugger, but may not be
43 // present in generated code. 40 // present in generated code.
44 int frame_size_for_locals = fixed_register_count * kPointerSize; 41 int frame_size_for_locals = fixed_register_count * kPointerSize;
45 int frame_size_used = max_register_count() * kPointerSize; 42 int frame_size_used = max_register_count() * kPointerSize;
46 int frame_size = std::max(frame_size_for_locals, frame_size_used); 43 int frame_size = std::max(frame_size_for_locals, frame_size_used);
47 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray(); 44 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray();
48 Handle<ByteArray> source_position_table =
49 source_position_table_builder()->ToSourcePositionTable();
50 Handle<BytecodeArray> bytecode_array = isolate_->factory()->NewBytecodeArray( 45 Handle<BytecodeArray> bytecode_array = isolate_->factory()->NewBytecodeArray(
51 bytecode_size, &bytecodes()->front(), frame_size, parameter_count, 46 bytecode_size, &bytecodes()->front(), frame_size, parameter_count,
52 constant_pool); 47 constant_pool);
53 bytecode_array->set_handler_table(*handler_table); 48 bytecode_array->set_handler_table(*handler_table);
49 Handle<ByteArray> source_position_table =
50 source_position_table_builder()->ToSourcePositionTable();
54 bytecode_array->set_source_position_table(*source_position_table); 51 bytecode_array->set_source_position_table(*source_position_table);
55 52 source_position_table_builder()->EndJitLogging(
56 void* line_info = source_position_table_builder()->DetachJITHandlerData(); 53 AbstractCode::cast(*bytecode_array));
57 LOG_CODE_EVENT(isolate_, CodeEndLinePosInfoRecordEvent(
58 AbstractCode::cast(*bytecode_array), line_info));
59 return bytecode_array; 54 return bytecode_array;
60 } 55 }
61 56
62 // override 57 // override
63 void BytecodeArrayWriter::Write(BytecodeNode* node) { 58 void BytecodeArrayWriter::Write(BytecodeNode* node) {
64 DCHECK(!Bytecodes::IsJump(node->bytecode())); 59 DCHECK(!Bytecodes::IsJump(node->bytecode()));
65 UpdateSourcePositionTable(node); 60 UpdateSourcePositionTable(node);
66 EmitBytecode(node); 61 EmitBytecode(node);
67 } 62 }
68 63
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); 382 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder);
388 break; 383 break;
389 } 384 }
390 } 385 }
391 EmitBytecode(node); 386 EmitBytecode(node);
392 } 387 }
393 388
394 } // namespace interpreter 389 } // namespace interpreter
395 } // namespace internal 390 } // namespace internal
396 } // namespace v8 391 } // 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