Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index c5479c518ed374fbd6c58586cef6481b3182eeb0..bfc62e5e07fddf678d01857aa9b8c366d5bf9920 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; |
| @@ -4416,6 +4420,16 @@ class V8_EXPORT FunctionTemplate : public Template { |
| * 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); |
| + |
| + /** |
| + * 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, Local<Value> fast_handler, |
| Local<Value> data = Local<Value>(), |
| Local<Signature> signature = Local<Signature>(), int length = 0); |
| @@ -4430,9 +4444,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>(), |
| - Local<Value> fast_handler = 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); |
| @@ -6965,6 +6979,41 @@ class V8_EXPORT Locker { |
| }; |
| +namespace experimental { |
|
jochen (gone - plz use gerrit)
2015/11/27 08:33:45
i wonder whether we should move this to a separate
Michael Starzinger
2015/11/27 09:15:52
+1
vogelheim
2015/11/30 13:41:54
Done.
In a separate CL, I'll also move the api-*
|
| + |
| +class V8_EXPORT FastAccessorBuilder { |
| + public: |
| + struct ValueId { |
|
jochen (gone - plz use gerrit)
2015/11/27 08:33:45
why not using size_t = ValudId or typedef?
epertoso
2015/11/27 09:13:13
It was my suggestion. We don't want to pass ValueI
vogelheim
2015/11/27 16:24:50
^^^ This.
The original version used a single type
|
| + size_t value_id; |
| + }; |
| + struct LabelId { |
| + size_t label_id; |
| + }; |
| + |
| + ~FastAccessorBuilder(); |
| + static FastAccessorBuilder* New(Isolate* isolate); |
| + |
| + ValueId IntegerConstant(int int_constant); |
| + ValueId GetCallTarget(); |
| + 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 ReturnValue(ValueId value_id); |
| + 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_; |
| +}; |
|
jochen (gone - plz use gerrit)
2015/11/27 08:33:45
disallow copy/assign
vogelheim
2015/11/27 16:24:50
Done.
v8.h can't include macros.h, so done manual
|
| + |
| +} // namespace experimental |
| + |
| + |
| // --- Implementation --- |