Revision: 20552
Author:   [email protected]
Date:     Mon Apr  7 14:27:48 2014 UTC
Log:      Handlify deoptimization data allocators.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/factory.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/factory.cc      Mon Apr  7 12:43:35 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc      Mon Apr  7 14:27:48 2014 UTC
@@ -156,11 +156,8 @@
     int deopt_entry_count,
     PretenureFlag pretenure) {
   ASSERT(deopt_entry_count > 0);
-  CALL_HEAP_FUNCTION(isolate(),
-                     DeoptimizationInputData::Allocate(isolate(),
-                                                       deopt_entry_count,
-                                                       pretenure),
-                     DeoptimizationInputData);
+  int len = DeoptimizationInputData::LengthFor(deopt_entry_count);
+ return Handle<DeoptimizationInputData>::cast(NewFixedArray(len, pretenure));
 }


@@ -168,11 +165,8 @@
     int deopt_entry_count,
     PretenureFlag pretenure) {
   ASSERT(deopt_entry_count > 0);
-  CALL_HEAP_FUNCTION(isolate(),
-                     DeoptimizationOutputData::Allocate(isolate(),
-                                                        deopt_entry_count,
-                                                        pretenure),
-                     DeoptimizationOutputData);
+ int len = DeoptimizationOutputData::LengthOfFixedArray(deopt_entry_count); + return Handle<DeoptimizationOutputData>::cast(NewFixedArray(len, pretenure));
 }


@@ -982,11 +976,7 @@


 Handle<JSObject> Factory::NewNeanderObject() {
-  CALL_HEAP_FUNCTION(
-      isolate(),
-      isolate()->heap()->AllocateJSObjectFromMap(
-          isolate()->heap()->neander_map()),
-      JSObject);
+  return NewJSObjectFromMap(neander_map());
 }


@@ -1449,30 +1439,21 @@
   JSFunction::EnsureHasInitialMap(function);
   Handle<Map> map(function->initial_map());
   ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
-  CALL_HEAP_FUNCTION(
-      isolate(),
-      isolate()->heap()->AllocateJSObjectFromMap(*map),
-      JSGeneratorObject);
+  return Handle<JSGeneratorObject>::cast(NewJSObjectFromMap(map));
 }


 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() {
   Handle<JSFunction> array_buffer_fun(
       isolate()->context()->native_context()->array_buffer_fun());
-  CALL_HEAP_FUNCTION(
-      isolate(),
-      isolate()->heap()->AllocateJSObject(*array_buffer_fun),
-      JSArrayBuffer);
+  return Handle<JSArrayBuffer>::cast(NewJSObject(array_buffer_fun));
 }


 Handle<JSDataView> Factory::NewJSDataView() {
   Handle<JSFunction> data_view_fun(
       isolate()->context()->native_context()->data_view_fun());
-  CALL_HEAP_FUNCTION(
-      isolate(),
-      isolate()->heap()->AllocateJSObject(*data_view_fun),
-      JSDataView);
+  return Handle<JSDataView>::cast(NewJSObject(data_view_fun));
 }


@@ -1496,11 +1477,7 @@

 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) {
Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate()));
-
-  CALL_HEAP_FUNCTION(
-      isolate(),
-      isolate()->heap()->AllocateJSObject(*typed_array_fun_handle),
-      JSTypedArray);
+  return Handle<JSTypedArray>::cast(NewJSObject(typed_array_fun_handle));
 }


=======================================
--- /branches/bleeding_edge/src/factory.h       Mon Apr  7 12:43:35 2014 UTC
+++ /branches/bleeding_edge/src/factory.h       Mon Apr  7 14:27:48 2014 UTC
@@ -59,9 +59,13 @@

   Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors,
                                              int slack = 0);
+
+  // Create a DeoptimizationInputData.
   Handle<DeoptimizationInputData> NewDeoptimizationInputData(
       int deopt_entry_count,
       PretenureFlag pretenure);
+
+  // Create a DeoptimizationOutputData.
   Handle<DeoptimizationOutputData> NewDeoptimizationOutputData(
       int deopt_entry_count,
       PretenureFlag pretenure);
@@ -211,6 +215,7 @@
   // the old generation).
   Handle<Struct> NewStruct(InstanceType type);

+  // Create an AliasedArgumentsEntry.
   Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
       int aliased_context_slot);

