| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/debug/debug-scopes.h" | 5 #include "src/debug/debug-scopes.h" |
| 6 | 6 |
| 7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
| 8 #include "src/frames-inl.h" | 8 #include "src/frames-inl.h" |
| 9 #include "src/globals.h" | 9 #include "src/globals.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 DCHECK(context_->IsCatchContext()); | 196 DCHECK(context_->IsCatchContext()); |
| 197 return ScopeTypeCatch; | 197 return ScopeTypeCatch; |
| 198 case BLOCK_SCOPE: | 198 case BLOCK_SCOPE: |
| 199 DCHECK(!scope_info->HasContext() || context_->IsBlockContext()); | 199 DCHECK(!scope_info->HasContext() || context_->IsBlockContext()); |
| 200 return ScopeTypeBlock; | 200 return ScopeTypeBlock; |
| 201 case EVAL_SCOPE: | 201 case EVAL_SCOPE: |
| 202 UNREACHABLE(); | 202 UNREACHABLE(); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 if (context_->IsNativeContext()) { | 205 if (context_->IsNativeContext()) { |
| 206 DCHECK(context_->global_object()->IsGlobalObject()); | 206 DCHECK(context_->global_object()->IsJSGlobalObject()); |
| 207 // If we are at the native context and have not yet seen script scope, | 207 // If we are at the native context and have not yet seen script scope, |
| 208 // fake it. | 208 // fake it. |
| 209 return seen_script_scope_ ? ScopeTypeGlobal : ScopeTypeScript; | 209 return seen_script_scope_ ? ScopeTypeGlobal : ScopeTypeScript; |
| 210 } | 210 } |
| 211 if (context_->IsFunctionContext()) { | 211 if (context_->IsFunctionContext()) { |
| 212 return ScopeTypeClosure; | 212 return ScopeTypeClosure; |
| 213 } | 213 } |
| 214 if (context_->IsCatchContext()) { | 214 if (context_->IsCatchContext()) { |
| 215 return ScopeTypeCatch; | 215 return ScopeTypeCatch; |
| 216 } | 216 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // information we get from the context chain but nothing about | 397 // information we get from the context chain but nothing about |
| 398 // completely stack allocated scopes or stack allocated locals. | 398 // completely stack allocated scopes or stack allocated locals. |
| 399 // Or it could be due to stack overflow. | 399 // Or it could be due to stack overflow. |
| 400 DCHECK(isolate_->has_pending_exception()); | 400 DCHECK(isolate_->has_pending_exception()); |
| 401 failed_ = true; | 401 failed_ = true; |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 | 404 |
| 405 | 405 |
| 406 MaybeHandle<JSObject> ScopeIterator::MaterializeScriptScope() { | 406 MaybeHandle<JSObject> ScopeIterator::MaterializeScriptScope() { |
| 407 Handle<GlobalObject> global(CurrentContext()->global_object()); | 407 Handle<JSGlobalObject> global(CurrentContext()->global_object()); |
| 408 Handle<ScriptContextTable> script_contexts( | 408 Handle<ScriptContextTable> script_contexts( |
| 409 global->native_context()->script_context_table()); | 409 global->native_context()->script_context_table()); |
| 410 | 410 |
| 411 Handle<JSObject> script_scope = | 411 Handle<JSObject> script_scope = |
| 412 isolate_->factory()->NewJSObject(isolate_->object_function()); | 412 isolate_->factory()->NewJSObject(isolate_->object_function()); |
| 413 | 413 |
| 414 for (int context_index = 0; context_index < script_contexts->used(); | 414 for (int context_index = 0; context_index < script_contexts->used(); |
| 415 context_index++) { | 415 context_index++) { |
| 416 Handle<Context> context = | 416 Handle<Context> context = |
| 417 ScriptContextTable::GetContext(script_contexts, context_index); | 417 ScriptContextTable::GetContext(script_contexts, context_index); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 isolate_, value, Object::GetPropertyOrElement(extension, key), false); | 782 isolate_, value, Object::GetPropertyOrElement(extension, key), false); |
| 783 RETURN_ON_EXCEPTION_VALUE( | 783 RETURN_ON_EXCEPTION_VALUE( |
| 784 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( | 784 isolate_, JSObject::SetOwnPropertyIgnoreAttributes( |
| 785 scope_object, key, value, NONE), false); | 785 scope_object, key, value, NONE), false); |
| 786 } | 786 } |
| 787 return true; | 787 return true; |
| 788 } | 788 } |
| 789 | 789 |
| 790 } // namespace internal | 790 } // namespace internal |
| 791 } // namespace v8 | 791 } // namespace v8 |
| OLD | NEW |