Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 53db6ea6a0401a26a5a6817ecda3e2f18ac600cf..e74f9457903a94f639fb7387d71efe67c185c935 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -136,6 +136,10 @@ class CallHandlerHelper; |
class EscapableHandleScope; |
template<typename T> class ReturnValue; |
+namespace experimental { |
+class FastAccessorBuilder; |
+} // namespace experimental |
+ |
namespace internal { |
class Arguments; |
class Heap; |
@@ -4411,6 +4415,16 @@ class V8_EXPORT FunctionTemplate : public Template { |
Local<Value> data = Local<Value>(), |
Local<Signature> signature = Local<Signature>(), int length = 0); |
+ /** |
+ * Creates a function template with a fast handler. If a fast handler is set, |
+ * the callback cannot be null. |
+ */ |
+ static Local<FunctionTemplate> NewWithFastHandler( |
+ Isolate* isolate, FunctionCallback callback, |
+ experimental::FastAccessorBuilder* fast_handler = nullptr, |
+ Local<Value> data = Local<Value>(), |
+ Local<Signature> signature = Local<Signature>(), int length = 0); |
+ |
/** Returns the unique function instance in the current execution context.*/ |
V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction()); |
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction( |
@@ -4421,8 +4435,9 @@ class V8_EXPORT FunctionTemplate : public Template { |
* callback is called whenever the function created from this |
* FunctionTemplate is called. |
*/ |
- void SetCallHandler(FunctionCallback callback, |
- Local<Value> data = Local<Value>()); |
+ void SetCallHandler( |
+ FunctionCallback callback, Local<Value> data = Local<Value>(), |
+ experimental::FastAccessorBuilder* fast_handler = nullptr); |
/** Set the predefined length property for the FunctionTemplate. */ |
void SetLength(int length); |
@@ -6955,6 +6970,35 @@ class V8_EXPORT Locker { |
}; |
+namespace experimental { |
+ |
+class V8_EXPORT FastAccessorBuilder { |
+ public: |
+ typedef size_t ValueId; |
+ |
+ ~FastAccessorBuilder(); |
+ static FastAccessorBuilder* New(Isolate* isolate); |
+ |
+ ValueId IntegerConstant(int int_constant); |
+ void ReturnValue(ValueId value_id); |
+ ValueId GetParameter(size_t parameter_no); |
+ ValueId GetInternalField(ValueId value_id, int field_no); |
+ ValueId LoadValue(ValueId value_id, int offset); |
+ ValueId LoadObject(ValueId value_id, int offset); |
+ void CheckFlagSetOrReturnNull(ValueId value_id, int mask); |
+ void CheckNotNullOrReturnNull(ValueId value_id); |
+ ValueId SetLabel(); |
+ void CheckNotNullOrJump(ValueId value_id, ValueId label_id); |
+ |
+ private: |
+ FastAccessorBuilder(); |
+ |
+ void* impl_; |
+}; |
+ |
+} // namespace experimental |
+ |
+ |
// --- Implementation --- |