Index: src/api.h |
diff --git a/src/api.h b/src/api.h |
index 438c4f31dc40967df0208c8ba518f6d83297d077..fc7a4eff6fc85992ced1c8329471c99d73be1063 100644 |
--- a/src/api.h |
+++ b/src/api.h |
@@ -406,72 +406,6 @@ OPEN_HANDLE_LIST(MAKE_OPEN_HANDLE) |
namespace internal { |
-// Tracks string usage to help make better decisions when |
-// externalizing strings. |
-// |
-// Implementation note: internally this class only tracks fresh |
-// strings and keeps a single use counter for them. |
-class StringTracker { |
- public: |
- // Records that the given string's characters were copied to some |
- // external buffer. If this happens often we should honor |
- // externalization requests for the string. |
- void RecordWrite(Handle<String> string) { |
- Address address = reinterpret_cast<Address>(*string); |
- Address top = isolate_->heap()->NewSpaceTop(); |
- if (IsFreshString(address, top)) { |
- IncrementUseCount(top); |
- } |
- } |
- |
- // Estimates freshness and use frequency of the given string based |
- // on how close it is to the new space top and the recorded usage |
- // history. |
- inline bool IsFreshUnusedString(Handle<String> string) { |
- Address address = reinterpret_cast<Address>(*string); |
- Address top = isolate_->heap()->NewSpaceTop(); |
- return IsFreshString(address, top) && IsUseCountLow(top); |
- } |
- |
- private: |
- StringTracker() : use_count_(0), last_top_(NULL), isolate_(NULL) { } |
- |
- static inline bool IsFreshString(Address string, Address top) { |
- return top - kFreshnessLimit <= string && string <= top; |
- } |
- |
- inline bool IsUseCountLow(Address top) { |
- if (last_top_ != top) return true; |
- return use_count_ < kUseLimit; |
- } |
- |
- inline void IncrementUseCount(Address top) { |
- if (last_top_ != top) { |
- use_count_ = 0; |
- last_top_ = top; |
- } |
- ++use_count_; |
- } |
- |
- // Single use counter shared by all fresh strings. |
- int use_count_; |
- |
- // Last new space top when the use count above was valid. |
- Address last_top_; |
- |
- Isolate* isolate_; |
- |
- // How close to the new space top a fresh string has to be. |
- static const int kFreshnessLimit = 1024; |
- |
- // The number of uses required to consider a string useful. |
- static const int kUseLimit = 32; |
- |
- friend class Isolate; |
- |
- DISALLOW_COPY_AND_ASSIGN(StringTracker); |
-}; |
- |
class DeferredHandles { |
public: |