Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 37ba1e5301a9e17a9e5f4f026e0ad902bb03fd9d..44d29bf6e87837065da338883543f6915dda08d5 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -209,15 +209,28 @@ RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure) { |
Handle<Object> type_info = args.at<Object>(parameters_start + 1); |
bool holey = false; |
- if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) { |
- int value = Smi::cast((*caller_args)[0])->value(); |
- holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray); |
+ bool ignore_type_feedback = false; |
danno
2013/06/05 11:31:13
Last comment: I think the logic makes a little mor
mvstanton
2013/06/06 09:23:33
Done.
|
+ if (caller_args->length() == 1) { |
+ Object* argument_one = (*caller_args)[0]; |
+ if (argument_one->IsSmi()) { |
+ int value = Smi::cast(argument_one)->value(); |
+ if (value < 0 || value >= JSObject::kInitialMaxFastElementArray) { |
+ // the array is a dictionary in this case. |
+ ignore_type_feedback = true; |
+ } else if (value != 0) { |
+ holey = true; |
+ } |
+ } else { |
+ // Non-smi length argument produces a dictionary |
+ ignore_type_feedback = true; |
+ } |
} |
JSArray* array; |
MaybeObject* maybe_array; |
if (*type_info != isolate->heap()->undefined_value() && |
- JSGlobalPropertyCell::cast(*type_info)->value()->IsSmi()) { |
+ JSGlobalPropertyCell::cast(*type_info)->value()->IsSmi() && |
+ !ignore_type_feedback) { |
JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(*type_info); |
Smi* smi = Smi::cast(cell->value()); |
ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); |