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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 } | 1477 } |
1478 | 1478 |
1479 | 1479 |
1480 void JSObject::initialize_properties() { | 1480 void JSObject::initialize_properties() { |
1481 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1481 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
1482 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1482 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
1483 } | 1483 } |
1484 | 1484 |
1485 | 1485 |
1486 void JSObject::initialize_elements() { | 1486 void JSObject::initialize_elements() { |
1487 ASSERT(map()->has_fast_smi_or_object_elements() || | 1487 if (map()->has_fast_smi_or_object_elements() || |
1488 map()->has_fast_double_elements()); | 1488 map()->has_fast_double_elements()) { |
1489 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1489 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
1490 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array()); | 1490 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array()); |
| 1491 } else if (map()->has_external_array_elements()) { |
| 1492 ExternalArray* empty_array = GetHeap()->EmptyExternalArrayForMap(map()); |
| 1493 ASSERT(!GetHeap()->InNewSpace(empty_array)); |
| 1494 WRITE_FIELD(this, kElementsOffset, empty_array); |
| 1495 } else { |
| 1496 UNREACHABLE(); |
| 1497 } |
1491 } | 1498 } |
1492 | 1499 |
1493 | 1500 |
1494 MaybeObject* JSObject::ResetElements() { | 1501 MaybeObject* JSObject::ResetElements() { |
1495 if (map()->is_observed()) { | 1502 if (map()->is_observed()) { |
1496 // Maintain invariant that observed elements are always in dictionary mode. | 1503 // Maintain invariant that observed elements are always in dictionary mode. |
1497 SeededNumberDictionary* dictionary; | 1504 SeededNumberDictionary* dictionary; |
1498 MaybeObject* maybe = SeededNumberDictionary::Allocate(GetHeap(), 0); | 1505 MaybeObject* maybe = SeededNumberDictionary::Allocate(GetHeap(), 0); |
1499 if (!maybe->To(&dictionary)) return maybe; | 1506 if (!maybe->To(&dictionary)) return maybe; |
1500 if (map() == GetHeap()->non_strict_arguments_elements_map()) { | 1507 if (map() == GetHeap()->non_strict_arguments_elements_map()) { |
(...skipping 4713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6214 #undef WRITE_UINT32_FIELD | 6221 #undef WRITE_UINT32_FIELD |
6215 #undef READ_SHORT_FIELD | 6222 #undef READ_SHORT_FIELD |
6216 #undef WRITE_SHORT_FIELD | 6223 #undef WRITE_SHORT_FIELD |
6217 #undef READ_BYTE_FIELD | 6224 #undef READ_BYTE_FIELD |
6218 #undef WRITE_BYTE_FIELD | 6225 #undef WRITE_BYTE_FIELD |
6219 | 6226 |
6220 | 6227 |
6221 } } // namespace v8::internal | 6228 } } // namespace v8::internal |
6222 | 6229 |
6223 #endif // V8_OBJECTS_INL_H_ | 6230 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |