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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-js.h" | 10 #include "src/asmjs/asm-js.h" |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 // Compile baseline code using the full code generator. | 986 // Compile baseline code using the full code generator. |
987 if (!Compiler::Analyze(info.parse_info()) || | 987 if (!Compiler::Analyze(info.parse_info()) || |
988 !FullCodeGenerator::MakeCode(&info)) { | 988 !FullCodeGenerator::MakeCode(&info)) { |
989 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 989 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
990 return MaybeHandle<Code>(); | 990 return MaybeHandle<Code>(); |
991 } | 991 } |
992 | 992 |
993 // TODO(4280): For now we play it safe and remove the bytecode array when we | 993 // TODO(4280): For now we play it safe and remove the bytecode array when we |
994 // switch to baseline code. We might consider keeping around the bytecode so | 994 // switch to baseline code. We might consider keeping around the bytecode so |
995 // that it can be used as the "source of truth" eventually. | 995 // that it can be used as the "source of truth" eventually. |
996 shared->ClearBytecodeArray(); | 996 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); |
997 | 997 |
998 // Update the shared function info with the scope info. | 998 // Update the shared function info with the scope info. |
999 InstallSharedScopeInfo(&info, shared); | 999 InstallSharedScopeInfo(&info, shared); |
1000 | 1000 |
1001 // Install compilation result on the shared function info | 1001 // Install compilation result on the shared function info |
1002 InstallSharedCompilationResult(&info, shared); | 1002 InstallSharedCompilationResult(&info, shared); |
1003 | 1003 |
1004 // Record the function compilation event. | 1004 // Record the function compilation event. |
1005 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, &info); | 1005 RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, &info); |
1006 | 1006 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 if (shared->code()->kind() == Code::FUNCTION && | 1427 if (shared->code()->kind() == Code::FUNCTION && |
1428 shared->code()->has_reloc_info_for_serialization()) { | 1428 shared->code()->has_reloc_info_for_serialization()) { |
1429 unoptimized.PrepareForSerializing(); | 1429 unoptimized.PrepareForSerializing(); |
1430 } | 1430 } |
1431 EnsureFeedbackMetadata(&unoptimized); | 1431 EnsureFeedbackMetadata(&unoptimized); |
1432 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 1432 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
1433 | 1433 |
1434 // TODO(4280): For now we play it safe and remove the bytecode array when we | 1434 // TODO(4280): For now we play it safe and remove the bytecode array when we |
1435 // switch to baseline code. We might consider keeping around the bytecode so | 1435 // switch to baseline code. We might consider keeping around the bytecode so |
1436 // that it can be used as the "source of truth" eventually. | 1436 // that it can be used as the "source of truth" eventually. |
1437 shared->ClearBytecodeArray(); | 1437 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); |
1438 | 1438 |
1439 // The scope info might not have been set if a lazily compiled | 1439 // The scope info might not have been set if a lazily compiled |
1440 // function is inlined before being called for the first time. | 1440 // function is inlined before being called for the first time. |
1441 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { | 1441 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { |
1442 InstallSharedScopeInfo(info, shared); | 1442 InstallSharedScopeInfo(info, shared); |
1443 } | 1443 } |
1444 | 1444 |
1445 // Install compilation result on the shared function info | 1445 // Install compilation result on the shared function info |
1446 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 1446 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
1447 | 1447 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 DCHECK(shared->is_compiled()); | 1950 DCHECK(shared->is_compiled()); |
1951 function->set_literals(cached.literals); | 1951 function->set_literals(cached.literals); |
1952 } else if (shared->is_compiled()) { | 1952 } else if (shared->is_compiled()) { |
1953 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1953 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1954 JSFunction::EnsureLiterals(function); | 1954 JSFunction::EnsureLiterals(function); |
1955 } | 1955 } |
1956 } | 1956 } |
1957 | 1957 |
1958 } // namespace internal | 1958 } // namespace internal |
1959 } // namespace v8 | 1959 } // namespace v8 |
OLD | NEW |