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

Unified Diff: src/code-factory.cc

Issue 2187603004: [stubs] Using template magic to get the call interface descriptor type from callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@code-factory-cleanup
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/code-factory.h ('k') | src/compiler/js-generic-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-factory.cc
diff --git a/src/code-factory.cc b/src/code-factory.cc
index 63cd5d0765e6d5c6a55bba10316806eb8cf9260e..e2c008547e6431d6f1471a9558a4edba1a024e10 100644
--- a/src/code-factory.cc
+++ b/src/code-factory.cc
@@ -19,6 +19,13 @@ Callable make_callable(Stub& stub) {
return Callable(stub.GetCode(), Descriptor(stub.isolate()));
}
+// TODO(ishell): make it (const Stub& stub) once CodeStub::GetCode() is const.
+template <typename Stub>
+CallableD<typename Stub::Descriptor> make_callableD(Stub& stub) {
+ typedef typename Stub::Descriptor Descriptor;
+ return CallableD<Descriptor>(stub.GetCode(), stub.isolate());
+}
+
} // namespace
// static
@@ -38,13 +45,14 @@ Callable CodeFactory::ApiGetter(Isolate* isolate) {
}
// static
-Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate) {
+CallableD<LoadWithVectorDescriptor> CodeFactory::LoadICInOptimizedCode(
+ Isolate* isolate) {
if (FLAG_tf_load_ic_stub) {
LoadICTFStub stub(isolate);
- return make_callable(stub);
+ return make_callableD(stub);
}
LoadICStub stub(isolate);
- return make_callable(stub);
+ return make_callableD(stub);
}
// static
@@ -54,10 +62,11 @@ Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) {
}
// static
-Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate,
- TypeofMode typeof_mode) {
+CallableD<LoadGlobalWithVectorDescriptor>
+CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate,
+ TypeofMode typeof_mode) {
LoadGlobalICStub stub(isolate, LoadGlobalICState(typeof_mode));
- return make_callable(stub);
+ return make_callableD(stub);
}
// static
@@ -71,13 +80,14 @@ Callable CodeFactory::KeyedLoadIC(Isolate* isolate) {
}
// static
-Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) {
+CallableD<LoadWithVectorDescriptor> CodeFactory::KeyedLoadICInOptimizedCode(
+ Isolate* isolate) {
if (FLAG_tf_load_ic_stub) {
KeyedLoadICTFStub stub(isolate);
- return make_callable(stub);
+ return make_callableD(stub);
}
KeyedLoadICStub stub(isolate);
- return make_callable(stub);
+ return make_callableD(stub);
}
// static
@@ -109,10 +119,10 @@ Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) {
}
// static
-Callable CodeFactory::StoreICInOptimizedCode(Isolate* isolate,
- LanguageMode language_mode) {
+CallableD<StoreWithVectorDescriptor> CodeFactory::StoreICInOptimizedCode(
+ Isolate* isolate, LanguageMode language_mode) {
StoreICStub stub(isolate, StoreICState(language_mode));
- return make_callable(stub);
+ return make_callableD(stub);
}
// static
@@ -123,10 +133,10 @@ Callable CodeFactory::KeyedStoreIC(Isolate* isolate,
}
// static
-Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate,
- LanguageMode language_mode) {
+CallableD<StoreWithVectorDescriptor> CodeFactory::KeyedStoreICInOptimizedCode(
+ Isolate* isolate, LanguageMode language_mode) {
KeyedStoreICStub stub(isolate, StoreICState(language_mode));
- return make_callable(stub);
+ return make_callableD(stub);
}
// static
« no previous file with comments | « src/code-factory.h ('k') | src/compiler/js-generic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698