Commit 3d0c96f8 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Handlify RuntimeHidden_RegExpConstructResult.

R=mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20558 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ec56870d
...@@ -2604,38 +2604,21 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpExec) { ...@@ -2604,38 +2604,21 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpExec) {
RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpConstructResult) { RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_RegExpConstructResult) {
SealHandleScope shs(isolate); HandleScope handle_scope(isolate);
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
CONVERT_SMI_ARG_CHECKED(elements_count, 0); CONVERT_SMI_ARG_CHECKED(size, 0);
if (elements_count < 0 || RUNTIME_ASSERT(size >= 0 && size <= FixedArray::kMaxLength);
elements_count > FixedArray::kMaxLength || Handle<FixedArray> elements = isolate->factory()->NewFixedArray(size);
!Smi::IsValid(elements_count)) { Handle<Map> regexp_map(isolate->native_context()->regexp_result_map());
return isolate->ThrowIllegalOperation(); Handle<JSObject> object =
} isolate->factory()->NewJSObjectFromMap(regexp_map, NOT_TENURED, false);
Object* new_object; Handle<JSArray> array = Handle<JSArray>::cast(object);
{ MaybeObject* maybe_new_object = array->set_elements(*elements);
isolate->heap()->AllocateFixedArray(elements_count); array->set_length(Smi::FromInt(size));
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
}
FixedArray* elements = FixedArray::cast(new_object);
{ MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw(
JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE);
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
}
{
DisallowHeapAllocation no_gc;
HandleScope scope(isolate);
reinterpret_cast<HeapObject*>(new_object)->
set_map(isolate->native_context()->regexp_result_map());
}
JSArray* array = JSArray::cast(new_object);
array->set_properties(isolate->heap()->empty_fixed_array());
array->set_elements(elements);
array->set_length(Smi::FromInt(elements_count));
// Write in-object properties after the length of the array. // Write in-object properties after the length of the array.
array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]); array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, args[1]);
array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]);
return array; return *array;
} }
......
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