OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 #define STRUCT_ALLOCATION(NAME, Name, name) Map* Heap::name##_map_; | 50 #define STRUCT_ALLOCATION(NAME, Name, name) Map* Heap::name##_map_; |
51 STRUCT_LIST(STRUCT_ALLOCATION) | 51 STRUCT_LIST(STRUCT_ALLOCATION) |
52 #undef STRUCT_ALLOCATION | 52 #undef STRUCT_ALLOCATION |
53 | 53 |
54 | 54 |
55 #define SYMBOL_ALLOCATION(name, string) String* Heap::name##_; | 55 #define SYMBOL_ALLOCATION(name, string) String* Heap::name##_; |
56 SYMBOL_LIST(SYMBOL_ALLOCATION) | 56 SYMBOL_LIST(SYMBOL_ALLOCATION) |
57 #undef SYMBOL_ALLOCATION | 57 #undef SYMBOL_ALLOCATION |
58 | 58 |
| 59 String* Heap::hidden_symbol_; |
| 60 |
59 NewSpace Heap::new_space_; | 61 NewSpace Heap::new_space_; |
60 OldSpace* Heap::old_pointer_space_ = NULL; | 62 OldSpace* Heap::old_pointer_space_ = NULL; |
61 OldSpace* Heap::old_data_space_ = NULL; | 63 OldSpace* Heap::old_data_space_ = NULL; |
62 OldSpace* Heap::code_space_ = NULL; | 64 OldSpace* Heap::code_space_ = NULL; |
63 MapSpace* Heap::map_space_ = NULL; | 65 MapSpace* Heap::map_space_ = NULL; |
64 LargeObjectSpace* Heap::lo_space_ = NULL; | 66 LargeObjectSpace* Heap::lo_space_ = NULL; |
65 | 67 |
66 static const int kMinimumPromotionLimit = 2*MB; | 68 static const int kMinimumPromotionLimit = 2*MB; |
67 static const int kMinimumAllocationLimit = 8*MB; | 69 static const int kMinimumAllocationLimit = 8*MB; |
68 | 70 |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 obj = AllocateRawAsciiString(0, TENURED); | 1208 obj = AllocateRawAsciiString(0, TENURED); |
1207 if (obj->IsFailure()) return false; | 1209 if (obj->IsFailure()) return false; |
1208 empty_string_ = String::cast(obj); | 1210 empty_string_ = String::cast(obj); |
1209 | 1211 |
1210 #define SYMBOL_INITIALIZE(name, string) \ | 1212 #define SYMBOL_INITIALIZE(name, string) \ |
1211 obj = LookupAsciiSymbol(string); \ | 1213 obj = LookupAsciiSymbol(string); \ |
1212 if (obj->IsFailure()) return false; \ | 1214 if (obj->IsFailure()) return false; \ |
1213 (name##_) = String::cast(obj); | 1215 (name##_) = String::cast(obj); |
1214 SYMBOL_LIST(SYMBOL_INITIALIZE) | 1216 SYMBOL_LIST(SYMBOL_INITIALIZE) |
1215 #undef SYMBOL_INITIALIZE | 1217 #undef SYMBOL_INITIALIZE |
| 1218 |
| 1219 // Allocate the hidden symbol which is used to identify the hidden properties |
| 1220 // in JSObjects. The hash code has a special value so that it will not match |
| 1221 // the empty string when searching for the property. It cannot be part of the |
| 1222 // SYMBOL_LIST because it needs to be allocated manually with the special |
| 1223 // hash code in place. The hash code for the hidden_symbol is zero to ensure |
| 1224 // that it will always be at the first entry in property descriptors. |
| 1225 obj = AllocateSymbol(CStrVector(""), 0, String::kHashComputedMask); |
| 1226 if (obj->IsFailure()) return false; |
| 1227 hidden_symbol_ = String::cast(obj); |
1216 | 1228 |
1217 // Allocate the proxy for __proto__. | 1229 // Allocate the proxy for __proto__. |
1218 obj = AllocateProxy((Address) &Accessors::ObjectPrototype); | 1230 obj = AllocateProxy((Address) &Accessors::ObjectPrototype); |
1219 if (obj->IsFailure()) return false; | 1231 if (obj->IsFailure()) return false; |
1220 prototype_accessors_ = Proxy::cast(obj); | 1232 prototype_accessors_ = Proxy::cast(obj); |
1221 | 1233 |
1222 // Allocate the code_stubs dictionary. | 1234 // Allocate the code_stubs dictionary. |
1223 obj = Dictionary::Allocate(4); | 1235 obj = Dictionary::Allocate(4); |
1224 if (obj->IsFailure()) return false; | 1236 if (obj->IsFailure()) return false; |
1225 code_stubs_ = Dictionary::cast(obj); | 1237 code_stubs_ = Dictionary::cast(obj); |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 #define STRUCT_MAP_ITERATE(NAME, Name, name) \ | 2646 #define STRUCT_MAP_ITERATE(NAME, Name, name) \ |
2635 v->VisitPointer(bit_cast<Object**, Map**>(&name##_map_)); | 2647 v->VisitPointer(bit_cast<Object**, Map**>(&name##_map_)); |
2636 STRUCT_LIST(STRUCT_MAP_ITERATE); | 2648 STRUCT_LIST(STRUCT_MAP_ITERATE); |
2637 #undef STRUCT_MAP_ITERATE | 2649 #undef STRUCT_MAP_ITERATE |
2638 SYNCHRONIZE_TAG("struct_map"); | 2650 SYNCHRONIZE_TAG("struct_map"); |
2639 | 2651 |
2640 #define SYMBOL_ITERATE(name, string) \ | 2652 #define SYMBOL_ITERATE(name, string) \ |
2641 v->VisitPointer(bit_cast<Object**, String**>(&name##_)); | 2653 v->VisitPointer(bit_cast<Object**, String**>(&name##_)); |
2642 SYMBOL_LIST(SYMBOL_ITERATE) | 2654 SYMBOL_LIST(SYMBOL_ITERATE) |
2643 #undef SYMBOL_ITERATE | 2655 #undef SYMBOL_ITERATE |
| 2656 v->VisitPointer(bit_cast<Object**, String**>(&hidden_symbol_)); |
2644 SYNCHRONIZE_TAG("symbol"); | 2657 SYNCHRONIZE_TAG("symbol"); |
2645 | 2658 |
2646 Bootstrapper::Iterate(v); | 2659 Bootstrapper::Iterate(v); |
2647 SYNCHRONIZE_TAG("bootstrapper"); | 2660 SYNCHRONIZE_TAG("bootstrapper"); |
2648 Top::Iterate(v); | 2661 Top::Iterate(v); |
2649 SYNCHRONIZE_TAG("top"); | 2662 SYNCHRONIZE_TAG("top"); |
2650 Debug::Iterate(v); | 2663 Debug::Iterate(v); |
2651 SYNCHRONIZE_TAG("debug"); | 2664 SYNCHRONIZE_TAG("debug"); |
2652 CompilationCache::Iterate(v); | 2665 CompilationCache::Iterate(v); |
2653 SYNCHRONIZE_TAG("compilationcache"); | 2666 SYNCHRONIZE_TAG("compilationcache"); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 #ifdef DEBUG | 3337 #ifdef DEBUG |
3325 bool Heap::GarbageCollectionGreedyCheck() { | 3338 bool Heap::GarbageCollectionGreedyCheck() { |
3326 ASSERT(FLAG_gc_greedy); | 3339 ASSERT(FLAG_gc_greedy); |
3327 if (Bootstrapper::IsActive()) return true; | 3340 if (Bootstrapper::IsActive()) return true; |
3328 if (disallow_allocation_failure()) return true; | 3341 if (disallow_allocation_failure()) return true; |
3329 return CollectGarbage(0, NEW_SPACE); | 3342 return CollectGarbage(0, NEW_SPACE); |
3330 } | 3343 } |
3331 #endif | 3344 #endif |
3332 | 3345 |
3333 } } // namespace v8::internal | 3346 } } // namespace v8::internal |
OLD | NEW |