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 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1326 // TODO(titzer): increment the counters in caller. | 1326 // TODO(titzer): increment the counters in caller. |
1327 isolate->counters()->total_load_size()->Increment(source_length); | 1327 isolate->counters()->total_load_size()->Increment(source_length); |
1328 isolate->counters()->total_compile_size()->Increment(source_length); | 1328 isolate->counters()->total_compile_size()->Increment(source_length); |
1329 | 1329 |
1330 LanguageMode language_mode = | 1330 LanguageMode language_mode = |
1331 construct_language_mode(FLAG_use_strict, FLAG_use_strong); | 1331 construct_language_mode(FLAG_use_strict, FLAG_use_strong); |
1332 parse_info->set_language_mode( | 1332 parse_info->set_language_mode( |
1333 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); | 1333 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); |
1334 | 1334 |
1335 CompilationInfo compile_info(parse_info); | 1335 CompilationInfo compile_info(parse_info); |
1336 // TODO(marja): FLAG_serialize_toplevel is not honoured and won't be; when the | 1336 |
1337 // real code caching lands, streaming needs to be adapted to use it. | 1337 // If compiling for debugging, parse eagerly from scratch. |
Yang
2015/07/21 08:40:40
For the current strategy used in Chrome this is no
| |
1338 if (compile_info.is_debug()) parse_info->set_literal(NULL); | |
1339 | |
1338 return CompileToplevel(&compile_info); | 1340 return CompileToplevel(&compile_info); |
1339 } | 1341 } |
1340 | 1342 |
1341 | 1343 |
1342 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( | 1344 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( |
1343 FunctionLiteral* literal, Handle<Script> script, | 1345 FunctionLiteral* literal, Handle<Script> script, |
1344 CompilationInfo* outer_info) { | 1346 CompilationInfo* outer_info) { |
1345 // Precondition: code has been parsed and scopes have been analyzed. | 1347 // Precondition: code has been parsed and scopes have been analyzed. |
1346 Isolate* isolate = outer_info->isolate(); | 1348 Isolate* isolate = outer_info->isolate(); |
1347 MaybeHandle<SharedFunctionInfo> maybe_existing; | 1349 MaybeHandle<SharedFunctionInfo> maybe_existing; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1621 | 1623 |
1622 | 1624 |
1623 #if DEBUG | 1625 #if DEBUG |
1624 void CompilationInfo::PrintAstForTesting() { | 1626 void CompilationInfo::PrintAstForTesting() { |
1625 PrintF("--- Source from AST ---\n%s\n", | 1627 PrintF("--- Source from AST ---\n%s\n", |
1626 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1628 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1627 } | 1629 } |
1628 #endif | 1630 #endif |
1629 } // namespace internal | 1631 } // namespace internal |
1630 } // namespace v8 | 1632 } // namespace v8 |
OLD | NEW |