| 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/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 info.MarkAsGlobal(); | 1348 info.MarkAsGlobal(); |
| 1349 info.SetCachedData(cached_data, compile_options); | 1349 info.SetCachedData(cached_data, compile_options); |
| 1350 info.SetExtension(extension); | 1350 info.SetExtension(extension); |
| 1351 info.SetContext(context); | 1351 info.SetContext(context); |
| 1352 if (FLAG_serialize_toplevel && | 1352 if (FLAG_serialize_toplevel && |
| 1353 compile_options == ScriptCompiler::kProduceCodeCache) { | 1353 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1354 info.PrepareForSerializing(); | 1354 info.PrepareForSerializing(); |
| 1355 } | 1355 } |
| 1356 if (FLAG_use_strict) { | 1356 if (FLAG_use_strict) { |
| 1357 info.SetLanguageMode( | 1357 info.SetLanguageMode( |
| 1358 static_cast<LanguageMode>(info.language_mode() | STRICT)); | 1358 static_cast<LanguageMode>(info.language_mode() | STRICT_BIT)); |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 result = CompileToplevel(&info); | 1361 result = CompileToplevel(&info); |
| 1362 if (extension == NULL && !result.is_null() && !result->dont_cache()) { | 1362 if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
| 1363 compilation_cache->PutScript(source, context, result); | 1363 compilation_cache->PutScript(source, context, result); |
| 1364 if (FLAG_serialize_toplevel && | 1364 if (FLAG_serialize_toplevel && |
| 1365 compile_options == ScriptCompiler::kProduceCodeCache) { | 1365 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1366 HistogramTimerScope histogram_timer( | 1366 HistogramTimerScope histogram_timer( |
| 1367 isolate->counters()->compile_serialize()); | 1367 isolate->counters()->compile_serialize()); |
| 1368 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1368 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1382 | 1382 |
| 1383 | 1383 |
| 1384 Handle<SharedFunctionInfo> Compiler::CompileStreamedScript( | 1384 Handle<SharedFunctionInfo> Compiler::CompileStreamedScript( |
| 1385 CompilationInfo* info, int source_length) { | 1385 CompilationInfo* info, int source_length) { |
| 1386 Isolate* isolate = info->isolate(); | 1386 Isolate* isolate = info->isolate(); |
| 1387 isolate->counters()->total_load_size()->Increment(source_length); | 1387 isolate->counters()->total_load_size()->Increment(source_length); |
| 1388 isolate->counters()->total_compile_size()->Increment(source_length); | 1388 isolate->counters()->total_compile_size()->Increment(source_length); |
| 1389 | 1389 |
| 1390 if (FLAG_use_strict) { | 1390 if (FLAG_use_strict) { |
| 1391 info->SetLanguageMode( | 1391 info->SetLanguageMode( |
| 1392 static_cast<LanguageMode>(info->language_mode() | STRICT)); | 1392 static_cast<LanguageMode>(info->language_mode() | STRICT_BIT)); |
| 1393 } | 1393 } |
| 1394 // TODO(marja): FLAG_serialize_toplevel is not honoured and won't be; when the | 1394 // TODO(marja): FLAG_serialize_toplevel is not honoured and won't be; when the |
| 1395 // real code caching lands, streaming needs to be adapted to use it. | 1395 // real code caching lands, streaming needs to be adapted to use it. |
| 1396 return CompileToplevel(info); | 1396 return CompileToplevel(info); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 | 1399 |
| 1400 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo( | 1400 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo( |
| 1401 FunctionLiteral* literal, Handle<Script> script, | 1401 FunctionLiteral* literal, Handle<Script> script, |
| 1402 CompilationInfo* outer_info) { | 1402 CompilationInfo* outer_info) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 } | 1609 } |
| 1610 | 1610 |
| 1611 | 1611 |
| 1612 #if DEBUG | 1612 #if DEBUG |
| 1613 void CompilationInfo::PrintAstForTesting() { | 1613 void CompilationInfo::PrintAstForTesting() { |
| 1614 PrintF("--- Source from AST ---\n%s\n", | 1614 PrintF("--- Source from AST ---\n%s\n", |
| 1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1616 } | 1616 } |
| 1617 #endif | 1617 #endif |
| 1618 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
| OLD | NEW |