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

Unified Diff: src/runtime.cc

Issue 8590027: Fix the ScopeIterator reimplemantation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « src/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | test/mjsunit/debug-stepout-scope.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698