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

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

Issue 2795183002: [Interpreter] Move ToBoolean elision in BytecodeGenerator. (Closed)
Patch Set: tests Created 3 years, 8 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-generator.cc ('k') | src/interpreter/bytecode-peephole-table.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 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 {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 next_stage()->Write(last()); 262 next_stage()->Write(last());
263 InvalidateLast(); 263 InvalidateLast();
264 } 264 }
265 265
266 void BytecodePeepholeOptimizer::UpdateLastJumpAction( 266 void BytecodePeepholeOptimizer::UpdateLastJumpAction(
267 BytecodeNode* const node, const PeepholeActionAndData* action_data) { 267 BytecodeNode* const node, const PeepholeActionAndData* action_data) {
268 DCHECK(!LastIsValid()); 268 DCHECK(!LastIsValid());
269 DCHECK(Bytecodes::IsJump(node->bytecode())); 269 DCHECK(Bytecodes::IsJump(node->bytecode()));
270 } 270 }
271 271
272 void BytecodePeepholeOptimizer::ChangeJumpBytecodeAction(
273 BytecodeNode* const node, const PeepholeActionAndData* action_data) {
274 DCHECK(LastIsValid());
275 DCHECK(Bytecodes::IsJump(node->bytecode()));
276
277 next_stage()->Write(last());
278 InvalidateLast();
279 node->replace_bytecode(action_data->bytecode);
280 }
281
282 void BytecodePeepholeOptimizer::ElideLastBeforeJumpAction( 272 void BytecodePeepholeOptimizer::ElideLastBeforeJumpAction(
283 BytecodeNode* const node, const PeepholeActionAndData* action_data) { 273 BytecodeNode* const node, const PeepholeActionAndData* action_data) {
284 DCHECK(LastIsValid()); 274 DCHECK(LastIsValid());
285 DCHECK(Bytecodes::IsJump(node->bytecode())); 275 DCHECK(Bytecodes::IsJump(node->bytecode()));
286 276
287 if (!CanElideLastBasedOnSourcePosition(node)) { 277 if (!CanElideLastBasedOnSourcePosition(node)) {
288 next_stage()->Write(last()); 278 next_stage()->Write(last());
289 } else if (!node->source_info().is_valid()) { 279 } else if (!node->source_info().is_valid()) {
290 node->set_source_info(last()->source_info()); 280 node->set_source_info(last()->source_info());
291 } 281 }
(...skipping 17 matching lines...) Expand all
309 #undef CASE 299 #undef CASE
310 default: 300 default:
311 UNREACHABLE(); 301 UNREACHABLE();
312 break; 302 break;
313 } 303 }
314 } 304 }
315 305
316 } // namespace interpreter 306 } // namespace interpreter
317 } // namespace internal 307 } // namespace internal
318 } // namespace v8 308 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/interpreter/bytecode-peephole-table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698