Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/api-arguments-inl.h

Issue 2622863003: [debugger] infrastructure for side-effect-free debug-evaluate. (Closed)
Patch Set: fix mips one more time Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api-arguments.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tracing/trace-event.h" 7 #include "src/tracing/trace-event.h"
8 #include "src/vm-state-inl.h" 8 #include "src/vm-state-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 #define SIDE_EFFECT_CHECK(ISOLATE, F, RETURN_TYPE) \
14 do { \
15 if (ISOLATE->needs_side_effect_check() && \
16 !PerformSideEffectCheck(ISOLATE, FUNCTION_ADDR(F))) { \
17 return Handle<RETURN_TYPE>(); \
18 } \
19 } while (false)
20
13 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \ 21 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \
14 F(AccessorNameGetterCallback, "get", v8::Value, Object) \ 22 F(AccessorNameGetterCallback, "get", v8::Value, Object) \
15 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \ 23 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \
16 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object) 24 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object)
17 25
18 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \ 26 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \
19 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \ 27 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
20 Handle<Name> name) { \ 28 Handle<Name> name) { \
21 Isolate* isolate = this->isolate(); \ 29 Isolate* isolate = this->isolate(); \
30 SIDE_EFFECT_CHECK(isolate, f, InternalReturn); \
22 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ 31 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
23 VMState<EXTERNAL> state(isolate); \ 32 VMState<EXTERNAL> state(isolate); \
24 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 33 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
25 PropertyCallbackInfo<ApiReturn> info(begin()); \ 34 PropertyCallbackInfo<ApiReturn> info(begin()); \
26 LOG(isolate, \ 35 LOG(isolate, \
27 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \ 36 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \
28 f(v8::Utils::ToLocal(name), info); \ 37 f(v8::Utils::ToLocal(name), info); \
29 return GetReturnValue<InternalReturn>(isolate); \ 38 return GetReturnValue<InternalReturn>(isolate); \
30 } 39 }
31 40
32 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) 41 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME)
33 42
34 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME 43 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME
35 #undef WRITE_CALL_1_NAME 44 #undef WRITE_CALL_1_NAME
36 45
37 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ 46 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \
38 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ 47 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \
39 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \ 48 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \
40 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object) 49 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object)
41 50
42 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \ 51 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \
43 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \ 52 Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
44 uint32_t index) { \ 53 uint32_t index) { \
45 Isolate* isolate = this->isolate(); \ 54 Isolate* isolate = this->isolate(); \
55 SIDE_EFFECT_CHECK(isolate, f, InternalReturn); \
46 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \ 56 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
47 VMState<EXTERNAL> state(isolate); \ 57 VMState<EXTERNAL> state(isolate); \
48 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 58 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
49 PropertyCallbackInfo<ApiReturn> info(begin()); \ 59 PropertyCallbackInfo<ApiReturn> info(begin()); \
50 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \ 60 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \
51 holder(), index)); \ 61 holder(), index)); \
52 f(index, info); \ 62 f(index, info); \
53 return GetReturnValue<InternalReturn>(isolate); \ 63 return GetReturnValue<InternalReturn>(isolate); \
54 } 64 }
55 65
56 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX) 66 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX)
57 67
58 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX 68 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX
59 #undef WRITE_CALL_1_INDEX 69 #undef WRITE_CALL_1_INDEX
60 70
61 Handle<Object> PropertyCallbackArguments::Call( 71 Handle<Object> PropertyCallbackArguments::Call(
62 GenericNamedPropertySetterCallback f, Handle<Name> name, 72 GenericNamedPropertySetterCallback f, Handle<Name> name,
63 Handle<Object> value) { 73 Handle<Object> value) {
64 Isolate* isolate = this->isolate(); 74 Isolate* isolate = this->isolate();
75 SIDE_EFFECT_CHECK(isolate, f, Object);
65 RuntimeCallTimerScope timer( 76 RuntimeCallTimerScope timer(
66 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback); 77 isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
67 VMState<EXTERNAL> state(isolate); 78 VMState<EXTERNAL> state(isolate);
68 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 79 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
69 PropertyCallbackInfo<v8::Value> info(begin()); 80 PropertyCallbackInfo<v8::Value> info(begin());
70 LOG(isolate, 81 LOG(isolate,
71 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 82 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
72 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 83 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
73 return GetReturnValue<Object>(isolate); 84 return GetReturnValue<Object>(isolate);
74 } 85 }
75 86
76 Handle<Object> PropertyCallbackArguments::Call( 87 Handle<Object> PropertyCallbackArguments::Call(
77 GenericNamedPropertyDefinerCallback f, Handle<Name> name, 88 GenericNamedPropertyDefinerCallback f, Handle<Name> name,
78 const v8::PropertyDescriptor& desc) { 89 const v8::PropertyDescriptor& desc) {
79 Isolate* isolate = this->isolate(); 90 Isolate* isolate = this->isolate();
91 SIDE_EFFECT_CHECK(isolate, f, Object);
80 RuntimeCallTimerScope timer( 92 RuntimeCallTimerScope timer(
81 isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback); 93 isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback);
82 VMState<EXTERNAL> state(isolate); 94 VMState<EXTERNAL> state(isolate);
83 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 95 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
84 PropertyCallbackInfo<v8::Value> info(begin()); 96 PropertyCallbackInfo<v8::Value> info(begin());
85 LOG(isolate, 97 LOG(isolate,
86 ApiNamedPropertyAccess("interceptor-named-define", holder(), *name)); 98 ApiNamedPropertyAccess("interceptor-named-define", holder(), *name));
87 f(v8::Utils::ToLocal(name), desc, info); 99 f(v8::Utils::ToLocal(name), desc, info);
88 return GetReturnValue<Object>(isolate); 100 return GetReturnValue<Object>(isolate);
89 } 101 }
90 102
91 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f, 103 Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f,
92 uint32_t index, 104 uint32_t index,
93 Handle<Object> value) { 105 Handle<Object> value) {
94 Isolate* isolate = this->isolate(); 106 Isolate* isolate = this->isolate();
107 SIDE_EFFECT_CHECK(isolate, f, Object);
95 RuntimeCallTimerScope timer(isolate, 108 RuntimeCallTimerScope timer(isolate,
96 &RuntimeCallStats::IndexedPropertySetterCallback); 109 &RuntimeCallStats::IndexedPropertySetterCallback);
97 VMState<EXTERNAL> state(isolate); 110 VMState<EXTERNAL> state(isolate);
98 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 111 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
99 PropertyCallbackInfo<v8::Value> info(begin()); 112 PropertyCallbackInfo<v8::Value> info(begin());
100 LOG(isolate, 113 LOG(isolate,
101 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index)); 114 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
102 f(index, v8::Utils::ToLocal(value), info); 115 f(index, v8::Utils::ToLocal(value), info);
103 return GetReturnValue<Object>(isolate); 116 return GetReturnValue<Object>(isolate);
104 } 117 }
105 118
106 Handle<Object> PropertyCallbackArguments::Call( 119 Handle<Object> PropertyCallbackArguments::Call(
107 IndexedPropertyDefinerCallback f, uint32_t index, 120 IndexedPropertyDefinerCallback f, uint32_t index,
108 const v8::PropertyDescriptor& desc) { 121 const v8::PropertyDescriptor& desc) {
109 Isolate* isolate = this->isolate(); 122 Isolate* isolate = this->isolate();
123 SIDE_EFFECT_CHECK(isolate, f, Object);
110 RuntimeCallTimerScope timer( 124 RuntimeCallTimerScope timer(
111 isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback); 125 isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback);
112 VMState<EXTERNAL> state(isolate); 126 VMState<EXTERNAL> state(isolate);
113 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 127 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
114 PropertyCallbackInfo<v8::Value> info(begin()); 128 PropertyCallbackInfo<v8::Value> info(begin());
115 LOG(isolate, 129 LOG(isolate,
116 ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index)); 130 ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index));
117 f(index, desc, info); 131 f(index, desc, info);
118 return GetReturnValue<Object>(isolate); 132 return GetReturnValue<Object>(isolate);
119 } 133 }
120 134
121 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f, 135 void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
122 Handle<Name> name, Handle<Object> value) { 136 Handle<Name> name, Handle<Object> value) {
123 Isolate* isolate = this->isolate(); 137 Isolate* isolate = this->isolate();
138 if (isolate->needs_side_effect_check() &&
139 !PerformSideEffectCheck(isolate, FUNCTION_ADDR(f))) {
140 return;
141 }
124 RuntimeCallTimerScope timer(isolate, 142 RuntimeCallTimerScope timer(isolate,
125 &RuntimeCallStats::AccessorNameSetterCallback); 143 &RuntimeCallStats::AccessorNameSetterCallback);
126 VMState<EXTERNAL> state(isolate); 144 VMState<EXTERNAL> state(isolate);
127 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 145 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
128 PropertyCallbackInfo<void> info(begin()); 146 PropertyCallbackInfo<void> info(begin());
129 LOG(isolate, 147 LOG(isolate,
130 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); 148 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
131 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 149 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
132 } 150 }
133 151
152 #undef SIDE_EFFECT_CHECK
153
134 } // namespace internal 154 } // namespace internal
135 } // namespace v8 155 } // namespace v8
OLDNEW
« no previous file with comments | « src/api-arguments.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698