| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \ | 186 V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \ |
| 187 V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \ | 187 V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \ |
| 188 V(illegal_return_symbol, "illegal_return") \ | 188 V(illegal_return_symbol, "illegal_return") \ |
| 189 V(illegal_break_symbol, "illegal_break") \ | 189 V(illegal_break_symbol, "illegal_break") \ |
| 190 V(illegal_continue_symbol, "illegal_continue") \ | 190 V(illegal_continue_symbol, "illegal_continue") \ |
| 191 V(unknown_label_symbol, "unknown_label") \ | 191 V(unknown_label_symbol, "unknown_label") \ |
| 192 V(redeclaration_symbol, "redeclaration") \ | 192 V(redeclaration_symbol, "redeclaration") \ |
| 193 V(failure_symbol, "<failure>") \ | 193 V(failure_symbol, "<failure>") \ |
| 194 V(space_symbol, " ") \ | 194 V(space_symbol, " ") \ |
| 195 V(exec_symbol, "exec") \ | 195 V(exec_symbol, "exec") \ |
| 196 V(zero_symbol, "0") | 196 V(zero_symbol, "0") \ |
| 197 V(global_eval_symbol, "GlobalEval") |
| 197 | 198 |
| 198 | 199 |
| 199 // Forward declaration of the GCTracer class. | 200 // Forward declaration of the GCTracer class. |
| 200 class GCTracer; | 201 class GCTracer; |
| 201 | 202 |
| 202 | 203 |
| 203 // The all static Heap captures the interface to the global object heap. | 204 // The all static Heap captures the interface to the global object heap. |
| 204 // All JavaScript contexts by this process share the same object heap. | 205 // All JavaScript contexts by this process share the same object heap. |
| 205 | 206 |
| 206 class Heap : public AllStatic { | 207 class Heap : public AllStatic { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 385 |
| 385 // Computes a single character string where the character has code. | 386 // Computes a single character string where the character has code. |
| 386 // A cache is used for ascii codes. | 387 // A cache is used for ascii codes. |
| 387 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 388 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 388 // failed. Please note this does not perform a garbage collection. | 389 // failed. Please note this does not perform a garbage collection. |
| 389 static Object* LookupSingleCharacterStringFromCode(uint16_t code); | 390 static Object* LookupSingleCharacterStringFromCode(uint16_t code); |
| 390 | 391 |
| 391 // Allocate a byte array of the specified length | 392 // Allocate a byte array of the specified length |
| 392 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 393 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 393 // failed. | 394 // failed. |
| 394 // Please not this does not perform a garbage collection. | 395 // Please note this does not perform a garbage collection. |
| 396 static Object* AllocateByteArray(int length, PretenureFlag pretenure); |
| 397 |
| 398 // Allocate a non-tenured byte array of the specified length |
| 399 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 400 // failed. |
| 401 // Please note this does not perform a garbage collection. |
| 395 static Object* AllocateByteArray(int length); | 402 static Object* AllocateByteArray(int length); |
| 396 | 403 |
| 397 // Allocates a fixed array initialized with undefined values | 404 // Allocates a fixed array initialized with undefined values |
| 398 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 405 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 399 // failed. | 406 // failed. |
| 400 // Please note this does not perform a garbage collection. | 407 // Please note this does not perform a garbage collection. |
| 401 static Object* AllocateFixedArray(int length, PretenureFlag pretenure); | 408 static Object* AllocateFixedArray(int length, PretenureFlag pretenure); |
| 402 // Allocate uninitialized, non-tenured fixed array with length elements. | 409 // Allocate uninitialized, non-tenured fixed array with length elements. |
| 403 static Object* AllocateFixedArray(int length); | 410 static Object* AllocateFixedArray(int length); |
| 404 | 411 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // hardware and OS allow. | 549 // hardware and OS allow. |
| 543 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 550 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 544 // failed. | 551 // failed. |
| 545 // Please note this function does not perform a garbage collection. | 552 // Please note this function does not perform a garbage collection. |
| 546 static inline Object* AllocateRaw(int size_in_bytes, | 553 static inline Object* AllocateRaw(int size_in_bytes, |
| 547 AllocationSpace space, | 554 AllocationSpace space, |
| 548 AllocationSpace retry_space); | 555 AllocationSpace retry_space); |
| 549 | 556 |
| 550 // Makes a new native code object | 557 // Makes a new native code object |
| 551 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 558 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 552 // failed. | 559 // failed. On success, the pointer to the Code object is stored in the |
| 560 // self_reference. This allows generated code to reference its own Code |
| 561 // object by containing this pointer. |
| 553 // Please note this function does not perform a garbage collection. | 562 // Please note this function does not perform a garbage collection. |
| 554 static Object* CreateCode(const CodeDesc& desc, | 563 static Object* CreateCode(const CodeDesc& desc, |
| 555 ScopeInfo<>* sinfo, | 564 ScopeInfo<>* sinfo, |
| 556 Code::Flags flags); | 565 Code::Flags flags, |
| 566 Code** self_reference = NULL); |
| 557 | 567 |
| 558 static Object* CopyCode(Code* code); | 568 static Object* CopyCode(Code* code); |
| 559 // Finds the symbol for string in the symbol table. | 569 // Finds the symbol for string in the symbol table. |
| 560 // If not found, a new symbol is added to the table and returned. | 570 // If not found, a new symbol is added to the table and returned. |
| 561 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 571 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 562 // failed. | 572 // failed. |
| 563 // Please note this function does not perform a garbage collection. | 573 // Please note this function does not perform a garbage collection. |
| 564 static Object* LookupSymbol(Vector<const char> str); | 574 static Object* LookupSymbol(Vector<const char> str); |
| 565 static Object* LookupAsciiSymbol(const char* str) { | 575 static Object* LookupAsciiSymbol(const char* str) { |
| 566 return LookupSymbol(CStrVector(str)); | 576 return LookupSymbol(CStrVector(str)); |
| 567 } | 577 } |
| 568 static Object* LookupSymbol(String* str); | 578 static Object* LookupSymbol(String* str); |
| 569 static bool LookupSymbolIfExists(String* str, String** symbol); | 579 static bool LookupSymbolIfExists(String* str, String** symbol); |
| 570 | 580 |
| 571 // Compute the matching symbol map for a string if possible. | 581 // Compute the matching symbol map for a string if possible. |
| 572 // NULL is returned if string is in new space or not flattened. | 582 // NULL is returned if string is in new space or not flattened. |
| 573 static Map* SymbolMapForString(String* str); | 583 static Map* SymbolMapForString(String* str); |
| 574 | 584 |
| 575 // Converts the given boolean condition to JavaScript boolean value. | 585 // Converts the given boolean condition to JavaScript boolean value. |
| 576 static Object* ToBoolean(bool condition) { | 586 static Object* ToBoolean(bool condition) { |
| 577 return condition ? true_value() : false_value(); | 587 return condition ? true_value() : false_value(); |
| 578 } | 588 } |
| 579 | 589 |
| 580 // Code that should be run before and after each GC. Includes some | 590 // Code that should be run before and after each GC. Includes some |
| 581 // reporting/verification activities when compiled with DEBUG set. | 591 // reporting/verification activities when compiled with DEBUG set. |
| 582 static void GarbageCollectionPrologue(); | 592 static void GarbageCollectionPrologue(); |
| 583 static void GarbageCollectionEpilogue(); | 593 static void GarbageCollectionEpilogue(); |
| 584 | 594 |
| 595 // Code that should be executed after the garbage collection proper. |
| 596 static void PostGarbageCollectionProcessing(); |
| 597 |
| 585 // Performs garbage collection operation. | 598 // Performs garbage collection operation. |
| 586 // Returns whether required_space bytes are available after the collection. | 599 // Returns whether required_space bytes are available after the collection. |
| 587 static bool CollectGarbage(int required_space, AllocationSpace space); | 600 static bool CollectGarbage(int required_space, AllocationSpace space); |
| 588 | 601 |
| 589 // Performs a full garbage collection. | 602 // Performs a full garbage collection. |
| 590 static void CollectAllGarbage(); | 603 static void CollectAllGarbage(); |
| 591 | 604 |
| 592 // Utility to invoke the scavenger. This is needed in test code to | 605 // Utility to invoke the scavenger. This is needed in test code to |
| 593 // ensure correct callback for weak global handles. | 606 // ensure correct callback for weak global handles. |
| 594 static void PerformScavenge(); | 607 static void PerformScavenge(); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 int marked_count_; | 1283 int marked_count_; |
| 1271 | 1284 |
| 1272 // The count from the end of the previous full GC. Will be zero if there | 1285 // The count from the end of the previous full GC. Will be zero if there |
| 1273 // was no previous full GC. | 1286 // was no previous full GC. |
| 1274 int previous_marked_count_; | 1287 int previous_marked_count_; |
| 1275 }; | 1288 }; |
| 1276 | 1289 |
| 1277 } } // namespace v8::internal | 1290 } } // namespace v8::internal |
| 1278 | 1291 |
| 1279 #endif // V8_HEAP_H_ | 1292 #endif // V8_HEAP_H_ |
| OLD | NEW |