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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 info.code(), scope_info, info.feedback_vector()); | 1418 info.code(), scope_info, info.feedback_vector()); |
1419 | 1419 |
1420 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1420 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
1421 SharedFunctionInfo::SetScript(result, script); | 1421 SharedFunctionInfo::SetScript(result, script); |
1422 result->set_is_toplevel(false); | 1422 result->set_is_toplevel(false); |
1423 // If the outer function has been compiled before, we cannot be sure that | 1423 // If the outer function has been compiled before, we cannot be sure that |
1424 // shared function info for this function literal has been created for the | 1424 // shared function info for this function literal has been created for the |
1425 // first time. It may have already been compiled previously. | 1425 // first time. It may have already been compiled previously. |
1426 result->set_never_compiled(outer_info->is_first_compile() && lazy); | 1426 result->set_never_compiled(outer_info->is_first_compile() && lazy); |
1427 | 1427 |
| 1428 if (literal->scope()->new_target_var() != nullptr) { |
| 1429 Handle<Code> stub(isolate->builtins()->JSConstructStubNewTarget()); |
| 1430 result->set_construct_stub(*stub); |
| 1431 } |
| 1432 |
1428 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1433 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
1429 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); | 1434 result->set_allows_lazy_compilation(literal->AllowsLazyCompilation()); |
1430 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1435 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
1431 | 1436 |
1432 // Set the expected number of properties for instances and return | 1437 // Set the expected number of properties for instances and return |
1433 // the resulting function. | 1438 // the resulting function. |
1434 SetExpectedNofPropertiesFromEstimate(result, | 1439 SetExpectedNofPropertiesFromEstimate(result, |
1435 literal->expected_property_count()); | 1440 literal->expected_property_count()); |
1436 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); | 1441 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); |
1437 return result; | 1442 return result; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 | 1611 |
1607 | 1612 |
1608 #if DEBUG | 1613 #if DEBUG |
1609 void CompilationInfo::PrintAstForTesting() { | 1614 void CompilationInfo::PrintAstForTesting() { |
1610 PrintF("--- Source from AST ---\n%s\n", | 1615 PrintF("--- Source from AST ---\n%s\n", |
1611 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1616 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1612 } | 1617 } |
1613 #endif | 1618 #endif |
1614 } // namespace internal | 1619 } // namespace internal |
1615 } // namespace v8 | 1620 } // namespace v8 |
OLD | NEW |