diff options
Diffstat (limited to 'deps/v8/src/runtime.cc')
-rw-r--r-- | deps/v8/src/runtime.cc | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/deps/v8/src/runtime.cc b/deps/v8/src/runtime.cc index 2f1f54c696..b8133ae15e 100644 --- a/deps/v8/src/runtime.cc +++ b/deps/v8/src/runtime.cc @@ -6944,15 +6944,9 @@ static MaybeObject* Runtime_CompileForOnStackReplacement(Arguments args) { Handle<Code> check_code = check_stub.GetCode(); Handle<Code> replacement_code( Builtins::builtin(Builtins::OnStackReplacement)); - // Iterate the unoptimized code and revert all the patched stack checks. - for (RelocIterator it(*unoptimized, RelocInfo::kCodeTargetMask); - !it.done(); - it.next()) { - RelocInfo* rinfo = it.rinfo(); - if (rinfo->target_address() == replacement_code->entry()) { - Deoptimizer::RevertStackCheckCode(rinfo, *check_code); - } - } + Deoptimizer::RevertStackCheckCode(*unoptimized, + *check_code, + *replacement_code); // Allow OSR only at nesting level zero again. unoptimized->set_allow_osr_at_loop_nesting_level(0); @@ -7049,7 +7043,7 @@ static MaybeObject* Runtime_PushCatchContext(Arguments args) { } -static MaybeObject* Runtime_LookupContext(Arguments args) { +static MaybeObject* Runtime_DeleteContextSlot(Arguments args) { HandleScope scope; ASSERT(args.length() == 2); @@ -7059,16 +7053,31 @@ static MaybeObject* Runtime_LookupContext(Arguments args) { int index; PropertyAttributes attributes; ContextLookupFlags flags = FOLLOW_CHAINS; - Handle<Object> holder = - context->Lookup(name, flags, &index, &attributes); + Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); - if (index < 0 && !holder.is_null()) { - ASSERT(holder->IsJSObject()); - return *holder; + // If the slot was not found the result is true. + if (holder.is_null()) { + return Heap::true_value(); } - // No intermediate context found. Use global object by default. - return Top::context()->global(); + // If the slot was found in a context, it should be DONT_DELETE. + if (holder->IsContext()) { + return Heap::false_value(); + } + + // The slot was found in a JSObject, either a context extension object, + // the global object, or an arguments object. Try to delete it + // (respecting DONT_DELETE). For consistency with V8's usual behavior, + // which allows deleting all parameters in functions that mention + // 'arguments', we do this even for the case of slots found on an + // arguments object. The slot was found on an arguments object if the + // index is non-negative. + Handle<JSObject> object = Handle<JSObject>::cast(holder); + if (index >= 0) { + return object->DeleteElement(index, JSObject::NORMAL_DELETION); + } else { + return object->DeleteProperty(*name, JSObject::NORMAL_DELETION); + } } @@ -7141,8 +7150,7 @@ static ObjectPair LoadContextSlotHelper(Arguments args, bool throw_error) { int index; PropertyAttributes attributes; ContextLookupFlags flags = FOLLOW_CHAINS; - Handle<Object> holder = - context->Lookup(name, flags, &index, &attributes); + Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); // If the index is non-negative, the slot has been found in a local // variable or a parameter. Read it from the context object or the @@ -7209,8 +7217,7 @@ static MaybeObject* Runtime_StoreContextSlot(Arguments args) { int index; PropertyAttributes attributes; ContextLookupFlags flags = FOLLOW_CHAINS; - Handle<Object> holder = - context->Lookup(name, flags, &index, &attributes); + Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); if (index >= 0) { if (holder->IsContext()) { |