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 51866649 : Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) {
16 51866649 : Isolate* isolate = this->isolate();
17 51866649 : if (isolate->needs_side_effect_check() &&
18 0 : !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) {
19 0 : return Handle<Object>();
20 : }
21 51866649 : RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback);
22 103733296 : VMState<EXTERNAL> state(isolate);
23 103733296 : ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
24 51866646 : FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_);
25 51866646 : f(info);
26 51866649 : return GetReturnValue<Object>(isolate);
27 : }
28 :
29 324 : Handle<JSObject> PropertyCallbackArguments::Call(
30 : IndexedPropertyEnumeratorCallback f) {
31 324 : Isolate* isolate = this->isolate();
32 324 : if (isolate->needs_side_effect_check() &&
33 0 : !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) {
34 0 : return Handle<JSObject>();
35 : }
36 324 : RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback);
37 648 : VMState<EXTERNAL> state(isolate);
38 648 : ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
39 324 : PropertyCallbackInfo<v8::Array> info(begin());
40 324 : f(info);
41 324 : return GetReturnValue<JSObject>(isolate);
42 : }
43 :
44 266 : bool PropertyCallbackArguments::PerformSideEffectCheck(Isolate* isolate,
45 : Address function) {
46 266 : return isolate->debug()->PerformSideEffectCheckForCallback(function);
47 : }
48 :
49 : } // namespace internal
50 : } // namespace v8
|