Revision: 11265
Author:   [email protected]
Date:     Wed Apr 11 02:23:57 2012
Log:      Fix external allocated memory accounting to use 64 bit values on
64 bit architectures.
Review URL: https://chromiumcodereview.appspot.com/10020032
http://code.google.com/p/v8/source/detail?r=11265

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/heap-inl.h
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/include/v8.h        Mon Mar 19 02:51:36 2012
+++ /branches/bleeding_edge/include/v8.h        Wed Apr 11 02:23:57 2012
@@ -1236,8 +1236,7 @@
* this function should not otherwise delete or modify the resource. Neither * should the underlying buffer be deallocated or modified except through the
    * destructor of the external string resource.
-   */
-  V8EXPORT static Local<String> NewExternal(
+   */ V8EXPORT static Local<String> NewExternal(
       ExternalAsciiStringResource* resource);

   /**
@@ -3153,7 +3152,8 @@
    *   that is kept alive by JavaScript objects.
    * \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.
=======================================
--- /branches/bleeding_edge/src/api.cc  Sun Apr  8 12:18:06 2012
+++ /branches/bleeding_edge/src/api.cc  Wed Apr 11 02:23:57 2012
@@ -5208,7 +5208,7 @@
 }


-int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
+intptr_t V8::AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes) {
   i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
     return 0;
=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Mon Mar  5 00:17:16 2012
+++ /branches/bleeding_edge/src/heap-inl.h      Wed Apr 11 02:23:57 2012
@@ -460,15 +460,16 @@
 }


-int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
+intptr_t Heap::AdjustAmountOfExternalAllocatedMemory(
+    intptr_t change_in_bytes) {
   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) {
     // Avoid overflow.
     if (amount > amount_of_external_allocated_memory_) {
       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_at_last_global_gc_;
     if (amount_since_last_global_gc > external_allocation_limit_) {
=======================================
--- /branches/bleeding_edge/src/heap.h  Tue Apr  3 00:32:19 2012
+++ /branches/bleeding_edge/src/heap.h  Wed Apr 11 02:23:57 2012
@@ -1711,7 +1711,7 @@

   // The amount of external memory registered through the API kept alive
   // 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.
   int amount_of_external_allocated_memory_at_last_global_gc_;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to