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

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

Issue 2038083002: [Interpreter] Add a simple dead-code elimination bytecode optimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_jump_writer
Patch Set: Fix tests Created 4 years, 6 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/flag-definitions.h ('k') | src/interpreter/bytecode-dead-code-optimizer.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-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-array-writer.h" 8 #include "src/interpreter/bytecode-array-writer.h"
9 #include "src/interpreter/bytecode-dead-code-optimizer.h"
9 #include "src/interpreter/bytecode-label.h" 10 #include "src/interpreter/bytecode-label.h"
10 #include "src/interpreter/bytecode-peephole-optimizer.h" 11 #include "src/interpreter/bytecode-peephole-optimizer.h"
11 #include "src/interpreter/bytecode-register-optimizer.h" 12 #include "src/interpreter/bytecode-register-optimizer.h"
12 #include "src/interpreter/interpreter-intrinsics.h" 13 #include "src/interpreter/interpreter-intrinsics.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 namespace interpreter { 17 namespace interpreter {
17 18
18 BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone, 19 BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone,
19 int parameter_count, 20 int parameter_count,
20 int context_count, int locals_count, 21 int context_count, int locals_count,
21 FunctionLiteral* literal) 22 FunctionLiteral* literal)
22 : isolate_(isolate), 23 : isolate_(isolate),
23 zone_(zone), 24 zone_(zone),
24 bytecode_generated_(false), 25 bytecode_generated_(false),
25 constant_array_builder_(isolate, zone), 26 constant_array_builder_(isolate, zone),
26 handler_table_builder_(isolate, zone), 27 handler_table_builder_(isolate, zone),
27 return_seen_in_block_(false), 28 return_seen_in_block_(false),
28 parameter_count_(parameter_count), 29 parameter_count_(parameter_count),
29 local_register_count_(locals_count), 30 local_register_count_(locals_count),
30 context_register_count_(context_count), 31 context_register_count_(context_count),
31 temporary_allocator_(zone, fixed_register_count()), 32 temporary_allocator_(zone, fixed_register_count()),
32 bytecode_array_writer_(isolate, zone, &constant_array_builder_), 33 bytecode_array_writer_(isolate, zone, &constant_array_builder_),
33 pipeline_(&bytecode_array_writer_) { 34 pipeline_(&bytecode_array_writer_) {
34 DCHECK_GE(parameter_count_, 0); 35 DCHECK_GE(parameter_count_, 0);
35 DCHECK_GE(context_register_count_, 0); 36 DCHECK_GE(context_register_count_, 0);
36 DCHECK_GE(local_register_count_, 0); 37 DCHECK_GE(local_register_count_, 0);
37 38
39 if (FLAG_ignition_deadcode) {
40 pipeline_ = new (zone) BytecodeDeadCodeOptimizer(pipeline_);
41 }
42
38 if (FLAG_ignition_peephole) { 43 if (FLAG_ignition_peephole) {
39 pipeline_ = new (zone) 44 pipeline_ = new (zone)
40 BytecodePeepholeOptimizer(&constant_array_builder_, pipeline_); 45 BytecodePeepholeOptimizer(&constant_array_builder_, pipeline_);
41 } 46 }
42 47
43 if (FLAG_ignition_reo) { 48 if (FLAG_ignition_reo) {
44 pipeline_ = new (zone) BytecodeRegisterOptimizer( 49 pipeline_ = new (zone) BytecodeRegisterOptimizer(
45 zone, &temporary_allocator_, parameter_count, pipeline_); 50 zone, &temporary_allocator_, parameter_count, pipeline_);
46 } 51 }
47 52
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 return Bytecode::kTailCall; 922 return Bytecode::kTailCall;
918 default: 923 default:
919 UNREACHABLE(); 924 UNREACHABLE();
920 } 925 }
921 return Bytecode::kIllegal; 926 return Bytecode::kIllegal;
922 } 927 }
923 928
924 } // namespace interpreter 929 } // namespace interpreter
925 } // namespace internal 930 } // namespace internal
926 } // namespace v8 931 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/interpreter/bytecode-dead-code-optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698