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

Side by Side Diff: src/objects-inl.h

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 port Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 isolate, object, handle(isolate->context()->native_context(), isolate)); 1155 isolate, object, handle(isolate->context()->native_context(), isolate));
1156 } 1156 }
1157 1157
1158 1158
1159 bool Object::HasSpecificClassOf(String* name) { 1159 bool Object::HasSpecificClassOf(String* name) {
1160 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); 1160 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1161 } 1161 }
1162 1162
1163 1163
1164 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, 1164 MaybeHandle<Object> Object::GetProperty(Handle<Object> object,
1165 Handle<Name> name) { 1165 Handle<Name> name, Strength strength) {
1166 LookupIterator it(object, name); 1166 LookupIterator it(object, name);
1167 return GetProperty(&it); 1167 return GetProperty(&it, strength);
1168 } 1168 }
1169 1169
1170 1170
1171 MaybeHandle<Object> Object::GetElement(Isolate* isolate, 1171 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object,
1172 Handle<Object> object, 1172 uint32_t index, Strength strength) {
1173 uint32_t index) {
1174 LookupIterator it(isolate, object, index); 1173 LookupIterator it(isolate, object, index);
1175 return GetProperty(&it); 1174 return GetProperty(&it, strength);
1176 } 1175 }
1177 1176
1178 1177
1179 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( 1178 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes(
1180 Isolate* isolate, Handle<Object> receiver) { 1179 Isolate* isolate, Handle<Object> receiver) {
1181 PrototypeIterator iter(isolate, receiver); 1180 PrototypeIterator iter(isolate, receiver);
1182 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { 1181 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
1183 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { 1182 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
1184 return PrototypeIterator::GetCurrent(iter); 1183 return PrototypeIterator::GetCurrent(iter);
1185 } 1184 }
1186 iter.Advance(); 1185 iter.Advance();
1187 } 1186 }
1188 return PrototypeIterator::GetCurrent(iter); 1187 return PrototypeIterator::GetCurrent(iter);
1189 } 1188 }
1190 1189
1191 1190
1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, 1191 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object,
1193 Handle<Object> object, 1192 const char* name, Strength strength) {
1194 const char* name) {
1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); 1193 Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
1196 return GetProperty(object, str); 1194 return GetProperty(object, str, strength);
1197 } 1195 }
1198 1196
1199 1197
1200 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, 1198 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
1201 Handle<JSReceiver> receiver, 1199 Handle<JSReceiver> receiver,
1202 uint32_t index, 1200 uint32_t index,
1203 Handle<Object> value, 1201 Handle<Object> value,
1204 LanguageMode language_mode) { 1202 LanguageMode language_mode) {
1205 Isolate* isolate = proxy->GetIsolate(); 1203 Isolate* isolate = proxy->GetIsolate();
1206 Handle<String> name = isolate->factory()->Uint32ToString(index); 1204 Handle<String> name = isolate->factory()->Uint32ToString(index);
(...skipping 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after
6594 if (HasHashCode()) return this; 6592 if (HasHashCode()) return this;
6595 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); 6593 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot));
6596 DCHECK(canonical->IsInternalizedString()); 6594 DCHECK(canonical->IsInternalizedString());
6597 DCHECK(SlowEquals(canonical)); 6595 DCHECK(SlowEquals(canonical));
6598 DCHECK(canonical->HasHashCode()); 6596 DCHECK(canonical->HasHashCode());
6599 return canonical; 6597 return canonical;
6600 } 6598 }
6601 6599
6602 6600
6603 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, 6601 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
6604 Handle<Name> name) { 6602 Handle<Name> name,
6603 Strength strength) {
6605 uint32_t index; 6604 uint32_t index;
6606 LookupIterator it = name->AsArrayIndex(&index) 6605 LookupIterator it = name->AsArrayIndex(&index)
6607 ? LookupIterator(name->GetIsolate(), object, index) 6606 ? LookupIterator(name->GetIsolate(), object, index)
6608 : LookupIterator(object, name); 6607 : LookupIterator(object, name);
6609 return GetProperty(&it); 6608 return GetProperty(&it, strength);
6610 } 6609 }
6611 6610
6612 6611
6613 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, 6612 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
6614 Handle<Name> name) { 6613 Handle<Name> name) {
6615 // Call the "has" trap on proxies. 6614 // Call the "has" trap on proxies.
6616 if (object->IsJSProxy()) { 6615 if (object->IsJSProxy()) {
6617 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6616 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6618 return JSProxy::HasPropertyWithHandler(proxy, name); 6617 return JSProxy::HasPropertyWithHandler(proxy, name);
6619 } 6618 }
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
7375 #undef READ_SHORT_FIELD 7374 #undef READ_SHORT_FIELD
7376 #undef WRITE_SHORT_FIELD 7375 #undef WRITE_SHORT_FIELD
7377 #undef READ_BYTE_FIELD 7376 #undef READ_BYTE_FIELD
7378 #undef WRITE_BYTE_FIELD 7377 #undef WRITE_BYTE_FIELD
7379 #undef NOBARRIER_READ_BYTE_FIELD 7378 #undef NOBARRIER_READ_BYTE_FIELD
7380 #undef NOBARRIER_WRITE_BYTE_FIELD 7379 #undef NOBARRIER_WRITE_BYTE_FIELD
7381 7380
7382 } } // namespace v8::internal 7381 } } // namespace v8::internal
7383 7382
7384 #endif // V8_OBJECTS_INL_H_ 7383 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698