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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 702 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
703 return MaybeHandle<Code>(); | 703 return MaybeHandle<Code>(); |
704 } | 704 } |
705 info->MarkAsOptimizeFromBytecode(); | 705 info->MarkAsOptimizeFromBytecode(); |
706 } | 706 } |
707 | 707 |
708 if (IsEvalToplevel(shared)) { | 708 if (IsEvalToplevel(shared)) { |
709 parse_info->set_eval(); | 709 parse_info->set_eval(); |
710 parse_info->set_toplevel(); | 710 parse_info->set_toplevel(); |
711 parse_info->set_allow_lazy_parsing(false); | 711 parse_info->set_allow_lazy_parsing(false); |
712 parse_info->set_lazy(false); | |
713 } | 712 } |
714 | 713 |
715 // Verify that OSR compilations are delegated to the correct graph builder. | 714 // Verify that OSR compilations are delegated to the correct graph builder. |
716 // Depending on the underlying frame the semantics of the {BailoutId} differ | 715 // Depending on the underlying frame the semantics of the {BailoutId} differ |
717 // and the various graph builders hard-code a certain semantic: | 716 // and the various graph builders hard-code a certain semantic: |
718 // - Interpreter : The BailoutId represents a bytecode offset. | 717 // - Interpreter : The BailoutId represents a bytecode offset. |
719 // - FullCodegen : The BailoutId represents the id of an AST node. | 718 // - FullCodegen : The BailoutId represents the id of an AST node. |
720 DCHECK_IMPLIES(info->is_osr() && ignition_osr, | 719 DCHECK_IMPLIES(info->is_osr() && ignition_osr, |
721 info->is_optimizing_from_bytecode()); | 720 info->is_optimizing_from_bytecode()); |
722 DCHECK_IMPLIES(info->is_osr() && !ignition_osr, | 721 DCHECK_IMPLIES(info->is_osr() && !ignition_osr, |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 DCHECK(AllowCompilation::IsAllowed(isolate)); | 1250 DCHECK(AllowCompilation::IsAllowed(isolate)); |
1252 | 1251 |
1253 // Start a compilation. | 1252 // Start a compilation. |
1254 Zone zone(isolate->allocator()); | 1253 Zone zone(isolate->allocator()); |
1255 ParseInfo parse_info(&zone, function); | 1254 ParseInfo parse_info(&zone, function); |
1256 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | 1255 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1257 if (IsEvalToplevel(handle(function->shared()))) { | 1256 if (IsEvalToplevel(handle(function->shared()))) { |
1258 parse_info.set_eval(); | 1257 parse_info.set_eval(); |
1259 parse_info.set_toplevel(); | 1258 parse_info.set_toplevel(); |
1260 parse_info.set_allow_lazy_parsing(false); | 1259 parse_info.set_allow_lazy_parsing(false); |
1261 parse_info.set_lazy(false); | |
1262 } | 1260 } |
1263 info.MarkAsDebug(); | 1261 info.MarkAsDebug(); |
1264 if (GetUnoptimizedCode(&info).is_null()) { | 1262 if (GetUnoptimizedCode(&info).is_null()) { |
1265 isolate->clear_pending_exception(); | 1263 isolate->clear_pending_exception(); |
1266 return false; | 1264 return false; |
1267 } | 1265 } |
1268 | 1266 |
1269 // Check postconditions on success. | 1267 // Check postconditions on success. |
1270 DCHECK(!isolate->has_pending_exception()); | 1268 DCHECK(!isolate->has_pending_exception()); |
1271 DCHECK(function->shared()->is_compiled()); | 1269 DCHECK(function->shared()->is_compiled()); |
1272 DCHECK(function->shared()->HasDebugCode()); | 1270 DCHECK(function->shared()->HasDebugCode()); |
1273 return true; | 1271 return true; |
1274 } | 1272 } |
1275 | 1273 |
1276 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { | 1274 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { |
1277 Isolate* isolate = shared->GetIsolate(); | 1275 Isolate* isolate = shared->GetIsolate(); |
1278 DCHECK(AllowCompilation::IsAllowed(isolate)); | 1276 DCHECK(AllowCompilation::IsAllowed(isolate)); |
1279 | 1277 |
1280 // Start a compilation. | 1278 // Start a compilation. |
1281 Zone zone(isolate->allocator()); | 1279 Zone zone(isolate->allocator()); |
1282 ParseInfo parse_info(&zone, shared); | 1280 ParseInfo parse_info(&zone, shared); |
1283 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | 1281 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1284 if (IsEvalToplevel(shared)) { | 1282 if (IsEvalToplevel(shared)) { |
1285 parse_info.set_eval(); | 1283 parse_info.set_eval(); |
1286 parse_info.set_toplevel(); | 1284 parse_info.set_toplevel(); |
1287 parse_info.set_allow_lazy_parsing(false); | 1285 parse_info.set_allow_lazy_parsing(false); |
1288 parse_info.set_lazy(false); | |
1289 } | 1286 } |
1290 info.MarkAsDebug(); | 1287 info.MarkAsDebug(); |
1291 if (GetUnoptimizedCode(&info).is_null()) { | 1288 if (GetUnoptimizedCode(&info).is_null()) { |
1292 isolate->clear_pending_exception(); | 1289 isolate->clear_pending_exception(); |
1293 return false; | 1290 return false; |
1294 } | 1291 } |
1295 | 1292 |
1296 // Check postconditions on success. | 1293 // Check postconditions on success. |
1297 DCHECK(!isolate->has_pending_exception()); | 1294 DCHECK(!isolate->has_pending_exception()); |
1298 DCHECK(shared->is_compiled()); | 1295 DCHECK(shared->is_compiled()); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 DCHECK(shared->is_compiled()); | 1873 DCHECK(shared->is_compiled()); |
1877 function->set_literals(cached.literals); | 1874 function->set_literals(cached.literals); |
1878 } else if (shared->is_compiled()) { | 1875 } else if (shared->is_compiled()) { |
1879 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1876 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1880 JSFunction::EnsureLiterals(function); | 1877 JSFunction::EnsureLiterals(function); |
1881 } | 1878 } |
1882 } | 1879 } |
1883 | 1880 |
1884 } // namespace internal | 1881 } // namespace internal |
1885 } // namespace v8 | 1882 } // namespace v8 |
OLD | NEW |