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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5219 UNREACHABLE(); | 5219 UNREACHABLE(); |
5220 } | 5220 } |
5221 | 5221 |
5222 | 5222 |
5223 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5223 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
5224 ASSERT(!HasStackOverflow()); | 5224 ASSERT(!HasStackOverflow()); |
5225 ASSERT(current_block() != NULL); | 5225 ASSERT(current_block() != NULL); |
5226 ASSERT(current_block()->HasPredecessor()); | 5226 ASSERT(current_block()->HasPredecessor()); |
5227 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); | 5227 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); |
5228 if (shared_info.is_null()) { | 5228 if (shared_info.is_null()) { |
5229 shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script()); | 5229 shared_info = |
| 5230 Compiler::BuildFunctionInfo(expr, current_info()->script(), top_info()); |
5230 } | 5231 } |
5231 // We also have a stack overflow if the recursive compilation did. | 5232 // We also have a stack overflow if the recursive compilation did. |
5232 if (HasStackOverflow()) return; | 5233 if (HasStackOverflow()) return; |
5233 HFunctionLiteral* instr = | 5234 HFunctionLiteral* instr = |
5234 New<HFunctionLiteral>(shared_info, expr->pretenure()); | 5235 New<HFunctionLiteral>(shared_info, expr->pretenure()); |
5235 return ast_context()->ReturnInstruction(instr, expr->id()); | 5236 return ast_context()->ReturnInstruction(instr, expr->id()); |
5236 } | 5237 } |
5237 | 5238 |
5238 | 5239 |
5239 void HOptimizedGraphBuilder::VisitNativeFunctionLiteral( | 5240 void HOptimizedGraphBuilder::VisitNativeFunctionLiteral( |
(...skipping 5992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11232 | 11233 |
11233 | 11234 |
11234 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 11235 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
11235 FunctionDeclaration* declaration) { | 11236 FunctionDeclaration* declaration) { |
11236 VariableProxy* proxy = declaration->proxy(); | 11237 VariableProxy* proxy = declaration->proxy(); |
11237 Variable* variable = proxy->var(); | 11238 Variable* variable = proxy->var(); |
11238 switch (variable->location()) { | 11239 switch (variable->location()) { |
11239 case Variable::UNALLOCATED: { | 11240 case Variable::UNALLOCATED: { |
11240 globals_.Add(variable->name(), zone()); | 11241 globals_.Add(variable->name(), zone()); |
11241 Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo( | 11242 Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo( |
11242 declaration->fun(), current_info()->script()); | 11243 declaration->fun(), current_info()->script(), top_info()); |
11243 // Check for stack-overflow exception. | 11244 // Check for stack-overflow exception. |
11244 if (function.is_null()) return SetStackOverflow(); | 11245 if (function.is_null()) return SetStackOverflow(); |
11245 globals_.Add(function, zone()); | 11246 globals_.Add(function, zone()); |
11246 return; | 11247 return; |
11247 } | 11248 } |
11248 case Variable::PARAMETER: | 11249 case Variable::PARAMETER: |
11249 case Variable::LOCAL: { | 11250 case Variable::LOCAL: { |
11250 CHECK_ALIVE(VisitForValue(declaration->fun())); | 11251 CHECK_ALIVE(VisitForValue(declaration->fun())); |
11251 HValue* value = Pop(); | 11252 HValue* value = Pop(); |
11252 BindIfLive(variable, value); | 11253 BindIfLive(variable, value); |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12473 if (ShouldProduceTraceOutput()) { | 12474 if (ShouldProduceTraceOutput()) { |
12474 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12475 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12475 } | 12476 } |
12476 | 12477 |
12477 #ifdef DEBUG | 12478 #ifdef DEBUG |
12478 graph_->Verify(false); // No full verify. | 12479 graph_->Verify(false); // No full verify. |
12479 #endif | 12480 #endif |
12480 } | 12481 } |
12481 | 12482 |
12482 } } // namespace v8::internal | 12483 } } // namespace v8::internal |
OLD | NEW |