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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 return Compiler::GetFunctionFromEval(source, outer_info, native_context, | 1404 return Compiler::GetFunctionFromEval(source, outer_info, native_context, |
1405 SLOPPY, restriction, eval_scope_position, | 1405 SLOPPY, restriction, eval_scope_position, |
1406 eval_position); | 1406 eval_position); |
1407 } | 1407 } |
1408 | 1408 |
1409 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( | 1409 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( |
1410 Handle<String> source, Handle<Object> script_name, int line_offset, | 1410 Handle<String> source, Handle<Object> script_name, int line_offset, |
1411 int column_offset, ScriptOriginOptions resource_options, | 1411 int column_offset, ScriptOriginOptions resource_options, |
1412 Handle<Object> source_map_url, Handle<Context> context, | 1412 Handle<Object> source_map_url, Handle<Context> context, |
1413 v8::Extension* extension, ScriptData** cached_data, | 1413 v8::Extension* extension, ScriptData** cached_data, |
1414 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, | 1414 ScriptCompiler::CompileOptions compile_options, NativesFlag natives) { |
1415 bool is_module) { | |
1416 Isolate* isolate = source->GetIsolate(); | 1415 Isolate* isolate = source->GetIsolate(); |
1417 if (compile_options == ScriptCompiler::kNoCompileOptions) { | 1416 if (compile_options == ScriptCompiler::kNoCompileOptions) { |
1418 cached_data = NULL; | 1417 cached_data = NULL; |
1419 } else if (compile_options == ScriptCompiler::kProduceParserCache || | 1418 } else if (compile_options == ScriptCompiler::kProduceParserCache || |
1420 compile_options == ScriptCompiler::kProduceCodeCache) { | 1419 compile_options == ScriptCompiler::kProduceCodeCache) { |
1421 DCHECK(cached_data && !*cached_data); | 1420 DCHECK(cached_data && !*cached_data); |
1422 DCHECK(extension == NULL); | 1421 DCHECK(extension == NULL); |
1423 DCHECK(!isolate->debug()->is_loaded()); | 1422 DCHECK(!isolate->debug()->is_loaded()); |
1424 } else { | 1423 } else { |
1425 DCHECK(compile_options == ScriptCompiler::kConsumeParserCache || | 1424 DCHECK(compile_options == ScriptCompiler::kConsumeParserCache || |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 } | 1491 } |
1493 script->set_origin_options(resource_options); | 1492 script->set_origin_options(resource_options); |
1494 if (!source_map_url.is_null()) { | 1493 if (!source_map_url.is_null()) { |
1495 script->set_source_mapping_url(*source_map_url); | 1494 script->set_source_mapping_url(*source_map_url); |
1496 } | 1495 } |
1497 | 1496 |
1498 // Compile the function and add it to the cache. | 1497 // Compile the function and add it to the cache. |
1499 Zone zone(isolate->allocator(), ZONE_NAME); | 1498 Zone zone(isolate->allocator(), ZONE_NAME); |
1500 ParseInfo parse_info(&zone, script); | 1499 ParseInfo parse_info(&zone, script); |
1501 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | 1500 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1502 if (is_module) parse_info.set_module(); | 1501 if (resource_options.IsModule()) parse_info.set_module(); |
1503 if (compile_options != ScriptCompiler::kNoCompileOptions) { | 1502 if (compile_options != ScriptCompiler::kNoCompileOptions) { |
1504 parse_info.set_cached_data(cached_data); | 1503 parse_info.set_cached_data(cached_data); |
1505 } | 1504 } |
1506 parse_info.set_compile_options(compile_options); | 1505 parse_info.set_compile_options(compile_options); |
1507 parse_info.set_extension(extension); | 1506 parse_info.set_extension(extension); |
1508 if (!context->IsNativeContext()) { | 1507 if (!context->IsNativeContext()) { |
1509 parse_info.set_outer_scope_info(handle(context->scope_info())); | 1508 parse_info.set_outer_scope_info(handle(context->scope_info())); |
1510 } | 1509 } |
1511 if (FLAG_serialize_toplevel && | 1510 if (FLAG_serialize_toplevel && |
1512 compile_options == ScriptCompiler::kProduceCodeCache) { | 1511 compile_options == ScriptCompiler::kProduceCodeCache) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 DCHECK(shared->is_compiled()); | 1745 DCHECK(shared->is_compiled()); |
1747 function->set_literals(cached.literals); | 1746 function->set_literals(cached.literals); |
1748 } else if (shared->is_compiled()) { | 1747 } else if (shared->is_compiled()) { |
1749 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1748 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1750 JSFunction::EnsureLiterals(function); | 1749 JSFunction::EnsureLiterals(function); |
1751 } | 1750 } |
1752 } | 1751 } |
1753 | 1752 |
1754 } // namespace internal | 1753 } // namespace internal |
1755 } // namespace v8 | 1754 } // namespace v8 |
OLD | NEW |