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 <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #undef DEF_VISIT | 107 #undef DEF_VISIT |
108 | 108 |
109 #define DEF_VISIT(type) \ | 109 #define DEF_VISIT(type) \ |
110 void Visit##type(type* node) override { \ | 110 void Visit##type(type* node) override { \ |
111 HOptimizedGraphBuilder::Visit##type(node); \ | 111 HOptimizedGraphBuilder::Visit##type(node); \ |
112 } | 112 } |
113 DECLARATION_NODE_LIST(DEF_VISIT) | 113 DECLARATION_NODE_LIST(DEF_VISIT) |
114 #undef DEF_VISIT | 114 #undef DEF_VISIT |
115 }; | 115 }; |
116 | 116 |
117 HCompilationJob::Status HCompilationJob::PrepareJobImpl() { | 117 HCompilationJob::Status HCompilationJob::CreateGraphImpl() { |
118 if (!isolate()->use_crankshaft() || | 118 if (!isolate()->use_crankshaft() || |
119 info()->shared_info()->dont_crankshaft()) { | 119 info()->shared_info()->dont_crankshaft()) { |
120 // Crankshaft is entirely disabled. | 120 // Crankshaft is entirely disabled. |
121 return FAILED; | 121 return FAILED; |
122 } | 122 } |
123 | 123 |
124 // Optimization requires a version of fullcode with deoptimization support. | 124 // Optimization requires a version of fullcode with deoptimization support. |
125 // Recompile the unoptimized version of the code if the current version | 125 // Recompile the unoptimized version of the code if the current version |
126 // doesn't have deoptimization support already. | 126 // doesn't have deoptimization support already. |
127 // Otherwise, if we are gathering compilation time and space statistics | 127 // Otherwise, if we are gathering compilation time and space statistics |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (graph_ == NULL) return FAILED; | 196 if (graph_ == NULL) return FAILED; |
197 | 197 |
198 if (info()->dependencies()->HasAborted()) { | 198 if (info()->dependencies()->HasAborted()) { |
199 // Dependency has changed during graph creation. Let's try again later. | 199 // Dependency has changed during graph creation. Let's try again later. |
200 return RetryOptimization(kBailedOutDueToDependencyChange); | 200 return RetryOptimization(kBailedOutDueToDependencyChange); |
201 } | 201 } |
202 | 202 |
203 return SUCCEEDED; | 203 return SUCCEEDED; |
204 } | 204 } |
205 | 205 |
206 HCompilationJob::Status HCompilationJob::ExecuteJobImpl() { | 206 HCompilationJob::Status HCompilationJob::OptimizeGraphImpl() { |
207 DCHECK(graph_ != NULL); | 207 DCHECK(graph_ != NULL); |
208 BailoutReason bailout_reason = kNoReason; | 208 BailoutReason bailout_reason = kNoReason; |
209 | 209 |
210 if (graph_->Optimize(&bailout_reason)) { | 210 if (graph_->Optimize(&bailout_reason)) { |
211 chunk_ = LChunk::NewChunk(graph_); | 211 chunk_ = LChunk::NewChunk(graph_); |
212 if (chunk_ != NULL) return SUCCEEDED; | 212 if (chunk_ != NULL) return SUCCEEDED; |
213 } else if (bailout_reason != kNoReason) { | 213 } else if (bailout_reason != kNoReason) { |
214 info()->AbortOptimization(bailout_reason); | 214 info()->AbortOptimization(bailout_reason); |
215 } | 215 } |
216 | 216 |
217 return FAILED; | 217 return FAILED; |
218 } | 218 } |
219 | 219 |
220 HCompilationJob::Status HCompilationJob::FinalizeJobImpl() { | 220 HCompilationJob::Status HCompilationJob::GenerateCodeImpl() { |
221 DCHECK(chunk_ != NULL); | 221 DCHECK(chunk_ != NULL); |
222 DCHECK(graph_ != NULL); | 222 DCHECK(graph_ != NULL); |
223 { | 223 { |
224 // Deferred handles reference objects that were accessible during | 224 // Deferred handles reference objects that were accessible during |
225 // graph creation. To make sure that we don't encounter inconsistencies | 225 // graph creation. To make sure that we don't encounter inconsistencies |
226 // between graph creation and code generation, we disallow accessing | 226 // between graph creation and code generation, we disallow accessing |
227 // objects through deferred handles during the latter, with exceptions. | 227 // objects through deferred handles during the latter, with exceptions. |
228 DisallowDeferredHandleDereference no_deferred_handle_deref; | 228 DisallowDeferredHandleDereference no_deferred_handle_deref; |
229 Handle<Code> optimized_code = chunk_->Codegen(); | 229 Handle<Code> optimized_code = chunk_->Codegen(); |
230 if (optimized_code.is_null()) { | 230 if (optimized_code.is_null()) { |
(...skipping 13201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13432 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13432 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13433 } | 13433 } |
13434 | 13434 |
13435 #ifdef DEBUG | 13435 #ifdef DEBUG |
13436 graph_->Verify(false); // No full verify. | 13436 graph_->Verify(false); // No full verify. |
13437 #endif | 13437 #endif |
13438 } | 13438 } |
13439 | 13439 |
13440 } // namespace internal | 13440 } // namespace internal |
13441 } // namespace v8 | 13441 } // namespace v8 |
OLD | NEW |