Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime/runtime.cc

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move function address calculation into bytecode handler and have an option on CEntry stub for argv_… Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 static Runtime::Function* kRedirectedIntrinsicFunctions = nullptr;
99
100
101 const Runtime::Function* Runtime::RuntimeFunctionTable(Isolate* isolate) {
102 if (isolate->external_reference_redirector()) {
103 // When running with the simulator we need to provide a table which has
104 // redirected runtime entry addresses.
105 if (!kRedirectedIntrinsicFunctions) {
Michael Starzinger 2015/09/29 08:28:34 This is not thread-safe when multiple isolates are
rmcilroy 2015/10/01 17:02:45 Put this on the isolate in RuntimeState as disscus
Michael Starzinger 2015/10/01 17:43:47 Acknowledged. Looks good.
106 kRedirectedIntrinsicFunctions = reinterpret_cast<Runtime::Function*>(
107 malloc(sizeof(kIntrinsicFunctions)));
Michael Starzinger 2015/09/29 08:28:34 Hmm, allocated but never freed AFAICT. How about w
rmcilroy 2015/10/01 17:02:45 Put this on the isolate in RuntimeState as disscus
Michael Starzinger 2015/10/01 17:43:47 Acknowledged. Looks good.
108 memcpy(kRedirectedIntrinsicFunctions, kIntrinsicFunctions,
109 sizeof(kIntrinsicFunctions));
110 for (int i = 0; i < sizeof(kIntrinsicFunctions) / sizeof(Function); i++) {
oth 2015/09/29 09:33:36 nit: arraysize()
rmcilroy 2015/10/01 17:02:45 Done.
111 ExternalReference redirected_entry(static_cast<Runtime::FunctionId>(i),
112 isolate);
113 kRedirectedIntrinsicFunctions[i].entry = redirected_entry.address();
114 }
rmcilroy 2015/09/28 16:20:47 Note: To get this working on the simulator I've ne
Michael Starzinger 2015/09/29 08:28:34 Acknowledged. I'm fine with this, just the mechani
rmcilroy 2015/10/01 17:02:45 Acknowledged.
115 }
116 return kRedirectedIntrinsicFunctions;
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698