| 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 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); | 2211 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 | 2214 |
| 2215 bool FixedDoubleArray::is_the_hole(int index) { | 2215 bool FixedDoubleArray::is_the_hole(int index) { |
| 2216 int offset = kHeaderSize + index * kDoubleSize; | 2216 int offset = kHeaderSize + index * kDoubleSize; |
| 2217 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); | 2217 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 SMI_ACCESSORS( | 2221 void ConstantPoolArray::set_weak_object_state( |
| 2222 ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset) | 2222 ConstantPoolArray::WeakObjectState state) { |
| 2223 SMI_ACCESSORS( | 2223 int old_layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); |
| 2224 ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset) | 2224 int new_layout_field = WeakObjectStateField::update(old_layout_field, state); |
| 2225 SMI_ACCESSORS( | 2225 WRITE_INT_FIELD(this, kArrayLayoutOffset, new_layout_field); |
| 2226 ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset) | 2226 } |
| 2227 |
| 2228 |
| 2229 ConstantPoolArray::WeakObjectState ConstantPoolArray::get_weak_object_state() { |
| 2230 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); |
| 2231 return WeakObjectStateField::decode(layout_field); |
| 2232 } |
| 2227 | 2233 |
| 2228 | 2234 |
| 2229 int ConstantPoolArray::first_int64_index() { | 2235 int ConstantPoolArray::first_int64_index() { |
| 2230 return 0; | 2236 return 0; |
| 2231 } | 2237 } |
| 2232 | 2238 |
| 2233 | 2239 |
| 2240 int ConstantPoolArray::first_code_ptr_index() { |
| 2241 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); |
| 2242 return first_int64_index() + |
| 2243 NumberOfInt64EntriesField::decode(layout_field); |
| 2244 } |
| 2245 |
| 2246 |
| 2247 int ConstantPoolArray::first_heap_ptr_index() { |
| 2248 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); |
| 2249 return first_code_ptr_index() + |
| 2250 NumberOfCodePtrEntriesField::decode(layout_field); |
| 2251 } |
| 2252 |
| 2253 |
| 2254 int ConstantPoolArray::first_int32_index() { |
| 2255 int layout_field = READ_INT_FIELD(this, kArrayLayoutOffset); |
| 2256 return first_heap_ptr_index() + |
| 2257 NumberOfHeapPtrEntriesField::decode(layout_field); |
| 2258 } |
| 2259 |
| 2260 |
| 2234 int ConstantPoolArray::count_of_int64_entries() { | 2261 int ConstantPoolArray::count_of_int64_entries() { |
| 2235 return first_code_ptr_index(); | 2262 return first_code_ptr_index(); |
| 2236 } | 2263 } |
| 2237 | 2264 |
| 2238 | 2265 |
| 2239 int ConstantPoolArray::count_of_code_ptr_entries() { | 2266 int ConstantPoolArray::count_of_code_ptr_entries() { |
| 2240 return first_heap_ptr_index() - first_code_ptr_index(); | 2267 return first_heap_ptr_index() - first_code_ptr_index(); |
| 2241 } | 2268 } |
| 2242 | 2269 |
| 2243 | 2270 |
| 2244 int ConstantPoolArray::count_of_heap_ptr_entries() { | 2271 int ConstantPoolArray::count_of_heap_ptr_entries() { |
| 2245 return first_int32_index() - first_heap_ptr_index(); | 2272 return first_int32_index() - first_heap_ptr_index(); |
| 2246 } | 2273 } |
| 2247 | 2274 |
| 2248 | 2275 |
| 2249 int ConstantPoolArray::count_of_int32_entries() { | 2276 int ConstantPoolArray::count_of_int32_entries() { |
| 2250 return length() - first_int32_index(); | 2277 return length() - first_int32_index(); |
| 2251 } | 2278 } |
| 2252 | 2279 |
| 2253 | 2280 |
| 2254 void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries, | 2281 void ConstantPoolArray::Init(int number_of_int64_entries, |
| 2255 int number_of_code_ptr_entries, | 2282 int number_of_code_ptr_entries, |
| 2256 int number_of_heap_ptr_entries, | 2283 int number_of_heap_ptr_entries, |
| 2257 int number_of_int32_entries) { | 2284 int number_of_int32_entries) { |
| 2258 int current_index = number_of_int64_entries; | 2285 set_length(number_of_int64_entries + |
| 2259 set_first_code_ptr_index(current_index); | 2286 number_of_code_ptr_entries + |
| 2260 current_index += number_of_code_ptr_entries; | 2287 number_of_heap_ptr_entries + |
| 2261 set_first_heap_ptr_index(current_index); | 2288 number_of_int32_entries); |
| 2262 current_index += number_of_heap_ptr_entries; | 2289 int layout_field = |
| 2263 set_first_int32_index(current_index); | 2290 NumberOfInt64EntriesField::encode(number_of_int64_entries) | |
| 2264 current_index += number_of_int32_entries; | 2291 NumberOfCodePtrEntriesField::encode(number_of_code_ptr_entries) | |
| 2265 set_length(current_index); | 2292 NumberOfHeapPtrEntriesField::encode(number_of_heap_ptr_entries) | |
| 2293 WeakObjectStateField::encode(NO_WEAK_OBJECTS); |
| 2294 WRITE_INT_FIELD(this, kArrayLayoutOffset, layout_field); |
| 2266 } | 2295 } |
| 2267 | 2296 |
| 2268 | 2297 |
| 2269 int64_t ConstantPoolArray::get_int64_entry(int index) { | 2298 int64_t ConstantPoolArray::get_int64_entry(int index) { |
| 2270 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2299 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2271 ASSERT(index >= 0 && index < first_code_ptr_index()); | 2300 ASSERT(index >= 0 && index < first_code_ptr_index()); |
| 2272 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); | 2301 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); |
| 2273 } | 2302 } |
| 2274 | 2303 |
| 2275 double ConstantPoolArray::get_int64_entry_as_double(int index) { | 2304 double ConstantPoolArray::get_int64_entry_as_double(int index) { |
| (...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4591 } | 4620 } |
| 4592 | 4621 |
| 4593 | 4622 |
| 4594 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { | 4623 Object* Code::GetObjectFromEntryAddress(Address location_of_address) { |
| 4595 return HeapObject:: | 4624 return HeapObject:: |
| 4596 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); | 4625 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); |
| 4597 } | 4626 } |
| 4598 | 4627 |
| 4599 | 4628 |
| 4600 bool Code::IsWeakObjectInOptimizedCode(Object* object) { | 4629 bool Code::IsWeakObjectInOptimizedCode(Object* object) { |
| 4601 ASSERT(is_optimized_code()); | |
| 4602 if (object->IsMap()) { | 4630 if (object->IsMap()) { |
| 4603 return Map::cast(object)->CanTransition() && | 4631 return Map::cast(object)->CanTransition() && |
| 4604 FLAG_collect_maps && | 4632 FLAG_collect_maps && |
| 4605 FLAG_weak_embedded_maps_in_optimized_code; | 4633 FLAG_weak_embedded_maps_in_optimized_code; |
| 4606 } | 4634 } |
| 4607 if (object->IsJSObject() || | 4635 if (object->IsJSObject() || |
| 4608 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { | 4636 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { |
| 4609 return FLAG_weak_embedded_objects_in_optimized_code; | 4637 return FLAG_weak_embedded_objects_in_optimized_code; |
| 4610 } | 4638 } |
| 4611 return false; | 4639 return false; |
| (...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6799 #undef READ_UINT32_FIELD | 6827 #undef READ_UINT32_FIELD |
| 6800 #undef WRITE_UINT32_FIELD | 6828 #undef WRITE_UINT32_FIELD |
| 6801 #undef READ_SHORT_FIELD | 6829 #undef READ_SHORT_FIELD |
| 6802 #undef WRITE_SHORT_FIELD | 6830 #undef WRITE_SHORT_FIELD |
| 6803 #undef READ_BYTE_FIELD | 6831 #undef READ_BYTE_FIELD |
| 6804 #undef WRITE_BYTE_FIELD | 6832 #undef WRITE_BYTE_FIELD |
| 6805 | 6833 |
| 6806 } } // namespace v8::internal | 6834 } } // namespace v8::internal |
| 6807 | 6835 |
| 6808 #endif // V8_OBJECTS_INL_H_ | 6836 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |