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

Side by Side Diff: src/hydrogen-infer-types.cc

Issue 1405363003: Move Hydrogen and Lithium to src/crankshaft/ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 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
« no previous file with comments | « src/hydrogen-infer-types.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/hydrogen-infer-types.h"
6
7 namespace v8 {
8 namespace internal {
9
10 void HInferTypesPhase::InferTypes(int from_inclusive, int to_inclusive) {
11 for (int i = from_inclusive; i <= to_inclusive; ++i) {
12 HBasicBlock* block = graph()->blocks()->at(i);
13
14 const ZoneList<HPhi*>* phis = block->phis();
15 for (int j = 0; j < phis->length(); j++) {
16 phis->at(j)->UpdateInferredType();
17 }
18
19 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
20 it.Current()->UpdateInferredType();
21 }
22
23 if (block->IsLoopHeader()) {
24 HBasicBlock* last_back_edge =
25 block->loop_information()->GetLastBackEdge();
26 InferTypes(i + 1, last_back_edge->block_id());
27 // Skip all blocks already processed by the recursive call.
28 i = last_back_edge->block_id();
29 // Update phis of the loop header now after the whole loop body is
30 // guaranteed to be processed.
31 for (int j = 0; j < block->phis()->length(); ++j) {
32 HPhi* phi = block->phis()->at(j);
33 worklist_.Add(phi, zone());
34 in_worklist_.Add(phi->id());
35 }
36 while (!worklist_.is_empty()) {
37 HValue* current = worklist_.RemoveLast();
38 in_worklist_.Remove(current->id());
39 if (current->UpdateInferredType()) {
40 for (HUseIterator it(current->uses()); !it.Done(); it.Advance()) {
41 HValue* use = it.value();
42 if (!in_worklist_.Contains(use->id())) {
43 in_worklist_.Add(use->id());
44 worklist_.Add(use, zone());
45 }
46 }
47 }
48 }
49 DCHECK(in_worklist_.IsEmpty());
50 }
51 }
52 }
53
54 } // namespace internal
55 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen-infer-types.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698