| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index c195a90271a18b8a3d33f68d5ffbaa48469e6a2d..5c4e38d5cff6239d722f9b62841b77cfab1d1a81 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -41,6 +41,7 @@
|
| #include "src/smart-pointers.h"
|
| #include "src/string-search.h"
|
| #include "src/stub-cache.h"
|
| +#include "src/unscopables.h"
|
| #include "src/uri.h"
|
| #include "src/v8threads.h"
|
| #include "src/vm-state-inl.h"
|
| @@ -9139,6 +9140,29 @@ static Object* ComputeReceiverForNonGlobal(Isolate* isolate,
|
| }
|
|
|
|
|
| +static ObjectPair LoadWithContextSlot(Isolate* isolate, Handle<String> name,
|
| + Handle<JSReceiver> object,
|
| + Handle<Object> receiver_handle) {
|
| + LookupIterator it(object, name);
|
| + Maybe<PropertyAttributes> maybe_attrs = UnscopableLookup(&it);
|
| + if (!maybe_attrs.has_value) {
|
| + return MakePair(isolate->heap()->exception(), NULL);
|
| + }
|
| +
|
| + if (maybe_attrs.value != ABSENT) {
|
| + Handle<Object> value;
|
| + ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
| + isolate, value, Object::GetProperty(&it),
|
| + MakePair(isolate->heap()->exception(), NULL));
|
| +
|
| + return MakePair(*value, *receiver_handle);
|
| + }
|
| +
|
| + return MakePair(isolate->heap()->undefined_value(),
|
| + isolate->heap()->undefined_value());
|
| +}
|
| +
|
| +
|
| static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate,
|
| bool throw_error) {
|
| HandleScope scope(isolate);
|
| @@ -9218,6 +9242,10 @@ static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate,
|
| : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)),
|
| isolate);
|
|
|
| + if (FLAG_harmony_unscopables && context->IsWithContext()) {
|
| + return LoadWithContextSlot(isolate, name, object, receiver_handle);
|
| + }
|
| +
|
| // No need to unhole the value here. This is taken care of by the
|
| // GetProperty function.
|
| Handle<Object> value;
|
|
|