| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/api-arguments.h" | 5 #include "src/api-arguments.h" |
| 6 | 6 |
| 7 #include "src/debug/debug.h" |
| 7 #include "src/tracing/trace-event.h" | 8 #include "src/tracing/trace-event.h" |
| 8 #include "src/vm-state-inl.h" | 9 #include "src/vm-state-inl.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 namespace internal { | 12 namespace internal { |
| 12 | 13 |
| 13 Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) { | 14 Handle<Object> FunctionCallbackArguments::Call(FunctionCallback f) { |
| 14 Isolate* isolate = this->isolate(); | 15 Isolate* isolate = this->isolate(); |
| 16 if (isolate->needs_side_effect_check() && |
| 17 !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) { |
| 18 return Handle<Object>(); |
| 19 } |
| 15 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback); | 20 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::FunctionCallback); |
| 16 VMState<EXTERNAL> state(isolate); | 21 VMState<EXTERNAL> state(isolate); |
| 17 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); | 22 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 18 FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_); | 23 FunctionCallbackInfo<v8::Value> info(begin(), argv_, argc_); |
| 19 f(info); | 24 f(info); |
| 20 return GetReturnValue<Object>(isolate); | 25 return GetReturnValue<Object>(isolate); |
| 21 } | 26 } |
| 22 | 27 |
| 23 Handle<JSObject> PropertyCallbackArguments::Call( | 28 Handle<JSObject> PropertyCallbackArguments::Call( |
| 24 IndexedPropertyEnumeratorCallback f) { | 29 IndexedPropertyEnumeratorCallback f) { |
| 25 Isolate* isolate = this->isolate(); | 30 Isolate* isolate = this->isolate(); |
| 31 if (isolate->needs_side_effect_check() && |
| 32 !isolate->debug()->PerformSideEffectCheckForCallback(FUNCTION_ADDR(f))) { |
| 33 return Handle<JSObject>(); |
| 34 } |
| 26 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback); | 35 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::PropertyCallback); |
| 27 VMState<EXTERNAL> state(isolate); | 36 VMState<EXTERNAL> state(isolate); |
| 28 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); | 37 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 29 PropertyCallbackInfo<v8::Array> info(begin()); | 38 PropertyCallbackInfo<v8::Array> info(begin()); |
| 30 f(info); | 39 f(info); |
| 31 return GetReturnValue<JSObject>(isolate); | 40 return GetReturnValue<JSObject>(isolate); |
| 32 } | 41 } |
| 33 | 42 |
| 43 bool PropertyCallbackArguments::PerformSideEffectCheck(Isolate* isolate, |
| 44 Address function) { |
| 45 return isolate->debug()->PerformSideEffectCheckForCallback(function); |
| 46 } |
| 47 |
| 34 } // namespace internal | 48 } // namespace internal |
| 35 } // namespace v8 | 49 } // namespace v8 |
| OLD | NEW |