diff options
Diffstat (limited to 'deps/v8/src/execution.cc')
-rw-r--r-- | deps/v8/src/execution.cc | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/deps/v8/src/execution.cc b/deps/v8/src/execution.cc index da2d880a49..7442d1732f 100644 --- a/deps/v8/src/execution.cc +++ b/deps/v8/src/execution.cc @@ -77,6 +77,13 @@ static Handle<Object> Invoke(bool is_construct, // Entering JavaScript. VMState<JS> state(isolate); + CHECK(AllowJavascriptExecution::IsAllowed(isolate)); + if (!ThrowOnJavascriptExecution::IsAllowed(isolate)) { + isolate->ThrowIllegalOperation(); + *has_pending_exception = true; + isolate->ReportPendingMessages(); + return Handle<Object>(); + } // Placeholder for return value. MaybeObject* value = reinterpret_cast<Object*>(kZapValue); @@ -128,11 +135,6 @@ static Handle<Object> Invoke(bool is_construct, ASSERT(*has_pending_exception == isolate->has_pending_exception()); if (*has_pending_exception) { isolate->ReportPendingMessages(); - if (isolate->pending_exception()->IsOutOfMemory()) { - if (!isolate->ignore_out_of_memory()) { - V8::FatalProcessOutOfMemory("JS", true); - } - } #ifdef ENABLE_DEBUGGER_SUPPORT // Reset stepping state when script exits with uncaught exception. if (isolate->debugger()->IsDebuggerActive()) { @@ -163,9 +165,10 @@ Handle<Object> Execution::Call(Isolate* isolate, } Handle<JSFunction> func = Handle<JSFunction>::cast(callable); - // In non-strict mode, convert receiver. + // In sloppy mode, convert receiver. if (convert_receiver && !receiver->IsJSReceiver() && - !func->shared()->native() && func->shared()->is_classic_mode()) { + !func->shared()->native() && + func->shared()->strict_mode() == SLOPPY) { if (receiver->IsUndefined() || receiver->IsNull()) { Object* global = func->context()->global_object()->global_receiver(); // Under some circumstances, 'global' can be the JSBuiltinsObject @@ -217,9 +220,6 @@ Handle<Object> Execution::TryCall(Handle<JSFunction> func, ASSERT(catcher.HasCaught()); ASSERT(isolate->has_pending_exception()); ASSERT(isolate->external_caught_exception()); - if (isolate->is_out_of_memory() && !isolate->ignore_out_of_memory()) { - V8::FatalProcessOutOfMemory("OOM during Execution::TryCall"); - } if (isolate->pending_exception() == isolate->heap()->termination_exception()) { result = isolate->factory()->termination_exception(); @@ -368,6 +368,20 @@ void Execution::RunMicrotasks(Isolate* isolate) { } +void Execution::EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask) { + bool threw = false; + Handle<Object> args[] = { microtask }; + Execution::Call( + isolate, + isolate->enqueue_external_microtask(), + isolate->factory()->undefined_value(), + 1, + args, + &threw); + ASSERT(!threw); +} + + bool StackGuard::IsStackOverflow() { ExecutionAccess access(isolate_); return (thread_local_.jslimit_ != kInterruptLimit && @@ -502,15 +516,15 @@ void StackGuard::FullDeopt() { } -bool StackGuard::IsDeoptMarkedCode() { +bool StackGuard::IsDeoptMarkedAllocationSites() { ExecutionAccess access(isolate_); - return (thread_local_.interrupt_flags_ & DEOPT_MARKED_CODE) != 0; + return (thread_local_.interrupt_flags_ & DEOPT_MARKED_ALLOCATION_SITES) != 0; } -void StackGuard::DeoptMarkedCode() { +void StackGuard::DeoptMarkedAllocationSites() { ExecutionAccess access(isolate_); - thread_local_.interrupt_flags_ |= DEOPT_MARKED_CODE; + thread_local_.interrupt_flags_ |= DEOPT_MARKED_ALLOCATION_SITES; set_interrupt_limits(access); } @@ -797,10 +811,10 @@ Handle<JSFunction> Execution::InstantiateFunction( if (!data->do_not_cache()) { // Fast case: see if the function has already been instantiated int serial_number = Smi::cast(data->serial_number())->value(); - Object* elm = - isolate->native_context()->function_cache()-> - GetElementNoExceptionThrown(isolate, serial_number); - if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); + Handle<JSObject> cache(isolate->native_context()->function_cache()); + Handle<Object> elm = + Object::GetElementNoExceptionThrown(isolate, cache, serial_number); + if (elm->IsJSFunction()) return Handle<JSFunction>::cast(elm); } // The function has not yet been instantiated in this context; do it. Handle<Object> args[] = { data }; @@ -1026,9 +1040,9 @@ MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) { stack_guard->Continue(FULL_DEOPT); Deoptimizer::DeoptimizeAll(isolate); } - if (stack_guard->IsDeoptMarkedCode()) { - stack_guard->Continue(DEOPT_MARKED_CODE); - Deoptimizer::DeoptimizeMarkedCode(isolate); + if (stack_guard->IsDeoptMarkedAllocationSites()) { + stack_guard->Continue(DEOPT_MARKED_ALLOCATION_SITES); + isolate->heap()->DeoptMarkedAllocationSites(); } if (stack_guard->IsInstallCodeRequest()) { ASSERT(isolate->concurrent_recompilation_enabled()); |