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

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

Issue 2048203002: [interpreter] Minor clean-up of BytecodeSourceInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0066-suppress
Patch Set: Rebase 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-pipeline.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-peephole-optimizer.h" 5 #include "src/interpreter/bytecode-peephole-optimizer.h"
6 6
7 #include "src/interpreter/constant-array-builder.h" 7 #include "src/interpreter/constant-array-builder.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 10
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // Preserve the source information by replacing the current bytecode 290 // Preserve the source information by replacing the current bytecode
291 // with a no op bytecode. 291 // with a no op bytecode.
292 current->set_bytecode(Bytecode::kNop); 292 current->set_bytecode(Bytecode::kNop);
293 } else { 293 } else {
294 current = nullptr; 294 current = nullptr;
295 } 295 }
296 return current; 296 return current;
297 } 297 }
298 298
299 if (CanElideLast(current) && CanElideLastBasedOnSourcePosition(current)) { 299 if (CanElideLast(current) && CanElideLastBasedOnSourcePosition(current)) {
300 current->source_info().Update(last_.source_info()); 300 if (last_.source_info().is_valid()) {
301 // Current can not be valid per CanElideLastBasedOnSourcePosition().
302 current->source_info().Clone(last_.source_info());
303 }
301 InvalidateLast(); 304 InvalidateLast();
302 return current; 305 return current;
303 } 306 }
304 307
305 return current; 308 return current;
306 } 309 }
307 310
308 BytecodeNode* BytecodePeepholeOptimizer::OptimizeAndEmitLast( 311 BytecodeNode* BytecodePeepholeOptimizer::OptimizeAndEmitLast(
309 BytecodeNode* current) { 312 BytecodeNode* current) {
310 // Attempt optimization if there is an earlier node to optimize with. 313 // Attempt optimization if there is an earlier node to optimize with.
311 if (LastIsValid()) { 314 if (LastIsValid()) {
312 current = Optimize(current); 315 current = Optimize(current);
313 // Only output the last node if it wasn't invalidated by the optimization. 316 // Only output the last node if it wasn't invalidated by the optimization.
314 if (LastIsValid()) { 317 if (LastIsValid()) {
315 next_stage_->Write(&last_); 318 next_stage_->Write(&last_);
316 InvalidateLast(); 319 InvalidateLast();
317 } 320 }
318 } 321 }
319 return current; 322 return current;
320 } 323 }
321 324
322 } // namespace interpreter 325 } // namespace interpreter
323 } // namespace internal 326 } // namespace internal
324 } // namespace v8 327 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-pipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698