@@ -320,9 +325,6 @@
       bool allocate_properties = true,
Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null());

-  Handle<JSObject> NewJSObjectFromMapForDeoptimizer(
-      Handle<Map> map, PretenureFlag pretenure = NOT_TENURED);
-
   // JS modules are pretenured.
   Handle<JSModule> NewJSModule(Handle<Context> context,
                                Handle<ScopeInfo> scope_info);
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Apr  7 14:22:32 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Apr  7 14:27:48 2014 UTC
@@ -2683,21 +2683,6 @@
   code_cache->set_normal_type_cache(undefined_value(), SKIP_WRITE_BARRIER);
   return code_cache;
 }
-
-
-MaybeObject* Heap::AllocatePolymorphicCodeCache() {
-  return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE);
-}
-
-
-MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) {
-  AliasedArgumentsEntry* entry;
- { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE);
-    if (!maybe_entry->To(&entry)) return maybe_entry;
-  }
-  entry->set_aliased_context_slot(aliased_context_slot);
-  return entry;
-}


 const Heap::StringTypeTable Heap::string_type_table[] = {
@@ -3245,7 +3230,7 @@
   }
   set_non_monomorphic_cache(UnseededNumberDictionary::cast(obj));

-  { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache();
+  { MaybeObject* maybe_obj = AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE);
     if (!maybe_obj->ToObject(&obj)) return false;
   }
   set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj));
=======================================
--- /branches/bleeding_edge/src/heap.h  Mon Apr  7 14:22:32 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Mon Apr  7 14:27:48 2014 UTC
@@ -789,12 +789,6 @@
   // Allocates an empty code cache.
   MUST_USE_RESULT MaybeObject* AllocateCodeCache();

-  // Allocates an empty PolymorphicCodeCache.
-  MUST_USE_RESULT MaybeObject* AllocatePolymorphicCodeCache();
-
-  // Allocates an AliasedArgumentsEntry.
-  MUST_USE_RESULT MaybeObject* AllocateAliasedArgumentsEntry(int slot);
-
   // Clear the Instanceof cache (used when a prototype changes).
   inline void ClearInstanceofCache();

=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Apr  7 10:00:14 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Apr  7 14:27:48 2014 UTC
@@ -8227,24 +8227,6 @@
   Object* accessor = get(component);
   return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor;
 }
-
-
-MaybeObject* DeoptimizationInputData::Allocate(Isolate* isolate,
-                                               int deopt_entry_count,
-                                               PretenureFlag pretenure) {
-  ASSERT(deopt_entry_count > 0);
-  return isolate->heap()->AllocateFixedArray(LengthFor(deopt_entry_count),
-                                             pretenure);
-}
-
-
-MaybeObject* DeoptimizationOutputData::Allocate(Isolate* isolate,
-                                                int number_of_deopt_points,
-                                                PretenureFlag pretenure) {
- if (number_of_deopt_points == 0) return isolate->heap()->empty_fixed_array();
-  return isolate->heap()->AllocateFixedArray(
-      LengthOfFixedArray(number_of_deopt_points), pretenure);
-}


 #ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Apr  7 10:00:14 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Mon Apr  7 14:27:48 2014 UTC
@@ -5278,10 +5278,9 @@
     return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize;
   }

-  // Allocates a DeoptimizationInputData.
-  MUST_USE_RESULT static MaybeObject* Allocate(Isolate* isolate,
-                                               int deopt_entry_count,
-                                               PretenureFlag pretenure);
+  static int LengthFor(int entry_count) {
+    return IndexForEntry(entry_count);
+  }

   // Casting.
   static inline DeoptimizationInputData* cast(Object* obj);
@@ -5294,10 +5293,6 @@
   static int IndexForEntry(int i) {
     return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
   }
-
-  static int LengthFor(int entry_count) {
-    return IndexForEntry(entry_count);
-  }
 };


@@ -5324,11 +5319,6 @@
   static int LengthOfFixedArray(int deopt_points) {
     return deopt_points * 2;
   }
-
-  // Allocates a DeoptimizationOutputData.
-  MUST_USE_RESULT static MaybeObject* Allocate(Isolate* isolate,
-                                               int number_of_deopt_points,
-                                               PretenureFlag pretenure);

   // Casting.
   static inline DeoptimizationOutputData* cast(Object* obj);

--
--
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