| 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 #ifndef V8_API_ARGUMENTS_H_ | 5 #ifndef V8_API_ARGUMENTS_H_ |
| 6 #define V8_API_ARGUMENTS_H_ | 6 #define V8_API_ARGUMENTS_H_ |
| 7 | 7 |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/tracing/trace-event.h" | 10 #include "src/tracing/trace-event.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 Handle<JSObject> Call(IndexedPropertyEnumeratorCallback f); | 109 Handle<JSObject> Call(IndexedPropertyEnumeratorCallback f); |
| 110 | 110 |
| 111 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \ | 111 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \ |
| 112 F(AccessorNameGetterCallback, "get", v8::Value, Object) \ | 112 F(AccessorNameGetterCallback, "get", v8::Value, Object) \ |
| 113 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \ | 113 F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \ |
| 114 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object) | 114 F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object) |
| 115 | 115 |
| 116 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \ | 116 #define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \ |
| 117 Handle<InternalReturn> Call(Function f, Handle<Name> name) { \ | 117 Handle<InternalReturn> Call(Function f, Handle<Name> name) { \ |
| 118 Isolate* isolate = this->isolate(); \ | 118 Isolate* isolate = this->isolate(); \ |
| 119 RuntimeCallTimerScope timer( \ |
| 120 isolate, &isolate->counters()->runtime_call_stats()->Function); \ |
| 119 VMState<EXTERNAL> state(isolate); \ | 121 VMState<EXTERNAL> state(isolate); \ |
| 120 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ | 122 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ |
| 121 PropertyCallbackInfo<ApiReturn> info(begin()); \ | 123 PropertyCallbackInfo<ApiReturn> info(begin()); \ |
| 122 LOG(isolate, \ | 124 LOG(isolate, \ |
| 123 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \ | 125 ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \ |
| 124 f(v8::Utils::ToLocal(name), info); \ | 126 f(v8::Utils::ToLocal(name), info); \ |
| 125 return GetReturnValue<InternalReturn>(isolate); \ | 127 return GetReturnValue<InternalReturn>(isolate); \ |
| 126 } | 128 } |
| 127 | 129 |
| 128 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) | 130 FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME) |
| 129 | 131 |
| 130 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME | 132 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME |
| 131 #undef WRITE_CALL_1_NAME | 133 #undef WRITE_CALL_1_NAME |
| 132 | 134 |
| 133 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ | 135 #define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \ |
| 134 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ | 136 F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \ |
| 135 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \ | 137 F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \ |
| 136 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object) | 138 F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object) |
| 137 | 139 |
| 138 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \ | 140 #define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \ |
| 139 Handle<InternalReturn> Call(Function f, uint32_t index) { \ | 141 Handle<InternalReturn> Call(Function f, uint32_t index) { \ |
| 140 Isolate* isolate = this->isolate(); \ | 142 Isolate* isolate = this->isolate(); \ |
| 141 VMState<EXTERNAL> state(isolate); \ | 143 RuntimeCallTimerScope timer( \ |
| 142 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ | 144 isolate, &isolate->counters()->runtime_call_stats()->Function); \ |
| 143 PropertyCallbackInfo<ApiReturn> info(begin()); \ | 145 VMState<EXTERNAL> state(isolate); \ |
| 144 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \ | 146 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ |
| 145 holder(), index)); \ | 147 PropertyCallbackInfo<ApiReturn> info(begin()); \ |
| 146 f(index, info); \ | 148 LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \ |
| 147 return GetReturnValue<InternalReturn>(isolate); \ | 149 holder(), index)); \ |
| 150 f(index, info); \ |
| 151 return GetReturnValue<InternalReturn>(isolate); \ |
| 148 } | 152 } |
| 149 | 153 |
| 150 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX) | 154 FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX) |
| 151 | 155 |
| 152 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX | 156 #undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX |
| 153 #undef WRITE_CALL_1_INDEX | 157 #undef WRITE_CALL_1_INDEX |
| 154 | 158 |
| 155 Handle<Object> Call(GenericNamedPropertySetterCallback f, Handle<Name> name, | 159 Handle<Object> Call(GenericNamedPropertySetterCallback f, Handle<Name> name, |
| 156 Handle<Object> value) { | 160 Handle<Object> value) { |
| 157 Isolate* isolate = this->isolate(); | 161 Isolate* isolate = this->isolate(); |
| 162 RuntimeCallTimerScope timer(isolate, |
| 163 &isolate->counters() |
| 164 ->runtime_call_stats() |
| 165 ->GenericNamedPropertySetterCallback); |
| 158 VMState<EXTERNAL> state(isolate); | 166 VMState<EXTERNAL> state(isolate); |
| 159 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); | 167 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 160 PropertyCallbackInfo<v8::Value> info(begin()); | 168 PropertyCallbackInfo<v8::Value> info(begin()); |
| 161 LOG(isolate, | 169 LOG(isolate, |
| 162 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); | 170 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); |
| 163 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); | 171 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); |
| 164 return GetReturnValue<Object>(isolate); | 172 return GetReturnValue<Object>(isolate); |
| 165 } | 173 } |
| 166 | 174 |
| 167 Handle<Object> Call(IndexedPropertySetterCallback f, uint32_t index, | 175 Handle<Object> Call(IndexedPropertySetterCallback f, uint32_t index, |
| 168 Handle<Object> value) { | 176 Handle<Object> value) { |
| 169 Isolate* isolate = this->isolate(); | 177 Isolate* isolate = this->isolate(); |
| 178 RuntimeCallTimerScope timer(isolate, &isolate->counters() |
| 179 ->runtime_call_stats() |
| 180 ->IndexedPropertySetterCallback); |
| 170 VMState<EXTERNAL> state(isolate); | 181 VMState<EXTERNAL> state(isolate); |
| 171 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); | 182 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 172 PropertyCallbackInfo<v8::Value> info(begin()); | 183 PropertyCallbackInfo<v8::Value> info(begin()); |
| 173 LOG(isolate, | 184 LOG(isolate, |
| 174 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index)); | 185 ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index)); |
| 175 f(index, v8::Utils::ToLocal(value), info); | 186 f(index, v8::Utils::ToLocal(value), info); |
| 176 return GetReturnValue<Object>(isolate); | 187 return GetReturnValue<Object>(isolate); |
| 177 } | 188 } |
| 178 | 189 |
| 179 void Call(AccessorNameSetterCallback f, Handle<Name> name, | 190 void Call(AccessorNameSetterCallback f, Handle<Name> name, |
| 180 Handle<Object> value) { | 191 Handle<Object> value) { |
| 181 Isolate* isolate = this->isolate(); | 192 Isolate* isolate = this->isolate(); |
| 193 RuntimeCallTimerScope timer( |
| 194 isolate, |
| 195 &isolate->counters()->runtime_call_stats()->AccessorNameSetterCallback); |
| 182 VMState<EXTERNAL> state(isolate); | 196 VMState<EXTERNAL> state(isolate); |
| 183 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); | 197 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); |
| 184 PropertyCallbackInfo<void> info(begin()); | 198 PropertyCallbackInfo<void> info(begin()); |
| 185 LOG(isolate, | 199 LOG(isolate, |
| 186 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); | 200 ApiNamedPropertyAccess("interceptor-named-set", holder(), *name)); |
| 187 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); | 201 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); |
| 188 } | 202 } |
| 189 | 203 |
| 190 private: | 204 private: |
| 191 inline JSObject* holder() { | 205 inline JSObject* holder() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 258 |
| 245 private: | 259 private: |
| 246 internal::Object** argv_; | 260 internal::Object** argv_; |
| 247 int argc_; | 261 int argc_; |
| 248 }; | 262 }; |
| 249 | 263 |
| 250 } // namespace internal | 264 } // namespace internal |
| 251 } // namespace v8 | 265 } // namespace v8 |
| 252 | 266 |
| 253 #endif // V8_API_ARGUMENTS_H_ | 267 #endif // V8_API_ARGUMENTS_H_ |
| OLD | NEW |