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" |
11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
| 13 #include "src/visitors.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 // Forward declarations for C++ builtins. | 18 // Forward declarations for C++ builtins. |
18 #define FORWARD_DECLARE(Name) \ | 19 #define FORWARD_DECLARE(Name) \ |
19 Object* Builtin_##Name(int argc, Object** args, Isolate* isolate); | 20 Object* Builtin_##Name(int argc, Object** args, Isolate* isolate); |
20 BUILTIN_LIST_C(FORWARD_DECLARE) | 21 BUILTIN_LIST_C(FORWARD_DECLARE) |
21 | 22 |
22 Builtins::Builtins() : initialized_(false) { | 23 Builtins::Builtins() : initialized_(false) { |
23 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); | 24 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); |
24 } | 25 } |
25 | 26 |
26 Builtins::~Builtins() {} | 27 Builtins::~Builtins() {} |
27 | 28 |
28 void Builtins::TearDown() { initialized_ = false; } | 29 void Builtins::TearDown() { initialized_ = false; } |
29 | 30 |
30 void Builtins::IterateBuiltins(ObjectVisitor* v) { | 31 void Builtins::IterateBuiltins(RootVisitor* v) { |
31 v->VisitPointers(&builtins_[0], &builtins_[0] + builtin_count); | 32 v->VisitRootPointers(Root::kBuiltins, &builtins_[0], |
| 33 &builtins_[0] + builtin_count); |
32 } | 34 } |
33 | 35 |
34 const char* Builtins::Lookup(byte* pc) { | 36 const char* Builtins::Lookup(byte* pc) { |
35 // may be called during initialization (disassembler!) | 37 // may be called during initialization (disassembler!) |
36 if (initialized_) { | 38 if (initialized_) { |
37 for (int i = 0; i < builtin_count; i++) { | 39 for (int i = 0; i < builtin_count; i++) { |
38 Code* entry = Code::cast(builtins_[i]); | 40 Code* entry = Code::cast(builtins_[i]); |
39 if (entry->contains(pc)) return name(i); | 41 if (entry->contains(pc)) return name(i); |
40 } | 42 } |
41 } | 43 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // TODO(jochen): Remove this. | 243 // TODO(jochen): Remove this. |
242 if (responsible_context.is_null()) { | 244 if (responsible_context.is_null()) { |
243 return true; | 245 return true; |
244 } | 246 } |
245 if (*responsible_context == target->context()) return true; | 247 if (*responsible_context == target->context()) return true; |
246 return isolate->MayAccess(responsible_context, target_global_proxy); | 248 return isolate->MayAccess(responsible_context, target_global_proxy); |
247 } | 249 } |
248 | 250 |
249 } // namespace internal | 251 } // namespace internal |
250 } // namespace v8 | 252 } // namespace v8 |
OLD | NEW |