};
-/**
- * Sets the given ResourceConstraints on the given Isolate.
- *
- * Deprecated, will be removed. Pass constraints via Isolate::New or modify
- * the stack limit via Isolate::SetStackLimit.
- */
-bool V8_EXPORT SetResourceConstraints(Isolate* isolate,
- ResourceConstraints* constraints);
-
-
// --- Exceptions ---
ReturnAddressLocationResolver return_address_resolver);
/**
- * Allows the host application to provide the address of a function that's
- * invoked on entry to every V8-generated function.
- * Note that \p entry_hook is invoked at the very start of each
- * generated function.
- *
- * \param isolate the isolate to operate on.
- * \param entry_hook a function that will be invoked on entry to every
- * V8-generated function.
- * \returns true on success on supported platforms, false on failure.
- * \note Setting an entry hook can only be done very early in an isolates
- * lifetime, and once set, the entry hook cannot be revoked.
- *
- * Deprecated, will be removed. Use Isolate::New(entry_hook) instead.
- */
- static bool SetFunctionEntryHook(Isolate* isolate,
- FunctionEntryHook entry_hook);
-
- /**
- * Allows the host application to provide the address of a function that is
- * notified each time code is added, moved or removed.
- *
- * \param options options for the JIT code event handler.
- * \param event_handler the JIT code event handler, which will be invoked
- * each time code is added, moved or removed.
- * \note \p event_handler won't get notified of existent code.
- * \note since code removal notifications are not currently issued, the
- * \p event_handler may get notifications of code that overlaps earlier
- * code notifications. This happens when code areas are reused, and the
- * earlier overlapping code areas should therefore be discarded.
- * \note the events passed to \p event_handler and the strings they point to
- * are not guaranteed to live past each call. The \p event_handler must
- * copy strings and other parameters it needs to keep around.
- * \note the set of events declared in JitCodeEvent::EventType is expected to
- * grow over time, and the JitCodeEvent structure is expected to accrue
- * new members. The \p event_handler function must ignore event codes
- * it does not recognize to maintain future compatibility.
- *
- * Deprecated, will be removed. Use Isolate::SetJitCodeEventHandler or
- * Isolate::CreateParams instead.
- */
- static void SetJitCodeEventHandler(JitCodeEventOptions options,
- JitCodeEventHandler event_handler);
-
- /**
* Forcefully terminate the current thread of JavaScript execution
* in the given isolate.
*
}
-bool SetResourceConstraints(Isolate* v8_isolate,
- ResourceConstraints* constraints) {
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- int semi_space_size = constraints->max_semi_space_size();
- int old_space_size = constraints->max_old_space_size();
- int max_executable_size = constraints->max_executable_size();
- size_t code_range_size = constraints->code_range_size();
+void SetResourceConstraints(i::Isolate* isolate,
+ const ResourceConstraints& constraints) {
+ int semi_space_size = constraints.max_semi_space_size();
+ int old_space_size = constraints.max_old_space_size();
+ int max_executable_size = constraints.max_executable_size();
+ size_t code_range_size = constraints.code_range_size();
if (semi_space_size != 0 || old_space_size != 0 ||
max_executable_size != 0 || code_range_size != 0) {
- // After initialization it's too late to change Heap constraints.
- DCHECK(!isolate->IsInitialized());
- bool result = isolate->heap()->ConfigureHeap(semi_space_size,
- old_space_size,
- max_executable_size,
- code_range_size);
- if (!result) return false;
- }
- if (constraints->stack_limit() != NULL) {
- uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
+ isolate->heap()->ConfigureHeap(semi_space_size, old_space_size,
+ max_executable_size, code_range_size);
+ }
+ if (constraints.stack_limit() != NULL) {
+ uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
isolate->stack_guard()->SetStackLimit(limit);
}
- isolate->set_max_available_threads(constraints->max_available_threads());
- return true;
+ isolate->set_max_available_threads(constraints.max_available_threads());
}
i::V8::SetReturnAddressLocationResolver(return_address_resolver);
}
-
-bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
- FunctionEntryHook entry_hook) {
- DCHECK(ext_isolate != NULL);
- DCHECK(entry_hook != NULL);
-
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
-
- // The entry hook can only be set before the Isolate is initialized, as
- // otherwise the Isolate's code stubs generated at initialization won't
- // contain entry hooks.
- if (isolate->IsInitialized())
- return false;
-
- // Setting an entry hook is a one-way operation, once set, it cannot be
- // changed or unset.
- if (isolate->function_entry_hook() != NULL)
- return false;
-
- isolate->set_function_entry_hook(entry_hook);
- return true;
-}
-
-
-void v8::V8::SetJitCodeEventHandler(
- JitCodeEventOptions options, JitCodeEventHandler event_handler) {
- i::Isolate* isolate = i::Isolate::Current();
- // Ensure that logging is initialized for our isolate.
- isolate->InitializeLoggingAndCounters();
- isolate->logger()->SetCodeEventHandler(options, event_handler);
-}
-
void v8::V8::SetArrayBufferAllocator(
ArrayBuffer::Allocator* allocator) {
if (!Utils::ApiCheck(i::V8::ArrayBufferAllocator() == NULL,
isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault,
params.code_event_handler);
}
- SetResourceConstraints(v8_isolate,
- const_cast<ResourceConstraints*>(¶ms.constraints));
+ SetResourceConstraints(isolate, params.constraints);
if (params.enable_serializer) {
isolate->enable_serializer();
}