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/runtime/runtime.h" | 5 #include "src/runtime/runtime.h" |
6 | 6 |
| 7 #include "src/assembler.h" |
7 #include "src/contexts.h" | 8 #include "src/contexts.h" |
8 #include "src/handles-inl.h" | 9 #include "src/handles-inl.h" |
9 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
10 #include "src/isolate.h" | 11 #include "src/isolate.h" |
11 #include "src/runtime/runtime-utils.h" | 12 #include "src/runtime/runtime-utils.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 // Header of runtime functions. | 17 // Header of runtime functions. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 88 } |
88 return NULL; | 89 return NULL; |
89 } | 90 } |
90 | 91 |
91 | 92 |
92 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 93 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
93 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 94 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
94 } | 95 } |
95 | 96 |
96 | 97 |
| 98 const Runtime::Function* Runtime::RuntimeFunctionTable(Isolate* isolate) { |
| 99 if (isolate->external_reference_redirector()) { |
| 100 // When running with the simulator we need to provide a table which has |
| 101 // redirected runtime entry addresses. |
| 102 if (!isolate->runtime_state()->redirected_intrinsic_functions()) { |
| 103 size_t function_count = arraysize(kIntrinsicFunctions); |
| 104 Function* redirected_functions = new Function[function_count]; |
| 105 memcpy(redirected_functions, kIntrinsicFunctions, |
| 106 sizeof(kIntrinsicFunctions)); |
| 107 for (size_t i = 0; i < function_count; i++) { |
| 108 ExternalReference redirected_entry(static_cast<Runtime::FunctionId>(i), |
| 109 isolate); |
| 110 redirected_functions[i].entry = redirected_entry.address(); |
| 111 } |
| 112 isolate->runtime_state()->set_redirected_intrinsic_functions( |
| 113 redirected_functions); |
| 114 } |
| 115 |
| 116 return isolate->runtime_state()->redirected_intrinsic_functions(); |
| 117 } else { |
| 118 return kIntrinsicFunctions; |
| 119 } |
| 120 } |
| 121 |
| 122 |
97 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { | 123 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { |
98 return os << Runtime::FunctionForId(id)->name; | 124 return os << Runtime::FunctionForId(id)->name; |
99 } | 125 } |
100 | 126 |
101 } // namespace internal | 127 } // namespace internal |
102 } // namespace v8 | 128 } // namespace v8 |
OLD | NEW |