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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 literal->kind(), info.code(), scope_info, info.feedback_vector()); | 1436 literal->kind(), info.code(), scope_info, info.feedback_vector()); |
1437 | 1437 |
1438 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1438 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
1439 SharedFunctionInfo::SetScript(result, script); | 1439 SharedFunctionInfo::SetScript(result, script); |
1440 result->set_is_toplevel(false); | 1440 result->set_is_toplevel(false); |
1441 // If the outer function has been compiled before, we cannot be sure that | 1441 // If the outer function has been compiled before, we cannot be sure that |
1442 // shared function info for this function literal has been created for the | 1442 // shared function info for this function literal has been created for the |
1443 // first time. It may have already been compiled previously. | 1443 // first time. It may have already been compiled previously. |
1444 result->set_never_compiled(outer_info->is_first_compile() && lazy); | 1444 result->set_never_compiled(outer_info->is_first_compile() && lazy); |
1445 | 1445 |
1446 if (literal->scope()->new_target_var() != nullptr) { | |
1447 Handle<Code> stub(isolate->builtins()->JSConstructStubNewTarget()); | |
1448 result->set_construct_stub(*stub); | |
1449 } | |
1450 | |
1451 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1446 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
1452 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); | 1447 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); |
1453 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1448 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
1454 | 1449 |
1455 // Set the expected number of properties for instances and return | 1450 // Set the expected number of properties for instances and return |
1456 // the resulting function. | 1451 // the resulting function. |
1457 SetExpectedNofPropertiesFromEstimate(result, | 1452 SetExpectedNofPropertiesFromEstimate(result, |
1458 literal->expected_property_count()); | 1453 literal->expected_property_count()); |
1459 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); | 1454 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); |
1460 return result; | 1455 return result; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1626 |
1632 | 1627 |
1633 #if DEBUG | 1628 #if DEBUG |
1634 void CompilationInfo::PrintAstForTesting() { | 1629 void CompilationInfo::PrintAstForTesting() { |
1635 PrintF("--- Source from AST ---\n%s\n", | 1630 PrintF("--- Source from AST ---\n%s\n", |
1636 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1631 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1637 } | 1632 } |
1638 #endif | 1633 #endif |
1639 } // namespace internal | 1634 } // namespace internal |
1640 } // namespace v8 | 1635 } // namespace v8 |
OLD | NEW |