blob: f8d6c8fcc3ddda3ee8d83e5419be4b7127ff8f8a [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
Ben Murdoch61f157c2016-09-16 13:49:30 +01007#include "src/tracing/trace-event.h"
8#include "src/vm-state-inl.h"
9
Ben Murdochda12d292016-06-02 14:46:10 +010010namespace v8 {
11namespace internal {
12
13Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
14 Isolate* isolate = this->isolate();
Ben Murdochc5610432016-08-08 18:44:38 +010015 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback);
Ben Murdochda12d292016-06-02 14:46:10 +010016 VMState<EXTERNAL> state(isolate);
17 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
Ben Murdochc5610432016-08-08 18:44:38 +010018 FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
Ben Murdochda12d292016-06-02 14:46:10 +010019 f(info);
20 return GetReturnValue<Object>(isolate);
21}
22
23Handle<JSObject> PropertyCallbackArguments::Call(
24 IndexedPropertyEnumeratorCallback f) {
25 Isolate* isolate = this->isolate();
Ben Murdochc5610432016-08-08 18:44:38 +010026 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback);
Ben Murdochda12d292016-06-02 14:46:10 +010027 VMState<EXTERNAL> state(isolate);
28 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
29 PropertyCallbackInfo<v8::Array> info(begin());
30 f(info);
31 return GetReturnValue<JSObject>(isolate);
32}
33
34} // namespace internal
35} // namespace v8