OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 literal->kind(), info.code(), scope_info, info.feedback_vector()); | 1433 literal->kind(), info.code(), scope_info, info.feedback_vector()); |
1434 | 1434 |
1435 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1435 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
1436 SharedFunctionInfo::SetScript(result, script); | 1436 SharedFunctionInfo::SetScript(result, script); |
1437 result->set_is_toplevel(false); | 1437 result->set_is_toplevel(false); |
1438 // If the outer function has been compiled before, we cannot be sure that | 1438 // If the outer function has been compiled before, we cannot be sure that |
1439 // shared function info for this function literal has been created for the | 1439 // shared function info for this function literal has been created for the |
1440 // first time. It may have already been compiled previously. | 1440 // first time. It may have already been compiled previously. |
1441 result->set_never_compiled(outer_info->is_first_compile() && lazy); | 1441 result->set_never_compiled(outer_info->is_first_compile() && lazy); |
1442 | 1442 |
| 1443 if (literal->scope()->new_target_var() != nullptr) { |
| 1444 Handle<Code> stub(isolate->builtins()->JSConstructStubNewTarget()); |
| 1445 result->set_construct_stub(*stub); |
| 1446 } |
| 1447 |
1443 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1448 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
1444 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); | 1449 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); |
1445 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1450 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
1446 | 1451 |
1447 // Set the expected number of properties for instances and return | 1452 // Set the expected number of properties for instances and return |
1448 // the resulting function. | 1453 // the resulting function. |
1449 SetExpectedNofPropertiesFromEstimate(result, | 1454 SetExpectedNofPropertiesFromEstimate(result, |
1450 literal->expected_property_count()); | 1455 literal->expected_property_count()); |
1451 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); | 1456 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); |
1452 return result; | 1457 return result; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 | 1626 |
1622 | 1627 |
1623 #if DEBUG | 1628 #if DEBUG |
1624 void CompilationInfo::PrintAstForTesting() { | 1629 void CompilationInfo::PrintAstForTesting() { |
1625 PrintF("--- Source from AST ---\n%s\n", | 1630 PrintF("--- Source from AST ---\n%s\n", |
1626 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1631 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1627 } | 1632 } |
1628 #endif | 1633 #endif |
1629 } // namespace internal | 1634 } // namespace internal |
1630 } // namespace v8 | 1635 } // namespace v8 |
OLD | NEW |