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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 return true; | 1191 return true; |
1192 } | 1192 } |
1193 | 1193 |
1194 // TODO(turbofan): In the future, unoptimized code with deopt support could | 1194 // TODO(turbofan): In the future, unoptimized code with deopt support could |
1195 // be generated lazily once deopt is triggered. | 1195 // be generated lazily once deopt is triggered. |
1196 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 1196 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
1197 DCHECK_NOT_NULL(info->literal()); | 1197 DCHECK_NOT_NULL(info->literal()); |
1198 DCHECK_NOT_NULL(info->scope()); | 1198 DCHECK_NOT_NULL(info->scope()); |
1199 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1199 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1200 if (!shared->has_deoptimization_support()) { | 1200 if (!shared->has_deoptimization_support()) { |
1201 // TODO(titzer): just reuse the ParseInfo for the unoptimized compile. | 1201 Zone zone(info->isolate()->allocator()); |
1202 CompilationInfoWithZone unoptimized(info->closure()); | 1202 CompilationInfo unoptimized(info->parse_info(), info->closure()); |
1203 // Note that we use the same AST that we will use for generating the | |
1204 // optimized code. | |
1205 ParseInfo* parse_info = unoptimized.parse_info(); | |
1206 parse_info->set_literal(info->literal()); | |
1207 parse_info->set_scope(info->scope()); | |
1208 parse_info->set_context(info->context()); | |
1209 unoptimized.EnableDeoptimizationSupport(); | 1203 unoptimized.EnableDeoptimizationSupport(); |
1210 // If the current code has reloc info for serialization, also include | 1204 // If the current code has reloc info for serialization, also include |
1211 // reloc info for serialization for the new code, so that deopt support | 1205 // reloc info for serialization for the new code, so that deopt support |
1212 // can be added without losing IC state. | 1206 // can be added without losing IC state. |
1213 if (shared->code()->kind() == Code::FUNCTION && | 1207 if (shared->code()->kind() == Code::FUNCTION && |
1214 shared->code()->has_reloc_info_for_serialization()) { | 1208 shared->code()->has_reloc_info_for_serialization()) { |
1215 unoptimized.PrepareForSerializing(); | 1209 unoptimized.PrepareForSerializing(); |
1216 } | 1210 } |
1217 EnsureFeedbackVector(&unoptimized); | 1211 EnsureFeedbackVector(&unoptimized); |
1218 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 1212 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 MaybeHandle<Code> code; | 1680 MaybeHandle<Code> code; |
1687 if (cached.code != nullptr) code = handle(cached.code); | 1681 if (cached.code != nullptr) code = handle(cached.code); |
1688 Handle<Context> native_context(function->context()->native_context()); | 1682 Handle<Context> native_context(function->context()->native_context()); |
1689 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1683 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1690 literals, BailoutId::None()); | 1684 literals, BailoutId::None()); |
1691 } | 1685 } |
1692 } | 1686 } |
1693 | 1687 |
1694 } // namespace internal | 1688 } // namespace internal |
1695 } // namespace v8 | 1689 } // namespace v8 |
OLD | NEW |