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

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

Issue 25039003: Only call into the HOsrBuilder if required for OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nits 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
« no previous file with comments | « src/hydrogen-osr.h ('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 19 matching lines...) Expand all
30 30
31 namespace v8 { 31 namespace v8 {
32 namespace internal { 32 namespace internal {
33 33
34 // True iff. we are compiling for OSR and the statement is the entry. 34 // True iff. we are compiling for OSR and the statement is the entry.
35 bool HOsrBuilder::HasOsrEntryAt(IterationStatement* statement) { 35 bool HOsrBuilder::HasOsrEntryAt(IterationStatement* statement) {
36 return statement->OsrEntryId() == builder_->current_info()->osr_ast_id(); 36 return statement->OsrEntryId() == builder_->current_info()->osr_ast_id();
37 } 37 }
38 38
39 39
40 // Build a new loop header block and set it as the current block. 40 HBasicBlock* HOsrBuilder::BuildOsrLoopEntry(IterationStatement* statement) {
41 HBasicBlock *HOsrBuilder::BuildLoopEntry() { 41 ASSERT(HasOsrEntryAt(statement));
42 HBasicBlock* loop_entry = builder_->CreateLoopHeaderBlock();
43 builder_->current_block()->Goto(loop_entry);
44 builder_->set_current_block(loop_entry);
45 return loop_entry;
46 }
47
48
49 HBasicBlock* HOsrBuilder::BuildPossibleOsrLoopEntry(
50 IterationStatement* statement) {
51 // Check if there is an OSR here first.
52 if (!HasOsrEntryAt(statement)) return BuildLoopEntry();
53 42
54 Zone* zone = builder_->zone(); 43 Zone* zone = builder_->zone();
55 HGraph* graph = builder_->graph(); 44 HGraph* graph = builder_->graph();
56 45
57 // only one OSR point per compile is allowed. 46 // only one OSR point per compile is allowed.
58 ASSERT(graph->osr() == NULL); 47 ASSERT(graph->osr() == NULL);
59 48
60 // remember this builder as the one OSR builder in the graph. 49 // remember this builder as the one OSR builder in the graph.
61 graph->set_osr(this); 50 graph->set_osr(this);
62 51
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 95
107 builder_->Add<HSimulate>(osr_entry_id); 96 builder_->Add<HSimulate>(osr_entry_id);
108 builder_->Add<HOsrEntry>(osr_entry_id); 97 builder_->Add<HOsrEntry>(osr_entry_id);
109 HContext* context = builder_->Add<HContext>(); 98 HContext* context = builder_->Add<HContext>();
110 environment->BindContext(context); 99 environment->BindContext(context);
111 builder_->current_block()->Goto(loop_predecessor); 100 builder_->current_block()->Goto(loop_predecessor);
112 loop_predecessor->SetJoinId(statement->EntryId()); 101 loop_predecessor->SetJoinId(statement->EntryId());
113 builder_->set_current_block(loop_predecessor); 102 builder_->set_current_block(loop_predecessor);
114 103
115 // Create the final loop entry 104 // Create the final loop entry
116 osr_loop_entry_ = BuildLoopEntry(); 105 osr_loop_entry_ = builder_->BuildLoopEntry();
117 return osr_loop_entry_; 106 return osr_loop_entry_;
118 } 107 }
119 108
120 109
121 void HOsrBuilder::FinishGraph() { 110 void HOsrBuilder::FinishGraph() {
122 // do nothing for now. 111 // do nothing for now.
123 } 112 }
124 113
125 114
126 void HOsrBuilder::FinishOsrValues() { 115 void HOsrBuilder::FinishOsrValues() {
127 const ZoneList<HPhi*>* phis = osr_loop_entry_->phis(); 116 const ZoneList<HPhi*>* phis = osr_loop_entry_->phis();
128 for (int j = 0; j < phis->length(); j++) { 117 for (int j = 0; j < phis->length(); j++) {
129 HPhi* phi = phis->at(j); 118 HPhi* phi = phis->at(j);
130 if (phi->HasMergedIndex()) { 119 if (phi->HasMergedIndex()) {
131 osr_values_->at(phi->merged_index())->set_incoming_value(phi); 120 osr_values_->at(phi->merged_index())->set_incoming_value(phi);
132 } 121 }
133 } 122 }
134 } 123 }
135 124
136 } } // namespace v8::internal 125 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-osr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698