Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: src/runtime.cc

Issue 384963002: ES6 Unscopables (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use new GetHolder Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 61e1069d0db35242be66e6f2031c9b098760b064..e33acc75973c29b7246815d557fbc6b3103fe174 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"
@@ -9132,6 +9133,25 @@ static Object* ComputeReceiverForNonGlobal(Isolate* isolate,
}
+static ObjectPair LoadWithContextSlot(Isolate* isolate, Handle<String> name,
+ Handle<JSReceiver> object,
+ Handle<Object> receiver_handle) {
+ LookupIterator it(object, name);
+ PropertyAttributes attrs = UnscopableLookup(&it);
Toon Verwaest 2014/07/25 10:09:41 An exception could already have been thrown in Uns
+ if (attrs != 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);
@@ -9205,6 +9225,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;

Powered by Google App Engine
This is Rietveld 408576698