| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1258 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1259 shared_info, context, NOT_TENURED); | 1259 shared_info, context, NOT_TENURED); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 | 1262 |
| 1263 Handle<SharedFunctionInfo> Compiler::CompileScript( | 1263 Handle<SharedFunctionInfo> Compiler::CompileScript( |
| 1264 Handle<String> source, Handle<Object> script_name, int line_offset, | 1264 Handle<String> source, Handle<Object> script_name, int line_offset, |
| 1265 int column_offset, bool is_embedder_debug_script, | 1265 int column_offset, bool is_embedder_debug_script, |
| 1266 bool is_shared_cross_origin, Handle<Context> context, | 1266 bool is_shared_cross_origin, Handle<Object> source_map_url, |
| 1267 v8::Extension* extension, ScriptData** cached_data, | 1267 Handle<Context> context, v8::Extension* extension, ScriptData** cached_data, |
| 1268 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, | 1268 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, |
| 1269 bool is_module) { | 1269 bool is_module) { |
| 1270 Isolate* isolate = source->GetIsolate(); | 1270 Isolate* isolate = source->GetIsolate(); |
| 1271 if (compile_options == ScriptCompiler::kNoCompileOptions) { | 1271 if (compile_options == ScriptCompiler::kNoCompileOptions) { |
| 1272 cached_data = NULL; | 1272 cached_data = NULL; |
| 1273 } else if (compile_options == ScriptCompiler::kProduceParserCache || | 1273 } else if (compile_options == ScriptCompiler::kProduceParserCache || |
| 1274 compile_options == ScriptCompiler::kProduceCodeCache) { | 1274 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1275 DCHECK(cached_data && !*cached_data); | 1275 DCHECK(cached_data && !*cached_data); |
| 1276 DCHECK(extension == NULL); | 1276 DCHECK(extension == NULL); |
| 1277 DCHECK(!isolate->debug()->is_loaded()); | 1277 DCHECK(!isolate->debug()->is_loaded()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 if (natives == NATIVES_CODE) { | 1328 if (natives == NATIVES_CODE) { |
| 1329 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 1329 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 1330 } | 1330 } |
| 1331 if (!script_name.is_null()) { | 1331 if (!script_name.is_null()) { |
| 1332 script->set_name(*script_name); | 1332 script->set_name(*script_name); |
| 1333 script->set_line_offset(Smi::FromInt(line_offset)); | 1333 script->set_line_offset(Smi::FromInt(line_offset)); |
| 1334 script->set_column_offset(Smi::FromInt(column_offset)); | 1334 script->set_column_offset(Smi::FromInt(column_offset)); |
| 1335 } | 1335 } |
| 1336 script->set_is_shared_cross_origin(is_shared_cross_origin); | 1336 script->set_is_shared_cross_origin(is_shared_cross_origin); |
| 1337 script->set_is_embedder_debug_script(is_embedder_debug_script); | 1337 script->set_is_embedder_debug_script(is_embedder_debug_script); |
| 1338 if (!source_map_url.is_null()) { |
| 1339 script->set_source_mapping_url(*source_map_url); |
| 1340 } |
| 1338 | 1341 |
| 1339 // Compile the function and add it to the cache. | 1342 // Compile the function and add it to the cache. |
| 1340 CompilationInfoWithZone info(script); | 1343 CompilationInfoWithZone info(script); |
| 1341 if (FLAG_harmony_modules && is_module) { | 1344 if (FLAG_harmony_modules && is_module) { |
| 1342 info.MarkAsModule(); | 1345 info.MarkAsModule(); |
| 1343 } else { | 1346 } else { |
| 1344 info.MarkAsGlobal(); | 1347 info.MarkAsGlobal(); |
| 1345 } | 1348 } |
| 1346 info.SetCachedData(cached_data, compile_options); | 1349 info.SetCachedData(cached_data, compile_options); |
| 1347 info.SetExtension(extension); | 1350 info.SetExtension(extension); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 } | 1612 } |
| 1610 | 1613 |
| 1611 | 1614 |
| 1612 #if DEBUG | 1615 #if DEBUG |
| 1613 void CompilationInfo::PrintAstForTesting() { | 1616 void CompilationInfo::PrintAstForTesting() { |
| 1614 PrintF("--- Source from AST ---\n%s\n", | 1617 PrintF("--- Source from AST ---\n%s\n", |
| 1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1618 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1616 } | 1619 } |
| 1617 #endif | 1620 #endif |
| 1618 } } // namespace v8::internal | 1621 } } // namespace v8::internal |
| OLD | NEW |