| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 V(Proxy, prototype_accessors) \ | 115 V(Proxy, prototype_accessors) \ |
| 116 V(JSObject, debug_event_listeners) \ | 116 V(JSObject, debug_event_listeners) \ |
| 117 V(Dictionary, code_stubs) \ | 117 V(Dictionary, code_stubs) \ |
| 118 V(Dictionary, non_monomorphic_cache) \ | 118 V(Dictionary, non_monomorphic_cache) \ |
| 119 V(Code, js_entry_code) \ | 119 V(Code, js_entry_code) \ |
| 120 V(Code, js_construct_entry_code) \ | 120 V(Code, js_construct_entry_code) \ |
| 121 V(Code, c_entry_code) \ | 121 V(Code, c_entry_code) \ |
| 122 V(Code, c_entry_debug_break_code) \ | 122 V(Code, c_entry_debug_break_code) \ |
| 123 V(FixedArray, number_string_cache) \ | 123 V(FixedArray, number_string_cache) \ |
| 124 V(FixedArray, single_character_string_cache) \ | 124 V(FixedArray, single_character_string_cache) \ |
| 125 V(FixedArray, natives_source_cache) \ | 125 V(FixedArray, natives_source_cache) |
| 126 V(Object, eval_cache_global) \ | 126 |
| 127 V(Object, eval_cache_non_global) | |
| 128 | 127 |
| 129 #define ROOT_LIST(V) \ | 128 #define ROOT_LIST(V) \ |
| 130 STRONG_ROOT_LIST(V) \ | 129 STRONG_ROOT_LIST(V) \ |
| 131 V(Object, symbol_table) | 130 V(Object, symbol_table) |
| 132 | 131 |
| 133 #define SYMBOL_LIST(V) \ | 132 #define SYMBOL_LIST(V) \ |
| 134 V(Array_symbol, "Array") \ | 133 V(Array_symbol, "Array") \ |
| 135 V(Object_symbol, "Object") \ | 134 V(Object_symbol, "Object") \ |
| 136 V(Proto_symbol, "__proto__") \ | 135 V(Proto_symbol, "__proto__") \ |
| 137 V(StringImpl_symbol, "StringImpl") \ | 136 V(StringImpl_symbol, "StringImpl") \ |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 // If not found, a new symbol is added to the table and returned. | 523 // If not found, a new symbol is added to the table and returned. |
| 525 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 524 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 526 // failed. | 525 // failed. |
| 527 // Please note this function does not perform a garbage collection. | 526 // Please note this function does not perform a garbage collection. |
| 528 static Object* LookupSymbol(Vector<const char> str); | 527 static Object* LookupSymbol(Vector<const char> str); |
| 529 static Object* LookupAsciiSymbol(const char* str) { | 528 static Object* LookupAsciiSymbol(const char* str) { |
| 530 return LookupSymbol(CStrVector(str)); | 529 return LookupSymbol(CStrVector(str)); |
| 531 } | 530 } |
| 532 static Object* LookupSymbol(String* str); | 531 static Object* LookupSymbol(String* str); |
| 533 | 532 |
| 534 // EvalCache caches function boilerplates for compiled scripts | |
| 535 // from 'eval' function. | |
| 536 // Source string is used as the key, and compiled function | |
| 537 // boilerplate as value. Because the same source has different | |
| 538 // compiled code in global or local context, we use separate | |
| 539 // caches for global and local contexts. | |
| 540 // Caches are cleared before mark-compact/mark-sweep GC's. | |
| 541 | |
| 542 // Finds the function boilerplate of a source string. | |
| 543 // It returns a JSFunction object if found in the cache. | |
| 544 // The first parameter specifies whether the code is | |
| 545 // compiled in a global context. | |
| 546 static Object* LookupEvalCache(bool is_global_context, String* src); | |
| 547 | |
| 548 // Put a source string and its compiled function boilerplate | |
| 549 // in the eval cache. The cache may expand, and returns failure | |
| 550 // if it cannot expand the cache, otherwise the value is returned. | |
| 551 // The first parameter specifies whether the boilerplate is | |
| 552 // compiled in a global context. | |
| 553 static Object* PutInEvalCache(bool is_global_context, | |
| 554 String* src, JSFunction* value); | |
| 555 | |
| 556 // Compute the matching symbol map for a string if possible. | 533 // Compute the matching symbol map for a string if possible. |
| 557 // NULL is returned if string is in new space or not flattened. | 534 // NULL is returned if string is in new space or not flattened. |
| 558 static Map* SymbolMapForString(String* str); | 535 static Map* SymbolMapForString(String* str); |
| 559 | 536 |
| 560 // Converts the given boolean condition to JavaScript boolean value. | 537 // Converts the given boolean condition to JavaScript boolean value. |
| 561 static Object* ToBoolean(bool condition) { | 538 static Object* ToBoolean(bool condition) { |
| 562 return condition ? true_value() : false_value(); | 539 return condition ? true_value() : false_value(); |
| 563 } | 540 } |
| 564 | 541 |
| 565 // Code that should be run before and after each GC. Includes some | 542 // Code that should be run before and after each GC. Includes some |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 int marked_count_; | 1163 int marked_count_; |
| 1187 | 1164 |
| 1188 // The count from the end of the previous full GC. Will be zero if there | 1165 // The count from the end of the previous full GC. Will be zero if there |
| 1189 // was no previous full GC. | 1166 // was no previous full GC. |
| 1190 int previous_marked_count_; | 1167 int previous_marked_count_; |
| 1191 }; | 1168 }; |
| 1192 | 1169 |
| 1193 } } // namespace v8::internal | 1170 } } // namespace v8::internal |
| 1194 | 1171 |
| 1195 #endif // V8_HEAP_H_ | 1172 #endif // V8_HEAP_H_ |
| OLD | NEW |