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