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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 422923004: Track usage of "this" and "arguments" in Scope (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/preparser.h ('k') | src/scopeinfo.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1125 }
1126 1126
1127 if (ignore_nested_scopes) { 1127 if (ignore_nested_scopes) {
1128 if (scope_info->HasContext()) { 1128 if (scope_info->HasContext()) {
1129 context_ = Handle<Context>(context_->declaration_context(), isolate_); 1129 context_ = Handle<Context>(context_->declaration_context(), isolate_);
1130 } else { 1130 } else {
1131 while (context_->closure() == *function_) { 1131 while (context_->closure() == *function_) {
1132 context_ = Handle<Context>(context_->previous(), isolate_); 1132 context_ = Handle<Context>(context_->previous(), isolate_);
1133 } 1133 }
1134 } 1134 }
1135 if (scope_info->scope_type() == FUNCTION_SCOPE) { 1135 if (scope_info->scope_type() == FUNCTION_SCOPE ||
1136 scope_info->scope_type() == ARROW_SCOPE) {
1136 nested_scope_chain_.Add(scope_info); 1137 nested_scope_chain_.Add(scope_info);
1137 } 1138 }
1138 } else { 1139 } else {
1139 // Reparse the code and analyze the scopes. 1140 // Reparse the code and analyze the scopes.
1140 Handle<Script> script(Script::cast(shared_info->script())); 1141 Handle<Script> script(Script::cast(shared_info->script()));
1141 Scope* scope = NULL; 1142 Scope* scope = NULL;
1142 1143
1143 // Check whether we are in global, eval or function code. 1144 // Check whether we are in global, eval or function code.
1144 Handle<ScopeInfo> scope_info(shared_info->scope_info()); 1145 Handle<ScopeInfo> scope_info(shared_info->scope_info());
1145 if (scope_info->scope_type() != FUNCTION_SCOPE) { 1146 if (scope_info->scope_type() != FUNCTION_SCOPE &&
1147 scope_info->scope_type() != ARROW_SCOPE) {
1146 // Global or eval code. 1148 // Global or eval code.
1147 CompilationInfoWithZone info(script); 1149 CompilationInfoWithZone info(script);
1148 if (scope_info->scope_type() == GLOBAL_SCOPE) { 1150 if (scope_info->scope_type() == GLOBAL_SCOPE) {
1149 info.MarkAsGlobal(); 1151 info.MarkAsGlobal();
1150 } else { 1152 } else {
1151 DCHECK(scope_info->scope_type() == EVAL_SCOPE); 1153 DCHECK(scope_info->scope_type() == EVAL_SCOPE);
1152 info.MarkAsEval(); 1154 info.MarkAsEval();
1153 info.SetContext(Handle<Context>(function_->context())); 1155 info.SetContext(Handle<Context>(function_->context()));
1154 } 1156 }
1155 if (Parser::Parse(&info) && Scope::Analyze(&info)) { 1157 if (Parser::Parse(&info) && Scope::Analyze(&info)) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 } 1210 }
1209 } 1211 }
1210 1212
1211 // Return the type of the current scope. 1213 // Return the type of the current scope.
1212 ScopeType Type() { 1214 ScopeType Type() {
1213 DCHECK(!failed_); 1215 DCHECK(!failed_);
1214 if (!nested_scope_chain_.is_empty()) { 1216 if (!nested_scope_chain_.is_empty()) {
1215 Handle<ScopeInfo> scope_info = nested_scope_chain_.last(); 1217 Handle<ScopeInfo> scope_info = nested_scope_chain_.last();
1216 switch (scope_info->scope_type()) { 1218 switch (scope_info->scope_type()) {
1217 case FUNCTION_SCOPE: 1219 case FUNCTION_SCOPE:
1220 case ARROW_SCOPE:
1218 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext()); 1221 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext());
1219 return ScopeTypeLocal; 1222 return ScopeTypeLocal;
1220 case MODULE_SCOPE: 1223 case MODULE_SCOPE:
1221 DCHECK(context_->IsModuleContext()); 1224 DCHECK(context_->IsModuleContext());
1222 return ScopeTypeModule; 1225 return ScopeTypeModule;
1223 case GLOBAL_SCOPE: 1226 case GLOBAL_SCOPE:
1224 DCHECK(context_->IsNativeContext()); 1227 DCHECK(context_->IsNativeContext());
1225 return ScopeTypeGlobal; 1228 return ScopeTypeGlobal;
1226 case WITH_SCOPE: 1229 case WITH_SCOPE:
1227 DCHECK(context_->IsWithContext()); 1230 DCHECK(context_->IsWithContext());
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 return isolate->heap()->undefined_value(); 2730 return isolate->heap()->undefined_value();
2728 } 2731 }
2729 2732
2730 2733
2731 RUNTIME_FUNCTION(RuntimeReference_DebugIsActive) { 2734 RUNTIME_FUNCTION(RuntimeReference_DebugIsActive) {
2732 SealHandleScope shs(isolate); 2735 SealHandleScope shs(isolate);
2733 return Smi::FromInt(isolate->debug()->is_active()); 2736 return Smi::FromInt(isolate->debug()->is_active());
2734 } 2737 }
2735 } 2738 }
2736 } // namespace v8::internal 2739 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698