| 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 5520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5531 | 5531 |
| 5532 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5532 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 5533 DCHECK(!HasStackOverflow()); | 5533 DCHECK(!HasStackOverflow()); |
| 5534 DCHECK(current_block() != NULL); | 5534 DCHECK(current_block() != NULL); |
| 5535 DCHECK(current_block()->HasPredecessor()); | 5535 DCHECK(current_block()->HasPredecessor()); |
| 5536 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5536 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
| 5537 expr, current_info()->script(), top_info()); | 5537 expr, current_info()->script(), top_info()); |
| 5538 // We also have a stack overflow if the recursive compilation did. | 5538 // We also have a stack overflow if the recursive compilation did. |
| 5539 if (HasStackOverflow()) return; | 5539 if (HasStackOverflow()) return; |
| 5540 // Use the fast case closure allocation code that allocates in new | 5540 // Use the fast case closure allocation code that allocates in new |
| 5541 // space for nested functions that don't need pretenuring. | 5541 // space for nested functions that don't need literals cloning. |
| 5542 HConstant* shared_info_value = Add<HConstant>(shared_info); | 5542 HConstant* shared_info_value = Add<HConstant>(shared_info); |
| 5543 HInstruction* instr; | 5543 HInstruction* instr; |
| 5544 if (!expr->pretenure()) { | 5544 if (!expr->pretenure() && shared_info->num_literals() == 0) { |
| 5545 FastNewClosureStub stub(isolate(), shared_info->language_mode(), | 5545 FastNewClosureStub stub(isolate(), shared_info->language_mode(), |
| 5546 shared_info->kind()); | 5546 shared_info->kind()); |
| 5547 FastNewClosureDescriptor descriptor(isolate()); | 5547 FastNewClosureDescriptor descriptor(isolate()); |
| 5548 HValue* values[] = {context(), shared_info_value}; | 5548 HValue* values[] = {context(), shared_info_value}; |
| 5549 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5549 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
| 5550 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5550 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
| 5551 Vector<HValue*>(values, arraysize(values)), | 5551 Vector<HValue*>(values, arraysize(values)), |
| 5552 NORMAL_CALL); | 5552 NORMAL_CALL); |
| 5553 } else { | 5553 } else { |
| 5554 Add<HPushArguments>(shared_info_value); | 5554 Add<HPushArguments>(shared_info_value); |
| (...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8472 // the target function if we don't already have it. | 8472 // the target function if we don't already have it. |
| 8473 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { | 8473 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
| 8474 TraceInline(target, caller, "could not generate deoptimization info"); | 8474 TraceInline(target, caller, "could not generate deoptimization info"); |
| 8475 return false; | 8475 return false; |
| 8476 } | 8476 } |
| 8477 // Remember that we inlined this function. This needs to be called right | 8477 // Remember that we inlined this function. This needs to be called right |
| 8478 // after the EnsureDeoptimizationSupport call so that the code flusher | 8478 // after the EnsureDeoptimizationSupport call so that the code flusher |
| 8479 // does not remove the code with the deoptimization support. | 8479 // does not remove the code with the deoptimization support. |
| 8480 top_info()->AddInlinedFunction(target_info.shared_info()); | 8480 top_info()->AddInlinedFunction(target_info.shared_info()); |
| 8481 | 8481 |
| 8482 // If target was lazily compiled, it's literals array may not yet be set up. | |
| 8483 JSFunction::EnsureLiterals(target); | |
| 8484 | |
| 8485 // ---------------------------------------------------------------- | 8482 // ---------------------------------------------------------------- |
| 8486 // After this point, we've made a decision to inline this function (so | 8483 // After this point, we've made a decision to inline this function (so |
| 8487 // TryInline should always return true). | 8484 // TryInline should always return true). |
| 8488 | 8485 |
| 8489 // Type-check the inlined function. | 8486 // Type-check the inlined function. |
| 8490 DCHECK(target_shared->has_deoptimization_support()); | 8487 DCHECK(target_shared->has_deoptimization_support()); |
| 8491 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8488 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
| 8492 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) | 8489 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) |
| 8493 .Run(); | 8490 .Run(); |
| 8494 | 8491 |
| (...skipping 5163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13658 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13655 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13659 } | 13656 } |
| 13660 | 13657 |
| 13661 #ifdef DEBUG | 13658 #ifdef DEBUG |
| 13662 graph_->Verify(false); // No full verify. | 13659 graph_->Verify(false); // No full verify. |
| 13663 #endif | 13660 #endif |
| 13664 } | 13661 } |
| 13665 | 13662 |
| 13666 } // namespace internal | 13663 } // namespace internal |
| 13667 } // namespace v8 | 13664 } // namespace v8 |
| OLD | NEW |