Revision: 21069
Author:   [email protected]
Date:     Wed Apr 30 06:26:50 2014 UTC
Log:      Hide some more heap allocators.

[email protected]

Review URL: https://codereview.chromium.org/252213002
http://code.google.com/p/v8/source/detail?r=21069

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/test/cctest/cctest.h
 /branches/bleeding_edge/test/cctest/test-heap.cc
 /branches/bleeding_edge/test/cctest/test-mark-compact.cc

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Apr 29 19:37:56 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Wed Apr 30 06:26:50 2014 UTC
@@ -4292,18 +4292,6 @@
   ConstantPoolArray::cast(result)->Init(0, 0, 0, 0);
   return result;
 }
-
-
-MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
-  Object* result;
-  { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
-    if (!maybe_result->ToObject(&result)) return maybe_result;
-  }
-  reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(
-      hash_table_map());
-  ASSERT(result->IsHashTable());
-  return result;
-}


 MaybeObject* Heap::AllocateSymbol() {
=======================================
--- /branches/bleeding_edge/src/heap.h  Tue Apr 29 14:31:12 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Wed Apr 30 06:26:50 2014 UTC
@@ -698,72 +698,13 @@
   // For use during bootup.
   void RepairFreeListsAfterBoot();

-  // Allocates an internalized string in old space based on the character
-  // stream. Returns Failure::RetryAfterGC(requested_bytes, space) if the
-  // allocation failed.
-  // Please note this function does not perform a garbage collection.
-  MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8(
-      Vector<const char> str,
-      int chars,
-      uint32_t hash_field);
-
-  MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString(
-        Vector<const uint8_t> str,
-        uint32_t hash_field);
-
-  MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString(
-        Vector<const uc16> str,
-        uint32_t hash_field);
-
   template<typename T>
   static inline bool IsOneByte(T t, int chars);

-  template<typename T>
-  MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl(
-      T t, int chars, uint32_t hash_field);
-
-  // Allocates a fixed array initialized with undefined values
- // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
-  // failed.
-  // Please note this does not perform a garbage collection.
-  MUST_USE_RESULT MaybeObject* AllocateFixedArray(
-      int length,
-      PretenureFlag pretenure = NOT_TENURED);
-
- // Allocates an uninitialized fixed array. It must be filled by the caller.
-  //
- // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
-  // failed.
-  // Please note this does not perform a garbage collection.
-  MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length);
-
// Move len elements within a given array from src_index index to dst_index
   // index.
void MoveElements(FixedArray* array, int dst_index, int src_index, int len);

-  // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
-  MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src);
-
-  // Make a copy of src, set the map, and return the copy. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. - MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map);
-
-  // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
-  MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray(
-      FixedDoubleArray* src);
-
-  // Make a copy of src and return it. Returns
- // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
-  MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray(
-      ConstantPoolArray* src);
-
-  // AllocateHashTable is identical to AllocateFixedArray except
-  // that the resulting object has hash_table_map as map.
-  MUST_USE_RESULT MaybeObject* AllocateHashTable(
-      int length, PretenureFlag pretenure = NOT_TENURED);
-
   // Sloppy mode arguments object size.
   static const int kSloppyArgumentsObjectSize =
       JSObject::kHeaderSize + 2 * kPointerSize;
@@ -798,7 +739,6 @@
   void AdjustLiveBytes(Address address, int by, InvocationMode mode);

   bool InternalizeStringIfExists(String* str, String** result);
-  bool InternalizeTwoCharsStringIfExists(String* str, String** result);

   // Converts the given boolean condition to JavaScript boolean value.
   inline Object* ToBoolean(bool condition);
@@ -1542,6 +1482,11 @@

   MUST_USE_RESULT MaybeObject* CopyCode(Code* code);

+  // Allocates a fixed array initialized with undefined values
+  MUST_USE_RESULT MaybeObject* AllocateFixedArray(
+      int length,
+      PretenureFlag pretenure = NOT_TENURED);
+
  private:
   Heap();

