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

Side by Side Diff: src/lookup.cc

Issue 2499593002: Make private symbols non-enumerable (Closed)
Patch Set: Created 4 years, 1 month 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 | src/property.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/lookup.h" 5 #include "src/lookup.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/field-type.h" 10 #include "src/field-type.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 #endif 301 #endif
302 } 302 }
303 303
304 // Can only be called when the receiver is a JSObject. JSProxy has to be handled 304 // Can only be called when the receiver is a JSObject. JSProxy has to be handled
305 // via a trap. Adding properties to primitive values is not observable. 305 // via a trap. Adding properties to primitive values is not observable.
306 void LookupIterator::PrepareTransitionToDataProperty( 306 void LookupIterator::PrepareTransitionToDataProperty(
307 Handle<JSObject> receiver, Handle<Object> value, 307 Handle<JSObject> receiver, Handle<Object> value,
308 PropertyAttributes attributes, Object::StoreFromKeyed store_mode) { 308 PropertyAttributes attributes, Object::StoreFromKeyed store_mode) {
309 DCHECK(receiver.is_identical_to(GetStoreTarget())); 309 DCHECK(receiver.is_identical_to(GetStoreTarget()));
310 if (state_ == TRANSITION) return; 310 if (state_ == TRANSITION) return;
311
312 if (!IsElement() && name()->IsPrivate()) {
313 attributes = static_cast<PropertyAttributes>(attributes | DONT_ENUM);
314 }
315
311 DCHECK(state_ != LookupIterator::ACCESSOR || 316 DCHECK(state_ != LookupIterator::ACCESSOR ||
312 (GetAccessors()->IsAccessorInfo() && 317 (GetAccessors()->IsAccessorInfo() &&
313 AccessorInfo::cast(*GetAccessors())->is_special_data_property())); 318 AccessorInfo::cast(*GetAccessors())->is_special_data_property()));
314 DCHECK_NE(INTEGER_INDEXED_EXOTIC, state_); 319 DCHECK_NE(INTEGER_INDEXED_EXOTIC, state_);
315 DCHECK(state_ == NOT_FOUND || !HolderIsReceiverOrHiddenPrototype()); 320 DCHECK(state_ == NOT_FOUND || !HolderIsReceiverOrHiddenPrototype());
316 321
317 Handle<Map> map(receiver->map(), isolate_); 322 Handle<Map> map(receiver->map(), isolate_);
318 323
319 // Dictionary maps can always have additional data properties. 324 // Dictionary maps can always have additional data properties.
320 if (map->is_dictionary_map()) { 325 if (map->is_dictionary_map()) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 440 }
436 441
437 void LookupIterator::TransitionToAccessorProperty( 442 void LookupIterator::TransitionToAccessorProperty(
438 Handle<Object> getter, Handle<Object> setter, 443 Handle<Object> getter, Handle<Object> setter,
439 PropertyAttributes attributes) { 444 PropertyAttributes attributes) {
440 DCHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_)); 445 DCHECK(!getter->IsNull(isolate_) || !setter->IsNull(isolate_));
441 // Can only be called when the receiver is a JSObject. JSProxy has to be 446 // Can only be called when the receiver is a JSObject. JSProxy has to be
442 // handled via a trap. Adding properties to primitive values is not 447 // handled via a trap. Adding properties to primitive values is not
443 // observable. 448 // observable.
444 Handle<JSObject> receiver = GetStoreTarget(); 449 Handle<JSObject> receiver = GetStoreTarget();
450 if (!IsElement() && name()->IsPrivate()) {
451 attributes = static_cast<PropertyAttributes>(attributes | DONT_ENUM);
452 }
445 453
446 if (!IsElement() && !receiver->map()->is_dictionary_map()) { 454 if (!IsElement() && !receiver->map()->is_dictionary_map()) {
447 Handle<Map> old_map(receiver->map(), isolate_); 455 Handle<Map> old_map(receiver->map(), isolate_);
448 456
449 if (!holder_.is_identical_to(receiver)) { 457 if (!holder_.is_identical_to(receiver)) {
450 holder_ = receiver; 458 holder_ = receiver;
451 state_ = NOT_FOUND; 459 state_ = NOT_FOUND;
452 } else if (state_ == INTERCEPTOR) { 460 } else if (state_ == INTERCEPTOR) {
453 LookupInRegularHolder<false>(*old_map, *holder_); 461 LookupInRegularHolder<false>(*old_map, *holder_);
454 } 462 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 867
860 // We have found a cached property! Modify the iterator accordingly. 868 // We have found a cached property! Modify the iterator accordingly.
861 name_ = maybe_name.ToHandleChecked(); 869 name_ = maybe_name.ToHandleChecked();
862 Restart(); 870 Restart();
863 CHECK_EQ(state(), LookupIterator::DATA); 871 CHECK_EQ(state(), LookupIterator::DATA);
864 return true; 872 return true;
865 } 873 }
866 874
867 } // namespace internal 875 } // namespace internal
868 } // namespace v8 876 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698