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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 RuntimeCallTimerScope runtimeTimer(isolate, | 1580 RuntimeCallTimerScope runtimeTimer(isolate, |
1581 &RuntimeCallStats::CompileDeserialize); | 1581 &RuntimeCallStats::CompileDeserialize); |
1582 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1582 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
1583 "V8.CompileDeserialize"); | 1583 "V8.CompileDeserialize"); |
1584 Handle<SharedFunctionInfo> inner_result; | 1584 Handle<SharedFunctionInfo> inner_result; |
1585 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1585 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
1586 .ToHandle(&inner_result)) { | 1586 .ToHandle(&inner_result)) { |
1587 // Promote to per-isolate compilation cache. | 1587 // Promote to per-isolate compilation cache. |
1588 // TODO(mvstanton): create a feedback vector array here. | 1588 // TODO(mvstanton): create a feedback vector array here. |
1589 DCHECK(inner_result->is_compiled()); | 1589 DCHECK(inner_result->is_compiled()); |
1590 Handle<FeedbackVector> feedback_vector = FeedbackVector::New( | 1590 Handle<FeedbackVector> feedback_vector = |
1591 isolate, handle(inner_result->feedback_metadata())); | 1591 FeedbackVector::New(isolate, inner_result); |
1592 vector = isolate->factory()->NewCell(feedback_vector); | 1592 vector = isolate->factory()->NewCell(feedback_vector); |
1593 compilation_cache->PutScript(source, context, language_mode, | 1593 compilation_cache->PutScript(source, context, language_mode, |
1594 inner_result, vector); | 1594 inner_result, vector); |
1595 return inner_result; | 1595 return inner_result; |
1596 } | 1596 } |
1597 // Deserializer failed. Fall through to compile. | 1597 // Deserializer failed. Fall through to compile. |
1598 } else { | 1598 } else { |
1599 if (pair.has_shared()) { | 1599 if (pair.has_shared()) { |
1600 result = Handle<SharedFunctionInfo>(pair.shared(), isolate); | 1600 result = Handle<SharedFunctionInfo>(pair.shared(), isolate); |
1601 } | 1601 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 info.PrepareForSerializing(); | 1655 info.PrepareForSerializing(); |
1656 } | 1656 } |
1657 | 1657 |
1658 parse_info.set_language_mode( | 1658 parse_info.set_language_mode( |
1659 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); | 1659 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); |
1660 result = CompileToplevel(&info); | 1660 result = CompileToplevel(&info); |
1661 if (extension == NULL && !result.is_null()) { | 1661 if (extension == NULL && !result.is_null()) { |
1662 // We need a feedback vector. | 1662 // We need a feedback vector. |
1663 DCHECK(result->is_compiled()); | 1663 DCHECK(result->is_compiled()); |
1664 Handle<FeedbackVector> feedback_vector = | 1664 Handle<FeedbackVector> feedback_vector = |
1665 FeedbackVector::New(isolate, handle(result->feedback_metadata())); | 1665 FeedbackVector::New(isolate, result); |
1666 vector = isolate->factory()->NewCell(feedback_vector); | 1666 vector = isolate->factory()->NewCell(feedback_vector); |
1667 compilation_cache->PutScript(source, context, language_mode, result, | 1667 compilation_cache->PutScript(source, context, language_mode, result, |
1668 vector); | 1668 vector); |
1669 if (FLAG_serialize_toplevel && | 1669 if (FLAG_serialize_toplevel && |
1670 compile_options == ScriptCompiler::kProduceCodeCache && | 1670 compile_options == ScriptCompiler::kProduceCodeCache && |
1671 !ContainsAsmModule(script)) { | 1671 !ContainsAsmModule(script)) { |
1672 HistogramTimerScope histogram_timer( | 1672 HistogramTimerScope histogram_timer( |
1673 isolate->counters()->compile_serialize()); | 1673 isolate->counters()->compile_serialize()); |
1674 RuntimeCallTimerScope runtimeTimer(isolate, | 1674 RuntimeCallTimerScope runtimeTimer(isolate, |
1675 &RuntimeCallStats::CompileSerialize); | 1675 &RuntimeCallStats::CompileSerialize); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 } | 1829 } |
1830 | 1830 |
1831 if (shared->is_compiled()) { | 1831 if (shared->is_compiled()) { |
1832 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1832 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1833 JSFunction::EnsureLiterals(function); | 1833 JSFunction::EnsureLiterals(function); |
1834 } | 1834 } |
1835 } | 1835 } |
1836 | 1836 |
1837 } // namespace internal | 1837 } // namespace internal |
1838 } // namespace v8 | 1838 } // namespace v8 |
OLD | NEW |