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

Side by Side Diff: src/interpreter/bytecode-peephole-optimizer.cc

Issue 2393683004: [Interpreter] Optimize the Register Optimizer. (Closed)
Patch Set: Fix unused variable in test Created 4 years, 2 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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-peephole-optimizer.h" 5 #include "src/interpreter/bytecode-peephole-optimizer.h"
6 6
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 #include "src/objects.h" 8 #include "src/objects.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 namespace interpreter { 12 namespace interpreter {
13 13
14 BytecodePeepholeOptimizer::BytecodePeepholeOptimizer( 14 BytecodePeepholeOptimizer::BytecodePeepholeOptimizer(
15 BytecodePipelineStage* next_stage) 15 BytecodePipelineStage* next_stage)
16 : next_stage_(next_stage), last_(Bytecode::kIllegal) { 16 : next_stage_(next_stage), last_(Bytecode::kIllegal, BytecodeSourceInfo()) {
17 InvalidateLast(); 17 InvalidateLast();
18 } 18 }
19 19
20 // override 20 // override
21 Handle<BytecodeArray> BytecodePeepholeOptimizer::ToBytecodeArray( 21 Handle<BytecodeArray> BytecodePeepholeOptimizer::ToBytecodeArray(
22 Isolate* isolate, int register_count, int parameter_count, 22 Isolate* isolate, int register_count, int parameter_count,
23 Handle<FixedArray> handler_table) { 23 Handle<FixedArray> handler_table) {
24 Flush(); 24 Flush();
25 return next_stage_->ToBytecodeArray(isolate, register_count, parameter_count, 25 return next_stage_->ToBytecodeArray(isolate, register_count, parameter_count,
26 handler_table); 26 handler_table);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 bool BytecodePeepholeOptimizer::LastIsValid() const { 71 bool BytecodePeepholeOptimizer::LastIsValid() const {
72 return last_.bytecode() != Bytecode::kIllegal; 72 return last_.bytecode() != Bytecode::kIllegal;
73 } 73 }
74 74
75 void BytecodePeepholeOptimizer::SetLast(const BytecodeNode* const node) { 75 void BytecodePeepholeOptimizer::SetLast(const BytecodeNode* const node) {
76 // An action shouldn't leave a NOP as last bytecode unless it has 76 // An action shouldn't leave a NOP as last bytecode unless it has
77 // source position information. NOP without source information can 77 // source position information. NOP without source information can
78 // always be elided. 78 // always be elided.
79 DCHECK(node->bytecode() != Bytecode::kNop || node->source_info().is_valid()); 79 DCHECK(node->bytecode() != Bytecode::kNop || node->source_info().is_valid());
80 80 last_ = *node;
81 last_.Clone(node);
82 } 81 }
83 82
84 bool BytecodePeepholeOptimizer::CanElideLastBasedOnSourcePosition( 83 bool BytecodePeepholeOptimizer::CanElideLastBasedOnSourcePosition(
85 const BytecodeNode* const current) const { 84 const BytecodeNode* const current) const {
86 // 85 //
87 // The rules for allowing the elision of the last bytecode based 86 // The rules for allowing the elision of the last bytecode based
88 // on source position are: 87 // on source position are:
89 // 88 //
90 // C U R R E N T 89 // C U R R E N T
91 // +--------+--------+--------+ 90 // +--------+--------+--------+
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 #undef CASE 335 #undef CASE
337 default: 336 default:
338 UNREACHABLE(); 337 UNREACHABLE();
339 break; 338 break;
340 } 339 }
341 } 340 }
342 341
343 } // namespace interpreter 342 } // namespace interpreter
344 } // namespace internal 343 } // namespace internal
345 } // namespace v8 344 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698