| 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 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1294 |
| 1295 CompilationCache* compilation_cache = isolate->compilation_cache(); | 1295 CompilationCache* compilation_cache = isolate->compilation_cache(); |
| 1296 MaybeHandle<SharedFunctionInfo> maybe_shared_info = | 1296 MaybeHandle<SharedFunctionInfo> maybe_shared_info = |
| 1297 compilation_cache->LookupEval(source, outer_info, context, language_mode, | 1297 compilation_cache->LookupEval(source, outer_info, context, language_mode, |
| 1298 eval_scope_position); | 1298 eval_scope_position); |
| 1299 Handle<SharedFunctionInfo> shared_info; | 1299 Handle<SharedFunctionInfo> shared_info; |
| 1300 | 1300 |
| 1301 Handle<Script> script; | 1301 Handle<Script> script; |
| 1302 if (!maybe_shared_info.ToHandle(&shared_info)) { | 1302 if (!maybe_shared_info.ToHandle(&shared_info)) { |
| 1303 script = isolate->factory()->NewScript(source); | 1303 script = isolate->factory()->NewScript(source); |
| 1304 if (FLAG_trace_deopt) Script::InitLineEnds(script); | 1304 if (isolate->NeedsSourcePositionsForProfiling()) { |
| 1305 Script::InitLineEnds(script); |
| 1306 } |
| 1305 if (!script_name.is_null()) { | 1307 if (!script_name.is_null()) { |
| 1306 script->set_name(*script_name); | 1308 script->set_name(*script_name); |
| 1307 script->set_line_offset(line_offset); | 1309 script->set_line_offset(line_offset); |
| 1308 script->set_column_offset(column_offset); | 1310 script->set_column_offset(column_offset); |
| 1309 } | 1311 } |
| 1310 script->set_origin_options(options); | 1312 script->set_origin_options(options); |
| 1311 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); | 1313 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); |
| 1312 Script::SetEvalOrigin(script, outer_info, eval_position); | 1314 Script::SetEvalOrigin(script, outer_info, eval_position); |
| 1313 | 1315 |
| 1314 Zone zone(isolate->allocator(), ZONE_NAME); | 1316 Zone zone(isolate->allocator(), ZONE_NAME); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 timer.Start(); | 1456 timer.Start(); |
| 1455 } | 1457 } |
| 1456 | 1458 |
| 1457 if (!maybe_result.ToHandle(&result) || | 1459 if (!maybe_result.ToHandle(&result) || |
| 1458 (FLAG_serialize_toplevel && | 1460 (FLAG_serialize_toplevel && |
| 1459 compile_options == ScriptCompiler::kProduceCodeCache)) { | 1461 compile_options == ScriptCompiler::kProduceCodeCache)) { |
| 1460 // No cache entry found, or embedder wants a code cache. Compile the script. | 1462 // No cache entry found, or embedder wants a code cache. Compile the script. |
| 1461 | 1463 |
| 1462 // Create a script object describing the script to be compiled. | 1464 // Create a script object describing the script to be compiled. |
| 1463 Handle<Script> script = isolate->factory()->NewScript(source); | 1465 Handle<Script> script = isolate->factory()->NewScript(source); |
| 1464 if (FLAG_trace_deopt) Script::InitLineEnds(script); | 1466 if (isolate->NeedsSourcePositionsForProfiling()) { |
| 1467 Script::InitLineEnds(script); |
| 1468 } |
| 1465 if (natives == NATIVES_CODE) { | 1469 if (natives == NATIVES_CODE) { |
| 1466 script->set_type(Script::TYPE_NATIVE); | 1470 script->set_type(Script::TYPE_NATIVE); |
| 1467 } else if (natives == EXTENSION_CODE) { | 1471 } else if (natives == EXTENSION_CODE) { |
| 1468 script->set_type(Script::TYPE_EXTENSION); | 1472 script->set_type(Script::TYPE_EXTENSION); |
| 1469 } else if (natives == INSPECTOR_CODE) { | 1473 } else if (natives == INSPECTOR_CODE) { |
| 1470 script->set_type(Script::TYPE_INSPECTOR); | 1474 script->set_type(Script::TYPE_INSPECTOR); |
| 1471 } | 1475 } |
| 1472 if (!script_name.is_null()) { | 1476 if (!script_name.is_null()) { |
| 1473 script->set_name(*script_name); | 1477 script->set_name(*script_name); |
| 1474 script->set_line_offset(line_offset); | 1478 script->set_line_offset(line_offset); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 DCHECK(shared->is_compiled()); | 1733 DCHECK(shared->is_compiled()); |
| 1730 function->set_literals(cached.literals); | 1734 function->set_literals(cached.literals); |
| 1731 } else if (shared->is_compiled()) { | 1735 } else if (shared->is_compiled()) { |
| 1732 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1736 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1733 JSFunction::EnsureLiterals(function); | 1737 JSFunction::EnsureLiterals(function); |
| 1734 } | 1738 } |
| 1735 } | 1739 } |
| 1736 | 1740 |
| 1737 } // namespace internal | 1741 } // namespace internal |
| 1738 } // namespace v8 | 1742 } // namespace v8 |
| OLD | NEW |