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

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 TODO to fix fat-fingered "this" scoping in script context Created 5 years, 7 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 // Move to the next scope. 1291 // Move to the next scope.
1292 void Next() { 1292 void Next() {
1293 DCHECK(!failed_); 1293 DCHECK(!failed_);
1294 ScopeType scope_type = Type(); 1294 ScopeType scope_type = Type();
1295 if (scope_type == ScopeTypeGlobal) { 1295 if (scope_type == ScopeTypeGlobal) {
1296 // The global scope is always the last in the chain. 1296 // The global scope is always the last in the chain.
1297 DCHECK(context_->IsNativeContext()); 1297 DCHECK(context_->IsNativeContext());
1298 context_ = Handle<Context>(); 1298 context_ = Handle<Context>();
1299 return; 1299 return;
1300 } 1300 }
1301 if (scope_type == ScopeTypeScript) seen_script_scope_ = true; 1301 if (scope_type == ScopeTypeScript) {
1302 if (nested_scope_chain_.is_empty()) { 1302 seen_script_scope_ = true;
1303 if (scope_type == ScopeTypeScript) { 1303 if (context_->IsScriptContext()) {
1304 if (context_->IsScriptContext()) {
1305 context_ = Handle<Context>(context_->previous(), isolate_);
1306 }
1307 CHECK(context_->IsNativeContext());
1308 } else {
1309 context_ = Handle<Context>(context_->previous(), isolate_); 1304 context_ = Handle<Context>(context_->previous(), isolate_);
1310 } 1305 }
1306 if (!nested_scope_chain_.is_empty()) {
1307 DCHECK_EQ(nested_scope_chain_.last()->scope_type(), SCRIPT_SCOPE);
1308 nested_scope_chain_.RemoveLast();
1309 DCHECK(nested_scope_chain_.is_empty());
1310 }
1311 CHECK(context_->IsNativeContext());
1312 return;
1313 }
1314 if (nested_scope_chain_.is_empty()) {
1315 context_ = Handle<Context>(context_->previous(), isolate_);
1311 } else { 1316 } else {
1312 if (nested_scope_chain_.last()->HasContext()) { 1317 if (nested_scope_chain_.last()->HasContext()) {
1313 DCHECK(context_->previous() != NULL); 1318 DCHECK(context_->previous() != NULL);
1314 context_ = Handle<Context>(context_->previous(), isolate_); 1319 context_ = Handle<Context>(context_->previous(), isolate_);
1315 } 1320 }
1316 nested_scope_chain_.RemoveLast(); 1321 nested_scope_chain_.RemoveLast();
1317 } 1322 }
1318 } 1323 }
1319 1324
1320 // Return the type of the current scope. 1325 // Return the type of the current scope.
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 return Smi::FromInt(isolate->debug()->is_active()); 2990 return Smi::FromInt(isolate->debug()->is_active());
2986 } 2991 }
2987 2992
2988 2993
2989 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 2994 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
2990 UNIMPLEMENTED(); 2995 UNIMPLEMENTED();
2991 return NULL; 2996 return NULL;
2992 } 2997 }
2993 } 2998 }
2994 } // namespace v8::internal 2999 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698