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

Side by Side Diff: src/compiler.cc

Issue 2342443004: Only pass the outer scope info with ParseInfo (Closed)
Patch Set: 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
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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); 1456 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
1457 Script::SetEvalOrigin(script, outer_info, eval_position); 1457 Script::SetEvalOrigin(script, outer_info, eval_position);
1458 1458
1459 Zone zone(isolate->allocator()); 1459 Zone zone(isolate->allocator());
1460 ParseInfo parse_info(&zone, script); 1460 ParseInfo parse_info(&zone, script);
1461 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1461 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1462 parse_info.set_eval(); 1462 parse_info.set_eval();
1463 if (context->IsNativeContext()) parse_info.set_global(); 1463 if (context->IsNativeContext()) parse_info.set_global();
1464 parse_info.set_language_mode(language_mode); 1464 parse_info.set_language_mode(language_mode);
1465 parse_info.set_parse_restriction(restriction); 1465 parse_info.set_parse_restriction(restriction);
1466 parse_info.set_context(context); 1466 if (!context->IsNativeContext()) {
1467 parse_info.set_outer_scope_info(handle(context->scope_info()));
1468 }
1467 1469
1468 shared_info = CompileToplevel(&info); 1470 shared_info = CompileToplevel(&info);
1469 1471
1470 if (shared_info.is_null()) { 1472 if (shared_info.is_null()) {
1471 return MaybeHandle<JSFunction>(); 1473 return MaybeHandle<JSFunction>();
1472 } else { 1474 } else {
1473 // If caller is strict mode, the result must be in strict mode as well. 1475 // If caller is strict mode, the result must be in strict mode as well.
1474 DCHECK(is_sloppy(language_mode) || 1476 DCHECK(is_sloppy(language_mode) ||
1475 is_strict(shared_info->language_mode())); 1477 is_strict(shared_info->language_mode()));
1476 compilation_cache->PutEval(source, outer_info, context, shared_info, 1478 compilation_cache->PutEval(source, outer_info, context, shared_info,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 if (is_module) { 1631 if (is_module) {
1630 parse_info.set_module(); 1632 parse_info.set_module();
1631 } else { 1633 } else {
1632 parse_info.set_global(); 1634 parse_info.set_global();
1633 } 1635 }
1634 if (compile_options != ScriptCompiler::kNoCompileOptions) { 1636 if (compile_options != ScriptCompiler::kNoCompileOptions) {
1635 parse_info.set_cached_data(cached_data); 1637 parse_info.set_cached_data(cached_data);
1636 } 1638 }
1637 parse_info.set_compile_options(compile_options); 1639 parse_info.set_compile_options(compile_options);
1638 parse_info.set_extension(extension); 1640 parse_info.set_extension(extension);
1639 parse_info.set_context(context); 1641 if (!context->IsNativeContext()) {
1642 parse_info.set_outer_scope_info(handle(context->scope_info()));
1643 }
1640 if (FLAG_serialize_toplevel && 1644 if (FLAG_serialize_toplevel &&
1641 compile_options == ScriptCompiler::kProduceCodeCache) { 1645 compile_options == ScriptCompiler::kProduceCodeCache) {
1642 info.PrepareForSerializing(); 1646 info.PrepareForSerializing();
1643 } 1647 }
1644 1648
1645 parse_info.set_language_mode( 1649 parse_info.set_language_mode(
1646 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); 1650 static_cast<LanguageMode>(parse_info.language_mode() | language_mode));
1647 result = CompileToplevel(&info); 1651 result = CompileToplevel(&info);
1648 if (extension == NULL && !result.is_null()) { 1652 if (extension == NULL && !result.is_null()) {
1649 compilation_cache->PutScript(source, context, language_mode, result); 1653 compilation_cache->PutScript(source, context, language_mode, result);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 DCHECK(shared->is_compiled()); 1893 DCHECK(shared->is_compiled());
1890 function->set_literals(cached.literals); 1894 function->set_literals(cached.literals);
1891 } else if (shared->is_compiled()) { 1895 } else if (shared->is_compiled()) {
1892 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1896 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1893 JSFunction::EnsureLiterals(function); 1897 JSFunction::EnsureLiterals(function);
1894 } 1898 }
1895 } 1899 }
1896 1900
1897 } // namespace internal 1901 } // namespace internal
1898 } // namespace v8 1902 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698