| 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 5483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5494 | 5494 |
| 5495 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5495 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 5496 DCHECK(!HasStackOverflow()); | 5496 DCHECK(!HasStackOverflow()); |
| 5497 DCHECK(current_block() != NULL); | 5497 DCHECK(current_block() != NULL); |
| 5498 DCHECK(current_block()->HasPredecessor()); | 5498 DCHECK(current_block()->HasPredecessor()); |
| 5499 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5499 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
| 5500 expr, current_info()->script(), top_info()); | 5500 expr, current_info()->script(), top_info()); |
| 5501 // We also have a stack overflow if the recursive compilation did. | 5501 // We also have a stack overflow if the recursive compilation did. |
| 5502 if (HasStackOverflow()) return; | 5502 if (HasStackOverflow()) return; |
| 5503 // Use the fast case closure allocation code that allocates in new | 5503 // Use the fast case closure allocation code that allocates in new |
| 5504 // space for nested functions that don't need pretenuring. | 5504 // space for nested functions that don't need literals cloning. |
| 5505 HConstant* shared_info_value = Add<HConstant>(shared_info); | 5505 HConstant* shared_info_value = Add<HConstant>(shared_info); |
| 5506 HInstruction* instr; | 5506 HInstruction* instr; |
| 5507 if (!expr->pretenure()) { | 5507 if (!expr->pretenure() && shared_info->num_literals() == 0) { |
| 5508 FastNewClosureStub stub(isolate(), shared_info->language_mode(), | 5508 FastNewClosureStub stub(isolate(), shared_info->language_mode(), |
| 5509 shared_info->kind()); | 5509 shared_info->kind()); |
| 5510 FastNewClosureDescriptor descriptor(isolate()); | 5510 FastNewClosureDescriptor descriptor(isolate()); |
| 5511 HValue* values[] = {context(), shared_info_value}; | 5511 HValue* values[] = {context(), shared_info_value}; |
| 5512 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5512 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
| 5513 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5513 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
| 5514 Vector<HValue*>(values, arraysize(values)), | 5514 Vector<HValue*>(values, arraysize(values)), |
| 5515 NORMAL_CALL); | 5515 NORMAL_CALL); |
| 5516 } else { | 5516 } else { |
| 5517 Add<HPushArguments>(shared_info_value); | 5517 Add<HPushArguments>(shared_info_value); |
| (...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8435 // the target function if we don't already have it. | 8435 // the target function if we don't already have it. |
| 8436 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { | 8436 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
| 8437 TraceInline(target, caller, "could not generate deoptimization info"); | 8437 TraceInline(target, caller, "could not generate deoptimization info"); |
| 8438 return false; | 8438 return false; |
| 8439 } | 8439 } |
| 8440 // Remember that we inlined this function. This needs to be called right | 8440 // Remember that we inlined this function. This needs to be called right |
| 8441 // after the EnsureDeoptimizationSupport call so that the code flusher | 8441 // after the EnsureDeoptimizationSupport call so that the code flusher |
| 8442 // does not remove the code with the deoptimization support. | 8442 // does not remove the code with the deoptimization support. |
| 8443 top_info()->AddInlinedFunction(target_info.shared_info()); | 8443 top_info()->AddInlinedFunction(target_info.shared_info()); |
| 8444 | 8444 |
| 8445 // If target was lazily compiled, it's literals array may not yet be set up. | |
| 8446 JSFunction::EnsureLiterals(target); | |
| 8447 | |
| 8448 // ---------------------------------------------------------------- | 8445 // ---------------------------------------------------------------- |
| 8449 // After this point, we've made a decision to inline this function (so | 8446 // After this point, we've made a decision to inline this function (so |
| 8450 // TryInline should always return true). | 8447 // TryInline should always return true). |
| 8451 | 8448 |
| 8452 // Type-check the inlined function. | 8449 // Type-check the inlined function. |
| 8453 DCHECK(target_shared->has_deoptimization_support()); | 8450 DCHECK(target_shared->has_deoptimization_support()); |
| 8454 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8451 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
| 8455 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) | 8452 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) |
| 8456 .Run(); | 8453 .Run(); |
| 8457 | 8454 |
| (...skipping 5172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13630 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13627 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13631 } | 13628 } |
| 13632 | 13629 |
| 13633 #ifdef DEBUG | 13630 #ifdef DEBUG |
| 13634 graph_->Verify(false); // No full verify. | 13631 graph_->Verify(false); // No full verify. |
| 13635 #endif | 13632 #endif |
| 13636 } | 13633 } |
| 13637 | 13634 |
| 13638 } // namespace internal | 13635 } // namespace internal |
| 13639 } // namespace v8 | 13636 } // namespace v8 |
| OLD | NEW |