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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 CompilationCache* compilation_cache = isolate->compilation_cache(); | 1274 CompilationCache* compilation_cache = isolate->compilation_cache(); |
1275 MaybeHandle<SharedFunctionInfo> maybe_shared_info = | 1275 MaybeHandle<SharedFunctionInfo> maybe_shared_info = |
1276 compilation_cache->LookupEval(source, outer_info, context, language_mode, | 1276 compilation_cache->LookupEval(source, outer_info, context, language_mode, |
1277 eval_scope_position); | 1277 eval_scope_position); |
1278 Handle<SharedFunctionInfo> shared_info; | 1278 Handle<SharedFunctionInfo> shared_info; |
1279 | 1279 |
1280 Handle<Script> script; | 1280 Handle<Script> script; |
1281 if (!maybe_shared_info.ToHandle(&shared_info)) { | 1281 if (!maybe_shared_info.ToHandle(&shared_info)) { |
1282 script = isolate->factory()->NewScript(source); | 1282 script = isolate->factory()->NewScript(source); |
| 1283 if (FLAG_trace_deopt) Script::InitLineEnds(script); |
1283 if (!script_name.is_null()) { | 1284 if (!script_name.is_null()) { |
1284 script->set_name(*script_name); | 1285 script->set_name(*script_name); |
1285 script->set_line_offset(line_offset); | 1286 script->set_line_offset(line_offset); |
1286 script->set_column_offset(column_offset); | 1287 script->set_column_offset(column_offset); |
1287 } | 1288 } |
1288 script->set_origin_options(options); | 1289 script->set_origin_options(options); |
1289 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); | 1290 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); |
1290 Script::SetEvalOrigin(script, outer_info, eval_position); | 1291 Script::SetEvalOrigin(script, outer_info, eval_position); |
1291 | 1292 |
1292 Zone zone(isolate->allocator(), ZONE_NAME); | 1293 Zone zone(isolate->allocator(), ZONE_NAME); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 timer.Start(); | 1433 timer.Start(); |
1433 } | 1434 } |
1434 | 1435 |
1435 if (!maybe_result.ToHandle(&result) || | 1436 if (!maybe_result.ToHandle(&result) || |
1436 (FLAG_serialize_toplevel && | 1437 (FLAG_serialize_toplevel && |
1437 compile_options == ScriptCompiler::kProduceCodeCache)) { | 1438 compile_options == ScriptCompiler::kProduceCodeCache)) { |
1438 // No cache entry found, or embedder wants a code cache. Compile the script. | 1439 // No cache entry found, or embedder wants a code cache. Compile the script. |
1439 | 1440 |
1440 // Create a script object describing the script to be compiled. | 1441 // Create a script object describing the script to be compiled. |
1441 Handle<Script> script = isolate->factory()->NewScript(source); | 1442 Handle<Script> script = isolate->factory()->NewScript(source); |
| 1443 if (FLAG_trace_deopt) Script::InitLineEnds(script); |
1442 if (natives == NATIVES_CODE) { | 1444 if (natives == NATIVES_CODE) { |
1443 script->set_type(Script::TYPE_NATIVE); | 1445 script->set_type(Script::TYPE_NATIVE); |
1444 script->set_hide_source(true); | 1446 script->set_hide_source(true); |
1445 } else if (natives == EXTENSION_CODE) { | 1447 } else if (natives == EXTENSION_CODE) { |
1446 script->set_type(Script::TYPE_EXTENSION); | 1448 script->set_type(Script::TYPE_EXTENSION); |
1447 script->set_hide_source(true); | 1449 script->set_hide_source(true); |
1448 } | 1450 } |
1449 if (!script_name.is_null()) { | 1451 if (!script_name.is_null()) { |
1450 script->set_name(*script_name); | 1452 script->set_name(*script_name); |
1451 script->set_line_offset(line_offset); | 1453 script->set_line_offset(line_offset); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 DCHECK(shared->is_compiled()); | 1707 DCHECK(shared->is_compiled()); |
1706 function->set_literals(cached.literals); | 1708 function->set_literals(cached.literals); |
1707 } else if (shared->is_compiled()) { | 1709 } else if (shared->is_compiled()) { |
1708 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1710 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1709 JSFunction::EnsureLiterals(function); | 1711 JSFunction::EnsureLiterals(function); |
1710 } | 1712 } |
1711 } | 1713 } |
1712 | 1714 |
1713 } // namespace internal | 1715 } // namespace internal |
1714 } // namespace v8 | 1716 } // namespace v8 |
OLD | NEW |