Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: src/objects.h

Issue 10565030: Fixing bugs in promotion of elements transitions (r1175). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 // Returns true for both shared empty_descriptor_array and for smis, which the 2434 // Returns true for both shared empty_descriptor_array and for smis, which the
2435 // map uses to encode additional bit fields when the descriptor array is not 2435 // map uses to encode additional bit fields when the descriptor array is not
2436 // yet used. 2436 // yet used.
2437 inline bool IsEmpty(); 2437 inline bool IsEmpty();
2438 inline bool MayContainTransitions(); 2438 inline bool MayContainTransitions();
2439 2439
2440 DECL_ACCESSORS(elements_transition_map, Map) 2440 DECL_ACCESSORS(elements_transition_map, Map)
2441 2441
2442 // Returns the number of descriptors in the array. 2442 // Returns the number of descriptors in the array.
2443 int number_of_descriptors() { 2443 int number_of_descriptors() {
2444 ASSERT(length() > kFirstIndex || 2444 ASSERT(length() >= kFirstIndex || IsEmpty());
2445 length() == kTransitionsIndex ||
2446 IsEmpty());
2447 int len = length(); 2445 int len = length();
2448 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; 2446 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize;
2449 } 2447 }
2450 2448
2451 int NextEnumerationIndex() { 2449 int NextEnumerationIndex() {
2452 if (IsEmpty()) return PropertyDetails::kInitialIndex; 2450 if (IsEmpty()) return PropertyDetails::kInitialIndex;
2453 Object* obj = get(kEnumerationIndexIndex); 2451 Object* obj = get(kEnumerationIndexIndex);
2454 if (obj->IsSmi()) { 2452 if (obj->IsSmi()) {
2455 return Smi::cast(obj)->value(); 2453 return Smi::cast(obj)->value();
2456 } else { 2454 } else {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors, 2606 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors,
2609 SharedMode shared_mode); 2607 SharedMode shared_mode);
2610 2608
2611 // Casting. 2609 // Casting.
2612 static inline DescriptorArray* cast(Object* obj); 2610 static inline DescriptorArray* cast(Object* obj);
2613 2611
2614 // Constant for denoting key was not found. 2612 // Constant for denoting key was not found.
2615 static const int kNotFound = -1; 2613 static const int kNotFound = -1;
2616 2614
2617 static const int kBitField3StorageIndex = 0; 2615 static const int kBitField3StorageIndex = 0;
2618 static const int kTransitionsIndex = 1; 2616 static const int kEnumerationIndexIndex = 1;
2619 static const int kEnumerationIndexIndex = 2; 2617 static const int kTransitionsIndex = 2;
2620 static const int kFirstIndex = 3; 2618 static const int kFirstIndex = 3;
2621 2619
2622 // The length of the "bridge" to the enum cache. 2620 // The length of the "bridge" to the enum cache.
2623 static const int kEnumCacheBridgeLength = 3; 2621 static const int kEnumCacheBridgeLength = 3;
2624 static const int kEnumCacheBridgeEnumIndex = 0; 2622 static const int kEnumCacheBridgeEnumIndex = 0;
2625 static const int kEnumCacheBridgeCacheIndex = 1; 2623 static const int kEnumCacheBridgeCacheIndex = 1;
2626 static const int kEnumCacheBridgeIndicesCacheIndex = 2; 2624 static const int kEnumCacheBridgeIndicesCacheIndex = 2;
2627 2625
2628 // Layout description. 2626 // Layout description.
2629 static const int kBitField3StorageOffset = FixedArray::kHeaderSize; 2627 static const int kBitField3StorageOffset = FixedArray::kHeaderSize;
2630 static const int kTransitionsOffset = kBitField3StorageOffset + kPointerSize; 2628 static const int kEnumerationIndexOffset =
2631 static const int kEnumerationIndexOffset = kTransitionsOffset + kPointerSize; 2629 kBitField3StorageOffset + kPointerSize;
2632 static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; 2630 static const int kTransitionsOffset = kEnumerationIndexOffset + kPointerSize;
2631 static const int kFirstOffset = kTransitionsOffset + kPointerSize;
2633 2632
2634 // Layout description for the bridge array. 2633 // Layout description for the bridge array.
2635 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize; 2634 static const int kEnumCacheBridgeEnumOffset = FixedArray::kHeaderSize;
2636 static const int kEnumCacheBridgeCacheOffset = 2635 static const int kEnumCacheBridgeCacheOffset =
2637 kEnumCacheBridgeEnumOffset + kPointerSize; 2636 kEnumCacheBridgeEnumOffset + kPointerSize;
2638 2637
2639 // Layout of descriptor. 2638 // Layout of descriptor.
2640 static const int kDescriptorKey = 0; 2639 static const int kDescriptorKey = 0;
2641 static const int kDescriptorDetails = 1; 2640 static const int kDescriptorDetails = 1;
2642 static const int kDescriptorValue = 2; 2641 static const int kDescriptorValue = 2;
(...skipping 6138 matching lines...) Expand 10 before | Expand all | Expand 10 after
8781 } else { 8780 } else {
8782 value &= ~(1 << bit_position); 8781 value &= ~(1 << bit_position);
8783 } 8782 }
8784 return value; 8783 return value;
8785 } 8784 }
8786 }; 8785 };
8787 8786
8788 } } // namespace v8::internal 8787 } } // namespace v8::internal
8789 8788
8790 #endif // V8_OBJECTS_H_ 8789 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698