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