if (receiver_map.is_null()) return false;
if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
ElementsKind elements_kind = receiver_map->elements_kind();
+ if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false;
if (!IsFastElementsKind(elements_kind)) return false;
if (receiver_map->is_observed()) return false;
if (!receiver_map->is_extensible()) return false;
if (receiver_map.is_null()) return false;
if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
ElementsKind kind = receiver_map->elements_kind();
+ if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false;
if (!IsFastElementsKind(kind)) return false;
if (receiver_map->is_observed()) return false;
if (!receiver_map->is_extensible()) return false;
graph()->GetConstant0(), new_length, Token::LT);
HValue* key = AddUncasted<HAdd>(new_key, graph()->GetConstant1());
key->ClearFlag(HValue::kCanOverflow);
+ ElementsKind copy_kind =
+ kind == FAST_HOLEY_SMI_ELEMENTS ? FAST_HOLEY_ELEMENTS : kind;
HValue* element = AddUncasted<HLoadKeyed>(
- elements, key, lengthiszero, kind, ALLOW_RETURN_HOLE);
- HStoreKeyed* store = Add<HStoreKeyed>(
- elements, new_key, element, kind);
+ elements, key, lengthiszero, copy_kind, ALLOW_RETURN_HOLE);
+ HStoreKeyed* store =
+ Add<HStoreKeyed>(elements, new_key, element, copy_kind);
store->SetFlag(HValue::kAllowUndefinedAsNaN);
}
loop.EndBody();
site_context->ExitScope(current_site, value_object);
Add<HStoreKeyed>(object_elements, key_constant, result, kind);
} else {
- HInstruction* value_instruction =
- Add<HLoadKeyed>(boilerplate_elements, key_constant,
- static_cast<HValue*>(NULL), kind,
- ALLOW_RETURN_HOLE);
- Add<HStoreKeyed>(object_elements, key_constant, value_instruction, kind);
+ ElementsKind copy_kind =
+ kind == FAST_HOLEY_SMI_ELEMENTS ? FAST_HOLEY_ELEMENTS : kind;
+ HInstruction* value_instruction = Add<HLoadKeyed>(
+ boilerplate_elements, key_constant, static_cast<HValue*>(NULL),
+ copy_kind, ALLOW_RETURN_HOLE);
+ Add<HStoreKeyed>(object_elements, key_constant, value_instruction,
+ copy_kind);
}
}
}
testAdd("normalized");
-function testRemove(mode) {
- var a = [1, 2, 3];
+function testRemove(a, mode) {
Object.defineProperty(a, "length", { writable : false});
function check(f) {
check(splice);
%OptimizeFunctionOnNextCall(splice);
check(splice);
-}
-testRemove("fast properties");
+ %ClearFunctionTypeFeedback(pop);
+ %ClearFunctionTypeFeedback(shift);
+ %ClearFunctionTypeFeedback(splice);
+}
-testRemove("normalized");
+for (var i = 0; i < 3; i++) {
+ var a = [1, 2, 3];
+ if (i == 1) {
+ a = [1, 2, 3.5];
+ } else if (i == 2) {
+ a = [1, 2, "string"];
+ }
+ testRemove(a, "fast properties");
+ testRemove(a, "normalized");
+}
var b = [];
Object.defineProperty(b.__proto__, "0", {