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

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

Issue 2038323002: [interpreter] Filter expression positions at source. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0060-source-position-testing
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool BytecodePeepholeOptimizer::LastBytecodePutsNameInAccumulator() const { 89 bool BytecodePeepholeOptimizer::LastBytecodePutsNameInAccumulator() const {
90 DCHECK(LastIsValid()); 90 DCHECK(LastIsValid());
91 return (last_.bytecode() == Bytecode::kTypeOf || 91 return (last_.bytecode() == Bytecode::kTypeOf ||
92 last_.bytecode() == Bytecode::kToName || 92 last_.bytecode() == Bytecode::kToName ||
93 (last_.bytecode() == Bytecode::kLdaConstant && 93 (last_.bytecode() == Bytecode::kLdaConstant &&
94 GetConstantForIndexOperand(&last_, 0)->IsName())); 94 GetConstantForIndexOperand(&last_, 0)->IsName()));
95 } 95 }
96 96
97 void BytecodePeepholeOptimizer::TryToRemoveLastExpressionPosition( 97 void BytecodePeepholeOptimizer::TryToRemoveLastExpressionPosition(
98 const BytecodeNode* const current) { 98 const BytecodeNode* const current) {
99 if (current->source_info().is_statement() && 99 if (current->source_info().is_valid() &&
100 last_.source_info().is_expression() && 100 last_.source_info().is_expression() &&
101 Bytecodes::IsWithoutExternalSideEffects(last_.bytecode())) { 101 Bytecodes::IsWithoutExternalSideEffects(last_.bytecode())) {
102 // The last bytecode has been marked as expression. It has no 102 // The last bytecode has been marked as expression. It has no
103 // external effects so can't throw and the current bytecode is a 103 // external effects so can't throw and the current bytecode is a
104 // source position. Remove the expression position on the last 104 // source position. Remove the expression position on the last
105 // bytecode to open up potential peephole optimizations and to 105 // bytecode to open up potential peephole optimizations and to
106 // save the memory and perf cost of storing the unneeded 106 // save the memory and perf cost of storing the unneeded
107 // expression position. 107 // expression position.
108 last_.source_info().set_invalid(); 108 last_.source_info().set_invalid();
109 } 109 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 next_stage_->Write(&last_); 316 next_stage_->Write(&last_);
317 InvalidateLast(); 317 InvalidateLast();
318 } 318 }
319 } 319 }
320 return current; 320 return current;
321 } 321 }
322 322
323 } // namespace interpreter 323 } // namespace interpreter
324 } // namespace internal 324 } // namespace internal
325 } // namespace v8 325 } // 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