OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 MUST_USE_RESULT static Handle<Object> SetLengthImpl( | 764 MUST_USE_RESULT static Handle<Object> SetLengthImpl( |
765 Handle<JSObject> obj, | 765 Handle<JSObject> obj, |
766 Handle<Object> length, | 766 Handle<Object> length, |
767 Handle<FixedArrayBase> backing_store); | 767 Handle<FixedArrayBase> backing_store); |
768 | 768 |
769 virtual void SetCapacityAndLength( | 769 virtual void SetCapacityAndLength( |
770 Handle<JSArray> array, | 770 Handle<JSArray> array, |
771 int capacity, | 771 int capacity, |
772 int length) V8_FINAL V8_OVERRIDE { | 772 int length) V8_FINAL V8_OVERRIDE { |
773 CALL_HEAP_FUNCTION_VOID( | 773 ElementsAccessorSubclass:: |
774 array->GetIsolate(), | 774 SetFastElementsCapacityAndLength(array, capacity, length); |
775 ElementsAccessorSubclass::SetFastElementsCapacityAndLength( | |
776 *array, | |
777 capacity, | |
778 length)); | |
779 } | 775 } |
780 | 776 |
781 MUST_USE_RESULT static MaybeObject* SetFastElementsCapacityAndLength( | 777 static void SetFastElementsCapacityAndLength( |
782 JSObject* obj, | 778 Handle<JSObject> obj, |
783 int capacity, | 779 int capacity, |
784 int length) { | 780 int length) { |
785 UNIMPLEMENTED(); | 781 UNIMPLEMENTED(); |
786 return obj; | |
787 } | |
788 | |
789 // TODO(ishell): Temporary wrapper until handlified. | |
790 MUST_USE_RESULT static Handle<Object> SetFastElementsCapacityAndLength( | |
791 Handle<JSObject> obj, | |
792 int capacity, | |
793 int length) { | |
794 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
795 SetFastElementsCapacityAndLength(*obj, capacity, length), | |
796 Object); | |
797 } | 782 } |
798 | 783 |
799 MUST_USE_RESULT virtual Handle<Object> Delete( | 784 MUST_USE_RESULT virtual Handle<Object> Delete( |
800 Handle<JSObject> obj, | 785 Handle<JSObject> obj, |
801 uint32_t key, | 786 uint32_t key, |
802 JSReceiver::DeleteMode mode) V8_OVERRIDE = 0; | 787 JSReceiver::DeleteMode mode) V8_OVERRIDE = 0; |
803 | 788 |
804 MUST_USE_RESULT static MaybeObject* CopyElementsImpl(FixedArrayBase* from, | 789 MUST_USE_RESULT static MaybeObject* CopyElementsImpl(FixedArrayBase* from, |
805 uint32_t from_start, | 790 uint32_t from_start, |
806 FixedArrayBase* to, | 791 FixedArrayBase* to, |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 case EXTERNAL_##TYPE##_ELEMENTS: \ | 1210 case EXTERNAL_##TYPE##_ELEMENTS: \ |
1226 case TYPE##_ELEMENTS: \ | 1211 case TYPE##_ELEMENTS: \ |
1227 UNREACHABLE(); | 1212 UNREACHABLE(); |
1228 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1213 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
1229 #undef TYPED_ARRAY_CASE | 1214 #undef TYPED_ARRAY_CASE |
1230 } | 1215 } |
1231 return NULL; | 1216 return NULL; |
1232 } | 1217 } |
1233 | 1218 |
1234 | 1219 |
1235 static MaybeObject* SetFastElementsCapacityAndLength(JSObject* obj, | 1220 static void SetFastElementsCapacityAndLength( |
1236 uint32_t capacity, | 1221 Handle<JSObject> obj, |
1237 uint32_t length) { | 1222 uint32_t capacity, |
| 1223 uint32_t length) { |
1238 JSObject::SetFastElementsCapacitySmiMode set_capacity_mode = | 1224 JSObject::SetFastElementsCapacitySmiMode set_capacity_mode = |
1239 obj->HasFastSmiElements() | 1225 obj->HasFastSmiElements() |
1240 ? JSObject::kAllowSmiElements | 1226 ? JSObject::kAllowSmiElements |
1241 : JSObject::kDontAllowSmiElements; | 1227 : JSObject::kDontAllowSmiElements; |
1242 return obj->SetFastElementsCapacityAndLength(capacity, | 1228 JSObject::SetFastElementsCapacityAndLength( |
1243 length, | 1229 obj, capacity, length, set_capacity_mode); |
1244 set_capacity_mode); | |
1245 } | |
1246 | |
1247 // TODO(ishell): Temporary wrapper until handlified. | |
1248 static Handle<Object> SetFastElementsCapacityAndLength( | |
1249 Handle<JSObject> obj, | |
1250 int capacity, | |
1251 int length) { | |
1252 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
1253 SetFastElementsCapacityAndLength(*obj, capacity, length), | |
1254 Object); | |
1255 } | 1230 } |
1256 }; | 1231 }; |
1257 | 1232 |
1258 | 1233 |
1259 class FastPackedSmiElementsAccessor | 1234 class FastPackedSmiElementsAccessor |
1260 : public FastSmiOrObjectElementsAccessor< | 1235 : public FastSmiOrObjectElementsAccessor< |
1261 FastPackedSmiElementsAccessor, | 1236 FastPackedSmiElementsAccessor, |
1262 ElementsKindTraits<FAST_SMI_ELEMENTS> > { | 1237 ElementsKindTraits<FAST_SMI_ELEMENTS> > { |
1263 public: | 1238 public: |
1264 explicit FastPackedSmiElementsAccessor(const char* name) | 1239 explicit FastPackedSmiElementsAccessor(const char* name) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 class FastDoubleElementsAccessor | 1284 class FastDoubleElementsAccessor |
1310 : public FastElementsAccessor<FastElementsAccessorSubclass, | 1285 : public FastElementsAccessor<FastElementsAccessorSubclass, |
1311 KindTraits, | 1286 KindTraits, |
1312 kDoubleSize> { | 1287 kDoubleSize> { |
1313 public: | 1288 public: |
1314 explicit FastDoubleElementsAccessor(const char* name) | 1289 explicit FastDoubleElementsAccessor(const char* name) |
1315 : FastElementsAccessor<FastElementsAccessorSubclass, | 1290 : FastElementsAccessor<FastElementsAccessorSubclass, |
1316 KindTraits, | 1291 KindTraits, |
1317 kDoubleSize>(name) {} | 1292 kDoubleSize>(name) {} |
1318 | 1293 |
1319 static MaybeObject* SetFastElementsCapacityAndLength(JSObject* obj, | 1294 static void SetFastElementsCapacityAndLength(Handle<JSObject> obj, |
1320 uint32_t capacity, | 1295 uint32_t capacity, |
1321 uint32_t length) { | 1296 uint32_t length) { |
1322 return obj->SetFastDoubleElementsCapacityAndLength(capacity, | 1297 JSObject::SetFastDoubleElementsCapacityAndLength(obj, capacity, length); |
1323 length); | |
1324 } | |
1325 | |
1326 // TODO(ishell): Temporary wrapper until handlified. | |
1327 static Handle<Object> SetFastElementsCapacityAndLength( | |
1328 Handle<JSObject> obj, | |
1329 int capacity, | |
1330 int length) { | |
1331 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
1332 SetFastElementsCapacityAndLength(*obj, capacity, length), | |
1333 Object); | |
1334 } | 1298 } |
1335 | 1299 |
1336 protected: | 1300 protected: |
1337 static MaybeObject* CopyElementsImpl(FixedArrayBase* from, | 1301 static MaybeObject* CopyElementsImpl(FixedArrayBase* from, |
1338 uint32_t from_start, | 1302 uint32_t from_start, |
1339 FixedArrayBase* to, | 1303 FixedArrayBase* to, |
1340 ElementsKind from_kind, | 1304 ElementsKind from_kind, |
1341 uint32_t to_start, | 1305 uint32_t to_start, |
1342 int packed_size, | 1306 int packed_size, |
1343 int copy_size) { | 1307 int copy_size) { |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 UNREACHABLE(); | 2078 UNREACHABLE(); |
2115 break; | 2079 break; |
2116 } | 2080 } |
2117 | 2081 |
2118 array->set_elements(*elms); | 2082 array->set_elements(*elms); |
2119 array->set_length(Smi::FromInt(number_of_elements)); | 2083 array->set_length(Smi::FromInt(number_of_elements)); |
2120 return array; | 2084 return array; |
2121 } | 2085 } |
2122 | 2086 |
2123 } } // namespace v8::internal | 2087 } } // namespace v8::internal |
OLD | NEW |