@@ -1866,10 +1811,51 @@
   bool CreateInitialMaps();
   void CreateInitialObjects();

+  // Allocates an internalized string in old space based on the character
+  // stream.
+  MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8(
+      Vector<const char> str,
+      int chars,
+      uint32_t hash_field);
+
+  MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString(
+        Vector<const uint8_t> str,
+        uint32_t hash_field);
+
+  MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString(
+        Vector<const uc16> str,
+        uint32_t hash_field);
+
   template<bool is_one_byte, typename T>
   MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl(
       T t, int chars, uint32_t hash_field);

+  template<typename T>
+  MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl(
+      T t, int chars, uint32_t hash_field);
+
+ // Allocates an uninitialized fixed array. It must be filled by the caller.
+  MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length);
+
+  // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+  MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src);
+
+  // Make a copy of src, set the map, and return the copy. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. + MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map);
+
+  // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+  MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray(
+      FixedDoubleArray* src);
+
+  // Make a copy of src and return it. Returns
+ // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
+  MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray(
+      ConstantPoolArray* src);
+
+
   // Computes a single character string where the character has code.
   // A cache is used for ASCII codes.
   MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode(
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.h Tue Apr 29 13:58:55 2014 UTC +++ /branches/bleeding_edge/test/cctest/cctest.h Wed Apr 30 06:26:50 2014 UTC
@@ -83,12 +83,13 @@
 // Use this to expose protected methods in i::Heap.
 class TestHeap : public i::Heap {
  public:
+  using i::Heap::AllocateArgumentsObject;
+  using i::Heap::AllocateByteArray;
+  using i::Heap::AllocateFixedArray;
   using i::Heap::AllocateHeapNumber;
-  using i::Heap::AllocateMap;
   using i::Heap::AllocateJSObject;
   using i::Heap::AllocateJSObjectFromMap;
-  using i::Heap::AllocateByteArray;
-  using i::Heap::AllocateArgumentsObject;
+  using i::Heap::AllocateMap;
   using i::Heap::CopyCode;
 };

=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Tue Apr 29 13:58:55 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap.cc Wed Apr 30 06:26:50 2014 UTC
@@ -1624,7 +1624,7 @@
     AlwaysAllocateScope always_allocate(CcTest::i_isolate());
     int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
     for (int i = 1; i <= 100; i++) {
-      CcTest::heap()->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
+ CcTest::test_heap()->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
       CHECK_EQ(initial_size + i * filler_size,
                static_cast<int>(CcTest::heap()->SizeOfObjects()));
     }
=======================================
--- /branches/bleeding_edge/test/cctest/test-mark-compact.cc Tue Apr 29 13:58:55 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-mark-compact.cc Wed Apr 30 06:26:50 2014 UTC
@@ -76,7 +76,7 @@

 TEST(Promotion) {
   CcTest::InitializeVM();
-  Heap* heap = CcTest::heap();
+  TestHeap* heap = CcTest::test_heap();
   heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0);

   v8::HandleScope sc(CcTest::isolate());
@@ -101,7 +101,7 @@

 TEST(NoPromotion) {
   CcTest::InitializeVM();
-  Heap* heap = CcTest::heap();
+  TestHeap* heap = CcTest::test_heap();
   heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0);

   v8::HandleScope sc(CcTest::isolate());
@@ -253,7 +253,7 @@
   FLAG_incremental_marking = false;
   CcTest::InitializeVM();
   GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
-  Heap* heap = CcTest::heap();
+  TestHeap* heap = CcTest::test_heap();
   NumberOfWeakCalls = 0;
   v8::HandleScope handle_scope(CcTest::isolate());

@@ -392,7 +392,7 @@
   v8::HandleScope handle_scope(CcTest::isolate());

   Handle<Object> object = global_handles->Create(
-      CcTest::heap()->AllocateFixedArray(1)->ToObjectChecked());
+      CcTest::test_heap()->AllocateFixedArray(1)->ToObjectChecked());

   TestRetainedObjectInfo info;
   global_handles->AddObjectGroup(NULL, 0, &info);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to