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

Side by Side Diff: src/hydrogen-gvn.cc

Issue 18068002: Use HInstructionIterator more broadly for hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 void HGlobalValueNumberer::ComputeBlockSideEffects() { 390 void HGlobalValueNumberer::ComputeBlockSideEffects() {
391 // The Analyze phase of GVN can be called multiple times. Clear loop side 391 // The Analyze phase of GVN can be called multiple times. Clear loop side
392 // effects before computing them to erase the contents from previous Analyze 392 // effects before computing them to erase the contents from previous Analyze
393 // passes. 393 // passes.
394 for (int i = 0; i < loop_side_effects_.length(); ++i) { 394 for (int i = 0; i < loop_side_effects_.length(); ++i) {
395 loop_side_effects_[i].RemoveAll(); 395 loop_side_effects_[i].RemoveAll();
396 } 396 }
397 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) { 397 for (int i = graph_->blocks()->length() - 1; i >= 0; --i) {
398 // Compute side effects for the block. 398 // Compute side effects for the block.
399 HBasicBlock* block = graph_->blocks()->at(i); 399 HBasicBlock* block = graph_->blocks()->at(i);
400 HInstruction* instr = block->first();
401 int id = block->block_id(); 400 int id = block->block_id();
402 GVNFlagSet side_effects; 401 GVNFlagSet side_effects;
403 while (instr != NULL) { 402 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
403 HInstruction* instr = it.Current();
404 side_effects.Add(instr->ChangesFlags()); 404 side_effects.Add(instr->ChangesFlags());
405 if (instr->IsSoftDeoptimize()) { 405 if (instr->IsSoftDeoptimize()) {
406 block_side_effects_[id].RemoveAll(); 406 block_side_effects_[id].RemoveAll();
407 side_effects.RemoveAll(); 407 side_effects.RemoveAll();
408 break; 408 break;
409 } 409 }
410 instr = instr->next();
411 } 410 }
412 block_side_effects_[id].Add(side_effects); 411 block_side_effects_[id].Add(side_effects);
413 412
414 // Loop headers are part of their loop. 413 // Loop headers are part of their loop.
415 if (block->IsLoopHeader()) { 414 if (block->IsLoopHeader()) {
416 loop_side_effects_[id].Add(side_effects); 415 loop_side_effects_[id].Add(side_effects);
417 } 416 }
418 417
419 // Propagate loop side effects upwards. 418 // Propagate loop side effects upwards.
420 if (block->HasParentLoopHeader()) { 419 if (block->HasParentLoopHeader()) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 dominated); 847 dominated);
849 successor_map->Kill(side_effects_on_all_paths); 848 successor_map->Kill(side_effects_on_all_paths);
850 successor_dominators->Kill(side_effects_on_all_paths); 849 successor_dominators->Kill(side_effects_on_all_paths);
851 } 850 }
852 } 851 }
853 current = next; 852 current = next;
854 } 853 }
855 } 854 }
856 855
857 } } // namespace v8::internal 856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698