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

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

Issue 1097283003: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add tests for "this" scoping in arrow functions Created 5 years, 8 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 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/compiler.h" 9 #include "src/compiler.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 // Move to the next scope. 1261 // Move to the next scope.
1262 void Next() { 1262 void Next() {
1263 DCHECK(!failed_); 1263 DCHECK(!failed_);
1264 ScopeType scope_type = Type(); 1264 ScopeType scope_type = Type();
1265 if (scope_type == ScopeTypeGlobal) { 1265 if (scope_type == ScopeTypeGlobal) {
1266 // The global scope is always the last in the chain. 1266 // The global scope is always the last in the chain.
1267 DCHECK(context_->IsNativeContext()); 1267 DCHECK(context_->IsNativeContext());
1268 context_ = Handle<Context>(); 1268 context_ = Handle<Context>();
1269 return; 1269 return;
1270 } 1270 }
1271 if (scope_type == ScopeTypeScript) seen_script_scope_ = true; 1271 if (scope_type == ScopeTypeScript) {
1272 if (nested_scope_chain_.is_empty()) { 1272 seen_script_scope_ = true;
1273 if (scope_type == ScopeTypeScript) { 1273 if (context_->IsScriptContext()) {
1274 if (context_->IsScriptContext()) {
1275 context_ = Handle<Context>(context_->previous(), isolate_);
1276 }
1277 CHECK(context_->IsNativeContext());
1278 } else {
1279 context_ = Handle<Context>(context_->previous(), isolate_); 1274 context_ = Handle<Context>(context_->previous(), isolate_);
1280 } 1275 }
1276 if (!nested_scope_chain_.is_empty()) {
1277 DCHECK_EQ(nested_scope_chain_.last()->scope_type(), SCRIPT_SCOPE);
1278 nested_scope_chain_.RemoveLast();
1279 DCHECK(nested_scope_chain_.is_empty());
1280 }
1281 CHECK(context_->IsNativeContext());
1282 return;
1283 }
1284 if (nested_scope_chain_.is_empty()) {
1285 context_ = Handle<Context>(context_->previous(), isolate_);
1281 } else { 1286 } else {
1282 if (nested_scope_chain_.last()->HasContext()) { 1287 if (nested_scope_chain_.last()->HasContext()) {
1283 DCHECK(context_->previous() != NULL); 1288 DCHECK(context_->previous() != NULL);
1284 context_ = Handle<Context>(context_->previous(), isolate_); 1289 context_ = Handle<Context>(context_->previous(), isolate_);
1285 } 1290 }
1286 nested_scope_chain_.RemoveLast(); 1291 nested_scope_chain_.RemoveLast();
1287 } 1292 }
1288 } 1293 }
1289 1294
1290 // Return the type of the current scope. 1295 // Return the type of the current scope.
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 return Smi::FromInt(isolate->debug()->is_active()); 2842 return Smi::FromInt(isolate->debug()->is_active());
2838 } 2843 }
2839 2844
2840 2845
2841 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 2846 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
2842 UNIMPLEMENTED(); 2847 UNIMPLEMENTED();
2843 return NULL; 2848 return NULL;
2844 } 2849 }
2845 } 2850 }
2846 } // namespace v8::internal 2851 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698