Commit a3629daa authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix external allocated memory accounting to use 64 bit values on

64 bit architectures.
Review URL: https://chromiumcodereview.appspot.com/10020032

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11265 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 00d9c147
...@@ -1236,8 +1236,7 @@ class String : public Primitive { ...@@ -1236,8 +1236,7 @@ class String : public Primitive {
* this function should not otherwise delete or modify the resource. Neither * this function should not otherwise delete or modify the resource. Neither
* should the underlying buffer be deallocated or modified except through the * should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource. * destructor of the external string resource.
*/ */ V8EXPORT static Local<String> NewExternal(
V8EXPORT static Local<String> NewExternal(
ExternalAsciiStringResource* resource); ExternalAsciiStringResource* resource);
/** /**
...@@ -3153,7 +3152,8 @@ class V8EXPORT V8 { ...@@ -3153,7 +3152,8 @@ class V8EXPORT V8 {
* that is kept alive by JavaScript objects. * that is kept alive by JavaScript objects.
* \returns the adjusted value. * \returns the adjusted value.
*/ */
static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); static intptr_t AdjustAmountOfExternalAllocatedMemory(
intptr_t change_in_bytes);
/** /**
* Suspends recording of tick samples in the profiler. * Suspends recording of tick samples in the profiler.
......
...@@ -5208,7 +5208,7 @@ void V8::AddImplicitReferences(Persistent<Object> parent, ...@@ -5208,7 +5208,7 @@ void V8::AddImplicitReferences(Persistent<Object> parent,
} }
int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) { if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
return 0; return 0;
......
...@@ -460,15 +460,16 @@ MaybeObject* Heap::PrepareForCompare(String* str) { ...@@ -460,15 +460,16 @@ MaybeObject* Heap::PrepareForCompare(String* str) {
} }
int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
intptr_t change_in_bytes) {
ASSERT(HasBeenSetUp()); ASSERT(HasBeenSetUp());
int amount = amount_of_external_allocated_memory_ + change_in_bytes; intptr_t amount = amount_of_external_allocated_memory_ + change_in_bytes;
if (change_in_bytes >= 0) { if (change_in_bytes >= 0) {
// Avoid overflow. // Avoid overflow.
if (amount > amount_of_external_allocated_memory_) { if (amount > amount_of_external_allocated_memory_) {
amount_of_external_allocated_memory_ = amount; amount_of_external_allocated_memory_ = amount;
} }
int amount_since_last_global_gc = intptr_t amount_since_last_global_gc =
amount_of_external_allocated_memory_ - amount_of_external_allocated_memory_ -
amount_of_external_allocated_memory_at_last_global_gc_; amount_of_external_allocated_memory_at_last_global_gc_;
if (amount_since_last_global_gc > external_allocation_limit_) { if (amount_since_last_global_gc > external_allocation_limit_) {
......
...@@ -1711,7 +1711,7 @@ class Heap { ...@@ -1711,7 +1711,7 @@ class Heap {
// The amount of external memory registered through the API kept alive // The amount of external memory registered through the API kept alive
// by global handles // by global handles
int amount_of_external_allocated_memory_; intptr_t amount_of_external_allocated_memory_;
// Caches the amount of external memory registered at the last global gc. // Caches the amount of external memory registered at the last global gc.
int amount_of_external_allocated_memory_at_last_global_gc_; int amount_of_external_allocated_memory_at_last_global_gc_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment