| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 #define INT_ACCESSORS(holder, name, offset) \ | 84 #define INT_ACCESSORS(holder, name, offset) \ |
| 85 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 85 int holder::name() { return READ_INT_FIELD(this, offset); } \ |
| 86 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 86 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } |
| 87 | 87 |
| 88 | 88 |
| 89 #define ACCESSORS(holder, name, type, offset) \ | 89 #define ACCESSORS(holder, name, type, offset) \ |
| 90 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 90 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ |
| 91 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 91 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
| 92 WRITE_FIELD(this, offset, value); \ | 92 WRITE_FIELD(this, offset, value); \ |
| 93 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ | 93 CONDITIONAL_WRITE_BARRIER(this, offset, value, mode); \ |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 #define SMI_ACCESSORS(holder, name, offset) \ | 97 #define SMI_ACCESSORS(holder, name, offset) \ |
| 98 int holder::name() { \ | 98 int holder::name() { \ |
| 99 Object* value = READ_FIELD(this, offset); \ | 99 Object* value = READ_FIELD(this, offset); \ |
| 100 return Smi::cast(value)->value(); \ | 100 return Smi::cast(value)->value(); \ |
| 101 } \ | 101 } \ |
| 102 void holder::set_##name(int value) { \ | 102 void holder::set_##name(int value) { \ |
| 103 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ | 103 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 839 |
| 840 #define FIELD_ADDR(p, offset) \ | 840 #define FIELD_ADDR(p, offset) \ |
| 841 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 841 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
| 842 | 842 |
| 843 #define READ_FIELD(p, offset) \ | 843 #define READ_FIELD(p, offset) \ |
| 844 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | 844 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) |
| 845 | 845 |
| 846 #define WRITE_FIELD(p, offset, value) \ | 846 #define WRITE_FIELD(p, offset, value) \ |
| 847 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | 847 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) |
| 848 | 848 |
| 849 #define WRITE_BARRIER(heap, object, offset, value) \ | 849 #define WRITE_BARRIER(object, offset, value) \ |
| 850 heap->incremental_marking()->RecordWrite( \ | 850 Address value_addr = reinterpret_cast<HeapObject*>(value)->address(); \ |
| 851 object, HeapObject::RawField(object, offset), value); \ | 851 if (!value->IsSmi() && Page::FromAddress(value_addr)->IsFlagSet( \ |
| 852 if (heap->InNewSpace(value)) { \ | 852 MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING)) { \ |
| 853 heap->RecordWrite(object->address(), offset); \ | 853 Heap* heap = object->GetHeap(); \ |
| 854 heap->incremental_marking()->RecordWrite( \ |
| 855 object, HeapObject::RawField(object, offset), value); \ |
| 856 if (heap->InNewSpace(value)) { \ |
| 857 heap->RecordWrite(object->address(), offset); \ |
| 858 } \ |
| 854 } | 859 } |
| 855 | 860 |
| 856 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ | 861 #define CONDITIONAL_WRITE_BARRIER(object, offset, value, mode) \ |
| 857 if (mode == UPDATE_WRITE_BARRIER) { \ | 862 Address value_addr = reinterpret_cast<HeapObject*>(value)->address(); \ |
| 863 if (mode == UPDATE_WRITE_BARRIER && \ |
| 864 !value->IsSmi() && \ |
| 865 Page::FromAddress(value_addr)->IsFlagSet( \ |
| 866 MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING)) { \ |
| 867 Heap* heap = object->GetHeap(); \ |
| 858 heap->incremental_marking()->RecordWrite( \ | 868 heap->incremental_marking()->RecordWrite( \ |
| 859 object, HeapObject::RawField(object, offset), value); \ | 869 object, HeapObject::RawField(object, offset), value); \ |
| 860 if (heap->InNewSpace(value)) { \ | 870 if (heap->InNewSpace(value)) { \ |
| 861 heap->RecordWrite(object->address(), offset); \ | 871 heap->RecordWrite(object->address(), offset); \ |
| 862 } \ | 872 } \ |
| 863 } | 873 } |
| 864 | 874 |
| 875 #define CONDITIONAL_WRITE_BARRIER_WITH_HEAP(heap, object, offset, value, mode) \ |
| 876 if (mode == UPDATE_WRITE_BARRIER) { \ |
| 877 heap->incremental_marking()->RecordWrite( \ |
| 878 object, HeapObject::RawField(object, offset), value); \ |
| 879 if (heap->InNewSpace(value)) { \ |
| 880 heap->RecordWrite(object->address(), offset); \ |
| 881 } \ |
| 882 } |
| 883 |
| 865 #ifndef V8_TARGET_ARCH_MIPS | 884 #ifndef V8_TARGET_ARCH_MIPS |
| 866 #define READ_DOUBLE_FIELD(p, offset) \ | 885 #define READ_DOUBLE_FIELD(p, offset) \ |
| 867 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | 886 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) |
| 868 #else // V8_TARGET_ARCH_MIPS | 887 #else // V8_TARGET_ARCH_MIPS |
| 869 // Prevent gcc from using load-double (mips ldc1) on (possibly) | 888 // Prevent gcc from using load-double (mips ldc1) on (possibly) |
| 870 // non-64-bit aligned HeapNumber::value. | 889 // non-64-bit aligned HeapNumber::value. |
| 871 static inline double read_double_field(void* p, int offset) { | 890 static inline double read_double_field(void* p, int offset) { |
| 872 union conversion { | 891 union conversion { |
| 873 double d; | 892 double d; |
| 874 uint32_t u[2]; | 893 uint32_t u[2]; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 map()->has_fast_smi_only_elements()) == | 1270 map()->has_fast_smi_only_elements()) == |
| 1252 (value->map() == GetHeap()->fixed_array_map() || | 1271 (value->map() == GetHeap()->fixed_array_map() || |
| 1253 value->map() == GetHeap()->fixed_cow_array_map())); | 1272 value->map() == GetHeap()->fixed_cow_array_map())); |
| 1254 ASSERT(map()->has_fast_double_elements() == | 1273 ASSERT(map()->has_fast_double_elements() == |
| 1255 value->IsFixedDoubleArray()); | 1274 value->IsFixedDoubleArray()); |
| 1256 ASSERT(value->HasValidElements()); | 1275 ASSERT(value->HasValidElements()); |
| 1257 #ifdef DEBUG | 1276 #ifdef DEBUG |
| 1258 ValidateSmiOnlyElements(); | 1277 ValidateSmiOnlyElements(); |
| 1259 #endif | 1278 #endif |
| 1260 WRITE_FIELD(this, kElementsOffset, value); | 1279 WRITE_FIELD(this, kElementsOffset, value); |
| 1261 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); | 1280 CONDITIONAL_WRITE_BARRIER(this, kElementsOffset, value, mode); |
| 1262 } | 1281 } |
| 1263 | 1282 |
| 1264 | 1283 |
| 1265 void JSObject::initialize_properties() { | 1284 void JSObject::initialize_properties() { |
| 1266 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1285 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1267 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1286 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 1268 } | 1287 } |
| 1269 | 1288 |
| 1270 | 1289 |
| 1271 void JSObject::initialize_elements() { | 1290 void JSObject::initialize_elements() { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 } | 1393 } |
| 1375 | 1394 |
| 1376 | 1395 |
| 1377 void JSObject::SetInternalField(int index, Object* value) { | 1396 void JSObject::SetInternalField(int index, Object* value) { |
| 1378 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1397 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1379 // Internal objects do follow immediately after the header, whereas in-object | 1398 // Internal objects do follow immediately after the header, whereas in-object |
| 1380 // properties are at the end of the object. Therefore there is no need | 1399 // properties are at the end of the object. Therefore there is no need |
| 1381 // to adjust the index here. | 1400 // to adjust the index here. |
| 1382 int offset = GetHeaderSize() + (kPointerSize * index); | 1401 int offset = GetHeaderSize() + (kPointerSize * index); |
| 1383 WRITE_FIELD(this, offset, value); | 1402 WRITE_FIELD(this, offset, value); |
| 1384 WRITE_BARRIER(GetHeap(), this, offset, value); | 1403 WRITE_BARRIER(this, offset, value); |
| 1385 } | 1404 } |
| 1386 | 1405 |
| 1387 | 1406 |
| 1388 void JSObject::SetInternalField(int index, Smi* value) { | 1407 void JSObject::SetInternalField(int index, Smi* value) { |
| 1389 ASSERT(index < GetInternalFieldCount() && index >= 0); | 1408 ASSERT(index < GetInternalFieldCount() && index >= 0); |
| 1390 // Internal objects do follow immediately after the header, whereas in-object | 1409 // Internal objects do follow immediately after the header, whereas in-object |
| 1391 // properties are at the end of the object. Therefore there is no need | 1410 // properties are at the end of the object. Therefore there is no need |
| 1392 // to adjust the index here. | 1411 // to adjust the index here. |
| 1393 int offset = GetHeaderSize() + (kPointerSize * index); | 1412 int offset = GetHeaderSize() + (kPointerSize * index); |
| 1394 WRITE_FIELD(this, offset, value); | 1413 WRITE_FIELD(this, offset, value); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1410 } | 1429 } |
| 1411 } | 1430 } |
| 1412 | 1431 |
| 1413 | 1432 |
| 1414 Object* JSObject::FastPropertyAtPut(int index, Object* value) { | 1433 Object* JSObject::FastPropertyAtPut(int index, Object* value) { |
| 1415 // Adjust for the number of properties stored in the object. | 1434 // Adjust for the number of properties stored in the object. |
| 1416 index -= map()->inobject_properties(); | 1435 index -= map()->inobject_properties(); |
| 1417 if (index < 0) { | 1436 if (index < 0) { |
| 1418 int offset = map()->instance_size() + (index * kPointerSize); | 1437 int offset = map()->instance_size() + (index * kPointerSize); |
| 1419 WRITE_FIELD(this, offset, value); | 1438 WRITE_FIELD(this, offset, value); |
| 1420 WRITE_BARRIER(GetHeap(), this, offset, value); | 1439 WRITE_BARRIER(this, offset, value); |
| 1421 } else { | 1440 } else { |
| 1422 ASSERT(index < properties()->length()); | 1441 ASSERT(index < properties()->length()); |
| 1423 properties()->set(index, value); | 1442 properties()->set(index, value); |
| 1424 } | 1443 } |
| 1425 return value; | 1444 return value; |
| 1426 } | 1445 } |
| 1427 | 1446 |
| 1428 | 1447 |
| 1429 int JSObject::GetInObjectPropertyOffset(int index) { | 1448 int JSObject::GetInObjectPropertyOffset(int index) { |
| 1430 // Adjust for the number of properties stored in the object. | 1449 // Adjust for the number of properties stored in the object. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1444 | 1463 |
| 1445 | 1464 |
| 1446 Object* JSObject::InObjectPropertyAtPut(int index, | 1465 Object* JSObject::InObjectPropertyAtPut(int index, |
| 1447 Object* value, | 1466 Object* value, |
| 1448 WriteBarrierMode mode) { | 1467 WriteBarrierMode mode) { |
| 1449 // Adjust for the number of properties stored in the object. | 1468 // Adjust for the number of properties stored in the object. |
| 1450 index -= map()->inobject_properties(); | 1469 index -= map()->inobject_properties(); |
| 1451 ASSERT(index < 0); | 1470 ASSERT(index < 0); |
| 1452 int offset = map()->instance_size() + (index * kPointerSize); | 1471 int offset = map()->instance_size() + (index * kPointerSize); |
| 1453 WRITE_FIELD(this, offset, value); | 1472 WRITE_FIELD(this, offset, value); |
| 1454 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | 1473 CONDITIONAL_WRITE_BARRIER(this, offset, value, mode); |
| 1455 return value; | 1474 return value; |
| 1456 } | 1475 } |
| 1457 | 1476 |
| 1458 | 1477 |
| 1459 | 1478 |
| 1460 void JSObject::InitializeBody(Map* map, | 1479 void JSObject::InitializeBody(Map* map, |
| 1461 Object* pre_allocated_value, | 1480 Object* pre_allocated_value, |
| 1462 Object* filler_value) { | 1481 Object* filler_value) { |
| 1463 ASSERT(!filler_value->IsHeapObject() || | 1482 ASSERT(!filler_value->IsHeapObject() || |
| 1464 !GetHeap()->InNewSpace(filler_value)); | 1483 !GetHeap()->InNewSpace(filler_value)); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 int offset = kHeaderSize + index * kPointerSize; | 1574 int offset = kHeaderSize + index * kPointerSize; |
| 1556 WRITE_FIELD(this, offset, value); | 1575 WRITE_FIELD(this, offset, value); |
| 1557 } | 1576 } |
| 1558 | 1577 |
| 1559 | 1578 |
| 1560 void FixedArray::set(int index, Object* value) { | 1579 void FixedArray::set(int index, Object* value) { |
| 1561 ASSERT(map() != HEAP->fixed_cow_array_map()); | 1580 ASSERT(map() != HEAP->fixed_cow_array_map()); |
| 1562 ASSERT(index >= 0 && index < this->length()); | 1581 ASSERT(index >= 0 && index < this->length()); |
| 1563 int offset = kHeaderSize + index * kPointerSize; | 1582 int offset = kHeaderSize + index * kPointerSize; |
| 1564 WRITE_FIELD(this, offset, value); | 1583 WRITE_FIELD(this, offset, value); |
| 1565 WRITE_BARRIER(GetHeap(), this, offset, value); | 1584 WRITE_BARRIER(this, offset, value); |
| 1566 } | 1585 } |
| 1567 | 1586 |
| 1568 | 1587 |
| 1569 inline bool FixedDoubleArray::is_the_hole_nan(double value) { | 1588 inline bool FixedDoubleArray::is_the_hole_nan(double value) { |
| 1570 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | 1589 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
| 1571 } | 1590 } |
| 1572 | 1591 |
| 1573 | 1592 |
| 1574 inline double FixedDoubleArray::hole_nan_as_double() { | 1593 inline double FixedDoubleArray::hole_nan_as_double() { |
| 1575 return BitCast<double, uint64_t>(kHoleNanInt64); | 1594 return BitCast<double, uint64_t>(kHoleNanInt64); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 } | 1711 } |
| 1693 | 1712 |
| 1694 | 1713 |
| 1695 void FixedArray::set(int index, | 1714 void FixedArray::set(int index, |
| 1696 Object* value, | 1715 Object* value, |
| 1697 WriteBarrierMode mode) { | 1716 WriteBarrierMode mode) { |
| 1698 ASSERT(map() != HEAP->fixed_cow_array_map()); | 1717 ASSERT(map() != HEAP->fixed_cow_array_map()); |
| 1699 ASSERT(index >= 0 && index < this->length()); | 1718 ASSERT(index >= 0 && index < this->length()); |
| 1700 int offset = kHeaderSize + index * kPointerSize; | 1719 int offset = kHeaderSize + index * kPointerSize; |
| 1701 WRITE_FIELD(this, offset, value); | 1720 WRITE_FIELD(this, offset, value); |
| 1702 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | 1721 CONDITIONAL_WRITE_BARRIER(this, offset, value, mode); |
| 1703 } | 1722 } |
| 1704 | 1723 |
| 1705 | 1724 |
| 1706 void FixedArray::NoWriteBarrierSet(FixedArray* array, | 1725 void FixedArray::NoWriteBarrierSet(FixedArray* array, |
| 1707 int index, | 1726 int index, |
| 1708 Object* value) { | 1727 Object* value) { |
| 1709 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); | 1728 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); |
| 1710 ASSERT(index >= 0 && index < array->length()); | 1729 ASSERT(index >= 0 && index < array->length()); |
| 1711 ASSERT(!HEAP->InNewSpace(value)); | 1730 ASSERT(!HEAP->InNewSpace(value)); |
| 1712 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); | 1731 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 WRITE_FIELD(this, offset, value); | 1774 WRITE_FIELD(this, offset, value); |
| 1756 } | 1775 } |
| 1757 | 1776 |
| 1758 | 1777 |
| 1759 void FixedArray::set_unchecked(Heap* heap, | 1778 void FixedArray::set_unchecked(Heap* heap, |
| 1760 int index, | 1779 int index, |
| 1761 Object* value, | 1780 Object* value, |
| 1762 WriteBarrierMode mode) { | 1781 WriteBarrierMode mode) { |
| 1763 int offset = kHeaderSize + index * kPointerSize; | 1782 int offset = kHeaderSize + index * kPointerSize; |
| 1764 WRITE_FIELD(this, offset, value); | 1783 WRITE_FIELD(this, offset, value); |
| 1765 CONDITIONAL_WRITE_BARRIER(heap, this, offset, value, mode); | 1784 CONDITIONAL_WRITE_BARRIER_WITH_HEAP(heap, this, offset, value, mode); |
| 1766 } | 1785 } |
| 1767 | 1786 |
| 1768 | 1787 |
| 1769 void FixedArray::set_null_unchecked(Heap* heap, int index) { | 1788 void FixedArray::set_null_unchecked(Heap* heap, int index) { |
| 1770 ASSERT(index >= 0 && index < this->length()); | 1789 ASSERT(index >= 0 && index < this->length()); |
| 1771 ASSERT(!HEAP->InNewSpace(heap->null_value())); | 1790 ASSERT(!HEAP->InNewSpace(heap->null_value())); |
| 1772 WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value()); | 1791 WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value()); |
| 1773 } | 1792 } |
| 1774 | 1793 |
| 1775 | 1794 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 } | 2289 } |
| 2271 | 2290 |
| 2272 | 2291 |
| 2273 Object* ConsString::unchecked_first() { | 2292 Object* ConsString::unchecked_first() { |
| 2274 return READ_FIELD(this, kFirstOffset); | 2293 return READ_FIELD(this, kFirstOffset); |
| 2275 } | 2294 } |
| 2276 | 2295 |
| 2277 | 2296 |
| 2278 void ConsString::set_first(String* value, WriteBarrierMode mode) { | 2297 void ConsString::set_first(String* value, WriteBarrierMode mode) { |
| 2279 WRITE_FIELD(this, kFirstOffset, value); | 2298 WRITE_FIELD(this, kFirstOffset, value); |
| 2280 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kFirstOffset, value, mode); | 2299 CONDITIONAL_WRITE_BARRIER(this, kFirstOffset, value, mode); |
| 2281 } | 2300 } |
| 2282 | 2301 |
| 2283 | 2302 |
| 2284 String* ConsString::second() { | 2303 String* ConsString::second() { |
| 2285 return String::cast(READ_FIELD(this, kSecondOffset)); | 2304 return String::cast(READ_FIELD(this, kSecondOffset)); |
| 2286 } | 2305 } |
| 2287 | 2306 |
| 2288 | 2307 |
| 2289 Object* ConsString::unchecked_second() { | 2308 Object* ConsString::unchecked_second() { |
| 2290 return READ_FIELD(this, kSecondOffset); | 2309 return READ_FIELD(this, kSecondOffset); |
| 2291 } | 2310 } |
| 2292 | 2311 |
| 2293 | 2312 |
| 2294 void ConsString::set_second(String* value, WriteBarrierMode mode) { | 2313 void ConsString::set_second(String* value, WriteBarrierMode mode) { |
| 2295 WRITE_FIELD(this, kSecondOffset, value); | 2314 WRITE_FIELD(this, kSecondOffset, value); |
| 2296 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode); | 2315 CONDITIONAL_WRITE_BARRIER(this, kSecondOffset, value, mode); |
| 2297 } | 2316 } |
| 2298 | 2317 |
| 2299 | 2318 |
| 2300 bool ExternalString::is_short() { | 2319 bool ExternalString::is_short() { |
| 2301 InstanceType type = map()->instance_type(); | 2320 InstanceType type = map()->instance_type(); |
| 2302 return (type & kShortExternalStringMask) == kShortExternalStringTag; | 2321 return (type & kShortExternalStringMask) == kShortExternalStringTag; |
| 2303 } | 2322 } |
| 2304 | 2323 |
| 2305 | 2324 |
| 2306 const ExternalAsciiString::Resource* ExternalAsciiString::resource() { | 2325 const ExternalAsciiString::Resource* ExternalAsciiString::resource() { |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 | 3221 |
| 3203 | 3222 |
| 3204 Object* Map::prototype() { | 3223 Object* Map::prototype() { |
| 3205 return READ_FIELD(this, kPrototypeOffset); | 3224 return READ_FIELD(this, kPrototypeOffset); |
| 3206 } | 3225 } |
| 3207 | 3226 |
| 3208 | 3227 |
| 3209 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 3228 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
| 3210 ASSERT(value->IsNull() || value->IsJSReceiver()); | 3229 ASSERT(value->IsNull() || value->IsJSReceiver()); |
| 3211 WRITE_FIELD(this, kPrototypeOffset, value); | 3230 WRITE_FIELD(this, kPrototypeOffset, value); |
| 3212 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 3231 CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, value, mode); |
| 3213 } | 3232 } |
| 3214 | 3233 |
| 3215 | 3234 |
| 3216 DescriptorArray* Map::instance_descriptors() { | 3235 DescriptorArray* Map::instance_descriptors() { |
| 3217 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset); | 3236 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset); |
| 3218 if (object->IsSmi()) { | 3237 if (object->IsSmi()) { |
| 3219 return HEAP->empty_descriptor_array(); | 3238 return HEAP->empty_descriptor_array(); |
| 3220 } else { | 3239 } else { |
| 3221 return DescriptorArray::cast(object); | 3240 return DescriptorArray::cast(object); |
| 3222 } | 3241 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3251 } else { | 3270 } else { |
| 3252 if (object->IsSmi()) { | 3271 if (object->IsSmi()) { |
| 3253 value->set_bit_field3_storage(Smi::cast(object)->value()); | 3272 value->set_bit_field3_storage(Smi::cast(object)->value()); |
| 3254 } else { | 3273 } else { |
| 3255 value->set_bit_field3_storage( | 3274 value->set_bit_field3_storage( |
| 3256 DescriptorArray::cast(object)->bit_field3_storage()); | 3275 DescriptorArray::cast(object)->bit_field3_storage()); |
| 3257 } | 3276 } |
| 3258 } | 3277 } |
| 3259 ASSERT(!is_shared()); | 3278 ASSERT(!is_shared()); |
| 3260 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); | 3279 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); |
| 3261 CONDITIONAL_WRITE_BARRIER( | 3280 CONDITIONAL_WRITE_BARRIER_WITH_HEAP( |
| 3262 heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode); | 3281 heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode); |
| 3263 } | 3282 } |
| 3264 | 3283 |
| 3265 | 3284 |
| 3266 int Map::bit_field3() { | 3285 int Map::bit_field3() { |
| 3267 Object* object = READ_FIELD(this, | 3286 Object* object = READ_FIELD(this, |
| 3268 kInstanceDescriptorsOrBitField3Offset); | 3287 kInstanceDescriptorsOrBitField3Offset); |
| 3269 if (object->IsSmi()) { | 3288 if (object->IsSmi()) { |
| 3270 return Smi::cast(object)->value(); | 3289 return Smi::cast(object)->value(); |
| 3271 } else { | 3290 } else { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 } | 3642 } |
| 3624 | 3643 |
| 3625 | 3644 |
| 3626 Code* SharedFunctionInfo::unchecked_code() { | 3645 Code* SharedFunctionInfo::unchecked_code() { |
| 3627 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); | 3646 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
| 3628 } | 3647 } |
| 3629 | 3648 |
| 3630 | 3649 |
| 3631 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 3650 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 3632 WRITE_FIELD(this, kCodeOffset, value); | 3651 WRITE_FIELD(this, kCodeOffset, value); |
| 3633 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); | 3652 CONDITIONAL_WRITE_BARRIER(this, kCodeOffset, value, mode); |
| 3634 } | 3653 } |
| 3635 | 3654 |
| 3636 | 3655 |
| 3637 ScopeInfo* SharedFunctionInfo::scope_info() { | 3656 ScopeInfo* SharedFunctionInfo::scope_info() { |
| 3638 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); | 3657 return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); |
| 3639 } | 3658 } |
| 3640 | 3659 |
| 3641 | 3660 |
| 3642 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, | 3661 void SharedFunctionInfo::set_scope_info(ScopeInfo* value, |
| 3643 WriteBarrierMode mode) { | 3662 WriteBarrierMode mode) { |
| 3644 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 3663 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); |
| 3645 CONDITIONAL_WRITE_BARRIER(GetHeap(), | 3664 CONDITIONAL_WRITE_BARRIER(this, |
| 3646 this, | |
| 3647 kScopeInfoOffset, | 3665 kScopeInfoOffset, |
| 3648 reinterpret_cast<Object*>(value), | 3666 reinterpret_cast<Object*>(value), |
| 3649 mode); | 3667 mode); |
| 3650 } | 3668 } |
| 3651 | 3669 |
| 3652 | 3670 |
| 3653 Smi* SharedFunctionInfo::deopt_counter() { | 3671 Smi* SharedFunctionInfo::deopt_counter() { |
| 3654 return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset)); | 3672 return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset)); |
| 3655 } | 3673 } |
| 3656 | 3674 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3782 | 3800 |
| 3783 SharedFunctionInfo* JSFunction::unchecked_shared() { | 3801 SharedFunctionInfo* JSFunction::unchecked_shared() { |
| 3784 return reinterpret_cast<SharedFunctionInfo*>( | 3802 return reinterpret_cast<SharedFunctionInfo*>( |
| 3785 READ_FIELD(this, kSharedFunctionInfoOffset)); | 3803 READ_FIELD(this, kSharedFunctionInfoOffset)); |
| 3786 } | 3804 } |
| 3787 | 3805 |
| 3788 | 3806 |
| 3789 void JSFunction::set_context(Object* value) { | 3807 void JSFunction::set_context(Object* value) { |
| 3790 ASSERT(value->IsUndefined() || value->IsContext()); | 3808 ASSERT(value->IsUndefined() || value->IsContext()); |
| 3791 WRITE_FIELD(this, kContextOffset, value); | 3809 WRITE_FIELD(this, kContextOffset, value); |
| 3792 WRITE_BARRIER(GetHeap(), this, kContextOffset, value); | 3810 WRITE_BARRIER(this, kContextOffset, value); |
| 3793 } | 3811 } |
| 3794 | 3812 |
| 3795 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 3813 ACCESSORS(JSFunction, prototype_or_initial_map, Object, |
| 3796 kPrototypeOrInitialMapOffset) | 3814 kPrototypeOrInitialMapOffset) |
| 3797 | 3815 |
| 3798 | 3816 |
| 3799 Map* JSFunction::initial_map() { | 3817 Map* JSFunction::initial_map() { |
| 3800 return Map::cast(prototype_or_initial_map()); | 3818 return Map::cast(prototype_or_initial_map()); |
| 3801 } | 3819 } |
| 3802 | 3820 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3885 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { | 3903 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { |
| 3886 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3904 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3887 return READ_FIELD(this, OffsetOfFunctionWithId(id)); | 3905 return READ_FIELD(this, OffsetOfFunctionWithId(id)); |
| 3888 } | 3906 } |
| 3889 | 3907 |
| 3890 | 3908 |
| 3891 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, | 3909 void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id, |
| 3892 Object* value) { | 3910 Object* value) { |
| 3893 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3911 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3894 WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); | 3912 WRITE_FIELD(this, OffsetOfFunctionWithId(id), value); |
| 3895 WRITE_BARRIER(GetHeap(), this, OffsetOfFunctionWithId(id), value); | 3913 WRITE_BARRIER(this, OffsetOfFunctionWithId(id), value); |
| 3896 } | 3914 } |
| 3897 | 3915 |
| 3898 | 3916 |
| 3899 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { | 3917 Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) { |
| 3900 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3918 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3901 return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); | 3919 return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id))); |
| 3902 } | 3920 } |
| 3903 | 3921 |
| 3904 | 3922 |
| 3905 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3923 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 #undef WRITE_INT_FIELD | 4709 #undef WRITE_INT_FIELD |
| 4692 #undef READ_SHORT_FIELD | 4710 #undef READ_SHORT_FIELD |
| 4693 #undef WRITE_SHORT_FIELD | 4711 #undef WRITE_SHORT_FIELD |
| 4694 #undef READ_BYTE_FIELD | 4712 #undef READ_BYTE_FIELD |
| 4695 #undef WRITE_BYTE_FIELD | 4713 #undef WRITE_BYTE_FIELD |
| 4696 | 4714 |
| 4697 | 4715 |
| 4698 } } // namespace v8::internal | 4716 } } // namespace v8::internal |
| 4699 | 4717 |
| 4700 #endif // V8_OBJECTS_INL_H_ | 4718 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |