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/callable.h" |
8 #include "src/code-events.h" | 9 #include "src/code-events.h" |
9 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
10 #include "src/ic/ic-state.h" | 11 #include "src/ic/ic-state.h" |
11 #include "src/interface-descriptors.h" | 12 #include "src/interface-descriptors.h" |
12 #include "src/isolate.h" | 13 #include "src/isolate.h" |
13 #include "src/macro-assembler.h" | 14 #include "src/macro-assembler.h" |
14 #include "src/objects-inl.h" | 15 #include "src/objects-inl.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (initialized_) { | 198 if (initialized_) { |
198 for (int i = 0; i < builtin_count; i++) { | 199 for (int i = 0; i < builtin_count; i++) { |
199 Code* entry = Code::cast(builtins_[i]); | 200 Code* entry = Code::cast(builtins_[i]); |
200 if (entry->contains(pc)) return name(i); | 201 if (entry->contains(pc)) return name(i); |
201 } | 202 } |
202 } | 203 } |
203 return NULL; | 204 return NULL; |
204 } | 205 } |
205 | 206 |
206 // static | 207 // static |
| 208 Callable Builtins::CallableFor(Isolate* isolate, Name name) { |
| 209 switch (name) { |
| 210 #define CASE(Name, _, __, InterfaceDescriptor, ...) \ |
| 211 case k##Name: { \ |
| 212 Handle<Code> code(Code::cast(isolate->builtins()->builtins_[name])); \ |
| 213 auto descriptor = InterfaceDescriptor##Descriptor(isolate); \ |
| 214 return Callable(code, descriptor); \ |
| 215 } |
| 216 BUILTIN_LIST_TFS(CASE) |
| 217 #undef CASE |
| 218 default: |
| 219 UNREACHABLE(); |
| 220 return Callable(Handle<Code>::null(), VoidDescriptor(isolate)); |
| 221 } |
| 222 } |
| 223 |
| 224 // static |
207 const char* Builtins::name(int index) { | 225 const char* Builtins::name(int index) { |
208 switch (index) { | 226 switch (index) { |
209 #define CASE(Name, ...) \ | 227 #define CASE(Name, ...) \ |
210 case k##Name: \ | 228 case k##Name: \ |
211 return #Name; | 229 return #Name; |
212 BUILTIN_LIST_ALL(CASE) | 230 BUILTIN_LIST_ALL(CASE) |
213 #undef CASE | 231 #undef CASE |
214 default: | 232 default: |
215 UNREACHABLE(); | 233 UNREACHABLE(); |
216 break; | 234 break; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // TODO(jochen): Remove this. | 323 // TODO(jochen): Remove this. |
306 if (responsible_context.is_null()) { | 324 if (responsible_context.is_null()) { |
307 return true; | 325 return true; |
308 } | 326 } |
309 if (*responsible_context == target->context()) return true; | 327 if (*responsible_context == target->context()) return true; |
310 return isolate->MayAccess(responsible_context, target_global_proxy); | 328 return isolate->MayAccess(responsible_context, target_global_proxy); |
311 } | 329 } |
312 | 330 |
313 } // namespace internal | 331 } // namespace internal |
314 } // namespace v8 | 332 } // namespace v8 |
OLD | NEW |