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 #ifndef V8_CONTEXTS_INL_H_ | 5 #ifndef V8_CONTEXTS_INL_H_ |
6 #define V8_CONTEXTS_INL_H_ | 6 #define V8_CONTEXTS_INL_H_ |
7 | 7 |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 Map* map = this->map(); | 117 Map* map = this->map(); |
118 return map == map->GetHeap()->module_context_map(); | 118 return map == map->GetHeap()->module_context_map(); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 bool Context::IsScriptContext() { | 122 bool Context::IsScriptContext() { |
123 Map* map = this->map(); | 123 Map* map = this->map(); |
124 return map == map->GetHeap()->script_context_map(); | 124 return map == map->GetHeap()->script_context_map(); |
125 } | 125 } |
126 | 126 |
127 | |
128 bool Context::HasSameSecurityTokenAs(Context* that) { | 127 bool Context::HasSameSecurityTokenAs(Context* that) { |
129 return this->native_context()->security_token() == | 128 return this->native_context()->security_token() == |
130 that->native_context()->security_token(); | 129 that->native_context()->security_token(); |
131 } | 130 } |
132 | 131 |
133 | 132 |
134 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ | 133 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ |
135 void Context::set_##name(type* value) { \ | 134 void Context::set_##name(type* value) { \ |
136 DCHECK(IsNativeContext()); \ | 135 DCHECK(IsNativeContext()); \ |
137 set(index, value); \ | 136 set(index, value); \ |
138 } \ | 137 } \ |
139 bool Context::is_##name(type* value) { \ | 138 bool Context::is_##name(type* value) { \ |
140 DCHECK(IsNativeContext()); \ | 139 DCHECK(IsNativeContext()); \ |
141 return type::cast(get(index)) == value; \ | 140 return type::cast(get(index)) == value; \ |
142 } \ | 141 } \ |
143 type* Context::name() { \ | 142 type* Context::name() { \ |
144 DCHECK(IsNativeContext()); \ | 143 DCHECK(IsNativeContext()); \ |
145 return type::cast(get(index)); \ | 144 return type::cast(get(index)); \ |
146 } | 145 } |
147 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS) | 146 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS) |
148 #undef NATIVE_CONTEXT_FIELD_ACCESSORS | 147 #undef NATIVE_CONTEXT_FIELD_ACCESSORS |
149 | 148 |
150 | 149 |
151 } // namespace internal | 150 } // namespace internal |
152 } // namespace v8 | 151 } // namespace v8 |
153 | 152 |
154 #endif // V8_CONTEXTS_INL_H_ | 153 #endif // V8_CONTEXTS_INL_H_ |
OLD | NEW |