api-arguments.cc 1.14 KB
Newer Older
1 2 3 4 5 6
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "src/api-arguments.h"

7 8 9
#include "src/tracing/trace-event.h"
#include "src/vm-state-inl.h"

10 11 12
namespace v8 {
namespace internal {

13
Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
14
  Isolate* isolate = this->isolate();
15
  RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback);
16 17
  VMState<EXTERNAL> state(isolate);
  ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
18
  FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
19
  f(info);
20
  return GetReturnValue<Object>(isolate);
21 22
}

23 24 25
Handle<JSObject> PropertyCallbackArguments::Call(
    IndexedPropertyEnumeratorCallback f) {
  Isolate* isolate = this->isolate();
26
  RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback);
27 28 29 30 31 32
  VMState<EXTERNAL> state(isolate);
  ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
  PropertyCallbackInfo<v8::Array> info(begin());
  f(info);
  return GetReturnValue<JSObject>(isolate);
}
33 34 35

}  // namespace internal
}  // namespace v8