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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 isolate->counters()->total_load_size()->Increment(source_length); | 1320 isolate->counters()->total_load_size()->Increment(source_length); |
1321 isolate->counters()->total_compile_size()->Increment(source_length); | 1321 isolate->counters()->total_compile_size()->Increment(source_length); |
1322 | 1322 |
1323 LanguageMode language_mode = | 1323 LanguageMode language_mode = |
1324 construct_language_mode(FLAG_use_strict, FLAG_use_strong); | 1324 construct_language_mode(FLAG_use_strict, FLAG_use_strong); |
1325 parse_info->set_language_mode( | 1325 parse_info->set_language_mode( |
1326 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); | 1326 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); |
1327 | 1327 |
1328 CompilationInfo compile_info(parse_info); | 1328 CompilationInfo compile_info(parse_info); |
1329 | 1329 |
1330 // If compiling for debugging, parse eagerly from scratch. | 1330 // The source was parsed lazily, so compiling for debugging is not possible. |
1331 if (compile_info.is_debug()) parse_info->set_literal(NULL); | 1331 DCHECK(!compile_info.is_debug()); |
1332 | 1332 |
1333 return CompileToplevel(&compile_info); | 1333 return CompileToplevel(&compile_info); |
1334 } | 1334 } |
1335 | 1335 |
1336 | 1336 |
1337 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( | 1337 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( |
1338 FunctionLiteral* literal, Handle<Script> script, | 1338 FunctionLiteral* literal, Handle<Script> script, |
1339 CompilationInfo* outer_info) { | 1339 CompilationInfo* outer_info) { |
1340 // Precondition: code has been parsed and scopes have been analyzed. | 1340 // Precondition: code has been parsed and scopes have been analyzed. |
1341 Isolate* isolate = outer_info->isolate(); | 1341 Isolate* isolate = outer_info->isolate(); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1616 |
1617 | 1617 |
1618 #if DEBUG | 1618 #if DEBUG |
1619 void CompilationInfo::PrintAstForTesting() { | 1619 void CompilationInfo::PrintAstForTesting() { |
1620 PrintF("--- Source from AST ---\n%s\n", | 1620 PrintF("--- Source from AST ---\n%s\n", |
1621 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1621 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1622 } | 1622 } |
1623 #endif | 1623 #endif |
1624 } // namespace internal | 1624 } // namespace internal |
1625 } // namespace v8 | 1625 } // namespace v8 |
OLD | NEW |