Line data Source code
1 : // Copyright 2012 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 : #ifndef V8_API_H_
6 : #define V8_API_H_
7 :
8 : #include "include/v8-testing.h"
9 : #include "src/contexts.h"
10 : #include "src/debug/debug-interface.h"
11 : #include "src/detachable-vector.h"
12 : #include "src/heap/factory.h"
13 : #include "src/isolate.h"
14 : #include "src/objects.h"
15 : #include "src/objects/bigint.h"
16 : #include "src/objects/js-collection.h"
17 : #include "src/objects/js-generator.h"
18 : #include "src/objects/js-promise.h"
19 : #include "src/objects/js-proxy.h"
20 : #include "src/objects/module.h"
21 : #include "src/objects/shared-function-info.h"
22 :
23 : #include "src/objects/templates.h"
24 :
25 : namespace v8 {
26 :
27 : namespace internal {
28 : class JSArrayBufferView;
29 : } // namespace internal
30 :
31 : // Constants used in the implementation of the API. The most natural thing
32 : // would usually be to place these with the classes that use them, but
33 : // we want to keep them out of v8.h because it is an externally
34 : // visible file.
35 : class Consts {
36 : public:
37 : enum TemplateType {
38 : FUNCTION_TEMPLATE = 0,
39 : OBJECT_TEMPLATE = 1
40 : };
41 : };
42 :
43 : template <typename T>
44 : inline T ToCData(v8::internal::Object obj);
45 :
46 : template <>
47 : inline v8::internal::Address ToCData(v8::internal::Object obj);
48 :
49 : template <typename T>
50 : inline v8::internal::Handle<v8::internal::Object> FromCData(
51 : v8::internal::Isolate* isolate, T obj);
52 :
53 : template <>
54 : inline v8::internal::Handle<v8::internal::Object> FromCData(
55 : v8::internal::Isolate* isolate, v8::internal::Address obj);
56 :
57 : class ApiFunction {
58 : public:
59 3719581 : explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { }
60 3719582 : v8::internal::Address address() { return addr_; }
61 : private:
62 : v8::internal::Address addr_;
63 : };
64 :
65 :
66 :
67 : class RegisteredExtension {
68 : public:
69 : explicit RegisteredExtension(Extension* extension);
70 : static void Register(RegisteredExtension* that);
71 : static void UnregisterAll();
72 : Extension* extension() { return extension_; }
73 : RegisteredExtension* next() { return next_; }
74 96158 : static RegisteredExtension* first_extension() { return first_extension_; }
75 : private:
76 : Extension* extension_;
77 : RegisteredExtension* next_;
78 : static RegisteredExtension* first_extension_;
79 : };
80 :
81 : #define OPEN_HANDLE_LIST(V) \
82 : V(Template, TemplateInfo) \
83 : V(FunctionTemplate, FunctionTemplateInfo) \
84 : V(ObjectTemplate, ObjectTemplateInfo) \
85 : V(Signature, FunctionTemplateInfo) \
86 : V(AccessorSignature, FunctionTemplateInfo) \
87 : V(Data, Object) \
88 : V(RegExp, JSRegExp) \
89 : V(Object, JSReceiver) \
90 : V(Array, JSArray) \
91 : V(Map, JSMap) \
92 : V(Set, JSSet) \
93 : V(ArrayBuffer, JSArrayBuffer) \
94 : V(ArrayBufferView, JSArrayBufferView) \
95 : V(TypedArray, JSTypedArray) \
96 : V(Uint8Array, JSTypedArray) \
97 : V(Uint8ClampedArray, JSTypedArray) \
98 : V(Int8Array, JSTypedArray) \
99 : V(Uint16Array, JSTypedArray) \
100 : V(Int16Array, JSTypedArray) \
101 : V(Uint32Array, JSTypedArray) \
102 : V(Int32Array, JSTypedArray) \
103 : V(Float32Array, JSTypedArray) \
104 : V(Float64Array, JSTypedArray) \
105 : V(DataView, JSDataView) \
106 : V(SharedArrayBuffer, JSArrayBuffer) \
107 : V(Name, Name) \
108 : V(String, String) \
109 : V(Symbol, Symbol) \
110 : V(Script, JSFunction) \
111 : V(UnboundModuleScript, SharedFunctionInfo) \
112 : V(UnboundScript, SharedFunctionInfo) \
113 : V(Module, Module) \
114 : V(Function, JSReceiver) \
115 : V(Message, JSMessageObject) \
116 : V(Context, Context) \
117 : V(External, Object) \
118 : V(StackTrace, FixedArray) \
119 : V(StackFrame, StackFrameInfo) \
120 : V(Proxy, JSProxy) \
121 : V(debug::GeneratorObject, JSGeneratorObject) \
122 : V(debug::Script, Script) \
123 : V(debug::WeakMap, JSWeakMap) \
124 : V(Promise, JSPromise) \
125 : V(Primitive, Object) \
126 : V(PrimitiveArray, FixedArray) \
127 : V(BigInt, BigInt) \
128 : V(ScriptOrModule, Script)
129 :
130 : class Utils {
131 : public:
132 : static inline bool ApiCheck(bool condition,
133 : const char* location,
134 : const char* message) {
135 467833344 : if (!condition) Utils::ReportApiFailure(location, message);
136 : return condition;
137 : }
138 : static void ReportOOMFailure(v8::internal::Isolate* isolate,
139 : const char* location, bool is_heap_oom);
140 :
141 : static inline Local<Context> ToLocal(
142 : v8::internal::Handle<v8::internal::Context> obj);
143 : static inline Local<Value> ToLocal(
144 : v8::internal::Handle<v8::internal::Object> obj);
145 : static inline Local<Module> ToLocal(
146 : v8::internal::Handle<v8::internal::Module> obj);
147 : static inline Local<Name> ToLocal(
148 : v8::internal::Handle<v8::internal::Name> obj);
149 : static inline Local<String> ToLocal(
150 : v8::internal::Handle<v8::internal::String> obj);
151 : static inline Local<Symbol> ToLocal(
152 : v8::internal::Handle<v8::internal::Symbol> obj);
153 : static inline Local<RegExp> ToLocal(
154 : v8::internal::Handle<v8::internal::JSRegExp> obj);
155 : static inline Local<Object> ToLocal(
156 : v8::internal::Handle<v8::internal::JSReceiver> obj);
157 : static inline Local<Object> ToLocal(
158 : v8::internal::Handle<v8::internal::JSObject> obj);
159 : static inline Local<Function> ToLocal(
160 : v8::internal::Handle<v8::internal::JSFunction> obj);
161 : static inline Local<Array> ToLocal(
162 : v8::internal::Handle<v8::internal::JSArray> obj);
163 : static inline Local<Map> ToLocal(
164 : v8::internal::Handle<v8::internal::JSMap> obj);
165 : static inline Local<Set> ToLocal(
166 : v8::internal::Handle<v8::internal::JSSet> obj);
167 : static inline Local<Proxy> ToLocal(
168 : v8::internal::Handle<v8::internal::JSProxy> obj);
169 : static inline Local<ArrayBuffer> ToLocal(
170 : v8::internal::Handle<v8::internal::JSArrayBuffer> obj);
171 : static inline Local<ArrayBufferView> ToLocal(
172 : v8::internal::Handle<v8::internal::JSArrayBufferView> obj);
173 : static inline Local<DataView> ToLocal(
174 : v8::internal::Handle<v8::internal::JSDataView> obj);
175 : static inline Local<TypedArray> ToLocal(
176 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
177 : static inline Local<Uint8Array> ToLocalUint8Array(
178 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
179 : static inline Local<Uint8ClampedArray> ToLocalUint8ClampedArray(
180 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
181 : static inline Local<Int8Array> ToLocalInt8Array(
182 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
183 : static inline Local<Uint16Array> ToLocalUint16Array(
184 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
185 : static inline Local<Int16Array> ToLocalInt16Array(
186 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
187 : static inline Local<Uint32Array> ToLocalUint32Array(
188 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
189 : static inline Local<Int32Array> ToLocalInt32Array(
190 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
191 : static inline Local<Float32Array> ToLocalFloat32Array(
192 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
193 : static inline Local<Float64Array> ToLocalFloat64Array(
194 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
195 : static inline Local<BigInt64Array> ToLocalBigInt64Array(
196 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
197 : static inline Local<BigUint64Array> ToLocalBigUint64Array(
198 : v8::internal::Handle<v8::internal::JSTypedArray> obj);
199 :
200 : static inline Local<SharedArrayBuffer> ToLocalShared(
201 : v8::internal::Handle<v8::internal::JSArrayBuffer> obj);
202 :
203 : static inline Local<Message> MessageToLocal(
204 : v8::internal::Handle<v8::internal::Object> obj);
205 : static inline Local<Promise> PromiseToLocal(
206 : v8::internal::Handle<v8::internal::JSObject> obj);
207 : static inline Local<StackTrace> StackTraceToLocal(
208 : v8::internal::Handle<v8::internal::FixedArray> obj);
209 : static inline Local<StackFrame> StackFrameToLocal(
210 : v8::internal::Handle<v8::internal::StackFrameInfo> obj);
211 : static inline Local<Number> NumberToLocal(
212 : v8::internal::Handle<v8::internal::Object> obj);
213 : static inline Local<Integer> IntegerToLocal(
214 : v8::internal::Handle<v8::internal::Object> obj);
215 : static inline Local<Uint32> Uint32ToLocal(
216 : v8::internal::Handle<v8::internal::Object> obj);
217 : static inline Local<BigInt> ToLocal(
218 : v8::internal::Handle<v8::internal::BigInt> obj);
219 : static inline Local<FunctionTemplate> ToLocal(
220 : v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
221 : static inline Local<ObjectTemplate> ToLocal(
222 : v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj);
223 : static inline Local<Signature> SignatureToLocal(
224 : v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
225 : static inline Local<AccessorSignature> AccessorSignatureToLocal(
226 : v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
227 : static inline Local<External> ExternalToLocal(
228 : v8::internal::Handle<v8::internal::JSObject> obj);
229 : static inline Local<Function> CallableToLocal(
230 : v8::internal::Handle<v8::internal::JSReceiver> obj);
231 : static inline Local<Primitive> ToLocalPrimitive(
232 : v8::internal::Handle<v8::internal::Object> obj);
233 : static inline Local<PrimitiveArray> ToLocal(
234 : v8::internal::Handle<v8::internal::FixedArray> obj);
235 : static inline Local<ScriptOrModule> ScriptOrModuleToLocal(
236 : v8::internal::Handle<v8::internal::Script> obj);
237 :
238 : #define DECLARE_OPEN_HANDLE(From, To) \
239 : static inline v8::internal::Handle<v8::internal::To> OpenHandle( \
240 : const From* that, bool allow_empty_handle = false);
241 :
242 : OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
243 :
244 : #undef DECLARE_OPEN_HANDLE
245 :
246 : template <class From, class To>
247 : static inline Local<To> Convert(v8::internal::Handle<From> obj);
248 :
249 : template <class T>
250 : static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
251 : const v8::Persistent<T>& persistent) {
252 : return v8::internal::Handle<v8::internal::Object>(
253 0 : reinterpret_cast<v8::internal::Address*>(persistent.val_));
254 : }
255 :
256 : template <class T>
257 : static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
258 : v8::Persistent<T>* persistent) {
259 : return OpenPersistent(*persistent);
260 : }
261 :
262 : template <class From, class To>
263 : static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) {
264 : return OpenHandle(*handle);
265 : }
266 :
267 57 : static inline CompiledWasmModule Convert(
268 : std::shared_ptr<i::wasm::NativeModule> native_module) {
269 114 : return CompiledWasmModule{std::move(native_module)};
270 : }
271 :
272 : private:
273 : static void ReportApiFailure(const char* location, const char* message);
274 : };
275 :
276 : template <class T>
277 : inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
278 : return reinterpret_cast<T*>(obj.location());
279 : }
280 :
281 : template <class T>
282 : inline v8::Local<T> ToApiHandle(
283 : v8::internal::Handle<v8::internal::Object> obj) {
284 : return Utils::Convert<v8::internal::Object, T>(obj);
285 : }
286 :
287 :
288 : template <class T>
289 : inline bool ToLocal(v8::internal::MaybeHandle<v8::internal::Object> maybe,
290 : Local<T>* local) {
291 : v8::internal::Handle<v8::internal::Object> handle;
292 3365115 : if (maybe.ToHandle(&handle)) {
293 : *local = Utils::Convert<v8::internal::Object, T>(handle);
294 : return true;
295 : }
296 : return false;
297 : }
298 :
299 : namespace internal {
300 :
301 : class V8_EXPORT_PRIVATE DeferredHandles {
302 : public:
303 : ~DeferredHandles();
304 :
305 : private:
306 : DeferredHandles(Address* first_block_limit, Isolate* isolate)
307 : : next_(nullptr),
308 : previous_(nullptr),
309 : first_block_limit_(first_block_limit),
310 12327 : isolate_(isolate) {
311 12327 : isolate->LinkDeferredHandles(this);
312 : }
313 :
314 : void Iterate(RootVisitor* v);
315 :
316 : std::vector<Address*> blocks_;
317 : DeferredHandles* next_;
318 : DeferredHandles* previous_;
319 : Address* first_block_limit_;
320 : Isolate* isolate_;
321 :
322 : friend class HandleScopeImplementer;
323 : friend class Isolate;
324 : };
325 :
326 :
327 : // This class is here in order to be able to declare it a friend of
328 : // HandleScope. Moving these methods to be members of HandleScope would be
329 : // neat in some ways, but it would expose internal implementation details in
330 : // our public header file, which is undesirable.
331 : //
332 : // An isolate has a single instance of this class to hold the current thread's
333 : // data. In multithreaded V8 programs this data is copied in and out of storage
334 : // so that the currently executing thread always has its own copy of this
335 : // data.
336 : class HandleScopeImplementer {
337 : public:
338 : class EnteredContextRewindScope {
339 : public:
340 : explicit EnteredContextRewindScope(HandleScopeImplementer* hsi)
341 : : hsi_(hsi), saved_entered_context_count_(hsi->EnteredContextCount()) {}
342 :
343 : ~EnteredContextRewindScope() {
344 : DCHECK_LE(saved_entered_context_count_, hsi_->EnteredContextCount());
345 52445 : while (saved_entered_context_count_ < hsi_->EnteredContextCount())
346 : hsi_->LeaveContext();
347 : }
348 :
349 : private:
350 : HandleScopeImplementer* hsi_;
351 : size_t saved_entered_context_count_;
352 : };
353 :
354 : explicit HandleScopeImplementer(Isolate* isolate)
355 : : isolate_(isolate),
356 : spare_(nullptr),
357 : call_depth_(0),
358 : microtasks_policy_(v8::MicrotasksPolicy::kAuto),
359 62883 : last_handle_before_deferred_block_(nullptr) {
360 : }
361 :
362 62868 : ~HandleScopeImplementer() {
363 62868 : DeleteArray(spare_);
364 62868 : }
365 :
366 : // Threading support for handle data.
367 : static int ArchiveSpacePerThread();
368 : char* RestoreThread(char* from);
369 : char* ArchiveThread(char* to);
370 : void FreeThreadResources();
371 :
372 : // Garbage collection support.
373 : void Iterate(v8::internal::RootVisitor* v);
374 : static char* Iterate(v8::internal::RootVisitor* v, char* data);
375 :
376 : inline internal::Address* GetSpareOrNewBlock();
377 : inline void DeleteExtensions(internal::Address* prev_limit);
378 :
379 : // Call depth represents nested v8 api calls.
380 12342033 : inline void IncrementCallDepth() {call_depth_++;}
381 12342019 : inline void DecrementCallDepth() {call_depth_--;}
382 : inline bool CallDepthIsZero() { return call_depth_ == 0; }
383 :
384 : inline void EnterContext(Context context);
385 : inline void LeaveContext();
386 : inline bool LastEnteredContextWas(Context context);
387 104875 : inline size_t EnteredContextCount() const { return entered_contexts_.size(); }
388 :
389 : inline void EnterMicrotaskContext(Context context);
390 :
391 : inline void set_microtasks_policy(v8::MicrotasksPolicy policy);
392 : inline v8::MicrotasksPolicy microtasks_policy() const;
393 :
394 : // Returns the last entered context or an empty handle if no
395 : // contexts have been entered.
396 : inline Handle<Context> LastEnteredContext();
397 : inline Handle<Context> LastEnteredOrMicrotaskContext();
398 :
399 : inline void SaveContext(Context context);
400 : inline Context RestoreContext();
401 : inline bool HasSavedContexts();
402 :
403 : inline DetachableVector<Address*>* blocks() { return &blocks_; }
404 : Isolate* isolate() const { return isolate_; }
405 :
406 : void ReturnBlock(Address* block) {
407 : DCHECK_NOT_NULL(block);
408 12327 : if (spare_ != nullptr) DeleteArray(spare_);
409 12327 : spare_ = block;
410 : }
411 :
412 : static const size_t kEnteredContextsOffset;
413 : static const size_t kIsMicrotaskContextOffset;
414 :
415 : private:
416 : void ResetAfterArchive() {
417 : blocks_.detach();
418 : entered_contexts_.detach();
419 : is_microtask_context_.detach();
420 : saved_contexts_.detach();
421 24256 : spare_ = nullptr;
422 24256 : last_handle_before_deferred_block_ = nullptr;
423 24256 : call_depth_ = 0;
424 : }
425 :
426 5918 : void Free() {
427 : DCHECK(blocks_.empty());
428 : DCHECK(entered_contexts_.empty());
429 : DCHECK(is_microtask_context_.empty());
430 : DCHECK(saved_contexts_.empty());
431 :
432 : blocks_.free();
433 : entered_contexts_.free();
434 : is_microtask_context_.free();
435 : saved_contexts_.free();
436 5918 : if (spare_ != nullptr) {
437 : DeleteArray(spare_);
438 5755 : spare_ = nullptr;
439 : }
440 : DCHECK_EQ(call_depth_, 0);
441 5918 : }
442 :
443 : void BeginDeferredScope();
444 : DeferredHandles* Detach(Address* prev_limit);
445 :
446 : Isolate* isolate_;
447 : DetachableVector<Address*> blocks_;
448 :
449 : // Used as a stack to keep track of entered contexts.
450 : // If |i|th item of |entered_contexts_| is added by EnterMicrotaskContext,
451 : // `is_microtask_context_[i]` is 1.
452 : // TODO(tzik): Remove |is_microtask_context_| after the deprecated
453 : // v8::Isolate::GetEnteredContext() is removed.
454 : DetachableVector<Context> entered_contexts_;
455 : DetachableVector<int8_t> is_microtask_context_;
456 :
457 : // Used as a stack to keep track of saved contexts.
458 : DetachableVector<Context> saved_contexts_;
459 : Address* spare_;
460 : int call_depth_;
461 :
462 : v8::MicrotasksPolicy microtasks_policy_;
463 :
464 : Address* last_handle_before_deferred_block_;
465 : // This is only used for threading support.
466 : HandleScopeData handle_scope_data_;
467 :
468 : void IterateThis(RootVisitor* v);
469 : char* RestoreThreadHelper(char* from);
470 : char* ArchiveThreadHelper(char* to);
471 :
472 : friend class DeferredHandles;
473 : friend class DeferredHandleScope;
474 : friend class HandleScopeImplementerOffsets;
475 :
476 : DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer);
477 : };
478 :
479 : const int kHandleBlockSize = v8::internal::KB - 2; // fit in one page
480 :
481 :
482 : void HandleScopeImplementer::set_microtasks_policy(
483 : v8::MicrotasksPolicy policy) {
484 2290 : microtasks_policy_ = policy;
485 : }
486 :
487 :
488 : v8::MicrotasksPolicy HandleScopeImplementer::microtasks_policy() const {
489 : return microtasks_policy_;
490 : }
491 :
492 : void HandleScopeImplementer::SaveContext(Context context) {
493 4372077 : saved_contexts_.push_back(context);
494 : }
495 :
496 : Context HandleScopeImplementer::RestoreContext() {
497 4352948 : Context last_context = saved_contexts_.back();
498 : saved_contexts_.pop_back();
499 : return last_context;
500 : }
501 :
502 :
503 : bool HandleScopeImplementer::HasSavedContexts() {
504 : return !saved_contexts_.empty();
505 : }
506 :
507 4371416 : void HandleScopeImplementer::EnterContext(Context context) {
508 : DCHECK_EQ(entered_contexts_.size(), is_microtask_context_.size());
509 4371416 : entered_contexts_.push_back(context);
510 4371418 : is_microtask_context_.push_back(0);
511 4371415 : }
512 :
513 : void HandleScopeImplementer::LeaveContext() {
514 : DCHECK(!entered_contexts_.empty());
515 : DCHECK_EQ(entered_contexts_.size(), is_microtask_context_.size());
516 : entered_contexts_.pop_back();
517 : is_microtask_context_.pop_back();
518 : }
519 :
520 : bool HandleScopeImplementer::LastEnteredContextWas(Context context) {
521 8704570 : return !entered_contexts_.empty() && entered_contexts_.back() == context;
522 : }
523 :
524 0 : void HandleScopeImplementer::EnterMicrotaskContext(Context context) {
525 : DCHECK_EQ(entered_contexts_.size(), is_microtask_context_.size());
526 0 : entered_contexts_.push_back(context);
527 0 : is_microtask_context_.push_back(1);
528 0 : }
529 :
530 : // If there's a spare block, use it for growing the current scope.
531 : internal::Address* HandleScopeImplementer::GetSpareOrNewBlock() {
532 : internal::Address* block =
533 3046001 : (spare_ != nullptr) ? spare_
534 3046001 : : NewArray<internal::Address>(kHandleBlockSize);
535 3046001 : spare_ = nullptr;
536 : return block;
537 : }
538 :
539 2859362 : void HandleScopeImplementer::DeleteExtensions(internal::Address* prev_limit) {
540 8752412 : while (!blocks_.empty()) {
541 3493351 : internal::Address* block_start = blocks_.back();
542 3493351 : internal::Address* block_limit = block_start + kHandleBlockSize;
543 :
544 : // SealHandleScope may make the prev_limit to point inside the block.
545 : // Cast possibly-unrelated pointers to plain Addres before comparing them
546 : // to avoid undefined behavior.
547 6986702 : if (reinterpret_cast<Address>(block_start) <=
548 3493351 : reinterpret_cast<Address>(prev_limit) &&
549 3493351 : reinterpret_cast<Address>(prev_limit) <=
550 : reinterpret_cast<Address>(block_limit)) {
551 : #ifdef ENABLE_HANDLE_ZAPPING
552 : internal::HandleScope::ZapRange(prev_limit, block_limit);
553 : #endif
554 : break;
555 : }
556 :
557 5893050 : blocks_.pop_back();
558 : #ifdef ENABLE_HANDLE_ZAPPING
559 : internal::HandleScope::ZapRange(block_start, block_limit);
560 : #endif
561 3033688 : if (spare_ != nullptr) {
562 : DeleteArray(spare_);
563 : }
564 3033688 : spare_ = block_start;
565 : }
566 : DCHECK((blocks_.empty() && prev_limit == nullptr) ||
567 : (!blocks_.empty() && prev_limit != nullptr));
568 2859362 : }
569 :
570 : // Interceptor functions called from generated inline caches to notify
571 : // CPU profiler that external callbacks are invoked.
572 : void InvokeAccessorGetterCallback(
573 : v8::Local<v8::Name> property,
574 : const v8::PropertyCallbackInfo<v8::Value>& info,
575 : v8::AccessorNameGetterCallback getter);
576 :
577 : void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
578 : v8::FunctionCallback callback);
579 :
580 : class Testing {
581 : public:
582 26321 : static v8::Testing::StressType stress_type() { return stress_type_; }
583 : static void set_stress_type(v8::Testing::StressType stress_type) {
584 5265 : stress_type_ = stress_type;
585 : }
586 :
587 : private:
588 : static v8::Testing::StressType stress_type_;
589 : };
590 :
591 : } // namespace internal
592 : } // namespace v8
593 :
594 : #endif // V8_API_H_
|