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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 return Compiler::GetFunctionFromEval(source, outer_info, native_context, | 1483 return Compiler::GetFunctionFromEval(source, outer_info, native_context, |
1484 SLOPPY, restriction, eval_scope_position, | 1484 SLOPPY, restriction, eval_scope_position, |
1485 eval_position); | 1485 eval_position); |
1486 } | 1486 } |
1487 | 1487 |
1488 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( | 1488 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( |
1489 Handle<String> source, Handle<Object> script_name, int line_offset, | 1489 Handle<String> source, Handle<Object> script_name, int line_offset, |
1490 int column_offset, ScriptOriginOptions resource_options, | 1490 int column_offset, ScriptOriginOptions resource_options, |
1491 Handle<Object> source_map_url, Handle<Context> context, | 1491 Handle<Object> source_map_url, Handle<Context> context, |
1492 v8::Extension* extension, ScriptData** cached_data, | 1492 v8::Extension* extension, ScriptData** cached_data, |
1493 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, | 1493 ScriptCompiler::CompileOptions compile_options, NativesFlag natives) { |
1494 bool is_module) { | |
1495 Isolate* isolate = source->GetIsolate(); | 1494 Isolate* isolate = source->GetIsolate(); |
1496 if (compile_options == ScriptCompiler::kNoCompileOptions) { | 1495 if (compile_options == ScriptCompiler::kNoCompileOptions) { |
1497 cached_data = NULL; | 1496 cached_data = NULL; |
1498 } else if (compile_options == ScriptCompiler::kProduceParserCache || | 1497 } else if (compile_options == ScriptCompiler::kProduceParserCache || |
1499 compile_options == ScriptCompiler::kProduceCodeCache) { | 1498 compile_options == ScriptCompiler::kProduceCodeCache) { |
1500 DCHECK(cached_data && !*cached_data); | 1499 DCHECK(cached_data && !*cached_data); |
1501 DCHECK(extension == NULL); | 1500 DCHECK(extension == NULL); |
1502 DCHECK(!isolate->debug()->is_loaded()); | 1501 DCHECK(!isolate->debug()->is_loaded()); |
1503 } else { | 1502 } else { |
1504 DCHECK(compile_options == ScriptCompiler::kConsumeParserCache || | 1503 DCHECK(compile_options == ScriptCompiler::kConsumeParserCache || |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 } | 1570 } |
1572 script->set_origin_options(resource_options); | 1571 script->set_origin_options(resource_options); |
1573 if (!source_map_url.is_null()) { | 1572 if (!source_map_url.is_null()) { |
1574 script->set_source_mapping_url(*source_map_url); | 1573 script->set_source_mapping_url(*source_map_url); |
1575 } | 1574 } |
1576 | 1575 |
1577 // Compile the function and add it to the cache. | 1576 // Compile the function and add it to the cache. |
1578 Zone zone(isolate->allocator(), ZONE_NAME); | 1577 Zone zone(isolate->allocator(), ZONE_NAME); |
1579 ParseInfo parse_info(&zone, script); | 1578 ParseInfo parse_info(&zone, script); |
1580 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); | 1579 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); |
1581 if (is_module) parse_info.set_module(); | 1580 if (resource_options.IsModule()) parse_info.set_module(); |
1582 if (compile_options != ScriptCompiler::kNoCompileOptions) { | 1581 if (compile_options != ScriptCompiler::kNoCompileOptions) { |
1583 parse_info.set_cached_data(cached_data); | 1582 parse_info.set_cached_data(cached_data); |
1584 } | 1583 } |
1585 parse_info.set_compile_options(compile_options); | 1584 parse_info.set_compile_options(compile_options); |
1586 parse_info.set_extension(extension); | 1585 parse_info.set_extension(extension); |
1587 if (!context->IsNativeContext()) { | 1586 if (!context->IsNativeContext()) { |
1588 parse_info.set_outer_scope_info(handle(context->scope_info())); | 1587 parse_info.set_outer_scope_info(handle(context->scope_info())); |
1589 } | 1588 } |
1590 if (FLAG_serialize_toplevel && | 1589 if (FLAG_serialize_toplevel && |
1591 compile_options == ScriptCompiler::kProduceCodeCache) { | 1590 compile_options == ScriptCompiler::kProduceCodeCache) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 } | 1762 } |
1764 | 1763 |
1765 if (shared->is_compiled()) { | 1764 if (shared->is_compiled()) { |
1766 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1765 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1767 JSFunction::EnsureLiterals(function); | 1766 JSFunction::EnsureLiterals(function); |
1768 } | 1767 } |
1769 } | 1768 } |
1770 | 1769 |
1771 } // namespace internal | 1770 } // namespace internal |
1772 } // namespace v8 | 1771 } // namespace v8 |
OLD | NEW |