| 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 5378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5389 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, | 5389 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, |
| 5390 FixedArray* new_cache) { | 5390 FixedArray* new_cache) { |
| 5391 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength); | 5391 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength); |
| 5392 if (HasEnumCache()) { | 5392 if (HasEnumCache()) { |
| 5393 FixedArray::cast(get(kEnumerationIndexIndex))-> | 5393 FixedArray::cast(get(kEnumerationIndexIndex))-> |
| 5394 set(kEnumCacheBridgeCacheIndex, new_cache); | 5394 set(kEnumCacheBridgeCacheIndex, new_cache); |
| 5395 } else { | 5395 } else { |
| 5396 if (IsEmpty()) return; // Do nothing for empty descriptor array. | 5396 if (IsEmpty()) return; // Do nothing for empty descriptor array. |
| 5397 FixedArray::cast(bridge_storage)-> | 5397 FixedArray::cast(bridge_storage)-> |
| 5398 set(kEnumCacheBridgeCacheIndex, new_cache); | 5398 set(kEnumCacheBridgeCacheIndex, new_cache); |
| 5399 fast_set(FixedArray::cast(bridge_storage), | 5399 NoWriteBarrierSet(FixedArray::cast(bridge_storage), |
| 5400 kEnumCacheBridgeEnumIndex, | 5400 kEnumCacheBridgeEnumIndex, |
| 5401 get(kEnumerationIndexIndex)); | 5401 get(kEnumerationIndexIndex)); |
| 5402 set(kEnumerationIndexIndex, bridge_storage); | 5402 set(kEnumerationIndexIndex, bridge_storage); |
| 5403 } | 5403 } |
| 5404 } | 5404 } |
| 5405 | 5405 |
| 5406 | 5406 |
| 5407 MaybeObject* DescriptorArray::CopyInsert(Descriptor* descriptor, | 5407 MaybeObject* DescriptorArray::CopyInsert(Descriptor* descriptor, |
| 5408 TransitionFlag transition_flag) { | 5408 TransitionFlag transition_flag) { |
| 5409 // Transitions are only kept when inserting another transition. | 5409 // Transitions are only kept when inserting another transition. |
| 5410 // This precondition is not required by this function's implementation, but | 5410 // This precondition is not required by this function's implementation, but |
| 5411 // is currently required by the semantics of maps, so we check it. | 5411 // is currently required by the semantics of maps, so we check it. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5452 t == FIELD || | 5452 t == FIELD || |
| 5453 t == CALLBACKS || | 5453 t == CALLBACKS || |
| 5454 t == INTERCEPTOR) { | 5454 t == INTERCEPTOR) { |
| 5455 keep_enumeration_index = true; | 5455 keep_enumeration_index = true; |
| 5456 } else if (remove_transitions) { | 5456 } else if (remove_transitions) { |
| 5457 // Replaced descriptor has been counted as removed if it is | 5457 // Replaced descriptor has been counted as removed if it is |
| 5458 // a transition that will be replaced. Adjust count in this case. | 5458 // a transition that will be replaced. Adjust count in this case. |
| 5459 ++new_size; | 5459 ++new_size; |
| 5460 } | 5460 } |
| 5461 } | 5461 } |
| 5462 |
| 5463 DescriptorArray* new_descriptors; |
| 5462 { MaybeObject* maybe_result = Allocate(new_size); | 5464 { MaybeObject* maybe_result = Allocate(new_size); |
| 5463 if (!maybe_result->ToObject(&result)) return maybe_result; | 5465 if (!maybe_result->To<DescriptorArray>(&new_descriptors)) { |
| 5466 return maybe_result; |
| 5467 } |
| 5464 } | 5468 } |
| 5465 DescriptorArray* new_descriptors = DescriptorArray::cast(result); | 5469 |
| 5470 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 5471 |
| 5466 // Set the enumeration index in the descriptors and set the enumeration index | 5472 // Set the enumeration index in the descriptors and set the enumeration index |
| 5467 // in the result. | 5473 // in the result. |
| 5468 int enumeration_index = NextEnumerationIndex(); | 5474 int enumeration_index = NextEnumerationIndex(); |
| 5469 if (!descriptor->GetDetails().IsTransition()) { | 5475 if (!descriptor->GetDetails().IsTransition()) { |
| 5470 if (keep_enumeration_index) { | 5476 if (keep_enumeration_index) { |
| 5471 descriptor->SetEnumerationIndex( | 5477 descriptor->SetEnumerationIndex( |
| 5472 PropertyDetails(GetDetails(index)).index()); | 5478 PropertyDetails(GetDetails(index)).index()); |
| 5473 } else { | 5479 } else { |
| 5474 descriptor->SetEnumerationIndex(enumeration_index); | 5480 descriptor->SetEnumerationIndex(enumeration_index); |
| 5475 ++enumeration_index; | 5481 ++enumeration_index; |
| 5476 } | 5482 } |
| 5477 } | 5483 } |
| 5478 new_descriptors->SetNextEnumerationIndex(enumeration_index); | 5484 new_descriptors->SetNextEnumerationIndex(enumeration_index); |
| 5479 | 5485 |
| 5480 // Copy the descriptors, filtering out transitions and null descriptors, | 5486 // Copy the descriptors, filtering out transitions and null descriptors, |
| 5481 // and inserting or replacing a descriptor. | 5487 // and inserting or replacing a descriptor. |
| 5482 uint32_t descriptor_hash = descriptor->GetKey()->Hash(); | 5488 uint32_t descriptor_hash = descriptor->GetKey()->Hash(); |
| 5483 int from_index = 0; | 5489 int from_index = 0; |
| 5484 int to_index = 0; | 5490 int to_index = 0; |
| 5485 | 5491 |
| 5486 for (; from_index < number_of_descriptors(); from_index++) { | 5492 for (; from_index < number_of_descriptors(); from_index++) { |
| 5487 String* key = GetKey(from_index); | 5493 String* key = GetKey(from_index); |
| 5488 if (key->Hash() > descriptor_hash || key == descriptor->GetKey()) { | 5494 if (key->Hash() > descriptor_hash || key == descriptor->GetKey()) { |
| 5489 break; | 5495 break; |
| 5490 } | 5496 } |
| 5491 if (IsNullDescriptor(from_index)) continue; | 5497 if (IsNullDescriptor(from_index)) continue; |
| 5492 if (remove_transitions && IsTransition(from_index)) continue; | 5498 if (remove_transitions && IsTransition(from_index)) continue; |
| 5493 new_descriptors->CopyFrom(to_index++, this, from_index); | 5499 new_descriptors->CopyFrom(to_index++, this, from_index, witness); |
| 5494 } | 5500 } |
| 5495 | 5501 |
| 5496 new_descriptors->Set(to_index++, descriptor); | 5502 new_descriptors->Set(to_index++, descriptor, witness); |
| 5497 if (replacing) from_index++; | 5503 if (replacing) from_index++; |
| 5498 | 5504 |
| 5499 for (; from_index < number_of_descriptors(); from_index++) { | 5505 for (; from_index < number_of_descriptors(); from_index++) { |
| 5500 if (IsNullDescriptor(from_index)) continue; | 5506 if (IsNullDescriptor(from_index)) continue; |
| 5501 if (remove_transitions && IsTransition(from_index)) continue; | 5507 if (remove_transitions && IsTransition(from_index)) continue; |
| 5502 new_descriptors->CopyFrom(to_index++, this, from_index); | 5508 new_descriptors->CopyFrom(to_index++, this, from_index, witness); |
| 5503 } | 5509 } |
| 5504 | 5510 |
| 5505 ASSERT(to_index == new_descriptors->number_of_descriptors()); | 5511 ASSERT(to_index == new_descriptors->number_of_descriptors()); |
| 5506 SLOW_ASSERT(new_descriptors->IsSortedNoDuplicates()); | 5512 SLOW_ASSERT(new_descriptors->IsSortedNoDuplicates()); |
| 5507 | 5513 |
| 5508 return new_descriptors; | 5514 return new_descriptors; |
| 5509 } | 5515 } |
| 5510 | 5516 |
| 5511 | 5517 |
| 5512 MaybeObject* DescriptorArray::RemoveTransitions() { | 5518 MaybeObject* DescriptorArray::RemoveTransitions() { |
| 5513 // Remove all transitions and null descriptors. Return a copy of the array | 5519 // Remove all transitions and null descriptors. Return a copy of the array |
| 5514 // with all transitions removed, or a Failure object if the new array could | 5520 // with all transitions removed, or a Failure object if the new array could |
| 5515 // not be allocated. | 5521 // not be allocated. |
| 5516 | 5522 |
| 5517 // Compute the size of the map transition entries to be removed. | 5523 // Compute the size of the map transition entries to be removed. |
| 5518 int num_removed = 0; | 5524 int num_removed = 0; |
| 5519 for (int i = 0; i < number_of_descriptors(); i++) { | 5525 for (int i = 0; i < number_of_descriptors(); i++) { |
| 5520 if (!IsProperty(i)) num_removed++; | 5526 if (!IsProperty(i)) num_removed++; |
| 5521 } | 5527 } |
| 5522 | 5528 |
| 5523 // Allocate the new descriptor array. | 5529 // Allocate the new descriptor array. |
| 5524 Object* result; | 5530 DescriptorArray* new_descriptors; |
| 5525 { MaybeObject* maybe_result = Allocate(number_of_descriptors() - num_removed); | 5531 { MaybeObject* maybe_result = Allocate(number_of_descriptors() - num_removed); |
| 5526 if (!maybe_result->ToObject(&result)) return maybe_result; | 5532 if (!maybe_result->To<DescriptorArray>(&new_descriptors)) { |
| 5533 return maybe_result; |
| 5534 } |
| 5527 } | 5535 } |
| 5528 DescriptorArray* new_descriptors = DescriptorArray::cast(result); | 5536 |
| 5537 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 5529 | 5538 |
| 5530 // Copy the content. | 5539 // Copy the content. |
| 5531 int next_descriptor = 0; | 5540 int next_descriptor = 0; |
| 5532 for (int i = 0; i < number_of_descriptors(); i++) { | 5541 for (int i = 0; i < number_of_descriptors(); i++) { |
| 5533 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); | 5542 if (IsProperty(i)) { |
| 5543 new_descriptors->CopyFrom(next_descriptor++, this, i, witness); |
| 5544 } |
| 5534 } | 5545 } |
| 5535 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); | 5546 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); |
| 5536 | 5547 |
| 5537 return new_descriptors; | 5548 return new_descriptors; |
| 5538 } | 5549 } |
| 5539 | 5550 |
| 5540 | 5551 |
| 5541 void DescriptorArray::SortUnchecked() { | 5552 void DescriptorArray::SortUnchecked(const WhitenessWitness& witness) { |
| 5542 // In-place heap sort. | 5553 // In-place heap sort. |
| 5543 int len = number_of_descriptors(); | 5554 int len = number_of_descriptors(); |
| 5544 | 5555 |
| 5545 // Bottom-up max-heap construction. | 5556 // Bottom-up max-heap construction. |
| 5546 // Index of the last node with children | 5557 // Index of the last node with children |
| 5547 const int max_parent_index = (len / 2) - 1; | 5558 const int max_parent_index = (len / 2) - 1; |
| 5548 for (int i = max_parent_index; i >= 0; --i) { | 5559 for (int i = max_parent_index; i >= 0; --i) { |
| 5549 int parent_index = i; | 5560 int parent_index = i; |
| 5550 const uint32_t parent_hash = GetKey(i)->Hash(); | 5561 const uint32_t parent_hash = GetKey(i)->Hash(); |
| 5551 while (parent_index <= max_parent_index) { | 5562 while (parent_index <= max_parent_index) { |
| 5552 int child_index = 2 * parent_index + 1; | 5563 int child_index = 2 * parent_index + 1; |
| 5553 uint32_t child_hash = GetKey(child_index)->Hash(); | 5564 uint32_t child_hash = GetKey(child_index)->Hash(); |
| 5554 if (child_index + 1 < len) { | 5565 if (child_index + 1 < len) { |
| 5555 uint32_t right_child_hash = GetKey(child_index + 1)->Hash(); | 5566 uint32_t right_child_hash = GetKey(child_index + 1)->Hash(); |
| 5556 if (right_child_hash > child_hash) { | 5567 if (right_child_hash > child_hash) { |
| 5557 child_index++; | 5568 child_index++; |
| 5558 child_hash = right_child_hash; | 5569 child_hash = right_child_hash; |
| 5559 } | 5570 } |
| 5560 } | 5571 } |
| 5561 if (child_hash <= parent_hash) break; | 5572 if (child_hash <= parent_hash) break; |
| 5562 Swap(parent_index, child_index); | 5573 NoWriteBarrierSwapDescriptors(parent_index, child_index); |
| 5563 // Now element at child_index could be < its children. | 5574 // Now element at child_index could be < its children. |
| 5564 parent_index = child_index; // parent_hash remains correct. | 5575 parent_index = child_index; // parent_hash remains correct. |
| 5565 } | 5576 } |
| 5566 } | 5577 } |
| 5567 | 5578 |
| 5568 // Extract elements and create sorted array. | 5579 // Extract elements and create sorted array. |
| 5569 for (int i = len - 1; i > 0; --i) { | 5580 for (int i = len - 1; i > 0; --i) { |
| 5570 // Put max element at the back of the array. | 5581 // Put max element at the back of the array. |
| 5571 Swap(0, i); | 5582 NoWriteBarrierSwapDescriptors(0, i); |
| 5572 // Sift down the new top element. | 5583 // Shift down the new top element. |
| 5573 int parent_index = 0; | 5584 int parent_index = 0; |
| 5574 const uint32_t parent_hash = GetKey(parent_index)->Hash(); | 5585 const uint32_t parent_hash = GetKey(parent_index)->Hash(); |
| 5575 const int max_parent_index = (i / 2) - 1; | 5586 const int max_parent_index = (i / 2) - 1; |
| 5576 while (parent_index <= max_parent_index) { | 5587 while (parent_index <= max_parent_index) { |
| 5577 int child_index = parent_index * 2 + 1; | 5588 int child_index = parent_index * 2 + 1; |
| 5578 uint32_t child_hash = GetKey(child_index)->Hash(); | 5589 uint32_t child_hash = GetKey(child_index)->Hash(); |
| 5579 if (child_index + 1 < i) { | 5590 if (child_index + 1 < i) { |
| 5580 uint32_t right_child_hash = GetKey(child_index + 1)->Hash(); | 5591 uint32_t right_child_hash = GetKey(child_index + 1)->Hash(); |
| 5581 if (right_child_hash > child_hash) { | 5592 if (right_child_hash > child_hash) { |
| 5582 child_index++; | 5593 child_index++; |
| 5583 child_hash = right_child_hash; | 5594 child_hash = right_child_hash; |
| 5584 } | 5595 } |
| 5585 } | 5596 } |
| 5586 if (child_hash <= parent_hash) break; | 5597 if (child_hash <= parent_hash) break; |
| 5587 Swap(parent_index, child_index); | 5598 NoWriteBarrierSwapDescriptors(parent_index, child_index); |
| 5588 parent_index = child_index; | 5599 parent_index = child_index; |
| 5589 } | 5600 } |
| 5590 } | 5601 } |
| 5591 } | 5602 } |
| 5592 | 5603 |
| 5593 | 5604 |
| 5594 void DescriptorArray::Sort() { | 5605 void DescriptorArray::Sort(const WhitenessWitness& witness) { |
| 5595 SortUnchecked(); | 5606 SortUnchecked(witness); |
| 5596 SLOW_ASSERT(IsSortedNoDuplicates()); | 5607 SLOW_ASSERT(IsSortedNoDuplicates()); |
| 5597 } | 5608 } |
| 5598 | 5609 |
| 5599 | 5610 |
| 5600 int DescriptorArray::BinarySearch(String* name, int low, int high) { | 5611 int DescriptorArray::BinarySearch(String* name, int low, int high) { |
| 5601 uint32_t hash = name->Hash(); | 5612 uint32_t hash = name->Hash(); |
| 5602 | 5613 |
| 5603 while (low <= high) { | 5614 while (low <= high) { |
| 5604 int mid = (low + high) / 2; | 5615 int mid = (low + high) / 2; |
| 5605 String* mid_name = GetKey(mid); | 5616 String* mid_name = GetKey(mid); |
| (...skipping 6096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11702 return cache; | 11713 return cache; |
| 11703 } | 11714 } |
| 11704 | 11715 |
| 11705 | 11716 |
| 11706 void CompilationCacheTable::Remove(Object* value) { | 11717 void CompilationCacheTable::Remove(Object* value) { |
| 11707 Object* null_value = GetHeap()->null_value(); | 11718 Object* null_value = GetHeap()->null_value(); |
| 11708 for (int entry = 0, size = Capacity(); entry < size; entry++) { | 11719 for (int entry = 0, size = Capacity(); entry < size; entry++) { |
| 11709 int entry_index = EntryToIndex(entry); | 11720 int entry_index = EntryToIndex(entry); |
| 11710 int value_index = entry_index + 1; | 11721 int value_index = entry_index + 1; |
| 11711 if (get(value_index) == value) { | 11722 if (get(value_index) == value) { |
| 11712 fast_set(this, entry_index, null_value); | 11723 NoWriteBarrierSet(this, entry_index, null_value); |
| 11713 fast_set(this, value_index, null_value); | 11724 NoWriteBarrierSet(this, value_index, null_value); |
| 11714 ElementRemoved(); | 11725 ElementRemoved(); |
| 11715 } | 11726 } |
| 11716 } | 11727 } |
| 11717 return; | 11728 return; |
| 11718 } | 11729 } |
| 11719 | 11730 |
| 11720 | 11731 |
| 11721 // SymbolsKey used for HashTable where key is array of symbols. | 11732 // SymbolsKey used for HashTable where key is array of symbols. |
| 11722 class SymbolsKey : public HashTableKey { | 11733 class SymbolsKey : public HashTableKey { |
| 11723 public: | 11734 public: |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12175 ASSERT(type != FIELD); | 12186 ASSERT(type != FIELD); |
| 12176 instance_descriptor_length++; | 12187 instance_descriptor_length++; |
| 12177 if (type == NORMAL && | 12188 if (type == NORMAL && |
| 12178 (!value->IsJSFunction() || heap->InNewSpace(value))) { | 12189 (!value->IsJSFunction() || heap->InNewSpace(value))) { |
| 12179 number_of_fields += 1; | 12190 number_of_fields += 1; |
| 12180 } | 12191 } |
| 12181 } | 12192 } |
| 12182 } | 12193 } |
| 12183 | 12194 |
| 12184 // Allocate the instance descriptor. | 12195 // Allocate the instance descriptor. |
| 12185 Object* descriptors_unchecked; | 12196 DescriptorArray* descriptors; |
| 12186 { MaybeObject* maybe_descriptors_unchecked = | 12197 { MaybeObject* maybe_descriptors = |
| 12187 DescriptorArray::Allocate(instance_descriptor_length); | 12198 DescriptorArray::Allocate(instance_descriptor_length); |
| 12188 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) { | 12199 if (!maybe_descriptors->To<DescriptorArray>(&descriptors)) { |
| 12189 return maybe_descriptors_unchecked; | 12200 return maybe_descriptors; |
| 12190 } | 12201 } |
| 12191 } | 12202 } |
| 12192 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_unchecked); | 12203 |
| 12204 DescriptorArray::WhitenessWitness witness(descriptors); |
| 12193 | 12205 |
| 12194 int inobject_props = obj->map()->inobject_properties(); | 12206 int inobject_props = obj->map()->inobject_properties(); |
| 12195 int number_of_allocated_fields = | 12207 int number_of_allocated_fields = |
| 12196 number_of_fields + unused_property_fields - inobject_props; | 12208 number_of_fields + unused_property_fields - inobject_props; |
| 12197 if (number_of_allocated_fields < 0) { | 12209 if (number_of_allocated_fields < 0) { |
| 12198 // There is enough inobject space for all fields (including unused). | 12210 // There is enough inobject space for all fields (including unused). |
| 12199 number_of_allocated_fields = 0; | 12211 number_of_allocated_fields = 0; |
| 12200 unused_property_fields = inobject_props - number_of_fields; | 12212 unused_property_fields = inobject_props - number_of_fields; |
| 12201 } | 12213 } |
| 12202 | 12214 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 12220 if (!maybe_key->ToObject(&key)) return maybe_key; | 12232 if (!maybe_key->ToObject(&key)) return maybe_key; |
| 12221 } | 12233 } |
| 12222 PropertyDetails details = DetailsAt(i); | 12234 PropertyDetails details = DetailsAt(i); |
| 12223 PropertyType type = details.type(); | 12235 PropertyType type = details.type(); |
| 12224 | 12236 |
| 12225 if (value->IsJSFunction() && !heap->InNewSpace(value)) { | 12237 if (value->IsJSFunction() && !heap->InNewSpace(value)) { |
| 12226 ConstantFunctionDescriptor d(String::cast(key), | 12238 ConstantFunctionDescriptor d(String::cast(key), |
| 12227 JSFunction::cast(value), | 12239 JSFunction::cast(value), |
| 12228 details.attributes(), | 12240 details.attributes(), |
| 12229 details.index()); | 12241 details.index()); |
| 12230 descriptors->Set(next_descriptor++, &d); | 12242 descriptors->Set(next_descriptor++, &d, witness); |
| 12231 } else if (type == NORMAL) { | 12243 } else if (type == NORMAL) { |
| 12232 if (current_offset < inobject_props) { | 12244 if (current_offset < inobject_props) { |
| 12233 obj->InObjectPropertyAtPut(current_offset, | 12245 obj->InObjectPropertyAtPut(current_offset, |
| 12234 value, | 12246 value, |
| 12235 UPDATE_WRITE_BARRIER); | 12247 UPDATE_WRITE_BARRIER); |
| 12236 } else { | 12248 } else { |
| 12237 int offset = current_offset - inobject_props; | 12249 int offset = current_offset - inobject_props; |
| 12238 FixedArray::cast(fields)->set(offset, value); | 12250 FixedArray::cast(fields)->set(offset, value); |
| 12239 } | 12251 } |
| 12240 FieldDescriptor d(String::cast(key), | 12252 FieldDescriptor d(String::cast(key), |
| 12241 current_offset++, | 12253 current_offset++, |
| 12242 details.attributes(), | 12254 details.attributes(), |
| 12243 details.index()); | 12255 details.index()); |
| 12244 descriptors->Set(next_descriptor++, &d); | 12256 descriptors->Set(next_descriptor++, &d, witness); |
| 12245 } else if (type == CALLBACKS) { | 12257 } else if (type == CALLBACKS) { |
| 12246 CallbacksDescriptor d(String::cast(key), | 12258 CallbacksDescriptor d(String::cast(key), |
| 12247 value, | 12259 value, |
| 12248 details.attributes(), | 12260 details.attributes(), |
| 12249 details.index()); | 12261 details.index()); |
| 12250 descriptors->Set(next_descriptor++, &d); | 12262 descriptors->Set(next_descriptor++, &d, witness); |
| 12251 } else { | 12263 } else { |
| 12252 UNREACHABLE(); | 12264 UNREACHABLE(); |
| 12253 } | 12265 } |
| 12254 } | 12266 } |
| 12255 } | 12267 } |
| 12256 ASSERT(current_offset == number_of_fields); | 12268 ASSERT(current_offset == number_of_fields); |
| 12257 | 12269 |
| 12258 descriptors->Sort(); | 12270 descriptors->Sort(witness); |
| 12259 // Allocate new map. | 12271 // Allocate new map. |
| 12260 Object* new_map; | 12272 Object* new_map; |
| 12261 { MaybeObject* maybe_new_map = obj->map()->CopyDropDescriptors(); | 12273 { MaybeObject* maybe_new_map = obj->map()->CopyDropDescriptors(); |
| 12262 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; | 12274 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
| 12263 } | 12275 } |
| 12264 | 12276 |
| 12265 // Transform the object. | 12277 // Transform the object. |
| 12266 obj->set_map(Map::cast(new_map)); | 12278 obj->set_map(Map::cast(new_map)); |
| 12267 obj->map()->set_instance_descriptors(descriptors); | 12279 obj->map()->set_instance_descriptors(descriptors); |
| 12268 obj->map()->set_unused_property_fields(unused_property_fields); | 12280 obj->map()->set_unused_property_fields(unused_property_fields); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12582 if (break_point_objects()->IsUndefined()) return 0; | 12594 if (break_point_objects()->IsUndefined()) return 0; |
| 12583 // Single break point. | 12595 // Single break point. |
| 12584 if (!break_point_objects()->IsFixedArray()) return 1; | 12596 if (!break_point_objects()->IsFixedArray()) return 1; |
| 12585 // Multiple break points. | 12597 // Multiple break points. |
| 12586 return FixedArray::cast(break_point_objects())->length(); | 12598 return FixedArray::cast(break_point_objects())->length(); |
| 12587 } | 12599 } |
| 12588 #endif // ENABLE_DEBUGGER_SUPPORT | 12600 #endif // ENABLE_DEBUGGER_SUPPORT |
| 12589 | 12601 |
| 12590 | 12602 |
| 12591 } } // namespace v8::internal | 12603 } } // namespace v8::internal |
| OLD | NEW |