OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 23 matching lines...) Expand all Loading... |
34 #include "list.h" | 34 #include "list.h" |
35 #include "spaces.h" | 35 #include "spaces.h" |
36 #include "splay-tree-inl.h" | 36 #include "splay-tree-inl.h" |
37 #include "v8-counters.h" | 37 #include "v8-counters.h" |
38 | 38 |
39 namespace v8 { | 39 namespace v8 { |
40 namespace internal { | 40 namespace internal { |
41 | 41 |
42 | 42 |
43 // Defines all the roots in Heap. | 43 // Defines all the roots in Heap. |
44 #define UNCONDITIONAL_STRONG_ROOT_LIST(V) \ | 44 #define STRONG_ROOT_LIST(V) \ |
45 /* Put the byte array map early. We need it to be in place by the time */ \ | 45 /* Put the byte array map early. We need it to be in place by the time */ \ |
46 /* the deserializer hits the next page, since it wants to put a byte */ \ | 46 /* the deserializer hits the next page, since it wants to put a byte */ \ |
47 /* array in the unused space at the end of the page. */ \ | 47 /* array in the unused space at the end of the page. */ \ |
48 V(Map, byte_array_map, ByteArrayMap) \ | 48 V(Map, byte_array_map, ByteArrayMap) \ |
49 V(Map, one_pointer_filler_map, OnePointerFillerMap) \ | 49 V(Map, one_pointer_filler_map, OnePointerFillerMap) \ |
50 V(Map, two_pointer_filler_map, TwoPointerFillerMap) \ | 50 V(Map, two_pointer_filler_map, TwoPointerFillerMap) \ |
51 /* Cluster the most popular ones in a few cache lines here at the top. */ \ | 51 /* Cluster the most popular ones in a few cache lines here at the top. */ \ |
52 V(Object, undefined_value, UndefinedValue) \ | 52 V(Object, undefined_value, UndefinedValue) \ |
53 V(Object, the_hole_value, TheHoleValue) \ | 53 V(Object, the_hole_value, TheHoleValue) \ |
54 V(Object, null_value, NullValue) \ | 54 V(Object, null_value, NullValue) \ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 V(Map, proxy_map, ProxyMap) \ | 107 V(Map, proxy_map, ProxyMap) \ |
108 V(Object, nan_value, NanValue) \ | 108 V(Object, nan_value, NanValue) \ |
109 V(Object, minus_zero_value, MinusZeroValue) \ | 109 V(Object, minus_zero_value, MinusZeroValue) \ |
110 V(Map, neander_map, NeanderMap) \ | 110 V(Map, neander_map, NeanderMap) \ |
111 V(JSObject, message_listeners, MessageListeners) \ | 111 V(JSObject, message_listeners, MessageListeners) \ |
112 V(Proxy, prototype_accessors, PrototypeAccessors) \ | 112 V(Proxy, prototype_accessors, PrototypeAccessors) \ |
113 V(NumberDictionary, code_stubs, CodeStubs) \ | 113 V(NumberDictionary, code_stubs, CodeStubs) \ |
114 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 114 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
115 V(Code, js_entry_code, JsEntryCode) \ | 115 V(Code, js_entry_code, JsEntryCode) \ |
116 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 116 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
117 V(Code, c_entry_code, CEntryCode) \ | |
118 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 117 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
119 V(Object, last_script_id, LastScriptId) \ | 118 V(Object, last_script_id, LastScriptId) \ |
120 V(Script, empty_script, EmptyScript) \ | 119 V(Script, empty_script, EmptyScript) \ |
121 V(Smi, real_stack_limit, RealStackLimit) \ | 120 V(Smi, real_stack_limit, RealStackLimit) \ |
122 V(StringDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 121 V(StringDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
123 | 122 |
124 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP | |
125 #define STRONG_ROOT_LIST(V) \ | |
126 UNCONDITIONAL_STRONG_ROOT_LIST(V) \ | |
127 V(Code, re_c_entry_code, RegExpCEntryCode) \ | |
128 V(Code, direct_c_entry_code, DirectCEntryCode) | |
129 #elif V8_TARGET_ARCH_ARM | |
130 #define STRONG_ROOT_LIST(V) \ | |
131 UNCONDITIONAL_STRONG_ROOT_LIST(V) \ | |
132 V(Code, direct_c_entry_code, DirectCEntryCode) | |
133 #else | |
134 #define STRONG_ROOT_LIST(V) UNCONDITIONAL_STRONG_ROOT_LIST(V) | |
135 #endif | |
136 | |
137 #define ROOT_LIST(V) \ | 123 #define ROOT_LIST(V) \ |
138 STRONG_ROOT_LIST(V) \ | 124 STRONG_ROOT_LIST(V) \ |
139 V(SymbolTable, symbol_table, SymbolTable) | 125 V(SymbolTable, symbol_table, SymbolTable) |
140 | 126 |
141 #define SYMBOL_LIST(V) \ | 127 #define SYMBOL_LIST(V) \ |
142 V(Array_symbol, "Array") \ | 128 V(Array_symbol, "Array") \ |
143 V(Object_symbol, "Object") \ | 129 V(Object_symbol, "Object") \ |
144 V(Proto_symbol, "__proto__") \ | 130 V(Proto_symbol, "__proto__") \ |
145 V(StringImpl_symbol, "StringImpl") \ | 131 V(StringImpl_symbol, "StringImpl") \ |
146 V(arguments_symbol, "arguments") \ | 132 V(arguments_symbol, "arguments") \ |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 static void CreateFillerObjectAt(Address addr, int size); | 684 static void CreateFillerObjectAt(Address addr, int size); |
699 | 685 |
700 // Makes a new native code object | 686 // Makes a new native code object |
701 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 687 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
702 // failed. On success, the pointer to the Code object is stored in the | 688 // failed. On success, the pointer to the Code object is stored in the |
703 // self_reference. This allows generated code to reference its own Code | 689 // self_reference. This allows generated code to reference its own Code |
704 // object by containing this pointer. | 690 // object by containing this pointer. |
705 // Please note this function does not perform a garbage collection. | 691 // Please note this function does not perform a garbage collection. |
706 MUST_USE_RESULT static MaybeObject* CreateCode(const CodeDesc& desc, | 692 MUST_USE_RESULT static MaybeObject* CreateCode(const CodeDesc& desc, |
707 Code::Flags flags, | 693 Code::Flags flags, |
708 Handle<Object> self_reference); | 694 Handle<Object> self_reference, |
| 695 bool immovable = false); |
709 | 696 |
710 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code); | 697 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code); |
711 | 698 |
712 // Copy the code and scope info part of the code object, but insert | 699 // Copy the code and scope info part of the code object, but insert |
713 // the provided data as the relocation information. | 700 // the provided data as the relocation information. |
714 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, | 701 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, |
715 Vector<byte> reloc_info); | 702 Vector<byte> reloc_info); |
716 | 703 |
717 // Finds the symbol for string in the symbol table. | 704 // Finds the symbol for string in the symbol table. |
718 // If not found, a new symbol is added to the table and returned. | 705 // If not found, a new symbol is added to the table and returned. |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 MUST_USE_RESULT static inline MaybeObject* AllocateRawCell(); | 1307 MUST_USE_RESULT static inline MaybeObject* AllocateRawCell(); |
1321 | 1308 |
1322 // Initializes a JSObject based on its map. | 1309 // Initializes a JSObject based on its map. |
1323 static void InitializeJSObjectFromMap(JSObject* obj, | 1310 static void InitializeJSObjectFromMap(JSObject* obj, |
1324 FixedArray* properties, | 1311 FixedArray* properties, |
1325 Map* map); | 1312 Map* map); |
1326 | 1313 |
1327 static bool CreateInitialMaps(); | 1314 static bool CreateInitialMaps(); |
1328 static bool CreateInitialObjects(); | 1315 static bool CreateInitialObjects(); |
1329 | 1316 |
1330 // These five Create*EntryStub functions are here and forced to not be inlined | 1317 // These two Create*EntryStub functions are here and forced to not be inlined |
1331 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 1318 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
1332 NO_INLINE(static void CreateCEntryStub()); | |
1333 NO_INLINE(static void CreateJSEntryStub()); | 1319 NO_INLINE(static void CreateJSEntryStub()); |
1334 NO_INLINE(static void CreateJSConstructEntryStub()); | 1320 NO_INLINE(static void CreateJSConstructEntryStub()); |
1335 NO_INLINE(static void CreateRegExpCEntryStub()); | |
1336 NO_INLINE(static void CreateDirectCEntryStub()); | |
1337 | 1321 |
1338 static void CreateFixedStubs(); | 1322 static void CreateFixedStubs(); |
1339 | 1323 |
1340 MUST_USE_RESULT static MaybeObject* CreateOddball(const char* to_string, | 1324 MUST_USE_RESULT static MaybeObject* CreateOddball(const char* to_string, |
1341 Object* to_number); | 1325 Object* to_number); |
1342 | 1326 |
1343 // Allocate empty fixed array. | 1327 // Allocate empty fixed array. |
1344 MUST_USE_RESULT static MaybeObject* AllocateEmptyFixedArray(); | 1328 MUST_USE_RESULT static MaybeObject* AllocateEmptyFixedArray(); |
1345 | 1329 |
1346 // Performs a minor collection in new generation. | 1330 // Performs a minor collection in new generation. |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2192 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2209 | 2193 |
2210 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2194 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2211 }; | 2195 }; |
2212 #endif // DEBUG || LIVE_OBJECT_LIST | 2196 #endif // DEBUG || LIVE_OBJECT_LIST |
2213 | 2197 |
2214 | 2198 |
2215 } } // namespace v8::internal | 2199 } } // namespace v8::internal |
2216 | 2200 |
2217 #endif // V8_HEAP_H_ | 2201 #endif // V8_HEAP_H_ |
OLD | NEW |