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