| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/external-reference-table.h" | 5 #include "src/external-reference-table.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/counters.h" | 9 #include "src/counters.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // rewritten to be mostly table driven, as the callback macro style tends to | 241 // rewritten to be mostly table driven, as the callback macro style tends to |
| 242 // very easily cause code bloat. Please be careful in the future when adding | 242 // very easily cause code bloat. Please be careful in the future when adding |
| 243 // new references. | 243 // new references. |
| 244 | 244 |
| 245 struct RefTableEntry { | 245 struct RefTableEntry { |
| 246 uint16_t id; | 246 uint16_t id; |
| 247 const char* name; | 247 const char* name; |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 static const RefTableEntry c_builtins[] = { | 250 static const RefTableEntry c_builtins[] = { |
| 251 #define DEF_ENTRY_C(name, ignore) {Builtins::c_##name, "Builtins::" #name}, | 251 #define DEF_ENTRY(name) {Builtins::c_##name, "Builtins::" #name}, |
| 252 BUILTIN_LIST_C(DEF_ENTRY_C) | 252 BUILTIN_LIST_C(DEF_ENTRY) |
| 253 #undef DEF_ENTRY_C | 253 #undef DEF_ENTRY |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 for (unsigned i = 0; i < arraysize(c_builtins); ++i) { | 256 for (unsigned i = 0; i < arraysize(c_builtins); ++i) { |
| 257 ExternalReference ref(static_cast<Builtins::CFunctionId>(c_builtins[i].id), | 257 ExternalReference ref(static_cast<Builtins::CFunctionId>(c_builtins[i].id), |
| 258 isolate); | 258 isolate); |
| 259 Add(ref.address(), c_builtins[i].name); | 259 Add(ref.address(), c_builtins[i].name); |
| 260 } | 260 } |
| 261 | 261 |
| 262 static const RefTableEntry builtins[] = { | 262 static const RefTableEntry builtins[] = { |
| 263 #define DEF_ENTRY_C(name, ignore) {Builtins::k##name, "Builtins::" #name}, | 263 #define DEF_ENTRY(name, ...) {Builtins::k##name, "Builtins::" #name}, |
| 264 #define DEF_ENTRY_A(name, i1, i2) {Builtins::k##name, "Builtins::" #name}, | 264 BUILTIN_LIST_C(DEF_ENTRY) BUILTIN_LIST_A(DEF_ENTRY) |
| 265 BUILTIN_LIST_C(DEF_ENTRY_C) BUILTIN_LIST_A(DEF_ENTRY_A) | 265 #undef DEF_ENTRY |
| 266 BUILTIN_LIST_DEBUG_A(DEF_ENTRY_A) | |
| 267 #undef DEF_ENTRY_C | |
| 268 #undef DEF_ENTRY_A | |
| 269 }; | 266 }; |
| 270 | 267 |
| 271 for (unsigned i = 0; i < arraysize(builtins); ++i) { | 268 for (unsigned i = 0; i < arraysize(builtins); ++i) { |
| 272 ExternalReference ref(static_cast<Builtins::Name>(builtins[i].id), isolate); | 269 ExternalReference ref(static_cast<Builtins::Name>(builtins[i].id), isolate); |
| 273 Add(ref.address(), builtins[i].name); | 270 Add(ref.address(), builtins[i].name); |
| 274 } | 271 } |
| 275 | 272 |
| 276 static const RefTableEntry runtime_functions[] = { | 273 static const RefTableEntry runtime_functions[] = { |
| 277 #define RUNTIME_ENTRY(name, i1, i2) {Runtime::k##name, "Runtime::" #name}, | 274 #define RUNTIME_ENTRY(name, i1, i2) {Runtime::k##name, "Runtime::" #name}, |
| 278 FOR_EACH_INTRINSIC(RUNTIME_ENTRY) | 275 FOR_EACH_INTRINSIC(RUNTIME_ENTRY) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (api_external_references != nullptr) { | 407 if (api_external_references != nullptr) { |
| 411 while (*api_external_references != 0) { | 408 while (*api_external_references != 0) { |
| 412 Add(reinterpret_cast<Address>(*api_external_references), "<embedder>"); | 409 Add(reinterpret_cast<Address>(*api_external_references), "<embedder>"); |
| 413 api_external_references++; | 410 api_external_references++; |
| 414 } | 411 } |
| 415 } | 412 } |
| 416 } | 413 } |
| 417 | 414 |
| 418 } // namespace internal | 415 } // namespace internal |
| 419 } // namespace v8 | 416 } // namespace v8 |
| OLD | NEW |