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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 V(Oddball, arguments_marker, ArgumentsMarker) \ | 80 V(Oddball, arguments_marker, ArgumentsMarker) \ |
81 /* The first 32 roots above this line should be boring from a GC point of */ \ | 81 /* The first 32 roots above this line should be boring from a GC point of */ \ |
82 /* view. This means they are never in new space and never on a page that */ \ | 82 /* view. This means they are never in new space and never on a page that */ \ |
83 /* is being compacted. */ \ | 83 /* is being compacted. */ \ |
84 V(FixedArray, number_string_cache, NumberStringCache) \ | 84 V(FixedArray, number_string_cache, NumberStringCache) \ |
85 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ | 85 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
86 V(Object, instanceof_cache_map, InstanceofCacheMap) \ | 86 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
87 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ | 87 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
88 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 88 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
89 V(FixedArray, string_split_cache, StringSplitCache) \ | 89 V(FixedArray, string_split_cache, StringSplitCache) \ |
| 90 V(FixedArray, regexp_multiple_cache, RegExpMultipleCache) \ |
90 V(Object, termination_exception, TerminationException) \ | 91 V(Object, termination_exception, TerminationException) \ |
91 V(Smi, hash_seed, HashSeed) \ | 92 V(Smi, hash_seed, HashSeed) \ |
92 V(Map, string_map, StringMap) \ | 93 V(Map, string_map, StringMap) \ |
93 V(Map, symbol_map, SymbolMap) \ | 94 V(Map, symbol_map, SymbolMap) \ |
94 V(Map, cons_string_map, ConsStringMap) \ | 95 V(Map, cons_string_map, ConsStringMap) \ |
95 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ | 96 V(Map, cons_ascii_string_map, ConsAsciiStringMap) \ |
96 V(Map, sliced_string_map, SlicedStringMap) \ | 97 V(Map, sliced_string_map, SlicedStringMap) \ |
97 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ | 98 V(Map, sliced_ascii_string_map, SlicedAsciiStringMap) \ |
98 V(Map, cons_symbol_map, ConsSymbolMap) \ | 99 V(Map, cons_symbol_map, ConsSymbolMap) \ |
99 V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \ | 100 V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \ |
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 int steps_count_since_last_gc_; | 2565 int steps_count_since_last_gc_; |
2565 double steps_took_since_last_gc_; | 2566 double steps_took_since_last_gc_; |
2566 | 2567 |
2567 Heap* heap_; | 2568 Heap* heap_; |
2568 | 2569 |
2569 const char* gc_reason_; | 2570 const char* gc_reason_; |
2570 const char* collector_reason_; | 2571 const char* collector_reason_; |
2571 }; | 2572 }; |
2572 | 2573 |
2573 | 2574 |
2574 class StringSplitCache { | 2575 class RegExpResultsCache { |
2575 public: | 2576 public: |
2576 static Object* Lookup(FixedArray* cache, String* string, String* pattern); | 2577 enum ResultsCacheType { REGEXP_MULTIPLE_INDICES, STRING_SPLIT_SUBSTRINGS }; |
| 2578 |
| 2579 // Attempt to retrieve a cached result. On failure, 0 is returned as a Smi. |
| 2580 // On success, the returned result is guaranteed to be a COW-array. |
| 2581 static Object* Lookup(Heap* heap, |
| 2582 String* key_string, |
| 2583 Object* key_pattern, |
| 2584 ResultsCacheType type); |
| 2585 // Attempt to add value_array to the cache specified by type. On success, |
| 2586 // value_array is turned into a COW-array. |
2577 static void Enter(Heap* heap, | 2587 static void Enter(Heap* heap, |
2578 FixedArray* cache, | 2588 String* key_string, |
2579 String* string, | 2589 Object* key_pattern, |
2580 String* pattern, | 2590 FixedArray* value_array, |
2581 FixedArray* array); | 2591 ResultsCacheType type); |
2582 static void Clear(FixedArray* cache); | 2592 static void Clear(FixedArray* cache); |
2583 static const int kStringSplitCacheSize = 0x100; | 2593 static const int kRegExpResultsCacheSize = 0x100; |
2584 | 2594 |
2585 private: | 2595 private: |
2586 static const int kArrayEntriesPerCacheEntry = 4; | 2596 static const int kArrayEntriesPerCacheEntry = 4; |
2587 static const int kStringOffset = 0; | 2597 static const int kStringOffset = 0; |
2588 static const int kPatternOffset = 1; | 2598 static const int kPatternOffset = 1; |
2589 static const int kArrayOffset = 2; | 2599 static const int kArrayOffset = 2; |
2590 | |
2591 static MaybeObject* WrapFixedArrayInJSArray(Object* fixed_array); | |
2592 }; | 2600 }; |
2593 | 2601 |
2594 | 2602 |
2595 class TranscendentalCache { | 2603 class TranscendentalCache { |
2596 public: | 2604 public: |
2597 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; | 2605 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; |
2598 static const int kTranscendentalTypeBits = 3; | 2606 static const int kTranscendentalTypeBits = 3; |
2599 STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches); | 2607 STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches); |
2600 | 2608 |
2601 // Returns a heap number with f(input), where f is a math function specified | 2609 // Returns a heap number with f(input), where f is a math function specified |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2781 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2774 | 2782 |
2775 private: | 2783 private: |
2776 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2784 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2777 }; | 2785 }; |
2778 #endif // DEBUG || LIVE_OBJECT_LIST | 2786 #endif // DEBUG || LIVE_OBJECT_LIST |
2779 | 2787 |
2780 } } // namespace v8::internal | 2788 } } // namespace v8::internal |
2781 | 2789 |
2782 #endif // V8_HEAP_H_ | 2790 #endif // V8_HEAP_H_ |
OLD | NEW |