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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 shared_info, context, NOT_TENURED); | 1540 shared_info, context, NOT_TENURED); |
1541 | 1541 |
1542 // OnAfterCompile has to be called after we create the JSFunction, which we | 1542 // OnAfterCompile has to be called after we create the JSFunction, which we |
1543 // may require to recompile the eval for debugging, if we find a function | 1543 // may require to recompile the eval for debugging, if we find a function |
1544 // that contains break points in the eval script. | 1544 // that contains break points in the eval script. |
1545 isolate->debug()->OnAfterCompile(script); | 1545 isolate->debug()->OnAfterCompile(script); |
1546 | 1546 |
1547 return result; | 1547 return result; |
1548 } | 1548 } |
1549 | 1549 |
1550 | 1550 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( |
1551 Handle<SharedFunctionInfo> Compiler::CompileScript( | |
1552 Handle<String> source, Handle<Object> script_name, int line_offset, | 1551 Handle<String> source, Handle<Object> script_name, int line_offset, |
1553 int column_offset, ScriptOriginOptions resource_options, | 1552 int column_offset, ScriptOriginOptions resource_options, |
1554 Handle<Object> source_map_url, Handle<Context> context, | 1553 Handle<Object> source_map_url, Handle<Context> context, |
1555 v8::Extension* extension, ScriptData** cached_data, | 1554 v8::Extension* extension, ScriptData** cached_data, |
1556 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, | 1555 ScriptCompiler::CompileOptions compile_options, NativesFlag natives, |
1557 bool is_module) { | 1556 bool is_module) { |
1558 Isolate* isolate = source->GetIsolate(); | 1557 Isolate* isolate = source->GetIsolate(); |
1559 if (compile_options == ScriptCompiler::kNoCompileOptions) { | 1558 if (compile_options == ScriptCompiler::kNoCompileOptions) { |
1560 cached_data = NULL; | 1559 cached_data = NULL; |
1561 } else if (compile_options == ScriptCompiler::kProduceParserCache || | 1560 } else if (compile_options == ScriptCompiler::kProduceParserCache || |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 isolate->ReportPendingMessages(); | 1675 isolate->ReportPendingMessages(); |
1677 } else { | 1676 } else { |
1678 isolate->debug()->OnAfterCompile(script); | 1677 isolate->debug()->OnAfterCompile(script); |
1679 } | 1678 } |
1680 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { | 1679 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { |
1681 result->ResetForNewContext(isolate->heap()->global_ic_age()); | 1680 result->ResetForNewContext(isolate->heap()->global_ic_age()); |
1682 } | 1681 } |
1683 return result; | 1682 return result; |
1684 } | 1683 } |
1685 | 1684 |
1686 | 1685 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript( |
1687 Handle<SharedFunctionInfo> Compiler::CompileStreamedScript( | |
1688 Handle<Script> script, ParseInfo* parse_info, int source_length) { | 1686 Handle<Script> script, ParseInfo* parse_info, int source_length) { |
1689 Isolate* isolate = script->GetIsolate(); | 1687 Isolate* isolate = script->GetIsolate(); |
1690 // TODO(titzer): increment the counters in caller. | 1688 // TODO(titzer): increment the counters in caller. |
1691 isolate->counters()->total_load_size()->Increment(source_length); | 1689 isolate->counters()->total_load_size()->Increment(source_length); |
1692 isolate->counters()->total_compile_size()->Increment(source_length); | 1690 isolate->counters()->total_compile_size()->Increment(source_length); |
1693 | 1691 |
1694 LanguageMode language_mode = | 1692 LanguageMode language_mode = |
1695 construct_language_mode(FLAG_use_strict, FLAG_use_strong); | 1693 construct_language_mode(FLAG_use_strict, FLAG_use_strong); |
1696 parse_info->set_language_mode( | 1694 parse_info->set_language_mode( |
1697 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); | 1695 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 | 1957 |
1960 #if DEBUG | 1958 #if DEBUG |
1961 void CompilationInfo::PrintAstForTesting() { | 1959 void CompilationInfo::PrintAstForTesting() { |
1962 PrintF("--- Source from AST ---\n%s\n", | 1960 PrintF("--- Source from AST ---\n%s\n", |
1963 PrettyPrinter(isolate()).PrintProgram(literal())); | 1961 PrettyPrinter(isolate()).PrintProgram(literal())); |
1964 } | 1962 } |
1965 #endif | 1963 #endif |
1966 | 1964 |
1967 } // namespace internal | 1965 } // namespace internal |
1968 } // namespace v8 | 1966 } // namespace v8 |
OLD | NEW |