Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: src/compiler.cc

Issue 2342443004: Only pass the outer scope info with ParseInfo (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/background-parsing-task.cc ('k') | src/compiler-dispatcher/compiler-dispatcher-job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); 1475 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
1476 Script::SetEvalOrigin(script, outer_info, eval_position); 1476 Script::SetEvalOrigin(script, outer_info, eval_position);
1477 1477
1478 Zone zone(isolate->allocator()); 1478 Zone zone(isolate->allocator());
1479 ParseInfo parse_info(&zone, script); 1479 ParseInfo parse_info(&zone, script);
1480 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1480 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1481 parse_info.set_eval(); 1481 parse_info.set_eval();
1482 if (context->IsNativeContext()) parse_info.set_global(); 1482 if (context->IsNativeContext()) parse_info.set_global();
1483 parse_info.set_language_mode(language_mode); 1483 parse_info.set_language_mode(language_mode);
1484 parse_info.set_parse_restriction(restriction); 1484 parse_info.set_parse_restriction(restriction);
1485 parse_info.set_context(context); 1485 if (!context->IsNativeContext()) {
1486 parse_info.set_outer_scope_info(handle(context->scope_info()));
1487 }
1486 1488
1487 shared_info = CompileToplevel(&info); 1489 shared_info = CompileToplevel(&info);
1488 1490
1489 if (shared_info.is_null()) { 1491 if (shared_info.is_null()) {
1490 return MaybeHandle<JSFunction>(); 1492 return MaybeHandle<JSFunction>();
1491 } else { 1493 } else {
1492 // If caller is strict mode, the result must be in strict mode as well. 1494 // If caller is strict mode, the result must be in strict mode as well.
1493 DCHECK(is_sloppy(language_mode) || 1495 DCHECK(is_sloppy(language_mode) ||
1494 is_strict(shared_info->language_mode())); 1496 is_strict(shared_info->language_mode()));
1495 compilation_cache->PutEval(source, outer_info, context, shared_info, 1497 compilation_cache->PutEval(source, outer_info, context, shared_info,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 if (is_module) { 1650 if (is_module) {
1649 parse_info.set_module(); 1651 parse_info.set_module();
1650 } else { 1652 } else {
1651 parse_info.set_global(); 1653 parse_info.set_global();
1652 } 1654 }
1653 if (compile_options != ScriptCompiler::kNoCompileOptions) { 1655 if (compile_options != ScriptCompiler::kNoCompileOptions) {
1654 parse_info.set_cached_data(cached_data); 1656 parse_info.set_cached_data(cached_data);
1655 } 1657 }
1656 parse_info.set_compile_options(compile_options); 1658 parse_info.set_compile_options(compile_options);
1657 parse_info.set_extension(extension); 1659 parse_info.set_extension(extension);
1658 parse_info.set_context(context); 1660 if (!context->IsNativeContext()) {
1661 parse_info.set_outer_scope_info(handle(context->scope_info()));
1662 }
1659 if (FLAG_serialize_toplevel && 1663 if (FLAG_serialize_toplevel &&
1660 compile_options == ScriptCompiler::kProduceCodeCache) { 1664 compile_options == ScriptCompiler::kProduceCodeCache) {
1661 info.PrepareForSerializing(); 1665 info.PrepareForSerializing();
1662 } 1666 }
1663 1667
1664 parse_info.set_language_mode( 1668 parse_info.set_language_mode(
1665 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); 1669 static_cast<LanguageMode>(parse_info.language_mode() | language_mode));
1666 result = CompileToplevel(&info); 1670 result = CompileToplevel(&info);
1667 if (extension == NULL && !result.is_null()) { 1671 if (extension == NULL && !result.is_null()) {
1668 compilation_cache->PutScript(source, context, language_mode, result); 1672 compilation_cache->PutScript(source, context, language_mode, result);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 DCHECK(shared->is_compiled()); 1906 DCHECK(shared->is_compiled());
1903 function->set_literals(cached.literals); 1907 function->set_literals(cached.literals);
1904 } else if (shared->is_compiled()) { 1908 } else if (shared->is_compiled()) {
1905 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1909 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1906 JSFunction::EnsureLiterals(function); 1910 JSFunction::EnsureLiterals(function);
1907 } 1911 }
1908 } 1912 }
1909 1913
1910 } // namespace internal 1914 } // namespace internal
1911 } // namespace v8 1915 } // namespace v8
OLDNEW
« no previous file with comments | « src/background-parsing-task.cc ('k') | src/compiler-dispatcher/compiler-dispatcher-job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698