| 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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 shared_info, context, NOT_TENURED); | 1525 shared_info, context, NOT_TENURED); |
| 1526 | 1526 |
| 1527 // OnAfterCompile has to be called after we create the JSFunction, which we | 1527 // OnAfterCompile has to be called after we create the JSFunction, which we |
| 1528 // may require to recompile the eval for debugging, if we find a function | 1528 // may require to recompile the eval for debugging, if we find a function |
| 1529 // that contains break points in the eval script. | 1529 // that contains break points in the eval script. |
| 1530 isolate->debug()->OnAfterCompile(script); | 1530 isolate->debug()->OnAfterCompile(script); |
| 1531 | 1531 |
| 1532 return result; | 1532 return result; |
| 1533 } | 1533 } |
| 1534 | 1534 |
| 1535 | 1535 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( |
| 1536 Handle<SharedFunctionInfo> Compiler::CompileScript( | |
| 1537 Handle<String> source, Handle<Object> script_name, int line_offset, | 1536 Handle<String> source, Handle<Object> script_name, int line_offset, |
| 1538 int column_offset, ScriptOriginOptions resource_options, | 1537 int column_offset, ScriptOriginOptions resource_options, |
| 1539 Handle<Object> source_map_url, Handle<Context> context, | 1538 Handle<Object> source_map_url, Handle<Context> context, |
| 1540 v8::Extension* extension, ScriptData** cached_data, | 1539 v8::Extension* extension, ScriptData** cached_data, |
| 1541 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, | 1540 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, |
| 1542 bool is_module) { | 1541 bool is_module) { |
| 1543 Isolate* isolate = source->GetIsolate(); | 1542 Isolate* isolate = source->GetIsolate(); |
| 1544 if (compile_options == ScriptCompiler::kNoCompileOptions) { | 1543 if (compile_options == ScriptCompiler::kNoCompileOptions) { |
| 1545 cached_data = NULL; | 1544 cached_data = NULL; |
| 1546 } else if (compile_options == ScriptCompiler::kProduceParserCache || | 1545 } else if (compile_options == ScriptCompiler::kProduceParserCache || |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 isolate->ReportPendingMessages(); | 1660 isolate->ReportPendingMessages(); |
| 1662 } else { | 1661 } else { |
| 1663 isolate->debug()->OnAfterCompile(script); | 1662 isolate->debug()->OnAfterCompile(script); |
| 1664 } | 1663 } |
| 1665 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { | 1664 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { |
| 1666 result->ResetForNewContext(isolate->heap()->global_ic_age()); | 1665 result->ResetForNewContext(isolate->heap()->global_ic_age()); |
| 1667 } | 1666 } |
| 1668 return result; | 1667 return result; |
| 1669 } | 1668 } |
| 1670 | 1669 |
| 1671 | 1670 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript( |
| 1672 Handle<SharedFunctionInfo> Compiler::CompileStreamedScript( | |
| 1673 Handle<Script> script, ParseInfo* parse_info, int source_length) { | 1671 Handle<Script> script, ParseInfo* parse_info, int source_length) { |
| 1674 Isolate* isolate = script->GetIsolate(); | 1672 Isolate* isolate = script->GetIsolate(); |
| 1675 // TODO(titzer): increment the counters in caller. | 1673 // TODO(titzer): increment the counters in caller. |
| 1676 isolate->counters()->total_load_size()->Increment(source_length); | 1674 isolate->counters()->total_load_size()->Increment(source_length); |
| 1677 isolate->counters()->total_compile_size()->Increment(source_length); | 1675 isolate->counters()->total_compile_size()->Increment(source_length); |
| 1678 | 1676 |
| 1679 LanguageMode language_mode = | 1677 LanguageMode language_mode = |
| 1680 construct_language_mode(FLAG_use_strict, FLAG_use_strong); | 1678 construct_language_mode(FLAG_use_strict, FLAG_use_strong); |
| 1681 parse_info->set_language_mode( | 1679 parse_info->set_language_mode( |
| 1682 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); | 1680 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 | 1909 |
| 1912 #if DEBUG | 1910 #if DEBUG |
| 1913 void CompilationInfo::PrintAstForTesting() { | 1911 void CompilationInfo::PrintAstForTesting() { |
| 1914 PrintF("--- Source from AST ---\n%s\n", | 1912 PrintF("--- Source from AST ---\n%s\n", |
| 1915 PrettyPrinter(isolate()).PrintProgram(literal())); | 1913 PrettyPrinter(isolate()).PrintProgram(literal())); |
| 1916 } | 1914 } |
| 1917 #endif | 1915 #endif |
| 1918 | 1916 |
| 1919 } // namespace internal | 1917 } // namespace internal |
| 1920 } // namespace v8 | 1918 } // namespace v8 |
| OLD | NEW |