OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 (info()->is_tracking_positions() || FLAG_trace_ic) | 178 (info()->is_tracking_positions() || FLAG_trace_ic) |
179 ? new (info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 179 ? new (info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
180 : new (info()->zone()) HOptimizedGraphBuilder(info()); | 180 : new (info()->zone()) HOptimizedGraphBuilder(info()); |
181 | 181 |
182 graph_ = graph_builder->CreateGraph(); | 182 graph_ = graph_builder->CreateGraph(); |
183 | 183 |
184 if (isolate()->has_pending_exception()) { | 184 if (isolate()->has_pending_exception()) { |
185 return FAILED; | 185 return FAILED; |
186 } | 186 } |
187 | 187 |
188 if (graph_ == NULL) return BAILED_OUT; | 188 if (graph_ == NULL) return FAILED; |
189 | 189 |
190 if (info()->dependencies()->HasAborted()) { | 190 if (info()->dependencies()->HasAborted()) { |
191 // Dependency has changed during graph creation. Let's try again later. | 191 // Dependency has changed during graph creation. Let's try again later. |
192 return RetryOptimization(kBailedOutDueToDependencyChange); | 192 return RetryOptimization(kBailedOutDueToDependencyChange); |
193 } | 193 } |
194 | 194 |
195 return SUCCEEDED; | 195 return SUCCEEDED; |
196 } | 196 } |
197 | 197 |
198 HCompilationJob::Status HCompilationJob::OptimizeGraphImpl() { | 198 HCompilationJob::Status HCompilationJob::OptimizeGraphImpl() { |
199 DCHECK(graph_ != NULL); | 199 DCHECK(graph_ != NULL); |
200 BailoutReason bailout_reason = kNoReason; | 200 BailoutReason bailout_reason = kNoReason; |
201 | 201 |
202 if (graph_->Optimize(&bailout_reason)) { | 202 if (graph_->Optimize(&bailout_reason)) { |
203 chunk_ = LChunk::NewChunk(graph_); | 203 chunk_ = LChunk::NewChunk(graph_); |
204 if (chunk_ != NULL) return SUCCEEDED; | 204 if (chunk_ != NULL) return SUCCEEDED; |
205 } else if (bailout_reason != kNoReason) { | 205 } else if (bailout_reason != kNoReason) { |
206 info()->AbortOptimization(bailout_reason); | 206 info()->AbortOptimization(bailout_reason); |
207 } | 207 } |
208 | 208 |
209 return BAILED_OUT; | 209 return FAILED; |
210 } | 210 } |
211 | 211 |
212 HCompilationJob::Status HCompilationJob::GenerateCodeImpl() { | 212 HCompilationJob::Status HCompilationJob::GenerateCodeImpl() { |
213 DCHECK(chunk_ != NULL); | 213 DCHECK(chunk_ != NULL); |
214 DCHECK(graph_ != NULL); | 214 DCHECK(graph_ != NULL); |
215 { | 215 { |
216 // Deferred handles reference objects that were accessible during | 216 // Deferred handles reference objects that were accessible during |
217 // graph creation. To make sure that we don't encounter inconsistencies | 217 // graph creation. To make sure that we don't encounter inconsistencies |
218 // between graph creation and code generation, we disallow accessing | 218 // between graph creation and code generation, we disallow accessing |
219 // objects through deferred handles during the latter, with exceptions. | 219 // objects through deferred handles during the latter, with exceptions. |
220 DisallowDeferredHandleDereference no_deferred_handle_deref; | 220 DisallowDeferredHandleDereference no_deferred_handle_deref; |
221 Handle<Code> optimized_code = chunk_->Codegen(); | 221 Handle<Code> optimized_code = chunk_->Codegen(); |
222 if (optimized_code.is_null()) { | 222 if (optimized_code.is_null()) { |
223 if (info()->bailout_reason() == kNoReason) { | 223 if (info()->bailout_reason() == kNoReason) { |
224 return AbortOptimization(kCodeGenerationFailed); | 224 return AbortOptimization(kCodeGenerationFailed); |
225 } | 225 } |
226 return BAILED_OUT; | 226 return FAILED; |
227 } | 227 } |
228 RegisterWeakObjectsInOptimizedCode(optimized_code); | 228 RegisterWeakObjectsInOptimizedCode(optimized_code); |
229 info()->SetCode(optimized_code); | 229 info()->SetCode(optimized_code); |
230 } | 230 } |
231 // Add to the weak list of optimized code objects. | 231 // Add to the weak list of optimized code objects. |
232 info()->context()->native_context()->AddOptimizedCode(*info()->code()); | 232 info()->context()->native_context()->AddOptimizedCode(*info()->code()); |
233 return SUCCEEDED; | 233 return SUCCEEDED; |
234 } | 234 } |
235 | 235 |
236 HBasicBlock::HBasicBlock(HGraph* graph) | 236 HBasicBlock::HBasicBlock(HGraph* graph) |
(...skipping 13492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13729 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13729 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13730 } | 13730 } |
13731 | 13731 |
13732 #ifdef DEBUG | 13732 #ifdef DEBUG |
13733 graph_->Verify(false); // No full verify. | 13733 graph_->Verify(false); // No full verify. |
13734 #endif | 13734 #endif |
13735 } | 13735 } |
13736 | 13736 |
13737 } // namespace internal | 13737 } // namespace internal |
13738 } // namespace v8 | 13738 } // namespace v8 |
OLD | NEW |