Revision: 20556
Author:   [email protected]
Date:     Tue Apr  8 06:15:20 2014 UTC
Log:      Revert "Handlify deoptimization data allocators."

This reverts r20552, it breaks with snapshot=off.

[email protected]
BUG=cctest/test-lockers/ExtensionsRegistration
LOG=n

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

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 14:27:48 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc      Tue Apr  8 06:15:20 2014 UTC
@@ -156,8 +156,11 @@
     int deopt_entry_count,
     PretenureFlag pretenure) {
   ASSERT(deopt_entry_count > 0);
-  int len = DeoptimizationInputData::LengthFor(deopt_entry_count);
- return Handle<DeoptimizationInputData>::cast(NewFixedArray(len, pretenure));
+  CALL_HEAP_FUNCTION(isolate(),
+                     DeoptimizationInputData::Allocate(isolate(),
+                                                       deopt_entry_count,
+                                                       pretenure),
+                     DeoptimizationInputData);
 }


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


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


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


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


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


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


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

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


=======================================
--- /branches/bleeding_edge/src/factory.h       Mon Apr  7 14:27:48 2014 UTC
+++ /branches/bleeding_edge/src/factory.h       Tue Apr  8 06:15:20 2014 UTC
@@ -59,13 +59,9 @@

   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);
@@ -215,7 +211,6 @@
   // the old generation).
   Handle<Struct> NewStruct(InstanceType type);

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

@@ -325,6 +320,9 @@
       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:27:48 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Tue Apr  8 06:15:20 2014 UTC
@@ -2683,6 +2683,21 @@
   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[] = {
@@ -3230,7 +3245,7 @@
   }
   set_non_monomorphic_cache(UnseededNumberDictionary::cast(obj));

-  { MaybeObject* maybe_obj = AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE);
+  { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache();
     if (!maybe_obj->ToObject(&obj)) return false;
   }
   set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj));
=======================================
--- /branches/bleeding_edge/src/heap.h  Mon Apr  7 14:27:48 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Tue Apr  8 06:15:20 2014 UTC
@@ -789,6 +789,12 @@
   // 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 14:27:48 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Apr  8 06:15:20 2014 UTC
@@ -8227,6 +8227,24 @@
   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 14:27:48 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Apr  8 06:15:20 2014 UTC
@@ -5278,9 +5278,10 @@
     return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize;
   }

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

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


@@ -5319,6 +5324,11 @@
   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