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

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: rebase 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
« no previous file with comments | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('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 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 #define FIELD_ADDR(p, offset) \ 1201 #define FIELD_ADDR(p, offset) \
1201 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) 1202 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
1202 1203
1203 #define FIELD_ADDR_CONST(p, offset) \ 1204 #define FIELD_ADDR_CONST(p, offset) \
1204 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) 1205 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag)
1205 1206
1206 #define READ_FIELD(p, offset) \ 1207 #define READ_FIELD(p, offset) \
(...skipping 5344 matching lines...) Expand 10 before | Expand all | Expand 10 after
6551 if (HasHashCode()) return this; 6552 if (HasHashCode()) return this;
6552 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot)); 6553 String* canonical = String::cast(READ_FIELD(this, kHashFieldSlot));
6553 DCHECK(canonical->IsInternalizedString()); 6554 DCHECK(canonical->IsInternalizedString());
6554 DCHECK(SlowEquals(canonical)); 6555 DCHECK(SlowEquals(canonical));
6555 DCHECK(canonical->HasHashCode()); 6556 DCHECK(canonical->HasHashCode());
6556 return canonical; 6557 return canonical;
6557 } 6558 }
6558 6559
6559 6560
6560 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object, 6561 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<Object> object,
6561 Handle<Name> name) { 6562 Handle<Name> name,
6563 LanguageMode language_mode) {
6562 LookupIterator it = 6564 LookupIterator it =
6563 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name); 6565 LookupIterator::PropertyOrElement(name->GetIsolate(), object, name);
6564 return GetProperty(&it); 6566 return GetProperty(&it, language_mode);
6565 } 6567 }
6566 6568
6567 6569
6568 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, 6570 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
6569 Handle<Name> name) { 6571 Handle<Name> name) {
6570 // Call the "has" trap on proxies. 6572 // Call the "has" trap on proxies.
6571 if (object->IsJSProxy()) { 6573 if (object->IsJSProxy()) {
6572 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6574 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6573 return JSProxy::HasPropertyWithHandler(proxy, name); 6575 return JSProxy::HasPropertyWithHandler(proxy, name);
6574 } 6576 }
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
7329 #undef READ_SHORT_FIELD 7331 #undef READ_SHORT_FIELD
7330 #undef WRITE_SHORT_FIELD 7332 #undef WRITE_SHORT_FIELD
7331 #undef READ_BYTE_FIELD 7333 #undef READ_BYTE_FIELD
7332 #undef WRITE_BYTE_FIELD 7334 #undef WRITE_BYTE_FIELD
7333 #undef NOBARRIER_READ_BYTE_FIELD 7335 #undef NOBARRIER_READ_BYTE_FIELD
7334 #undef NOBARRIER_WRITE_BYTE_FIELD 7336 #undef NOBARRIER_WRITE_BYTE_FIELD
7335 7337
7336 } } // namespace v8::internal 7338 } } // namespace v8::internal
7337 7339
7338 #endif // V8_OBJECTS_INL_H_ 7340 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « 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