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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 if (!Compiler::EnsureDeoptimizationSupport(info())) { | 370 if (!Compiler::EnsureDeoptimizationSupport(info())) { |
371 return SetLastStatus(FAILED); | 371 return SetLastStatus(FAILED); |
372 } | 372 } |
373 if (FLAG_hydrogen_stats) { | 373 if (FLAG_hydrogen_stats) { |
374 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); | 374 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 DCHECK(info()->shared_info()->has_deoptimization_support()); | 378 DCHECK(info()->shared_info()->has_deoptimization_support()); |
| 379 DCHECK(!info()->is_first_compile()); |
379 | 380 |
380 // Check the enabling conditions for TurboFan. | 381 // Check the enabling conditions for TurboFan. |
381 bool dont_crankshaft = info()->shared_info()->dont_crankshaft(); | 382 bool dont_crankshaft = info()->shared_info()->dont_crankshaft(); |
382 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 383 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
383 (dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0) || | 384 (dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0) || |
384 info()->closure()->PassesFilter(FLAG_turbo_filter)) && | 385 info()->closure()->PassesFilter(FLAG_turbo_filter)) && |
385 (FLAG_turbo_osr || !info()->is_osr())) { | 386 (FLAG_turbo_osr || !info()->is_osr())) { |
386 // Use TurboFan for the compilation. | 387 // Use TurboFan for the compilation. |
387 if (FLAG_trace_opt) { | 388 if (FLAG_trace_opt) { |
388 OFStream os(stdout); | 389 OFStream os(stdout); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 // can be added without losing IC state. | 950 // can be added without losing IC state. |
950 if (shared->code()->kind() == Code::FUNCTION && | 951 if (shared->code()->kind() == Code::FUNCTION && |
951 shared->code()->has_reloc_info_for_serialization()) { | 952 shared->code()->has_reloc_info_for_serialization()) { |
952 unoptimized.PrepareForSerializing(); | 953 unoptimized.PrepareForSerializing(); |
953 } | 954 } |
954 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 955 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
955 | 956 |
956 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 957 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
957 shared->set_feedback_vector(*unoptimized.feedback_vector()); | 958 shared->set_feedback_vector(*unoptimized.feedback_vector()); |
958 | 959 |
| 960 info->MarkAsCompiled(); |
| 961 |
959 // The scope info might not have been set if a lazily compiled | 962 // The scope info might not have been set if a lazily compiled |
960 // function is inlined before being called for the first time. | 963 // function is inlined before being called for the first time. |
961 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { | 964 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { |
962 Handle<ScopeInfo> target_scope_info = | 965 Handle<ScopeInfo> target_scope_info = |
963 ScopeInfo::Create(info->isolate(), info->zone(), info->scope()); | 966 ScopeInfo::Create(info->isolate(), info->zone(), info->scope()); |
964 shared->set_scope_info(*target_scope_info); | 967 shared->set_scope_info(*target_scope_info); |
965 } | 968 } |
966 | 969 |
967 // The existing unoptimized code was replaced with the new one. | 970 // The existing unoptimized code was replaced with the new one. |
968 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, &unoptimized, shared); | 971 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, &unoptimized, shared); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 | 1620 |
1618 | 1621 |
1619 #if DEBUG | 1622 #if DEBUG |
1620 void CompilationInfo::PrintAstForTesting() { | 1623 void CompilationInfo::PrintAstForTesting() { |
1621 PrintF("--- Source from AST ---\n%s\n", | 1624 PrintF("--- Source from AST ---\n%s\n", |
1622 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1625 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1623 } | 1626 } |
1624 #endif | 1627 #endif |
1625 } // namespace internal | 1628 } // namespace internal |
1626 } // namespace v8 | 1629 } // namespace v8 |
OLD | NEW |