OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/api.h" | 6 #include "src/api.h" |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/builtins/builtins-descriptors.h" | 8 #include "src/builtins/builtins-descriptors.h" |
9 #include "src/callable.h" | 9 #include "src/callable.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // static | 116 // static |
117 Callable Builtins::CallableFor(Isolate* isolate, Name name) { | 117 Callable Builtins::CallableFor(Isolate* isolate, Name name) { |
118 switch (name) { | 118 switch (name) { |
119 #define CASE(Name, ...) \ | 119 #define CASE(Name, ...) \ |
120 case k##Name: { \ | 120 case k##Name: { \ |
121 Handle<Code> code(Code::cast(isolate->builtins()->builtins_[name])); \ | 121 Handle<Code> code(Code::cast(isolate->builtins()->builtins_[name])); \ |
122 auto descriptor = Builtin_##Name##_InterfaceDescriptor(isolate); \ | 122 auto descriptor = Builtin_##Name##_InterfaceDescriptor(isolate); \ |
123 return Callable(code, descriptor); \ | 123 return Callable(code, descriptor); \ |
124 } | 124 } |
125 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE, CASE, | 125 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE, CASE, |
126 IGNORE_BUILTIN, IGNORE_BUILTIN) | 126 CASE, IGNORE_BUILTIN, IGNORE_BUILTIN) |
127 #undef CASE | 127 #undef CASE |
128 default: | 128 default: |
129 UNREACHABLE(); | 129 UNREACHABLE(); |
130 return Callable(Handle<Code>::null(), VoidDescriptor(isolate)); | 130 return Callable(Handle<Code>::null(), VoidDescriptor(isolate)); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 // static | 134 // static |
135 const char* Builtins::name(int index) { | 135 const char* Builtins::name(int index) { |
136 switch (index) { | 136 switch (index) { |
(...skipping 26 matching lines...) Expand all Loading... |
163 | 163 |
164 // static | 164 // static |
165 bool Builtins::IsCpp(int index) { | 165 bool Builtins::IsCpp(int index) { |
166 DCHECK(0 <= index && index < builtin_count); | 166 DCHECK(0 <= index && index < builtin_count); |
167 switch (index) { | 167 switch (index) { |
168 #define CASE(Name, ...) \ | 168 #define CASE(Name, ...) \ |
169 case k##Name: \ | 169 case k##Name: \ |
170 return true; | 170 return true; |
171 #define BUILTIN_LIST_CPP(V) \ | 171 #define BUILTIN_LIST_CPP(V) \ |
172 BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ | 172 BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \ |
173 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) | 173 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) |
174 BUILTIN_LIST_CPP(CASE) | 174 BUILTIN_LIST_CPP(CASE) |
175 #undef BUILTIN_LIST_CPP | 175 #undef BUILTIN_LIST_CPP |
176 #undef CASE | 176 #undef CASE |
177 default: | 177 default: |
178 return false; | 178 return false; |
179 } | 179 } |
180 UNREACHABLE(); | 180 UNREACHABLE(); |
181 } | 181 } |
182 | 182 |
183 // static | 183 // static |
184 bool Builtins::IsApi(int index) { | 184 bool Builtins::IsApi(int index) { |
185 DCHECK(0 <= index && index < builtin_count); | 185 DCHECK(0 <= index && index < builtin_count); |
186 switch (index) { | 186 switch (index) { |
187 #define CASE(Name, ...) \ | 187 #define CASE(Name, ...) \ |
188 case k##Name: \ | 188 case k##Name: \ |
189 return true; | 189 return true; |
190 #define BUILTIN_LIST_API(V) \ | 190 #define BUILTIN_LIST_API(V) \ |
191 BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \ | 191 BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \ |
192 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) | 192 IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) |
193 BUILTIN_LIST_API(CASE); | 193 BUILTIN_LIST_API(CASE); |
194 #undef BUILTIN_LIST_API | 194 #undef BUILTIN_LIST_API |
195 #undef CASE | 195 #undef CASE |
196 default: | 196 default: |
197 return false; | 197 return false; |
198 } | 198 } |
199 UNREACHABLE(); | 199 UNREACHABLE(); |
200 } | 200 } |
201 | 201 |
202 // static | 202 // static |
(...skipping 30 matching lines...) Expand all Loading... |
233 // TODO(jochen): Remove this. | 233 // TODO(jochen): Remove this. |
234 if (responsible_context.is_null()) { | 234 if (responsible_context.is_null()) { |
235 return true; | 235 return true; |
236 } | 236 } |
237 if (*responsible_context == target->context()) return true; | 237 if (*responsible_context == target->context()) return true; |
238 return isolate->MayAccess(responsible_context, target_global_proxy); | 238 return isolate->MayAccess(responsible_context, target_global_proxy); |
239 } | 239 } |
240 | 240 |
241 } // namespace internal | 241 } // namespace internal |
242 } // namespace v8 | 242 } // namespace v8 |
OLD | NEW |