| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index d980d327aa89640d2b44cbef8e08b58be0eb3257..e7bd3e8a0ba4658a5b03655aa8f51474777088e1 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"
|
| @@ -9091,6 +9092,30 @@ static Object* ComputeReceiverForNonGlobal(Isolate* isolate,
|
| }
|
|
|
|
|
| +static ObjectPair LoadWithContextSlot(Isolate* isolate, Handle<String> name,
|
| + Handle<JSReceiver> object,
|
| + Handle<Object> receiver_handle) {
|
| + UnscopableLookup lookup(isolate, name, object);
|
| + if (lookup.HasError()) {
|
| + return MakePair(isolate->heap()->exception(), NULL);
|
| + }
|
| + if (lookup.Found()) {
|
| + // The property might be a getter that is normally shadowed but due to the
|
| + // unscopables we found it further up the prototype chain. Therefore we need
|
| + // to ensure that we are using the right receiver and holder when we get the
|
| + // value.
|
| + Handle<Object> value;
|
| + LookupIterator it(object, name, lookup.GetHolder());
|
| + 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 LoadContextSlotHelper(Arguments args,
|
| Isolate* isolate,
|
| bool throw_error) {
|
| @@ -9165,6 +9190,10 @@ static ObjectPair LoadContextSlotHelper(Arguments args,
|
| : 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;
|
|
|