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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5284 | 5284 |
5285 void HOptimizedGraphBuilder::VisitCaseClause(CaseClause* clause) { | 5285 void HOptimizedGraphBuilder::VisitCaseClause(CaseClause* clause) { |
5286 UNREACHABLE(); | 5286 UNREACHABLE(); |
5287 } | 5287 } |
5288 | 5288 |
5289 | 5289 |
5290 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5290 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
5291 DCHECK(!HasStackOverflow()); | 5291 DCHECK(!HasStackOverflow()); |
5292 DCHECK(current_block() != NULL); | 5292 DCHECK(current_block() != NULL); |
5293 DCHECK(current_block()->HasPredecessor()); | 5293 DCHECK(current_block()->HasPredecessor()); |
5294 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); | 5294 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
5295 if (shared_info.is_null()) { | 5295 expr, current_info()->script(), top_info()); |
5296 shared_info = | |
5297 Compiler::BuildFunctionInfo(expr, current_info()->script(), top_info()); | |
5298 } | |
5299 // We also have a stack overflow if the recursive compilation did. | 5296 // We also have a stack overflow if the recursive compilation did. |
5300 if (HasStackOverflow()) return; | 5297 if (HasStackOverflow()) return; |
5301 HFunctionLiteral* instr = | 5298 HFunctionLiteral* instr = |
5302 New<HFunctionLiteral>(shared_info, expr->pretenure()); | 5299 New<HFunctionLiteral>(shared_info, expr->pretenure()); |
5303 return ast_context()->ReturnInstruction(instr, expr->id()); | 5300 return ast_context()->ReturnInstruction(instr, expr->id()); |
5304 } | 5301 } |
5305 | 5302 |
5306 | 5303 |
5307 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { | 5304 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { |
5308 DCHECK(!HasStackOverflow()); | 5305 DCHECK(!HasStackOverflow()); |
(...skipping 6353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11662 } | 11659 } |
11663 | 11660 |
11664 | 11661 |
11665 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 11662 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
11666 FunctionDeclaration* declaration) { | 11663 FunctionDeclaration* declaration) { |
11667 VariableProxy* proxy = declaration->proxy(); | 11664 VariableProxy* proxy = declaration->proxy(); |
11668 Variable* variable = proxy->var(); | 11665 Variable* variable = proxy->var(); |
11669 switch (variable->location()) { | 11666 switch (variable->location()) { |
11670 case Variable::UNALLOCATED: { | 11667 case Variable::UNALLOCATED: { |
11671 globals_.Add(variable->name(), zone()); | 11668 globals_.Add(variable->name(), zone()); |
11672 Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo( | 11669 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( |
11673 declaration->fun(), current_info()->script(), top_info()); | 11670 declaration->fun(), current_info()->script(), top_info()); |
11674 // Check for stack-overflow exception. | 11671 // Check for stack-overflow exception. |
11675 if (function.is_null()) return SetStackOverflow(); | 11672 if (function.is_null()) return SetStackOverflow(); |
11676 globals_.Add(function, zone()); | 11673 globals_.Add(function, zone()); |
11677 return; | 11674 return; |
11678 } | 11675 } |
11679 case Variable::PARAMETER: | 11676 case Variable::PARAMETER: |
11680 case Variable::LOCAL: { | 11677 case Variable::LOCAL: { |
11681 CHECK_ALIVE(VisitForValue(declaration->fun())); | 11678 CHECK_ALIVE(VisitForValue(declaration->fun())); |
11682 HValue* value = Pop(); | 11679 HValue* value = Pop(); |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13207 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13204 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13208 } | 13205 } |
13209 | 13206 |
13210 #ifdef DEBUG | 13207 #ifdef DEBUG |
13211 graph_->Verify(false); // No full verify. | 13208 graph_->Verify(false); // No full verify. |
13212 #endif | 13209 #endif |
13213 } | 13210 } |
13214 | 13211 |
13215 } // namespace internal | 13212 } // namespace internal |
13216 } // namespace v8 | 13213 } // namespace v8 |
OLD | NEW |