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 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 | 2446 |
2447 // Initialize or change the enum cache, | 2447 // Initialize or change the enum cache, |
2448 // using the supplied storage for the small "bridge". | 2448 // using the supplied storage for the small "bridge". |
2449 void SetEnumCache(FixedArray* bridge_storage, | 2449 void SetEnumCache(FixedArray* bridge_storage, |
2450 FixedArray* new_cache, | 2450 FixedArray* new_cache, |
2451 Object* new_index_cache); | 2451 Object* new_index_cache); |
2452 | 2452 |
2453 // Accessors for fetching instance descriptor at descriptor number. | 2453 // Accessors for fetching instance descriptor at descriptor number. |
2454 inline String* GetKey(int descriptor_number); | 2454 inline String* GetKey(int descriptor_number); |
2455 inline Object* GetValue(int descriptor_number); | 2455 inline Object* GetValue(int descriptor_number); |
| 2456 inline Object** GetValueSlot(int descriptor_number); |
2456 inline PropertyDetails GetDetails(int descriptor_number); | 2457 inline PropertyDetails GetDetails(int descriptor_number); |
2457 inline PropertyType GetType(int descriptor_number); | 2458 inline PropertyType GetType(int descriptor_number); |
2458 inline int GetFieldIndex(int descriptor_number); | 2459 inline int GetFieldIndex(int descriptor_number); |
2459 inline JSFunction* GetConstantFunction(int descriptor_number); | 2460 inline JSFunction* GetConstantFunction(int descriptor_number); |
2460 inline Object* GetCallbacksObject(int descriptor_number); | 2461 inline Object* GetCallbacksObject(int descriptor_number); |
2461 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 2462 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
2462 inline bool IsProperty(int descriptor_number); | 2463 inline bool IsProperty(int descriptor_number); |
2463 inline bool IsTransitionOnly(int descriptor_number); | 2464 inline bool IsTransitionOnly(int descriptor_number); |
2464 inline bool IsNullDescriptor(int descriptor_number); | 2465 inline bool IsNullDescriptor(int descriptor_number); |
2465 | 2466 |
| 2467 // WhitenessWitness is used to prove that a specific descriptor array is white |
| 2468 // (unmarked), so incremental write barriers can be skipped because the |
| 2469 // marking invariant cannot be broken and slots pointing into evacuation |
| 2470 // candidates will be discovered when the object is scanned. A witness is |
| 2471 // always stack-allocated right after creating a descriptor array. By |
| 2472 // allocating a witness, incremental marking is globally disabled. The witness |
| 2473 // is then passed along wherever needed to statically prove that the |
| 2474 // descriptor array is known to be white. |
2466 class WhitenessWitness { | 2475 class WhitenessWitness { |
2467 public: | 2476 public: |
2468 inline explicit WhitenessWitness(DescriptorArray* array); | 2477 inline explicit WhitenessWitness(DescriptorArray* array); |
2469 inline ~WhitenessWitness(); | 2478 inline ~WhitenessWitness(); |
2470 | 2479 |
2471 private: | 2480 private: |
2472 IncrementalMarking* marking_; | 2481 IncrementalMarking* marking_; |
2473 }; | 2482 }; |
2474 | 2483 |
2475 // Accessor for complete descriptor. | 2484 // Accessor for complete descriptor. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2584 | 2593 |
2585 // Are two DescriptorArrays equal? | 2594 // Are two DescriptorArrays equal? |
2586 bool IsEqualTo(DescriptorArray* other); | 2595 bool IsEqualTo(DescriptorArray* other); |
2587 #endif | 2596 #endif |
2588 | 2597 |
2589 // The maximum number of descriptors we want in a descriptor array (should | 2598 // The maximum number of descriptors we want in a descriptor array (should |
2590 // fit in a page). | 2599 // fit in a page). |
2591 static const int kMaxNumberOfDescriptors = 1024 + 512; | 2600 static const int kMaxNumberOfDescriptors = 1024 + 512; |
2592 | 2601 |
2593 private: | 2602 private: |
| 2603 friend class IntrusiveMapTransitionIterator; |
| 2604 |
2594 // An entry in a DescriptorArray, represented as an (array, index) pair. | 2605 // An entry in a DescriptorArray, represented as an (array, index) pair. |
2595 class Entry { | 2606 class Entry { |
2596 public: | 2607 public: |
2597 inline explicit Entry(DescriptorArray* descs, int index) : | 2608 inline explicit Entry(DescriptorArray* descs, int index) : |
2598 descs_(descs), index_(index) { } | 2609 descs_(descs), index_(index) { } |
2599 | 2610 |
2600 inline PropertyType type() { return descs_->GetType(index_); } | 2611 inline PropertyType type() { return descs_->GetType(index_); } |
2601 inline Object* GetCallbackObject() { return descs_->GetValue(index_); } | 2612 inline Object* GetCallbackObject() { return descs_->GetValue(index_); } |
2602 | 2613 |
2603 private: | 2614 private: |
(...skipping 18 matching lines...) Expand all Loading... |
2622 static inline void NoIncrementalWriteBarrierSwap( | 2633 static inline void NoIncrementalWriteBarrierSwap( |
2623 FixedArray* array, int first, int second); | 2634 FixedArray* array, int first, int second); |
2624 | 2635 |
2625 // Swap descriptor first and second. | 2636 // Swap descriptor first and second. |
2626 inline void NoIncrementalWriteBarrierSwapDescriptors( | 2637 inline void NoIncrementalWriteBarrierSwapDescriptors( |
2627 int first, int second); | 2638 int first, int second); |
2628 | 2639 |
2629 FixedArray* GetContentArray() { | 2640 FixedArray* GetContentArray() { |
2630 return FixedArray::cast(get(kContentArrayIndex)); | 2641 return FixedArray::cast(get(kContentArrayIndex)); |
2631 } | 2642 } |
| 2643 |
2632 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); | 2644 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); |
2633 }; | 2645 }; |
2634 | 2646 |
2635 | 2647 |
2636 // HashTable is a subclass of FixedArray that implements a hash table | 2648 // HashTable is a subclass of FixedArray that implements a hash table |
2637 // that uses open addressing and quadratic probing. | 2649 // that uses open addressing and quadratic probing. |
2638 // | 2650 // |
2639 // In order for the quadratic probing to work, elements that have not | 2651 // In order for the quadratic probing to work, elements that have not |
2640 // yet been used and elements that have been deleted are | 2652 // yet been used and elements that have been deleted are |
2641 // distinguished. Probing continues when deleted elements are | 2653 // distinguished. Probing continues when deleted elements are |
(...skipping 6030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8672 } else { | 8684 } else { |
8673 value &= ~(1 << bit_position); | 8685 value &= ~(1 << bit_position); |
8674 } | 8686 } |
8675 return value; | 8687 return value; |
8676 } | 8688 } |
8677 }; | 8689 }; |
8678 | 8690 |
8679 } } // namespace v8::internal | 8691 } } // namespace v8::internal |
8680 | 8692 |
8681 #endif // V8_OBJECTS_H_ | 8693 #endif // V8_OBJECTS_H_ |
OLD | NEW |