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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 | 1802 |
1803 // Consider compiling eagerly when compiling bytecode for Ignition. | 1803 // Consider compiling eagerly when compiling bytecode for Ignition. |
1804 lazy &= | 1804 lazy &= |
1805 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1805 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
1806 | 1806 |
1807 // Generate code | 1807 // Generate code |
1808 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1808 TimerEventScope<TimerEventCompileCode> timer(isolate); |
1809 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1809 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
1810 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1810 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
1811 isolate, &tracing::TraceEventStatsTable::CompileCode); | 1811 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1812 |
| 1813 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 1814 // required by the constant array builder to de-duplicate common objects |
| 1815 // without dereferencing handles. |
| 1816 std::unique_ptr<CanonicalHandleScope> canonical; |
| 1817 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate())); |
| 1818 |
1812 if (lazy) { | 1819 if (lazy) { |
1813 info.SetCode(isolate->builtins()->CompileLazy()); | 1820 info.SetCode(isolate->builtins()->CompileLazy()); |
1814 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1821 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
1815 // Code generation will ensure that the feedback vector is present and | 1822 // Code generation will ensure that the feedback vector is present and |
1816 // appropriately sized. | 1823 // appropriately sized. |
1817 DCHECK(!info.code().is_null()); | 1824 DCHECK(!info.code().is_null()); |
1818 if (literal->should_eager_compile() && | 1825 if (literal->should_eager_compile() && |
1819 literal->should_be_used_once_hint()) { | 1826 literal->should_be_used_once_hint()) { |
1820 info.code()->MarkToBeExecutedOnce(isolate); | 1827 info.code()->MarkToBeExecutedOnce(isolate); |
1821 } | 1828 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 DCHECK(shared->is_compiled()); | 1955 DCHECK(shared->is_compiled()); |
1949 function->set_literals(cached.literals); | 1956 function->set_literals(cached.literals); |
1950 } else if (shared->is_compiled()) { | 1957 } else if (shared->is_compiled()) { |
1951 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1958 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1952 JSFunction::EnsureLiterals(function); | 1959 JSFunction::EnsureLiterals(function); |
1953 } | 1960 } |
1954 } | 1961 } |
1955 | 1962 |
1956 } // namespace internal | 1963 } // namespace internal |
1957 } // namespace v8 | 1964 } // namespace v8 |
OLD | NEW |