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

Side by Side Diff: src/contexts.cc

Issue 807893002: ES6: Update unscopables to match spec (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/unscopables.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug.h" 8 #include "src/debug.h"
9 #include "src/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 Handle<Symbol> unscopables_symbol = isolate->factory()->unscopables_symbol(); 128 Handle<Symbol> unscopables_symbol = isolate->factory()->unscopables_symbol();
129 Handle<Object> receiver = it->GetReceiver(); 129 Handle<Object> receiver = it->GetReceiver();
130 Handle<Object> unscopables; 130 Handle<Object> unscopables;
131 MaybeHandle<Object> maybe_unscopables = 131 MaybeHandle<Object> maybe_unscopables =
132 Object::GetProperty(receiver, unscopables_symbol); 132 Object::GetProperty(receiver, unscopables_symbol);
133 if (!maybe_unscopables.ToHandle(&unscopables)) { 133 if (!maybe_unscopables.ToHandle(&unscopables)) {
134 return Maybe<PropertyAttributes>(); 134 return Maybe<PropertyAttributes>();
135 } 135 }
136 if (!unscopables->IsSpecObject()) return attrs; 136 if (!unscopables->IsSpecObject()) return attrs;
137 Maybe<bool> blacklist = JSReceiver::HasProperty( 137 Handle<Object> blacklist;
138 Handle<JSReceiver>::cast(unscopables), it->name()); 138 MaybeHandle<Object> maybe_blacklist =
139 if (!blacklist.has_value) { 139 Object::GetProperty(unscopables, it->name());
140 if (!maybe_blacklist.ToHandle(&blacklist)) {
140 DCHECK(isolate->has_pending_exception()); 141 DCHECK(isolate->has_pending_exception());
141 return Maybe<PropertyAttributes>(); 142 return Maybe<PropertyAttributes>();
142 } 143 }
143 if (blacklist.value) return maybe(ABSENT); 144 if (!blacklist->IsUndefined()) return maybe(ABSENT);
144 return attrs; 145 return attrs;
145 } 146 }
146 147
147 static void GetAttributesAndBindingFlags(VariableMode mode, 148 static void GetAttributesAndBindingFlags(VariableMode mode,
148 InitializationFlag init_flag, 149 InitializationFlag init_flag,
149 PropertyAttributes* attributes, 150 PropertyAttributes* attributes,
150 BindingFlags* binding_flags) { 151 BindingFlags* binding_flags) {
151 switch (mode) { 152 switch (mode) {
152 case INTERNAL: // Fall through. 153 case INTERNAL: // Fall through.
153 case VAR: 154 case VAR:
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 489 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
489 // During bootstrapping we allow all objects to pass as global 490 // During bootstrapping we allow all objects to pass as global
490 // objects. This is necessary to fix circular dependencies. 491 // objects. This is necessary to fix circular dependencies.
491 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 492 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
492 isolate->bootstrapper()->IsActive() || 493 isolate->bootstrapper()->IsActive() ||
493 object->IsGlobalObject(); 494 object->IsGlobalObject();
494 } 495 }
495 #endif 496 #endif
496 497
497 } } // namespace v8::internal 498 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/unscopables.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698