Line data Source code
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 : #include "src/debug/debug.h"
8 : #include "src/objects-inl.h"
9 : #include "src/tracing/trace-event.h"
10 : #include "src/vm-state-inl.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 :
15 14427581 : Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
16 14427581 : Isolate* isolate = this->isolate();
17 14427581 : if (isolate->needs_side_effect_check() &&
18 0 : !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) {
19 0 : return Handle<Object>();
20 : }
21 14427581 : RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback);
22 28855163 : VMState<EXTERNAL> state(isolate);
23 28855165 : ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
24 14427584 : FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
25 14427584 : f(info);
26 14427583 : return GetReturnValue<Object>(isolate);
27 : }
28 :
29 527 : Handle<JSObject> PropertyCallbackArguments::Call(
30 : IndexedPropertyEnumeratorCallback f) {
31 527 : Isolate* isolate = this->isolate();
32 527 : if (isolate->needs_side_effect_check() &&
33 0 : !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) {
34 0 : return Handle<JSObject>();
35 : }
36 527 : RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback);
37 1054 : VMState<EXTERNAL> state(isolate);
38 1054 : ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
39 527 : PropertyCallbackInfo<v8::Array> info(begin());
40 527 : f(info);
41 527 : return GetReturnValue<JSObject>(isolate);
42 : }
43 :
44 70 : bool PropertyCallbackArguments::PerformSideEffectCheck(Isolate* isolate,
45 : Address function) {
46 70 : return isolate->debug()->PerformSideEffectCheckForCallback(function);
47 : }
48 :
49 : } // namespace internal
50 : } // namespace v8
|