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

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

Issue 24957003: Add tool to visualize machine code/lithium. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Final polish before review Created 7 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 | Annotate | Revision Log
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ASSERT(graph->osr() == NULL); 47 ASSERT(graph->osr() == NULL);
48 48
49 // remember this builder as the one OSR builder in the graph. 49 // remember this builder as the one OSR builder in the graph.
50 graph->set_osr(this); 50 graph->set_osr(this);
51 51
52 HBasicBlock* non_osr_entry = graph->CreateBasicBlock(); 52 HBasicBlock* non_osr_entry = graph->CreateBasicBlock();
53 osr_entry_ = graph->CreateBasicBlock(); 53 osr_entry_ = graph->CreateBasicBlock();
54 HValue* true_value = graph->GetConstantTrue(); 54 HValue* true_value = graph->GetConstantTrue();
55 HBranch* test = builder_->New<HBranch>(true_value, ToBooleanStub::Types(), 55 HBranch* test = builder_->New<HBranch>(true_value, ToBooleanStub::Types(),
56 non_osr_entry, osr_entry_); 56 non_osr_entry, osr_entry_);
57 builder_->current_block()->Finish(test); 57 builder_->FinishCurrentBlock(test);
58 58
59 HBasicBlock* loop_predecessor = graph->CreateBasicBlock(); 59 HBasicBlock* loop_predecessor = graph->CreateBasicBlock();
60 non_osr_entry->Goto(loop_predecessor); 60 builder_->Goto(non_osr_entry, loop_predecessor);
61 61
62 builder_->set_current_block(osr_entry_); 62 builder_->set_current_block(osr_entry_);
63 osr_entry_->set_osr_entry(); 63 osr_entry_->set_osr_entry();
64 BailoutId osr_entry_id = statement->OsrEntryId(); 64 BailoutId osr_entry_id = statement->OsrEntryId();
65 65
66 HEnvironment *environment = builder_->environment(); 66 HEnvironment *environment = builder_->environment();
67 int first_expression_index = environment->first_expression_index(); 67 int first_expression_index = environment->first_expression_index();
68 int length = environment->length(); 68 int length = environment->length();
69 osr_values_ = new(zone) ZoneList<HUnknownOSRValue*>(length, zone); 69 osr_values_ = new(zone) ZoneList<HUnknownOSRValue*>(length, zone);
70 70
(...skipping 19 matching lines...) Expand all
90 90
91 // Keep a copy of the old environment, since the OSR values need it 91 // Keep a copy of the old environment, since the OSR values need it
92 // to figure out where exactly they are located in the unoptimized frame. 92 // to figure out where exactly they are located in the unoptimized frame.
93 environment = environment->Copy(); 93 environment = environment->Copy();
94 builder_->current_block()->UpdateEnvironment(environment); 94 builder_->current_block()->UpdateEnvironment(environment);
95 95
96 builder_->Add<HSimulate>(osr_entry_id); 96 builder_->Add<HSimulate>(osr_entry_id);
97 builder_->Add<HOsrEntry>(osr_entry_id); 97 builder_->Add<HOsrEntry>(osr_entry_id);
98 HContext* context = builder_->Add<HContext>(); 98 HContext* context = builder_->Add<HContext>();
99 environment->BindContext(context); 99 environment->BindContext(context);
100 builder_->current_block()->Goto(loop_predecessor); 100 builder_->Goto(loop_predecessor);
101 loop_predecessor->SetJoinId(statement->EntryId()); 101 loop_predecessor->SetJoinId(statement->EntryId());
102 builder_->set_current_block(loop_predecessor); 102 builder_->set_current_block(loop_predecessor);
103 103
104 // Create the final loop entry 104 // Create the final loop entry
105 osr_loop_entry_ = builder_->BuildLoopEntry(); 105 osr_loop_entry_ = builder_->BuildLoopEntry();
106 return osr_loop_entry_; 106 return osr_loop_entry_;
107 } 107 }
108 108
109 109
110 void HOsrBuilder::FinishGraph() { 110 void HOsrBuilder::FinishGraph() {
111 // do nothing for now. 111 // do nothing for now.
112 } 112 }
113 113
114 114
115 void HOsrBuilder::FinishOsrValues() { 115 void HOsrBuilder::FinishOsrValues() {
116 const ZoneList<HPhi*>* phis = osr_loop_entry_->phis(); 116 const ZoneList<HPhi*>* phis = osr_loop_entry_->phis();
117 for (int j = 0; j < phis->length(); j++) { 117 for (int j = 0; j < phis->length(); j++) {
118 HPhi* phi = phis->at(j); 118 HPhi* phi = phis->at(j);
119 if (phi->HasMergedIndex()) { 119 if (phi->HasMergedIndex()) {
120 osr_values_->at(phi->merged_index())->set_incoming_value(phi); 120 osr_values_->at(phi->merged_index())->set_incoming_value(phi);
121 } 121 }
122 } 122 }
123 } 123 }
124 124
125 } } // namespace v8::internal 125 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698