Commit f70a26bc authored by yangguo@chromium.org's avatar yangguo@chromium.org

Handlify callers of AllocateUninitializedFixedArray.

R=mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3abbb03c
...@@ -6817,12 +6817,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) { ...@@ -6817,12 +6817,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToArray) {
int position = 0; int position = 0;
if (s->IsFlat() && s->IsOneByteRepresentation()) { if (s->IsFlat() && s->IsOneByteRepresentation()) {
// Try using cached chars where possible. // Try using cached chars where possible.
Object* obj; elements = isolate->factory()->NewUninitializedFixedArray(length);
{ MaybeObject* maybe_obj =
isolate->heap()->AllocateUninitializedFixedArray(length);
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
elements = Handle<FixedArray>(FixedArray::cast(obj), isolate);
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
String::FlatContent content = s->GetFlatContent(); String::FlatContent content = s->GetFlatContent();
if (content.IsAscii()) { if (content.IsAscii()) {
...@@ -7995,35 +7991,26 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewArgumentsFast) { ...@@ -7995,35 +7991,26 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewArgumentsFast) {
RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewStrictArgumentsFast) { RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_NewStrictArgumentsFast) {
SealHandleScope shs(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0)
JSFunction* callee = JSFunction::cast(args[0]);
Object** parameters = reinterpret_cast<Object**>(args[1]); Object** parameters = reinterpret_cast<Object**>(args[1]);
const int length = args.smi_at(2); CONVERT_SMI_ARG_CHECKED(length, 2);
Object* result; Handle<JSObject> result =
{ MaybeObject* maybe_result = isolate->factory()->NewArgumentsObject(callee, length);
isolate->heap()->AllocateArgumentsObject(callee, length);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
// Allocate the elements if needed.
if (length > 0) {
// Allocate the fixed array.
FixedArray* array;
{ MaybeObject* maybe_obj =
isolate->heap()->AllocateUninitializedFixedArray(length);
if (!maybe_obj->To(&array)) return maybe_obj;
}
if (length > 0) {
Handle<FixedArray> array =
isolate->factory()->NewUninitializedFixedArray(length);
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc); WriteBarrierMode mode = array->GetWriteBarrierMode(no_gc);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
array->set(i, *--parameters, mode); array->set(i, *--parameters, mode);
} }
JSObject::cast(result)->set_elements(array); result->set_elements(*array);
} }
return result; return *result;
} }
......
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