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/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 5455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5466 | 5466 |
5467 | 5467 |
5468 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5468 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
5469 DCHECK(!HasStackOverflow()); | 5469 DCHECK(!HasStackOverflow()); |
5470 DCHECK(current_block() != NULL); | 5470 DCHECK(current_block() != NULL); |
5471 DCHECK(current_block()->HasPredecessor()); | 5471 DCHECK(current_block()->HasPredecessor()); |
5472 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5472 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
5473 expr, current_info()->script(), top_info()); | 5473 expr, current_info()->script(), top_info()); |
5474 // We also have a stack overflow if the recursive compilation did. | 5474 // We also have a stack overflow if the recursive compilation did. |
5475 if (HasStackOverflow()) return; | 5475 if (HasStackOverflow()) return; |
5476 HFunctionLiteral* instr = | 5476 // Use the fast case closure allocation code that allocates in new |
5477 New<HFunctionLiteral>(shared_info, expr->pretenure()); | 5477 // space for nested functions that don't need literals cloning. |
| 5478 HConstant* shared_info_value = Add<HConstant>(shared_info); |
| 5479 HInstruction* instr; |
| 5480 if (!expr->pretenure() && shared_info->num_literals() == 0) { |
| 5481 FastNewClosureStub stub(isolate(), shared_info->language_mode(), |
| 5482 shared_info->kind()); |
| 5483 FastNewClosureDescriptor descriptor(isolate()); |
| 5484 HValue* values[] = {context(), shared_info_value}; |
| 5485 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
| 5486 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
| 5487 Vector<HValue*>(values, arraysize(values)), |
| 5488 NORMAL_CALL); |
| 5489 } else { |
| 5490 Add<HPushArguments>(shared_info_value); |
| 5491 Runtime::FunctionId function_id = |
| 5492 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; |
| 5493 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 1); |
| 5494 } |
5478 return ast_context()->ReturnInstruction(instr, expr->id()); | 5495 return ast_context()->ReturnInstruction(instr, expr->id()); |
5479 } | 5496 } |
5480 | 5497 |
5481 | 5498 |
5482 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { | 5499 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { |
5483 DCHECK(!HasStackOverflow()); | 5500 DCHECK(!HasStackOverflow()); |
5484 DCHECK(current_block() != NULL); | 5501 DCHECK(current_block() != NULL); |
5485 DCHECK(current_block()->HasPredecessor()); | 5502 DCHECK(current_block()->HasPredecessor()); |
5486 return Bailout(kClassLiteral); | 5503 return Bailout(kClassLiteral); |
5487 } | 5504 } |
(...skipping 8008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13496 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13513 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13497 } | 13514 } |
13498 | 13515 |
13499 #ifdef DEBUG | 13516 #ifdef DEBUG |
13500 graph_->Verify(false); // No full verify. | 13517 graph_->Verify(false); // No full verify. |
13501 #endif | 13518 #endif |
13502 } | 13519 } |
13503 | 13520 |
13504 } // namespace internal | 13521 } // namespace internal |
13505 } // namespace v8 | 13522 } // namespace v8 |
OLD | NEW |