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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 | 1122 |
1123 DCHECK(function->code()->kind() == Code::FUNCTION || | 1123 DCHECK(function->code()->kind() == Code::FUNCTION || |
1124 function->code()->kind() == Code::OPTIMIZED_FUNCTION || | 1124 function->code()->kind() == Code::OPTIMIZED_FUNCTION || |
1125 (function->code()->is_interpreter_entry_trampoline() && | 1125 (function->code()->is_interpreter_entry_trampoline() && |
1126 function->shared()->HasBytecodeArray()) || | 1126 function->shared()->HasBytecodeArray()) || |
1127 function->IsInOptimizationQueue()); | 1127 function->IsInOptimizationQueue()); |
1128 return true; | 1128 return true; |
1129 } | 1129 } |
1130 | 1130 |
1131 bool Compiler::CompileDebugCode(Handle<JSFunction> function) { | 1131 bool Compiler::CompileDebugCode(Handle<JSFunction> function) { |
1132 Handle<SharedFunctionInfo> shared(function->shared()); | 1132 Zone zone(function->GetIsolate()->allocator()); |
1133 if (IsEvalToplevel(shared)) { | 1133 ParseInfo parse_info(&zone, function); |
1134 Handle<Script> script(Script::cast(shared->script())); | 1134 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1135 Handle<Context> context(function->context()); | 1135 if (IsEvalToplevel(handle(function->shared()))) { |
1136 | |
1137 Zone zone(function->GetIsolate()->allocator()); | |
1138 ParseInfo parse_info(&zone, script); | |
1139 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | |
1140 | |
1141 parse_info.set_eval(); | 1136 parse_info.set_eval(); |
1142 parse_info.set_context(context); | 1137 if (function->context()->IsNativeContext()) parse_info.set_global(); |
1143 parse_info.set_shared_info(shared); | |
1144 if (context->IsNativeContext()) parse_info.set_global(); | |
1145 parse_info.set_toplevel(); | 1138 parse_info.set_toplevel(); |
1146 parse_info.set_allow_lazy_parsing(false); | 1139 parse_info.set_allow_lazy_parsing(false); |
1147 parse_info.set_language_mode(shared->language_mode()); | 1140 parse_info.set_lazy(false); |
1148 parse_info.set_parse_restriction(NO_PARSE_RESTRICTION); | |
1149 return CompileForDebugging(&info); | |
1150 } else { | |
1151 CompilationInfoWithZone info(function); | |
1152 return CompileForDebugging(&info); | |
1153 } | 1141 } |
| 1142 return CompileForDebugging(&info); |
1154 } | 1143 } |
1155 | 1144 |
1156 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { | 1145 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { |
1157 DCHECK(shared->allows_lazy_compilation_without_context()); | 1146 DCHECK(shared->allows_lazy_compilation_without_context()); |
1158 DCHECK(!IsEvalToplevel(shared)); | 1147 DCHECK(!IsEvalToplevel(shared)); |
1159 Zone zone(shared->GetIsolate()->allocator()); | 1148 Zone zone(shared->GetIsolate()->allocator()); |
1160 ParseInfo parse_info(&zone, shared); | 1149 ParseInfo parse_info(&zone, shared); |
1161 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | 1150 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1162 return CompileForDebugging(&info); | 1151 return CompileForDebugging(&info); |
1163 } | 1152 } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 MaybeHandle<Code> code; | 1670 MaybeHandle<Code> code; |
1682 if (cached.code != nullptr) code = handle(cached.code); | 1671 if (cached.code != nullptr) code = handle(cached.code); |
1683 Handle<Context> native_context(function->context()->native_context()); | 1672 Handle<Context> native_context(function->context()->native_context()); |
1684 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1673 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1685 literals, BailoutId::None()); | 1674 literals, BailoutId::None()); |
1686 } | 1675 } |
1687 } | 1676 } |
1688 | 1677 |
1689 } // namespace internal | 1678 } // namespace internal |
1690 } // namespace v8 | 1679 } // namespace v8 |
OLD | NEW |