Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: src/heap.h

Issue 310393003: Move most of the implementation of AdjustAmountOfExternalMemory to v8.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_H_ 5 #ifndef V8_HEAP_H_
6 #define V8_HEAP_H_ 6 #define V8_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // Support for partial snapshots. After calling this we have a linear 1029 // Support for partial snapshots. After calling this we have a linear
1030 // space to write objects in each space. 1030 // space to write objects in each space.
1031 void ReserveSpace(int *sizes, Address* addresses); 1031 void ReserveSpace(int *sizes, Address* addresses);
1032 1032
1033 // 1033 //
1034 // Support for the API. 1034 // Support for the API.
1035 // 1035 //
1036 1036
1037 void CreateApiObjects(); 1037 void CreateApiObjects();
1038 1038
1039 // Adjusts the amount of registered external memory.
1040 // Returns the adjusted value.
1041 inline int64_t AdjustAmountOfExternalAllocatedMemory(
1042 int64_t change_in_bytes);
1043
1044 inline intptr_t PromotedTotalSize() { 1039 inline intptr_t PromotedTotalSize() {
1045 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); 1040 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
1046 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); 1041 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt);
1047 if (total < 0) return 0; 1042 if (total < 0) return 0;
1048 return static_cast<intptr_t>(total); 1043 return static_cast<intptr_t>(total);
1049 } 1044 }
1050 1045
1051 inline intptr_t OldGenerationSpaceAvailable() { 1046 inline intptr_t OldGenerationSpaceAvailable() {
1052 return old_generation_allocation_limit_ - PromotedTotalSize(); 1047 return old_generation_allocation_limit_ - PromotedTotalSize();
1053 } 1048 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 MUST_USE_RESULT AllocationResult CopyCode(Code* code); 1488 MUST_USE_RESULT AllocationResult CopyCode(Code* code);
1494 1489
1495 // Allocates a fixed array initialized with undefined values 1490 // Allocates a fixed array initialized with undefined values
1496 MUST_USE_RESULT AllocationResult AllocateFixedArray( 1491 MUST_USE_RESULT AllocationResult AllocateFixedArray(
1497 int length, 1492 int length,
1498 PretenureFlag pretenure = NOT_TENURED); 1493 PretenureFlag pretenure = NOT_TENURED);
1499 1494
1500 private: 1495 private:
1501 Heap(); 1496 Heap();
1502 1497
1498 // The amount of external memory registered through the API kept alive
1499 // by global handles
1500 int64_t amount_of_external_allocated_memory_;
1501
1502 // Caches the amount of external memory registered at the last global gc.
1503 int64_t amount_of_external_allocated_memory_at_last_global_gc_;
1504
1503 // This can be calculated directly from a pointer to the heap; however, it is 1505 // This can be calculated directly from a pointer to the heap; however, it is
1504 // more expedient to get at the isolate directly from within Heap methods. 1506 // more expedient to get at the isolate directly from within Heap methods.
1505 Isolate* isolate_; 1507 Isolate* isolate_;
1506 1508
1507 Object* roots_[kRootListLength]; 1509 Object* roots_[kRootListLength];
1508 1510
1509 intptr_t code_range_size_; 1511 intptr_t code_range_size_;
1510 int reserved_semispace_size_; 1512 int reserved_semispace_size_;
1511 int max_semi_space_size_; 1513 int max_semi_space_size_;
1512 int initial_semispace_size_; 1514 int initial_semispace_size_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 1585
1584 // Limit that triggers a global GC on the next (normally caused) GC. This 1586 // Limit that triggers a global GC on the next (normally caused) GC. This
1585 // is checked when we have already decided to do a GC to help determine 1587 // is checked when we have already decided to do a GC to help determine
1586 // which collector to invoke, before expanding a paged space in the old 1588 // which collector to invoke, before expanding a paged space in the old
1587 // generation and on every allocation in large object space. 1589 // generation and on every allocation in large object space.
1588 intptr_t old_generation_allocation_limit_; 1590 intptr_t old_generation_allocation_limit_;
1589 1591
1590 // Used to adjust the limits that control the timing of the next GC. 1592 // Used to adjust the limits that control the timing of the next GC.
1591 intptr_t size_of_old_gen_at_last_old_space_gc_; 1593 intptr_t size_of_old_gen_at_last_old_space_gc_;
1592 1594
1593 // Limit on the amount of externally allocated memory allowed
1594 // between global GCs. If reached a global GC is forced.
1595 intptr_t external_allocation_limit_;
1596
1597 // The amount of external memory registered through the API kept alive
1598 // by global handles
1599 int64_t amount_of_external_allocated_memory_;
1600
1601 // Caches the amount of external memory registered at the last global gc.
1602 int64_t amount_of_external_allocated_memory_at_last_global_gc_;
1603
1604 // Indicates that an allocation has failed in the old generation since the 1595 // Indicates that an allocation has failed in the old generation since the
1605 // last GC. 1596 // last GC.
1606 bool old_gen_exhausted_; 1597 bool old_gen_exhausted_;
1607 1598
1608 // Indicates that inline bump-pointer allocation has been globally disabled 1599 // Indicates that inline bump-pointer allocation has been globally disabled
1609 // for all spaces. This is used to disable allocations in generated code. 1600 // for all spaces. This is used to disable allocations in generated code.
1610 bool inline_allocation_disabled_; 1601 bool inline_allocation_disabled_;
1611 1602
1612 // Weak list heads, threaded through the objects. 1603 // Weak list heads, threaded through the objects.
1613 // List heads are initilized lazily and contain the undefined_value at start. 1604 // List heads are initilized lazily and contain the undefined_value at start.
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2779 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2789 2780
2790 private: 2781 private:
2791 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2782 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2792 }; 2783 };
2793 #endif // DEBUG 2784 #endif // DEBUG
2794 2785
2795 } } // namespace v8::internal 2786 } } // namespace v8::internal
2796 2787
2797 #endif // V8_HEAP_H_ 2788 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698