blob: c4b698c5a2146f872f17cfa6a52029c191dab027 [file] [log] [blame]
Ben Murdochda12d292016-06-02 14:46:10 +01001// 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
7namespace v8 {
8namespace internal {
9
10Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
11 Isolate* isolate = this->isolate();
12 VMState<EXTERNAL> state(isolate);
13 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
14 FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_,
15 is_construct_call_);
16 f(info);
17 return GetReturnValue<Object>(isolate);
18}
19
20Handle<JSObject> PropertyCallbackArguments::Call(
21 IndexedPropertyEnumeratorCallback f) {
22 Isolate* isolate = this->isolate();
23 VMState<EXTERNAL> state(isolate);
24 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
25 PropertyCallbackInfo<v8::Array> info(begin());
26 f(info);
27 return GetReturnValue<JSObject>(isolate);
28}
29
30} // namespace internal
31} // namespace v8