Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index 46bb5dc1c668104b03def8bd12cbb9546c6dbeaa..31fbaf7697300da4d1253ddb7bd431c203929bc6 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -11234,8 +11234,19 @@ class ScopeIterator { |
| if (scope_info->Type() != FUNCTION_SCOPE) { |
| // Global or eval code. |
| CompilationInfo info(script); |
| + ScriptDataImpl* pre_data = NULL; |
| + int flags = kNoParsingFlags; |
| + if (info.is_native() || FLAG_allow_natives_syntax) { |
| + flags |= kAllowNativesSyntax; |
| + } |
| + if (!info.is_native() && FLAG_harmony_scoping){ |
| + flags |= kHarmonyScoping; |
| + } |
| if (scope_info->Type() == GLOBAL_SCOPE) { |
| + Handle<String> source(String::cast(script->source())); |
| + pre_data = ParserApi::PartialPreParse(source, NULL, flags); |
|
Lasse Reichstein
2011/11/18 14:12:52
Why preparse? Is it for speed?
Maybe only do it i
Steven
2011/11/18 16:53:19
Initially this was only for mimicking the behaviou
|
| info.MarkAsGlobal(); |
| + info.SetPreParseData(pre_data); |
| } else { |
| ASSERT(scope_info->Type() == EVAL_SCOPE); |
| info.MarkAsEval(); |
| @@ -11244,6 +11255,10 @@ class ScopeIterator { |
| CHECK(ParserApi::Parse(&info)); |
| CHECK(Scope::Analyze(&info)); |
| scope = info.function()->scope(); |
| + // Delete preparse data again. |
| + if (pre_data != NULL) { |
| + delete pre_data; |
| + } |
| } else { |
| // Function code |
| CompilationInfo info(shared_info); |