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 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8446 // the target function if we don't already have it. | 8446 // the target function if we don't already have it. |
8447 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { | 8447 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
8448 TraceInline(target, caller, "could not generate deoptimization info"); | 8448 TraceInline(target, caller, "could not generate deoptimization info"); |
8449 return false; | 8449 return false; |
8450 } | 8450 } |
8451 // Remember that we inlined this function. This needs to be called right | 8451 // Remember that we inlined this function. This needs to be called right |
8452 // after the EnsureDeoptimizationSupport call so that the code flusher | 8452 // after the EnsureDeoptimizationSupport call so that the code flusher |
8453 // does not remove the code with the deoptimization support. | 8453 // does not remove the code with the deoptimization support. |
8454 top_info()->AddInlinedFunction(target_info.shared_info()); | 8454 top_info()->AddInlinedFunction(target_info.shared_info()); |
8455 | 8455 |
8456 // If target was lazily compiled, it's literals array may not yet be set up. | |
8457 JSFunction::EnsureLiterals(target); | |
8458 | |
8459 // ---------------------------------------------------------------- | 8456 // ---------------------------------------------------------------- |
8460 // After this point, we've made a decision to inline this function (so | 8457 // After this point, we've made a decision to inline this function (so |
8461 // TryInline should always return true). | 8458 // TryInline should always return true). |
8462 | 8459 |
8463 // Type-check the inlined function. | 8460 // Type-check the inlined function. |
8464 DCHECK(target_shared->has_deoptimization_support()); | 8461 DCHECK(target_shared->has_deoptimization_support()); |
8465 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8462 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
8466 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) | 8463 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) |
8467 .Run(); | 8464 .Run(); |
8468 | 8465 |
(...skipping 5172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13641 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13638 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13642 } | 13639 } |
13643 | 13640 |
13644 #ifdef DEBUG | 13641 #ifdef DEBUG |
13645 graph_->Verify(false); // No full verify. | 13642 graph_->Verify(false); // No full verify. |
13646 #endif | 13643 #endif |
13647 } | 13644 } |
13648 | 13645 |
13649 } // namespace internal | 13646 } // namespace internal |
13650 } // namespace v8 | 13647 } // namespace v8 |
OLD | NEW |