Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 1 | // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "src/api-arguments.h" |
| 6 | |
| 7 | namespace v8 { |
| 8 | namespace internal { |
| 9 | |
| 10 | Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) { |
| 11 | Isolate* isolate = this->isolate(); |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 12 | RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 13 | VMState<EXTERNAL> state(isolate); |
| 14 | ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 15 | FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 16 | f(info); |
| 17 | return GetReturnValue<Object>(isolate); |
| 18 | } |
| 19 | |
| 20 | Handle<JSObject> PropertyCallbackArguments::Call( |
| 21 | IndexedPropertyEnumeratorCallback f) { |
| 22 | Isolate* isolate = this->isolate(); |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 23 | RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 24 | VMState<EXTERNAL> state(isolate); |
| 25 | ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 26 | PropertyCallbackInfo<v8::Array> info(begin()); |
| 27 | f(info); |
| 28 | return GetReturnValue<JSObject>(isolate); |
| 29 | } |
| 30 | |
| 31 | } // namespace internal |
| 32 | } // namespace v8 |