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" | |
8 #include "src/contexts.h" | 7 #include "src/contexts.h" |
9 #include "src/handles-inl.h" | 8 #include "src/handles-inl.h" |
10 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
11 #include "src/isolate.h" | 10 #include "src/isolate.h" |
12 #include "src/runtime/runtime-utils.h" | 11 #include "src/runtime/runtime-utils.h" |
13 | 12 |
14 namespace v8 { | 13 namespace v8 { |
15 namespace internal { | 14 namespace internal { |
16 | 15 |
17 // Header of runtime functions. | 16 // Header of runtime functions. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 87 } |
89 return NULL; | 88 return NULL; |
90 } | 89 } |
91 | 90 |
92 | 91 |
93 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 92 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
94 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 93 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
95 } | 94 } |
96 | 95 |
97 | 96 |
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 | |
123 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { | 97 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { |
124 return os << Runtime::FunctionForId(id)->name; | 98 return os << Runtime::FunctionForId(id)->name; |
125 } | 99 } |
126 | 100 |
127 } // namespace internal | 101 } // namespace internal |
128 } // namespace v8 | 102 } // namespace v8 |
OLD | NEW |