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

Unified Diff: src/code-stubs.h

Issue 859783002: add stub for api function calls with known number of parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 11 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/arm64/code-stubs-arm64.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 4fa440bb70658f9131bf71d36e674a9623b50ef4..03075d92372fe7da40c6244ab42d0c2cd3e80b38 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -1153,7 +1153,18 @@ class CallApiAccessorStub : public PlatformCodeStub {
CallApiAccessorStub(Isolate* isolate, bool is_store, bool call_data_undefined)
: PlatformCodeStub(isolate) {
minor_key_ = IsStoreBits::encode(is_store) |
- CallDataUndefinedBits::encode(call_data_undefined);
+ CallDataUndefinedBits::encode(call_data_undefined) |
+ ArgumentBits::encode(is_store ? 1 : 0);
+ }
+
+ protected:
+ // For CallApiFunctionWithFixedArgsStub, see below.
+ static const int kArgBits = 3;
+ CallApiAccessorStub(Isolate* isolate, int argc, bool call_data_undefined)
+ : PlatformCodeStub(isolate) {
+ minor_key_ = IsStoreBits::encode(false) |
+ CallDataUndefinedBits::encode(call_data_undefined) |
+ ArgumentBits::encode(argc);
}
private:
@@ -1161,15 +1172,35 @@ class CallApiAccessorStub : public PlatformCodeStub {
bool call_data_undefined() const {
return CallDataUndefinedBits::decode(minor_key_);
}
+ int argc() const { return ArgumentBits::decode(minor_key_); }
class IsStoreBits: public BitField<bool, 0, 1> {};
class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
+ class ArgumentBits : public BitField<int, 2, kArgBits> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiAccessor);
DEFINE_PLATFORM_CODE_STUB(CallApiAccessor, PlatformCodeStub);
};
+// TODO(dcarney): see if it's possible to remove this later without performance
+// degradation.
+// This is not a real stub, but a way of generating the CallApiAccessorStub
+// (which has the same abi) which makes it clear that it is not an accessor.
+class CallApiFunctionWithFixedArgsStub : public CallApiAccessorStub {
+ public:
+ static const int kMaxFixedArgs = (1 << kArgBits) - 1;
+ CallApiFunctionWithFixedArgsStub(Isolate* isolate, int argc,
+ bool call_data_undefined)
+ : CallApiAccessorStub(isolate, argc, call_data_undefined) {
+ DCHECK(0 <= argc && argc <= kMaxFixedArgs);
+ }
+};
+
+
+typedef ApiAccessorDescriptor ApiFunctionWithFixedArgsDescriptor;
+
+
class CallApiGetterStub : public PlatformCodeStub {
public:
explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698