| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 Address* NewSpaceAllocationTopAddress() { | 441 Address* NewSpaceAllocationTopAddress() { |
| 442 return new_space_.allocation_top_address(); | 442 return new_space_.allocation_top_address(); |
| 443 } | 443 } |
| 444 Address* NewSpaceAllocationLimitAddress() { | 444 Address* NewSpaceAllocationLimitAddress() { |
| 445 return new_space_.allocation_limit_address(); | 445 return new_space_.allocation_limit_address(); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // Uncommit unused semi space. | 448 // Uncommit unused semi space. |
| 449 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } | 449 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } |
| 450 | 450 |
| 451 #ifdef ENABLE_HEAP_PROTECTION | |
| 452 // Protect/unprotect the heap by marking all spaces read-only/writable. | |
| 453 void Protect(); | |
| 454 void Unprotect(); | |
| 455 #endif | |
| 456 | |
| 457 // Allocates and initializes a new JavaScript object based on a | 451 // Allocates and initializes a new JavaScript object based on a |
| 458 // constructor. | 452 // constructor. |
| 459 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 453 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 460 // failed. | 454 // failed. |
| 461 // Please note this does not perform a garbage collection. | 455 // Please note this does not perform a garbage collection. |
| 462 MUST_USE_RESULT MaybeObject* AllocateJSObject( | 456 MUST_USE_RESULT MaybeObject* AllocateJSObject( |
| 463 JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED); | 457 JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED); |
| 464 | 458 |
| 465 // Allocates and initializes a new global object based on a constructor. | 459 // Allocates and initializes a new global object based on a constructor. |
| 466 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 460 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| (...skipping 12 matching lines...) Expand all Loading... |
| 479 // Please note this does not perform a garbage collection. | 473 // Please note this does not perform a garbage collection. |
| 480 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); | 474 MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function); |
| 481 | 475 |
| 482 // Allocates a Harmony Proxy. | 476 // Allocates a Harmony Proxy. |
| 483 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 477 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 484 // failed. | 478 // failed. |
| 485 // Please note this does not perform a garbage collection. | 479 // Please note this does not perform a garbage collection. |
| 486 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler, | 480 MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler, |
| 487 Object* prototype); | 481 Object* prototype); |
| 488 | 482 |
| 483 // Reinitialize a JSProxy into an (empty) JSObject. The receiver |
| 484 // must have the same size as an empty object. The object is reinitialized |
| 485 // and behaves as an object that has been freshly allocated. |
| 486 MUST_USE_RESULT MaybeObject* ReinitializeJSProxyAsJSObject(JSProxy* object); |
| 487 |
| 489 // Reinitialize an JSGlobalProxy based on a constructor. The object | 488 // Reinitialize an JSGlobalProxy based on a constructor. The object |
| 490 // must have the same size as objects allocated using the | 489 // must have the same size as objects allocated using the |
| 491 // constructor. The object is reinitialized and behaves as an | 490 // constructor. The object is reinitialized and behaves as an |
| 492 // object that has been freshly allocated using the constructor. | 491 // object that has been freshly allocated using the constructor. |
| 493 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( | 492 MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy( |
| 494 JSFunction* constructor, JSGlobalProxy* global); | 493 JSFunction* constructor, JSGlobalProxy* global); |
| 495 | 494 |
| 496 // Allocates and initializes a new JavaScript object based on a map. | 495 // Allocates and initializes a new JavaScript object based on a map. |
| 497 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 496 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 498 // failed. | 497 // failed. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length); | 649 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length); |
| 651 | 650 |
| 652 // Make a copy of src and return it. Returns | 651 // Make a copy of src and return it. Returns |
| 653 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 652 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 654 MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src); | 653 MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src); |
| 655 | 654 |
| 656 // Make a copy of src, set the map, and return the copy. Returns | 655 // Make a copy of src, set the map, and return the copy. Returns |
| 657 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 656 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 658 MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map); | 657 MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map); |
| 659 | 658 |
| 659 // Make a copy of src and return it. Returns |
| 660 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 661 MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray( |
| 662 FixedDoubleArray* src); |
| 663 |
| 664 // Make a copy of src, set the map, and return the copy. Returns |
| 665 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 666 MUST_USE_RESULT MaybeObject* CopyFixedDoubleArrayWithMap( |
| 667 FixedDoubleArray* src, Map* map); |
| 668 |
| 660 // Allocates a fixed array initialized with the hole values. | 669 // Allocates a fixed array initialized with the hole values. |
| 661 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 670 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 662 // failed. | 671 // failed. |
| 663 // Please note this does not perform a garbage collection. | 672 // Please note this does not perform a garbage collection. |
| 664 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithHoles( | 673 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithHoles( |
| 665 int length, | 674 int length, |
| 666 PretenureFlag pretenure = NOT_TENURED); | 675 PretenureFlag pretenure = NOT_TENURED); |
| 667 | 676 |
| 668 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( | 677 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( |
| 669 int length, | 678 int length, |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 void LargeObjectSpaceCheckStoreBuffer(); | 1103 void LargeObjectSpaceCheckStoreBuffer(); |
| 1095 | 1104 |
| 1096 // Report heap statistics. | 1105 // Report heap statistics. |
| 1097 void ReportHeapStatistics(const char* title); | 1106 void ReportHeapStatistics(const char* title); |
| 1098 void ReportCodeStatistics(const char* title); | 1107 void ReportCodeStatistics(const char* title); |
| 1099 | 1108 |
| 1100 // Fill in bogus values in from space | 1109 // Fill in bogus values in from space |
| 1101 void ZapFromSpace(); | 1110 void ZapFromSpace(); |
| 1102 #endif | 1111 #endif |
| 1103 | 1112 |
| 1104 #if defined(ENABLE_LOGGING_AND_PROFILING) | |
| 1105 // Print short heap statistics. | 1113 // Print short heap statistics. |
| 1106 void PrintShortHeapStatistics(); | 1114 void PrintShortHeapStatistics(); |
| 1107 #endif | |
| 1108 | 1115 |
| 1109 // Makes a new symbol object | 1116 // Makes a new symbol object |
| 1110 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1117 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1111 // failed. | 1118 // failed. |
| 1112 // Please note this function does not perform a garbage collection. | 1119 // Please note this function does not perform a garbage collection. |
| 1113 MUST_USE_RESULT MaybeObject* CreateSymbol( | 1120 MUST_USE_RESULT MaybeObject* CreateSymbol( |
| 1114 const char* str, int length, int hash); | 1121 const char* str, int length, int hash); |
| 1115 MUST_USE_RESULT MaybeObject* CreateSymbol(String* str); | 1122 MUST_USE_RESULT MaybeObject* CreateSymbol(String* str); |
| 1116 | 1123 |
| 1117 // Write barrier support for address[offset] = o. | 1124 // Write barrier support for address[offset] = o. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 // Performs a major collection in the whole heap. | 1605 // Performs a major collection in the whole heap. |
| 1599 void MarkCompact(GCTracer* tracer); | 1606 void MarkCompact(GCTracer* tracer); |
| 1600 | 1607 |
| 1601 // Code to be run before and after mark-compact. | 1608 // Code to be run before and after mark-compact. |
| 1602 void MarkCompactPrologue(); | 1609 void MarkCompactPrologue(); |
| 1603 | 1610 |
| 1604 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1611 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 1605 // around a GC). | 1612 // around a GC). |
| 1606 inline void CompletelyClearInstanceofCache(); | 1613 inline void CompletelyClearInstanceofCache(); |
| 1607 | 1614 |
| 1608 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | |
| 1609 // Record statistics before and after garbage collection. | 1615 // Record statistics before and after garbage collection. |
| 1610 void ReportStatisticsBeforeGC(); | 1616 void ReportStatisticsBeforeGC(); |
| 1611 void ReportStatisticsAfterGC(); | 1617 void ReportStatisticsAfterGC(); |
| 1612 #endif | |
| 1613 | 1618 |
| 1614 // Slow part of scavenge object. | 1619 // Slow part of scavenge object. |
| 1615 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); | 1620 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); |
| 1616 | 1621 |
| 1617 // Initializes a function with a shared part and prototype. | 1622 // Initializes a function with a shared part and prototype. |
| 1618 // Returns the function. | 1623 // Returns the function. |
| 1619 // Note: this code was factored out of AllocateFunction such that | 1624 // Note: this code was factored out of AllocateFunction such that |
| 1620 // other parts of the VM could use it. Specifically, a function that creates | 1625 // other parts of the VM could use it. Specifically, a function that creates |
| 1621 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. | 1626 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. |
| 1622 // Please note this does not perform a garbage collection. | 1627 // Please note this does not perform a garbage collection. |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2385 |
| 2381 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2386 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2382 }; | 2387 }; |
| 2383 #endif // DEBUG || LIVE_OBJECT_LIST | 2388 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2384 | 2389 |
| 2385 } } // namespace v8::internal | 2390 } } // namespace v8::internal |
| 2386 | 2391 |
| 2387 #undef HEAP | 2392 #undef HEAP |
| 2388 | 2393 |
| 2389 #endif // V8_HEAP_H_ | 2394 #endif // V8_HEAP_H_ |
| OLD | NEW |