Commit 69df3564 authored by ishell@chromium.org's avatar ishell@chromium.org

Further Kraken regression recover due to handlification.

R=yangguo@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20488 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1f38f42e
...@@ -278,6 +278,7 @@ static FixedArrayBase* LeftTrimFixedArray(Heap* heap, ...@@ -278,6 +278,7 @@ static FixedArrayBase* LeftTrimFixedArray(Heap* heap,
static bool ArrayPrototypeHasNoElements(Heap* heap, static bool ArrayPrototypeHasNoElements(Heap* heap,
Context* native_context, Context* native_context,
JSObject* array_proto) { JSObject* array_proto) {
DisallowHeapAllocation no_gc;
// This method depends on non writability of Object and Array prototype // This method depends on non writability of Object and Array prototype
// fields. // fields.
if (array_proto->elements() != heap->empty_fixed_array()) return false; if (array_proto->elements() != heap->empty_fixed_array()) return false;
...@@ -324,6 +325,8 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements( ...@@ -324,6 +325,8 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements(
ElementsKind origin_kind = array->map()->elements_kind(); ElementsKind origin_kind = array->map()->elements_kind();
ASSERT(!IsFastObjectElementsKind(origin_kind)); ASSERT(!IsFastObjectElementsKind(origin_kind));
ElementsKind target_kind = origin_kind; ElementsKind target_kind = origin_kind;
{
DisallowHeapAllocation no_gc;
int arg_count = args->length() - first_added_arg; int arg_count = args->length() - first_added_arg;
Object** arguments = args->arguments() - first_added_arg - (arg_count - 1); Object** arguments = args->arguments() - first_added_arg - (arg_count - 1);
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
...@@ -337,6 +340,7 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements( ...@@ -337,6 +340,7 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements(
} }
} }
} }
}
if (target_kind != origin_kind) { if (target_kind != origin_kind) {
JSObject::TransitionElementsKind(array, target_kind); JSObject::TransitionElementsKind(array, target_kind);
return handle(array->elements(), isolate); return handle(array->elements(), isolate);
...@@ -345,10 +349,10 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements( ...@@ -345,10 +349,10 @@ static inline Handle<FixedArrayBase> EnsureJSArrayWithWritableFastElements(
} }
// TODO(ishell): Handlify when all Array* builtins are handlified.
static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap, static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap,
JSArray* receiver) { JSArray* receiver) {
if (!FLAG_clever_optimizations) return false; if (!FLAG_clever_optimizations) return false;
DisallowHeapAllocation no_gc;
Context* native_context = heap->isolate()->context()->native_context(); Context* native_context = heap->isolate()->context()->native_context();
JSObject* array_proto = JSObject* array_proto =
JSObject::cast(native_context->array_function()->prototype()); JSObject::cast(native_context->array_function()->prototype());
...@@ -987,27 +991,30 @@ BUILTIN(ArraySplice) { ...@@ -987,27 +991,30 @@ BUILTIN(ArraySplice) {
BUILTIN(ArrayConcat) { BUILTIN(ArrayConcat) {
HandleScope scope(isolate); HandleScope scope(isolate);
int n_arguments = args.length();
int result_len = 0;
ElementsKind elements_kind = GetInitialFastElementsKind();
bool has_double = false;
{
DisallowHeapAllocation no_gc;
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
Handle<Context> native_context(isolate->context()->native_context(), isolate); Context* native_context = isolate->context()->native_context();
Handle<JSObject> array_proto( JSObject* array_proto =
JSObject::cast(native_context->array_function()->prototype()), isolate); JSObject::cast(native_context->array_function()->prototype());
if (!ArrayPrototypeHasNoElements(heap, *native_context, *array_proto)) { if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) {
AllowHeapAllocation allow_allocation;
return CallJsBuiltin(isolate, "ArrayConcat", args); return CallJsBuiltin(isolate, "ArrayConcat", args);
} }
// Iterate through all the arguments performing checks // Iterate through all the arguments performing checks
// and calculating total length. // and calculating total length.
int n_arguments = args.length();
int result_len = 0;
ElementsKind elements_kind = GetInitialFastElementsKind();
bool has_double = false;
bool is_holey = false; bool is_holey = false;
for (int i = 0; i < n_arguments; i++) { for (int i = 0; i < n_arguments; i++) {
DisallowHeapAllocation no_gc;
Object* arg = args[i]; Object* arg = args[i];
if (!arg->IsJSArray() || if (!arg->IsJSArray() ||
!JSArray::cast(arg)->HasFastElements() || !JSArray::cast(arg)->HasFastElements() ||
JSArray::cast(arg)->GetPrototype() != *array_proto) { JSArray::cast(arg)->GetPrototype() != array_proto) {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
return CallJsBuiltin(isolate, "ArrayConcat", args); return CallJsBuiltin(isolate, "ArrayConcat", args);
} }
...@@ -1032,8 +1039,8 @@ BUILTIN(ArrayConcat) { ...@@ -1032,8 +1039,8 @@ BUILTIN(ArrayConcat) {
elements_kind = arg_kind; elements_kind = arg_kind;
} }
} }
if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind);
}
// If a double array is concatted into a fast elements array, the fast // If a double array is concatted into a fast elements array, the fast
// elements array needs to be initialized to contain proper holes, since // elements array needs to be initialized to contain proper holes, since
......
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