| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/contexts.h" | 5 #include "src/contexts.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 JSReceiver* Context::extension_receiver() { | 104 JSReceiver* Context::extension_receiver() { |
| 105 DCHECK(IsNativeContext() || IsWithContext() || | 105 DCHECK(IsNativeContext() || IsWithContext() || |
| 106 IsFunctionContext() || IsBlockContext()); | 106 IsFunctionContext() || IsBlockContext()); |
| 107 return IsWithContext() ? JSReceiver::cast( | 107 return IsWithContext() ? JSReceiver::cast( |
| 108 ContextExtension::cast(extension())->extension()) | 108 ContextExtension::cast(extension())->extension()) |
| 109 : extension_object(); | 109 : extension_object(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 ScopeInfo* Context::scope_info() { | 112 ScopeInfo* Context::scope_info() { |
| 113 DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext() || | 113 DCHECK(!IsNativeContext()); |
| 114 IsCatchContext() || IsWithContext() || IsDebugEvaluateContext()); | 114 if (IsFunctionContext() || IsModuleContext()) { |
| 115 return closure()->shared()->scope_info(); |
| 116 } |
| 115 HeapObject* object = extension(); | 117 HeapObject* object = extension(); |
| 116 if (object->IsContextExtension()) { | 118 if (object->IsContextExtension()) { |
| 117 DCHECK(IsBlockContext() || IsCatchContext() || IsWithContext() || | 119 DCHECK(IsBlockContext() || IsCatchContext() || IsWithContext() || |
| 118 IsDebugEvaluateContext()); | 120 IsDebugEvaluateContext()); |
| 119 object = ContextExtension::cast(object)->scope_info(); | 121 object = ContextExtension::cast(object)->scope_info(); |
| 120 } | 122 } |
| 121 return ScopeInfo::cast(object); | 123 return ScopeInfo::cast(object); |
| 122 } | 124 } |
| 123 | 125 |
| 124 | 126 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 562 |
| 561 int previous_value = errors_thrown()->value(); | 563 int previous_value = errors_thrown()->value(); |
| 562 set_errors_thrown(Smi::FromInt(previous_value + 1)); | 564 set_errors_thrown(Smi::FromInt(previous_value + 1)); |
| 563 } | 565 } |
| 564 | 566 |
| 565 | 567 |
| 566 int Context::GetErrorsThrown() { return errors_thrown()->value(); } | 568 int Context::GetErrorsThrown() { return errors_thrown()->value(); } |
| 567 | 569 |
| 568 } // namespace internal | 570 } // namespace internal |
| 569 } // namespace v8 | 571 } // namespace v8 |
| OLD | NEW |