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 5463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5474 | 5474 |
5475 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 5475 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
5476 DCHECK(!HasStackOverflow()); | 5476 DCHECK(!HasStackOverflow()); |
5477 DCHECK(current_block() != NULL); | 5477 DCHECK(current_block() != NULL); |
5478 DCHECK(current_block()->HasPredecessor()); | 5478 DCHECK(current_block()->HasPredecessor()); |
5479 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5479 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
5480 expr, current_info()->script(), top_info()); | 5480 expr, current_info()->script(), top_info()); |
5481 // We also have a stack overflow if the recursive compilation did. | 5481 // We also have a stack overflow if the recursive compilation did. |
5482 if (HasStackOverflow()) return; | 5482 if (HasStackOverflow()) return; |
5483 // Use the fast case closure allocation code that allocates in new | 5483 // Use the fast case closure allocation code that allocates in new |
5484 // space for nested functions that don't need literals cloning. | 5484 // space for nested functions that don't need pretenuring. |
5485 HConstant* shared_info_value = Add<HConstant>(shared_info); | 5485 HConstant* shared_info_value = Add<HConstant>(shared_info); |
5486 HInstruction* instr; | 5486 HInstruction* instr; |
5487 if (!expr->pretenure() && shared_info->num_literals() == 0) { | 5487 if (!expr->pretenure()) { |
5488 FastNewClosureStub stub(isolate(), shared_info->language_mode(), | 5488 FastNewClosureStub stub(isolate(), shared_info->language_mode(), |
5489 shared_info->kind()); | 5489 shared_info->kind()); |
5490 FastNewClosureDescriptor descriptor(isolate()); | 5490 FastNewClosureDescriptor descriptor(isolate()); |
5491 HValue* values[] = {context(), shared_info_value}; | 5491 HValue* values[] = {context(), shared_info_value}; |
5492 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5492 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
5493 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5493 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
5494 Vector<HValue*>(values, arraysize(values)), | 5494 Vector<HValue*>(values, arraysize(values)), |
5495 NORMAL_CALL); | 5495 NORMAL_CALL); |
5496 } else { | 5496 } else { |
5497 Add<HPushArguments>(shared_info_value); | 5497 Add<HPushArguments>(shared_info_value); |
(...skipping 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8425 // the target function if we don't already have it. | 8425 // the target function if we don't already have it. |
8426 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { | 8426 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
8427 TraceInline(target, caller, "could not generate deoptimization info"); | 8427 TraceInline(target, caller, "could not generate deoptimization info"); |
8428 return false; | 8428 return false; |
8429 } | 8429 } |
8430 // Remember that we inlined this function. This needs to be called right | 8430 // Remember that we inlined this function. This needs to be called right |
8431 // after the EnsureDeoptimizationSupport call so that the code flusher | 8431 // after the EnsureDeoptimizationSupport call so that the code flusher |
8432 // does not remove the code with the deoptimization support. | 8432 // does not remove the code with the deoptimization support. |
8433 top_info()->AddInlinedFunction(target_info.shared_info()); | 8433 top_info()->AddInlinedFunction(target_info.shared_info()); |
8434 | 8434 |
8435 // If target was lazily compiled, it's literals array may not yet be set up. | |
8436 JSFunction::EnsureLiterals(target); | |
Benedikt Meurer
2016/01/15 11:36:43
Can we check this in the heap verifier?
| |
8437 | |
8435 // ---------------------------------------------------------------- | 8438 // ---------------------------------------------------------------- |
8436 // After this point, we've made a decision to inline this function (so | 8439 // After this point, we've made a decision to inline this function (so |
8437 // TryInline should always return true). | 8440 // TryInline should always return true). |
8438 | 8441 |
8439 // Type-check the inlined function. | 8442 // Type-check the inlined function. |
8440 DCHECK(target_shared->has_deoptimization_support()); | 8443 DCHECK(target_shared->has_deoptimization_support()); |
8441 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8444 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
8442 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) | 8445 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) |
8443 .Run(); | 8446 .Run(); |
8444 | 8447 |
(...skipping 5156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13601 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13604 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13602 } | 13605 } |
13603 | 13606 |
13604 #ifdef DEBUG | 13607 #ifdef DEBUG |
13605 graph_->Verify(false); // No full verify. | 13608 graph_->Verify(false); // No full verify. |
13606 #endif | 13609 #endif |
13607 } | 13610 } |
13608 | 13611 |
13609 } // namespace internal | 13612 } // namespace internal |
13610 } // namespace v8 | 13613 } // namespace v8 |
OLD | NEW |