| 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" |
| 11 #include "src/ast/scopeinfo.h" | 11 #include "src/ast/scopeinfo.h" |
| 12 #include "src/ast/scopes.h" | 12 #include "src/ast/scopes.h" |
| 13 #include "src/bootstrapper.h" | 13 #include "src/bootstrapper.h" |
| 14 #include "src/codegen.h" | 14 #include "src/codegen.h" |
| 15 #include "src/compilation-cache.h" | 15 #include "src/compilation-cache.h" |
| 16 #include "src/compiler/pipeline.h" | 16 #include "src/compiler/pipeline.h" |
| 17 #include "src/crankshaft/hydrogen.h" | 17 #include "src/crankshaft/hydrogen.h" |
| 18 #include "src/debug/debug.h" | 18 #include "src/debug/debug.h" |
| 19 #include "src/debug/liveedit.h" | 19 #include "src/debug/liveedit.h" |
| 20 #include "src/deoptimizer.h" | 20 #include "src/deoptimizer.h" |
| 21 #include "src/frames-inl.h" | 21 #include "src/frames-inl.h" |
| 22 #include "src/full-codegen/full-codegen.h" | 22 #include "src/full-codegen/full-codegen.h" |
| 23 #include "src/globals.h" |
| 23 #include "src/interpreter/interpreter.h" | 24 #include "src/interpreter/interpreter.h" |
| 24 #include "src/isolate-inl.h" | 25 #include "src/isolate-inl.h" |
| 25 #include "src/log-inl.h" | 26 #include "src/log-inl.h" |
| 26 #include "src/messages.h" | 27 #include "src/messages.h" |
| 27 #include "src/parsing/parser.h" | 28 #include "src/parsing/parser.h" |
| 28 #include "src/parsing/rewriter.h" | 29 #include "src/parsing/rewriter.h" |
| 29 #include "src/parsing/scanner-character-streams.h" | 30 #include "src/parsing/scanner-character-streams.h" |
| 30 #include "src/runtime-profiler.h" | 31 #include "src/runtime-profiler.h" |
| 31 #include "src/snapshot/code-serializer.h" | 32 #include "src/snapshot/code-serializer.h" |
| 32 #include "src/typing-asm.h" | 33 #include "src/typing-asm.h" |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 RuntimeCallTimerScope runtimeTimer( | 1093 RuntimeCallTimerScope runtimeTimer( |
| 1093 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1094 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1094 : &RuntimeCallStats::Compile); | 1095 : &RuntimeCallStats::Compile); |
| 1095 HistogramTimer* rate = parse_info->is_eval() | 1096 HistogramTimer* rate = parse_info->is_eval() |
| 1096 ? info->isolate()->counters()->compile_eval() | 1097 ? info->isolate()->counters()->compile_eval() |
| 1097 : info->isolate()->counters()->compile(); | 1098 : info->isolate()->counters()->compile(); |
| 1098 HistogramTimerScope timer(rate); | 1099 HistogramTimerScope timer(rate); |
| 1099 TRACE_EVENT0("v8", parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); | 1100 TRACE_EVENT0("v8", parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); |
| 1100 | 1101 |
| 1101 // Allocate a shared function info object. | 1102 // Allocate a shared function info object. |
| 1102 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 1103 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1103 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1104 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1104 result->set_is_toplevel(true); | 1105 result->set_is_toplevel(true); |
| 1105 if (parse_info->is_eval()) { | 1106 if (parse_info->is_eval()) { |
| 1106 // Eval scripts cannot be (re-)compiled without context. | 1107 // Eval scripts cannot be (re-)compiled without context. |
| 1107 result->set_allows_lazy_compilation_without_context(false); | 1108 result->set_allows_lazy_compilation_without_context(false); |
| 1108 } | 1109 } |
| 1109 parse_info->set_shared_info(result); | 1110 parse_info->set_shared_info(result); |
| 1110 | 1111 |
| 1111 // Compile the code. | 1112 // Compile the code. |
| 1112 if (!CompileUnoptimizedCode(info)) { | 1113 if (!CompileUnoptimizedCode(info)) { |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 DCHECK(shared->is_compiled()); | 1826 DCHECK(shared->is_compiled()); |
| 1826 function->set_literals(cached.literals); | 1827 function->set_literals(cached.literals); |
| 1827 } else if (shared->is_compiled()) { | 1828 } else if (shared->is_compiled()) { |
| 1828 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1829 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1829 JSFunction::EnsureLiterals(function); | 1830 JSFunction::EnsureLiterals(function); |
| 1830 } | 1831 } |
| 1831 } | 1832 } |
| 1832 | 1833 |
| 1833 } // namespace internal | 1834 } // namespace internal |
| 1834 } // namespace v8 | 1835 } // namespace v8 |
| OLD | NEW |