| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 #define INT_ACCESSORS(holder, name, offset) \ | 77 #define INT_ACCESSORS(holder, name, offset) \ |
| 78 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 78 int holder::name() { return READ_INT_FIELD(this, offset); } \ |
| 79 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 79 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } |
| 80 | 80 |
| 81 | 81 |
| 82 #define ACCESSORS(holder, name, type, offset) \ | 82 #define ACCESSORS(holder, name, type, offset) \ |
| 83 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 83 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ |
| 84 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 84 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
| 85 WRITE_FIELD(this, offset, value); \ | 85 WRITE_FIELD(this, offset, value); \ |
| 86 WRITE_BARRIER(GetHeap(), this, offset, value); \ | 86 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 // GC-safe accessors do not use HeapObject::GetHeap(), but access TLS instead. | 90 // GC-safe accessors do not use HeapObject::GetHeap(), but access TLS instead. |
| 91 #define ACCESSORS_GCSAFE(holder, name, type, offset) \ | 91 #define ACCESSORS_GCSAFE(holder, name, type, offset) \ |
| 92 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 92 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ |
| 93 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 93 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
| 94 WRITE_FIELD(this, offset, value); \ | 94 WRITE_FIELD(this, offset, value); \ |
| 95 WRITE_BARRIER(HEAP, this, offset, value); \ | 95 CONDITIONAL_WRITE_BARRIER(HEAP, this, offset, value, mode); \ |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 #define SMI_ACCESSORS(holder, name, offset) \ | 99 #define SMI_ACCESSORS(holder, name, offset) \ |
| 100 int holder::name() { \ | 100 int holder::name() { \ |
| 101 Object* value = READ_FIELD(this, offset); \ | 101 Object* value = READ_FIELD(this, offset); \ |
| 102 return Smi::cast(value)->value(); \ | 102 return Smi::cast(value)->value(); \ |
| 103 } \ | 103 } \ |
| 104 void holder::set_##name(int value) { \ | 104 void holder::set_##name(int value) { \ |
| 105 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ | 105 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 913 |
| 914 #define WRITE_FIELD(p, offset, value) \ | 914 #define WRITE_FIELD(p, offset, value) \ |
| 915 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | 915 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) |
| 916 | 916 |
| 917 #define WRITE_BARRIER(heap, object, offset, value) \ | 917 #define WRITE_BARRIER(heap, object, offset, value) \ |
| 918 heap->incremental_marking()->RecordWrite( \ | 918 heap->incremental_marking()->RecordWrite( \ |
| 919 object, HeapObject::RawField(object, offset), value); \ | 919 object, HeapObject::RawField(object, offset), value); \ |
| 920 if (heap->InNewSpace(value)) { \ | 920 if (heap->InNewSpace(value)) { \ |
| 921 heap->RecordWrite(object->address(), offset); \ | 921 heap->RecordWrite(object->address(), offset); \ |
| 922 } | 922 } |
| 923 |
| 924 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \ |
| 925 if (mode == UPDATE_WRITE_BARRIER) { \ |
| 926 heap->incremental_marking()->RecordWrite( \ |
| 927 object, HeapObject::RawField(object, offset), value); \ |
| 928 if (heap->InNewSpace(value)) { \ |
| 929 heap->RecordWrite(object->address(), offset); \ |
| 930 } \ |
| 931 } |
| 923 | 932 |
| 924 #ifndef V8_TARGET_ARCH_MIPS | 933 #ifndef V8_TARGET_ARCH_MIPS |
| 925 #define READ_DOUBLE_FIELD(p, offset) \ | 934 #define READ_DOUBLE_FIELD(p, offset) \ |
| 926 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | 935 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) |
| 927 #else // V8_TARGET_ARCH_MIPS | 936 #else // V8_TARGET_ARCH_MIPS |
| 928 // Prevent gcc from using load-double (mips ldc1) on (possibly) | 937 // Prevent gcc from using load-double (mips ldc1) on (possibly) |
| 929 // non-64-bit aligned HeapNumber::value. | 938 // non-64-bit aligned HeapNumber::value. |
| 930 static inline double read_double_field(void* p, int offset) { | 939 static inline double read_double_field(void* p, int offset) { |
| 931 union conversion { | 940 union conversion { |
| 932 double d; | 941 double d; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1258 |
| 1250 | 1259 |
| 1251 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { | 1260 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { |
| 1252 ASSERT(map()->has_fast_elements() == | 1261 ASSERT(map()->has_fast_elements() == |
| 1253 (value->map() == GetHeap()->fixed_array_map() || | 1262 (value->map() == GetHeap()->fixed_array_map() || |
| 1254 value->map() == GetHeap()->fixed_cow_array_map())); | 1263 value->map() == GetHeap()->fixed_cow_array_map())); |
| 1255 ASSERT(map()->has_fast_double_elements() == | 1264 ASSERT(map()->has_fast_double_elements() == |
| 1256 value->IsFixedDoubleArray()); | 1265 value->IsFixedDoubleArray()); |
| 1257 ASSERT(value->HasValidElements()); | 1266 ASSERT(value->HasValidElements()); |
| 1258 WRITE_FIELD(this, kElementsOffset, value); | 1267 WRITE_FIELD(this, kElementsOffset, value); |
| 1259 WRITE_BARRIER(GetHeap(), this, kElementsOffset, value); | 1268 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); |
| 1260 } | 1269 } |
| 1261 | 1270 |
| 1262 | 1271 |
| 1263 void JSObject::initialize_properties() { | 1272 void JSObject::initialize_properties() { |
| 1264 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1273 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1265 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1274 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 1266 } | 1275 } |
| 1267 | 1276 |
| 1268 | 1277 |
| 1269 void JSObject::initialize_elements() { | 1278 void JSObject::initialize_elements() { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 | 1439 |
| 1431 | 1440 |
| 1432 Object* JSObject::InObjectPropertyAtPut(int index, | 1441 Object* JSObject::InObjectPropertyAtPut(int index, |
| 1433 Object* value, | 1442 Object* value, |
| 1434 WriteBarrierMode mode) { | 1443 WriteBarrierMode mode) { |
| 1435 // Adjust for the number of properties stored in the object. | 1444 // Adjust for the number of properties stored in the object. |
| 1436 index -= map()->inobject_properties(); | 1445 index -= map()->inobject_properties(); |
| 1437 ASSERT(index < 0); | 1446 ASSERT(index < 0); |
| 1438 int offset = map()->instance_size() + (index * kPointerSize); | 1447 int offset = map()->instance_size() + (index * kPointerSize); |
| 1439 WRITE_FIELD(this, offset, value); | 1448 WRITE_FIELD(this, offset, value); |
| 1440 WRITE_BARRIER(GetHeap(), this, offset, value); | 1449 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
| 1441 return value; | 1450 return value; |
| 1442 } | 1451 } |
| 1443 | 1452 |
| 1444 | 1453 |
| 1445 | 1454 |
| 1446 void JSObject::InitializeBody(int object_size, Object* value) { | 1455 void JSObject::InitializeBody(int object_size, Object* value) { |
| 1447 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); | 1456 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); |
| 1448 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 1457 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
| 1449 WRITE_FIELD(this, offset, value); | 1458 WRITE_FIELD(this, offset, value); |
| 1450 } | 1459 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 Object* key = from->KeyAt(i); | 1647 Object* key = from->KeyAt(i); |
| 1639 if (key->IsNumber()) { | 1648 if (key->IsNumber()) { |
| 1640 uint32_t entry = static_cast<uint32_t>(key->Number()); | 1649 uint32_t entry = static_cast<uint32_t>(key->Number()); |
| 1641 set(entry, from->ValueAt(i)->Number()); | 1650 set(entry, from->ValueAt(i)->Number()); |
| 1642 } | 1651 } |
| 1643 } | 1652 } |
| 1644 } | 1653 } |
| 1645 | 1654 |
| 1646 | 1655 |
| 1647 WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) { | 1656 WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) { |
| 1648 if (GetHeap()->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 1657 Heap* heap = GetHeap(); |
| 1658 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
| 1659 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
| 1649 return UPDATE_WRITE_BARRIER; | 1660 return UPDATE_WRITE_BARRIER; |
| 1650 } | 1661 } |
| 1651 | 1662 |
| 1652 | 1663 |
| 1653 void FixedArray::set(int index, | 1664 void FixedArray::set(int index, |
| 1654 Object* value, | 1665 Object* value, |
| 1655 WriteBarrierMode mode) { | 1666 WriteBarrierMode mode) { |
| 1656 ASSERT(map() != HEAP->fixed_cow_array_map()); | 1667 ASSERT(map() != HEAP->fixed_cow_array_map()); |
| 1657 ASSERT(index >= 0 && index < this->length()); | 1668 ASSERT(index >= 0 && index < this->length()); |
| 1658 int offset = kHeaderSize + index * kPointerSize; | 1669 int offset = kHeaderSize + index * kPointerSize; |
| 1659 WRITE_FIELD(this, offset, value); | 1670 WRITE_FIELD(this, offset, value); |
| 1660 WRITE_BARRIER(GetHeap(), this, offset, value); | 1671 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
| 1661 } | 1672 } |
| 1662 | 1673 |
| 1663 | 1674 |
| 1664 void FixedArray::fast_set(FixedArray* array, int index, Object* value) { | 1675 void FixedArray::fast_set(FixedArray* array, int index, Object* value) { |
| 1665 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); | 1676 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); |
| 1666 ASSERT(index >= 0 && index < array->length()); | 1677 ASSERT(index >= 0 && index < array->length()); |
| 1667 ASSERT(!HEAP->InNewSpace(value)); | 1678 ASSERT(!HEAP->InNewSpace(value)); |
| 1668 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); | 1679 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); |
| 1669 array->GetHeap()->incremental_marking()->RecordWrite( | 1680 array->GetHeap()->incremental_marking()->RecordWrite( |
| 1670 array, | 1681 array, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 WRITE_FIELD(this, offset, value); | 1726 WRITE_FIELD(this, offset, value); |
| 1716 } | 1727 } |
| 1717 | 1728 |
| 1718 | 1729 |
| 1719 void FixedArray::set_unchecked(Heap* heap, | 1730 void FixedArray::set_unchecked(Heap* heap, |
| 1720 int index, | 1731 int index, |
| 1721 Object* value, | 1732 Object* value, |
| 1722 WriteBarrierMode mode) { | 1733 WriteBarrierMode mode) { |
| 1723 int offset = kHeaderSize + index * kPointerSize; | 1734 int offset = kHeaderSize + index * kPointerSize; |
| 1724 WRITE_FIELD(this, offset, value); | 1735 WRITE_FIELD(this, offset, value); |
| 1725 WRITE_BARRIER(heap, this, offset, value); | 1736 CONDITIONAL_WRITE_BARRIER(heap, this, offset, value, mode); |
| 1726 } | 1737 } |
| 1727 | 1738 |
| 1728 | 1739 |
| 1729 void FixedArray::set_null_unchecked(Heap* heap, int index) { | 1740 void FixedArray::set_null_unchecked(Heap* heap, int index) { |
| 1730 ASSERT(index >= 0 && index < this->length()); | 1741 ASSERT(index >= 0 && index < this->length()); |
| 1731 ASSERT(!HEAP->InNewSpace(heap->null_value())); | 1742 ASSERT(!HEAP->InNewSpace(heap->null_value())); |
| 1732 WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value()); | 1743 WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value()); |
| 1733 } | 1744 } |
| 1734 | 1745 |
| 1735 | 1746 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 } | 2189 } |
| 2179 | 2190 |
| 2180 | 2191 |
| 2181 Object* ConsString::unchecked_first() { | 2192 Object* ConsString::unchecked_first() { |
| 2182 return READ_FIELD(this, kFirstOffset); | 2193 return READ_FIELD(this, kFirstOffset); |
| 2183 } | 2194 } |
| 2184 | 2195 |
| 2185 | 2196 |
| 2186 void ConsString::set_first(String* value, WriteBarrierMode mode) { | 2197 void ConsString::set_first(String* value, WriteBarrierMode mode) { |
| 2187 WRITE_FIELD(this, kFirstOffset, value); | 2198 WRITE_FIELD(this, kFirstOffset, value); |
| 2188 WRITE_BARRIER(GetHeap(), this, kFirstOffset, value); | 2199 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kFirstOffset, value, mode); |
| 2189 } | 2200 } |
| 2190 | 2201 |
| 2191 | 2202 |
| 2192 String* ConsString::second() { | 2203 String* ConsString::second() { |
| 2193 return String::cast(READ_FIELD(this, kSecondOffset)); | 2204 return String::cast(READ_FIELD(this, kSecondOffset)); |
| 2194 } | 2205 } |
| 2195 | 2206 |
| 2196 | 2207 |
| 2197 Object* ConsString::unchecked_second() { | 2208 Object* ConsString::unchecked_second() { |
| 2198 return READ_FIELD(this, kSecondOffset); | 2209 return READ_FIELD(this, kSecondOffset); |
| 2199 } | 2210 } |
| 2200 | 2211 |
| 2201 | 2212 |
| 2202 void ConsString::set_second(String* value, WriteBarrierMode mode) { | 2213 void ConsString::set_second(String* value, WriteBarrierMode mode) { |
| 2203 WRITE_FIELD(this, kSecondOffset, value); | 2214 WRITE_FIELD(this, kSecondOffset, value); |
| 2204 WRITE_BARRIER(GetHeap(), this, kSecondOffset, value); | 2215 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode); |
| 2205 } | 2216 } |
| 2206 | 2217 |
| 2207 | 2218 |
| 2208 ExternalAsciiString::Resource* ExternalAsciiString::resource() { | 2219 ExternalAsciiString::Resource* ExternalAsciiString::resource() { |
| 2209 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); | 2220 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); |
| 2210 } | 2221 } |
| 2211 | 2222 |
| 2212 | 2223 |
| 2213 void ExternalAsciiString::set_resource( | 2224 void ExternalAsciiString::set_resource( |
| 2214 ExternalAsciiString::Resource* resource) { | 2225 ExternalAsciiString::Resource* resource) { |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 | 3036 |
| 3026 | 3037 |
| 3027 Object* Map::prototype() { | 3038 Object* Map::prototype() { |
| 3028 return READ_FIELD(this, kPrototypeOffset); | 3039 return READ_FIELD(this, kPrototypeOffset); |
| 3029 } | 3040 } |
| 3030 | 3041 |
| 3031 | 3042 |
| 3032 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 3043 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
| 3033 ASSERT(value->IsNull() || value->IsJSReceiver()); | 3044 ASSERT(value->IsNull() || value->IsJSReceiver()); |
| 3034 WRITE_FIELD(this, kPrototypeOffset, value); | 3045 WRITE_FIELD(this, kPrototypeOffset, value); |
| 3035 WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value); | 3046 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
| 3036 } | 3047 } |
| 3037 | 3048 |
| 3038 | 3049 |
| 3039 MaybeObject* Map::GetFastElementsMap() { | 3050 MaybeObject* Map::GetFastElementsMap() { |
| 3040 if (has_fast_elements()) return this; | 3051 if (has_fast_elements()) return this; |
| 3041 Object* obj; | 3052 Object* obj; |
| 3042 { MaybeObject* maybe_obj = CopyDropTransitions(); | 3053 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 3043 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 3054 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 3044 } | 3055 } |
| 3045 Map* new_map = Map::cast(obj); | 3056 Map* new_map = Map::cast(obj); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 } else { | 3124 } else { |
| 3114 if (object->IsSmi()) { | 3125 if (object->IsSmi()) { |
| 3115 value->set_bit_field3_storage(Smi::cast(object)->value()); | 3126 value->set_bit_field3_storage(Smi::cast(object)->value()); |
| 3116 } else { | 3127 } else { |
| 3117 value->set_bit_field3_storage( | 3128 value->set_bit_field3_storage( |
| 3118 DescriptorArray::cast(object)->bit_field3_storage()); | 3129 DescriptorArray::cast(object)->bit_field3_storage()); |
| 3119 } | 3130 } |
| 3120 } | 3131 } |
| 3121 ASSERT(!is_shared()); | 3132 ASSERT(!is_shared()); |
| 3122 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); | 3133 WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value); |
| 3123 WRITE_BARRIER(heap, this, kInstanceDescriptorsOrBitField3Offset, value); | 3134 CONDITIONAL_WRITE_BARRIER( |
| 3135 heap, this, kInstanceDescriptorsOrBitField3Offset, value, mode); |
| 3124 } | 3136 } |
| 3125 | 3137 |
| 3126 | 3138 |
| 3127 int Map::bit_field3() { | 3139 int Map::bit_field3() { |
| 3128 Object* object = READ_FIELD(this, | 3140 Object* object = READ_FIELD(this, |
| 3129 kInstanceDescriptorsOrBitField3Offset); | 3141 kInstanceDescriptorsOrBitField3Offset); |
| 3130 if (object->IsSmi()) { | 3142 if (object->IsSmi()) { |
| 3131 return Smi::cast(object)->value(); | 3143 return Smi::cast(object)->value(); |
| 3132 } else { | 3144 } else { |
| 3133 return DescriptorArray::cast(object)->bit_field3_storage(); | 3145 return DescriptorArray::cast(object)->bit_field3_storage(); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 } | 3465 } |
| 3454 | 3466 |
| 3455 | 3467 |
| 3456 Code* SharedFunctionInfo::unchecked_code() { | 3468 Code* SharedFunctionInfo::unchecked_code() { |
| 3457 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); | 3469 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); |
| 3458 } | 3470 } |
| 3459 | 3471 |
| 3460 | 3472 |
| 3461 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 3473 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 3462 WRITE_FIELD(this, kCodeOffset, value); | 3474 WRITE_FIELD(this, kCodeOffset, value); |
| 3463 WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value); | 3475 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); |
| 3464 } | 3476 } |
| 3465 | 3477 |
| 3466 | 3478 |
| 3467 SerializedScopeInfo* SharedFunctionInfo::scope_info() { | 3479 SerializedScopeInfo* SharedFunctionInfo::scope_info() { |
| 3468 return reinterpret_cast<SerializedScopeInfo*>( | 3480 return reinterpret_cast<SerializedScopeInfo*>( |
| 3469 READ_FIELD(this, kScopeInfoOffset)); | 3481 READ_FIELD(this, kScopeInfoOffset)); |
| 3470 } | 3482 } |
| 3471 | 3483 |
| 3472 | 3484 |
| 3473 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, | 3485 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, |
| 3474 WriteBarrierMode mode) { | 3486 WriteBarrierMode mode) { |
| 3475 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 3487 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); |
| 3476 WRITE_BARRIER(GetHeap(), | 3488 CONDITIONAL_WRITE_BARRIER(GetHeap(), |
| 3477 this, | 3489 this, |
| 3478 kScopeInfoOffset, | 3490 kScopeInfoOffset, |
| 3479 reinterpret_cast<Object*>(value)); | 3491 reinterpret_cast<Object*>(value), |
| 3492 mode); |
| 3480 } | 3493 } |
| 3481 | 3494 |
| 3482 | 3495 |
| 3483 Smi* SharedFunctionInfo::deopt_counter() { | 3496 Smi* SharedFunctionInfo::deopt_counter() { |
| 3484 return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset)); | 3497 return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset)); |
| 3485 } | 3498 } |
| 3486 | 3499 |
| 3487 | 3500 |
| 3488 void SharedFunctionInfo::set_deopt_counter(Smi* value) { | 3501 void SharedFunctionInfo::set_deopt_counter(Smi* value) { |
| 3489 WRITE_FIELD(this, kDeoptCounterOffset, value); | 3502 WRITE_FIELD(this, kDeoptCounterOffset, value); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3882 FixedArray::cast(data())->set(index, value); | 3895 FixedArray::cast(data())->set(index, value); |
| 3883 } | 3896 } |
| 3884 | 3897 |
| 3885 | 3898 |
| 3886 void JSRegExp::SetDataAtUnchecked(int index, Object* value, Heap* heap) { | 3899 void JSRegExp::SetDataAtUnchecked(int index, Object* value, Heap* heap) { |
| 3887 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. | 3900 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. |
| 3888 FixedArray* fa = reinterpret_cast<FixedArray*>(data()); | 3901 FixedArray* fa = reinterpret_cast<FixedArray*>(data()); |
| 3889 if (value->IsSmi()) { | 3902 if (value->IsSmi()) { |
| 3890 fa->set_unchecked(index, Smi::cast(value)); | 3903 fa->set_unchecked(index, Smi::cast(value)); |
| 3891 } else { | 3904 } else { |
| 3905 // We only do this during GC, so we don't need to notify the write barrier. |
| 3892 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER); | 3906 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER); |
| 3893 } | 3907 } |
| 3894 } | 3908 } |
| 3895 | 3909 |
| 3896 | 3910 |
| 3897 JSObject::ElementsKind JSObject::GetElementsKind() { | 3911 JSObject::ElementsKind JSObject::GetElementsKind() { |
| 3898 ElementsKind kind = map()->elements_kind(); | 3912 ElementsKind kind = map()->elements_kind(); |
| 3899 ASSERT((kind == FAST_ELEMENTS && | 3913 ASSERT((kind == FAST_ELEMENTS && |
| 3900 (elements()->map() == GetHeap()->fixed_array_map() || | 3914 (elements()->map() == GetHeap()->fixed_array_map() || |
| 3901 elements()->map() == GetHeap()->fixed_cow_array_map())) || | 3915 elements()->map() == GetHeap()->fixed_cow_array_map())) || |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4358 } else if (!GetHeap()->new_space()->Contains(elts) && | 4372 } else if (!GetHeap()->new_space()->Contains(elts) && |
| 4359 required_size < kArraySizeThatFitsComfortablyInNewSpace) { | 4373 required_size < kArraySizeThatFitsComfortablyInNewSpace) { |
| 4360 // Expand will allocate a new backing store in new space even if the size | 4374 // Expand will allocate a new backing store in new space even if the size |
| 4361 // we asked for isn't larger than what we had before. | 4375 // we asked for isn't larger than what we had before. |
| 4362 Expand(required_size); | 4376 Expand(required_size); |
| 4363 } | 4377 } |
| 4364 } | 4378 } |
| 4365 | 4379 |
| 4366 | 4380 |
| 4367 void JSArray::set_length(Smi* length) { | 4381 void JSArray::set_length(Smi* length) { |
| 4382 // Don't need a write barrier for a Smi. |
| 4368 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); | 4383 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); |
| 4369 } | 4384 } |
| 4370 | 4385 |
| 4371 | 4386 |
| 4372 void JSArray::SetContent(FixedArray* storage) { | 4387 void JSArray::SetContent(FixedArray* storage) { |
| 4373 set_length(Smi::FromInt(storage->length())); | 4388 set_length(Smi::FromInt(storage->length())); |
| 4374 set_elements(storage); | 4389 set_elements(storage); |
| 4375 } | 4390 } |
| 4376 | 4391 |
| 4377 | 4392 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4480 #undef WRITE_INT_FIELD | 4495 #undef WRITE_INT_FIELD |
| 4481 #undef READ_SHORT_FIELD | 4496 #undef READ_SHORT_FIELD |
| 4482 #undef WRITE_SHORT_FIELD | 4497 #undef WRITE_SHORT_FIELD |
| 4483 #undef READ_BYTE_FIELD | 4498 #undef READ_BYTE_FIELD |
| 4484 #undef WRITE_BYTE_FIELD | 4499 #undef WRITE_BYTE_FIELD |
| 4485 | 4500 |
| 4486 | 4501 |
| 4487 } } // namespace v8::internal | 4502 } } // namespace v8::internal |
| 4488 | 4503 |
| 4489 #endif // V8_OBJECTS_INL_H_ | 4504 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |