OLD | NEW |
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 Loading... |
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 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 return Smi::FromInt(isolate->debug()->is_active()); | 2981 return Smi::FromInt(isolate->debug()->is_active()); |
2977 } | 2982 } |
2978 | 2983 |
2979 | 2984 |
2980 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2985 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2981 UNIMPLEMENTED(); | 2986 UNIMPLEMENTED(); |
2982 return NULL; | 2987 return NULL; |
2983 } | 2988 } |
2984 } | 2989 } |
2985 } // namespace v8::internal | 2990 } // namespace v8::internal |
OLD | NEW |