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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime.cc
diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc
index 15451c5c6e3828f356df456fe720d834ae633518..8533aa4b30074b6f24e9310c8be3d736fa9501e2 100644
--- a/src/runtime/runtime.cc
+++ b/src/runtime/runtime.cc
@@ -4,6 +4,7 @@
#include "src/runtime/runtime.h"
+#include "src/assembler.h"
#include "src/contexts.h"
#include "src/handles-inl.h"
#include "src/heap/heap.h"
@@ -94,6 +95,31 @@ const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
}
+static Runtime::Function* kRedirectedIntrinsicFunctions = nullptr;
+
+
+const Runtime::Function* Runtime::RuntimeFunctionTable(Isolate* isolate) {
+ if (isolate->external_reference_redirector()) {
+ // When running with the simulator we need to provide a table which has
+ // redirected runtime entry addresses.
+ 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.
+ kRedirectedIntrinsicFunctions = reinterpret_cast<Runtime::Function*>(
+ 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.
+ memcpy(kRedirectedIntrinsicFunctions, kIntrinsicFunctions,
+ sizeof(kIntrinsicFunctions));
+ 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.
+ ExternalReference redirected_entry(static_cast<Runtime::FunctionId>(i),
+ isolate);
+ kRedirectedIntrinsicFunctions[i].entry = redirected_entry.address();
+ }
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.
+ }
+ return kRedirectedIntrinsicFunctions;
+ } else {
+ return kIntrinsicFunctions;
+ }
+}
+
+
std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) {
return os << Runtime::FunctionForId(id)->name;
}

Powered by Google App Engine
This is Rietveld 408576698