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 | 104 |
105 JSReceiver* Context::extension_receiver() { | 105 JSReceiver* Context::extension_receiver() { |
106 DCHECK(IsNativeContext() || IsWithContext() || | 106 DCHECK(IsNativeContext() || IsWithContext() || |
107 IsFunctionContext() || IsBlockContext()); | 107 IsFunctionContext() || IsBlockContext()); |
108 return IsWithContext() ? JSReceiver::cast(extension()) : extension_object(); | 108 return IsWithContext() ? JSReceiver::cast(extension()) : extension_object(); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 ScopeInfo* Context::scope_info() { | 112 ScopeInfo* Context::scope_info() { |
113 DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext()); | 113 DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext() || |
| 114 IsCatchContext()); |
114 HeapObject* object = extension(); | 115 HeapObject* object = extension(); |
115 if (object->IsContextExtension()) { | 116 if (object->IsContextExtension()) { |
116 DCHECK(IsBlockContext()); | 117 DCHECK(IsBlockContext() || IsCatchContext()); |
117 object = ContextExtension::cast(object)->scope_info(); | 118 object = ContextExtension::cast(object)->scope_info(); |
118 } | 119 } |
119 return ScopeInfo::cast(object); | 120 return ScopeInfo::cast(object); |
120 } | 121 } |
121 | 122 |
122 | 123 |
123 String* Context::catch_name() { | 124 String* Context::catch_name() { |
124 DCHECK(IsCatchContext()); | 125 DCHECK(IsCatchContext()); |
125 return String::cast(extension()); | 126 return String::cast(ContextExtension::cast(extension())->extension()); |
126 } | 127 } |
127 | 128 |
128 | 129 |
129 JSGlobalObject* Context::global_object() { | 130 JSGlobalObject* Context::global_object() { |
130 return JSGlobalObject::cast(native_context()->extension()); | 131 return JSGlobalObject::cast(native_context()->extension()); |
131 } | 132 } |
132 | 133 |
133 | 134 |
134 Context* Context::script_context() { | 135 Context* Context::script_context() { |
135 Context* current = this; | 136 Context* current = this; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 556 |
556 int previous_value = errors_thrown()->value(); | 557 int previous_value = errors_thrown()->value(); |
557 set_errors_thrown(Smi::FromInt(previous_value + 1)); | 558 set_errors_thrown(Smi::FromInt(previous_value + 1)); |
558 } | 559 } |
559 | 560 |
560 | 561 |
561 int Context::GetErrorsThrown() { return errors_thrown()->value(); } | 562 int Context::GetErrorsThrown() { return errors_thrown()->value(); } |
562 | 563 |
563 } // namespace internal | 564 } // namespace internal |
564 } // namespace v8 | 565 } // namespace v8 |
OLD | NEW |