Handlify deoptimization data allocators.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/227603004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20552 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8d3bd702
......@@ -156,11 +156,8 @@ Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData(
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 @@ Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData(
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<HeapNumber> Factory::NewHeapNumber(double value,
Handle<JSObject> Factory::NewNeanderObject() {
CALL_HEAP_FUNCTION(
isolate(),
isolate()->heap()->AllocateJSObjectFromMap(
isolate()->heap()->neander_map()),
JSObject);
return NewJSObjectFromMap(neander_map());
}
......@@ -1449,30 +1439,21 @@ Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
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 @@ static JSFunction* GetTypedArrayFun(ExternalArrayType type,
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));
}
......
......@@ -59,9 +59,13 @@ class Factory V8_FINAL {
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 @@ class Factory V8_FINAL {
// the old generation).
Handle<Struct> NewStruct(InstanceType type);
// Create an AliasedArgumentsEntry.
Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
int aliased_context_slot);
......@@ -320,9 +325,6 @@ class Factory V8_FINAL {
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);
......
......@@ -2685,21 +2685,6 @@ MaybeObject* Heap::AllocateCodeCache() {
}
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[] = {
#define STRING_TYPE_ELEMENT(type, size, name, camel_name) \
{type, size, k##camel_name##MapRootIndex},
......@@ -3245,7 +3230,7 @@ bool Heap::CreateInitialObjects() {
}
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));
......
......@@ -789,12 +789,6 @@ class Heap {
// 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();
......
......@@ -8229,24 +8229,6 @@ Object* AccessorPair::GetComponent(AccessorComponent component) {
}
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
bool DescriptorArray::IsEqualTo(DescriptorArray* other) {
if (IsEmpty()) return other->IsEmpty();
......
......@@ -5278,10 +5278,9 @@ class DeoptimizationInputData: public FixedArray {
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 @@ class DeoptimizationInputData: public FixedArray {
static int IndexForEntry(int i) {
return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
}
static int LengthFor(int entry_count) {
return IndexForEntry(entry_count);
}
};
......@@ -5325,11 +5320,6 @@ class DeoptimizationOutputData: public FixedArray {
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);
......
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