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

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: slim down, improve tests 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,
1166 LanguageMode language_mode) {
1166 LookupIterator it(object, name); 1167 LookupIterator it(object, name);
1167 return GetProperty(&it); 1168 return GetProperty(&it, language_mode);
1168 } 1169 }
1169 1170
1170 1171
1171 MaybeHandle<Object> Object::GetElement(Isolate* isolate, 1172 MaybeHandle<Object> Object::GetElement(Isolate* isolate, Handle<Object> object,
1172 Handle<Object> object, 1173 uint32_t index,
1173 uint32_t index) { 1174 LanguageMode language_mode) {
1174 LookupIterator it(isolate, object, index); 1175 LookupIterator it(isolate, object, index);
1175 return GetProperty(&it); 1176 return GetProperty(&it, language_mode);
1176 } 1177 }
1177 1178
1178 1179
1179 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( 1180 Handle<Object> Object::GetPrototypeSkipHiddenPrototypes(
1180 Isolate* isolate, Handle<Object> receiver) { 1181 Isolate* isolate, Handle<Object> receiver) {
1181 PrototypeIterator iter(isolate, receiver); 1182 PrototypeIterator iter(isolate, receiver);
1182 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { 1183 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
1183 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { 1184 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
1184 return PrototypeIterator::GetCurrent(iter); 1185 return PrototypeIterator::GetCurrent(iter);
1185 } 1186 }
1186 iter.Advance(); 1187 iter.Advance();
1187 } 1188 }
1188 return PrototypeIterator::GetCurrent(iter); 1189 return PrototypeIterator::GetCurrent(iter);
1189 } 1190 }
1190 1191
1191 1192
1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, 1193 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, Handle<Object> object,
1193 Handle<Object> object, 1194 const char* name,
1194 const char* name) { 1195 LanguageMode language_mode) {
1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); 1196 Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
1196 return GetProperty(object, str); 1197 return GetProperty(object, str, language_mode);
1197 } 1198 }
1198 1199
1199 1200
1200 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, 1201 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
1201 Handle<JSReceiver> receiver, 1202 Handle<JSReceiver> receiver,
1202 uint32_t index, 1203 uint32_t index,
1203 Handle<Object> value, 1204 Handle<Object> value,
1204 LanguageMode language_mode) { 1205 LanguageMode language_mode) {
1205 Isolate* isolate = proxy->GetIsolate(); 1206 Isolate* isolate = proxy->GetIsolate();
1206 Handle<String> name = isolate->factory()->Uint32ToString(index); 1207 Handle<String> name = isolate->factory()->Uint32ToString(index);
(...skipping 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after
6594 if (HasHashCode()) return this; 6595 if (HasHashCode()) return this;
6595 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); 6596 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot));
6596 DCHECK(canonical->IsInternalizedString()); 6597 DCHECK(canonical->IsInternalizedString());
6597 DCHECK(SlowEquals(canonical)); 6598 DCHECK(SlowEquals(canonical));
6598 DCHECK(canonical->HasHashCode()); 6599 DCHECK(canonical->HasHashCode());
6599 return canonical; 6600 return canonical;
6600 } 6601 }
6601 6602
6602 6603
6603 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, 6604 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
6604 Handle<Name> name) { 6605 Handle<Name> name,
6606 LanguageMode language_mode) {
6605 uint32_t index; 6607 uint32_t index;
6606 LookupIterator it = name->AsArrayIndex(&index) 6608 LookupIterator it = name->AsArrayIndex(&index)
6607 ? LookupIterator(name->GetIsolate(), object, index) 6609 ? LookupIterator(name->GetIsolate(), object, index)
6608 : LookupIterator(object, name); 6610 : LookupIterator(object, name);
6609 return GetProperty(&it); 6611 return GetProperty(&it, language_mode);
6610 } 6612 }
6611 6613
6612 6614
6613 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, 6615 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
6614 Handle<Name> name) { 6616 Handle<Name> name) {
6615 // Call the "has" trap on proxies. 6617 // Call the "has" trap on proxies.
6616 if (object->IsJSProxy()) { 6618 if (object->IsJSProxy()) {
6617 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6619 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6618 return JSProxy::HasPropertyWithHandler(proxy, name); 6620 return JSProxy::HasPropertyWithHandler(proxy, name);
6619 } 6621 }
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
7375 #undef READ_SHORT_FIELD 7377 #undef READ_SHORT_FIELD
7376 #undef WRITE_SHORT_FIELD 7378 #undef WRITE_SHORT_FIELD
7377 #undef READ_BYTE_FIELD 7379 #undef READ_BYTE_FIELD
7378 #undef WRITE_BYTE_FIELD 7380 #undef WRITE_BYTE_FIELD
7379 #undef NOBARRIER_READ_BYTE_FIELD 7381 #undef NOBARRIER_READ_BYTE_FIELD
7380 #undef NOBARRIER_WRITE_BYTE_FIELD 7382 #undef NOBARRIER_WRITE_BYTE_FIELD
7381 7383
7382 } } // namespace v8::internal 7384 } } // namespace v8::internal
7383 7385
7384 #endif // V8_OBJECTS_INL_H_ 7386 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/lookup.h ('K') | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698