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

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

Issue 1178503004: Replace SetObjectProperty / DefineObjectProperty with less powerful alternatives where relevant. (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/runtime/runtime.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 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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 1190
1191 1191
1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate, 1192 MaybeHandle<Object> Object::GetProperty(Isolate* isolate,
1193 Handle<Object> object, 1193 Handle<Object> object,
1194 const char* name) { 1194 const char* name) {
1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); 1195 Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
1196 return GetProperty(object, str); 1196 return GetProperty(object, str);
1197 } 1197 }
1198 1198
1199 1199
1200 MaybeHandle<Object> JSObject::DefinePropertyOrElement(
1201 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
1202 PropertyAttributes attributes) {
1203 uint32_t index;
1204 if (name->AsArrayIndex(&index)) {
1205 return SetOwnElementIgnoreAttributes(object, index, value, attributes);
1206 }
1207
1208 // TODO(verwaest): Is this necessary?
1209 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
1210 return SetOwnPropertyIgnoreAttributes(object, name, value, attributes);
1211 }
1212
1213
1200 #define FIELD_ADDR(p, offset) \ 1214 #define FIELD_ADDR(p, offset) \
1201 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) 1215 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
1202 1216
1203 #define FIELD_ADDR_CONST(p, offset) \ 1217 #define FIELD_ADDR_CONST(p, offset) \
1204 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) 1218 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag)
1205 1219
1206 #define READ_FIELD(p, offset) \ 1220 #define READ_FIELD(p, offset) \
1207 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) 1221 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset)))
1208 1222
1209 #define ACQUIRE_READ_FIELD(p, offset) \ 1223 #define ACQUIRE_READ_FIELD(p, offset) \
(...skipping 6137 matching lines...) Expand 10 before | Expand all | Expand 10 after
7347 #undef READ_SHORT_FIELD 7361 #undef READ_SHORT_FIELD
7348 #undef WRITE_SHORT_FIELD 7362 #undef WRITE_SHORT_FIELD
7349 #undef READ_BYTE_FIELD 7363 #undef READ_BYTE_FIELD
7350 #undef WRITE_BYTE_FIELD 7364 #undef WRITE_BYTE_FIELD
7351 #undef NOBARRIER_READ_BYTE_FIELD 7365 #undef NOBARRIER_READ_BYTE_FIELD
7352 #undef NOBARRIER_WRITE_BYTE_FIELD 7366 #undef NOBARRIER_WRITE_BYTE_FIELD
7353 7367
7354 } } // namespace v8::internal 7368 } } // namespace v8::internal
7355 7369
7356 #endif // V8_OBJECTS_INL_H_ 7370 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698