Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index 2c2445b4c78dce6810639eac3b1c14b521b435b8..6cd5e97f62a61252299cbddd4755dff7e8fedccb 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -3341,33 +3341,39 @@ void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, |
void MacroAssembler::CheckFastElements(Register map, |
Register scratch, |
Label* fail) { |
- STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
- STATIC_ASSERT(FAST_ELEMENTS == 1); |
+ STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
+ STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
+ STATIC_ASSERT(FAST_ELEMENTS == 2); |
+ STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
- Branch(fail, hi, scratch, Operand(Map::kMaximumBitField2FastElementValue)); |
+ Branch(fail, hi, scratch, |
+ Operand(Map::kMaximumBitField2FastHoleyElementValue)); |
} |
void MacroAssembler::CheckFastObjectElements(Register map, |
Register scratch, |
Label* fail) { |
- STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
- STATIC_ASSERT(FAST_ELEMENTS == 1); |
+ STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
+ STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
+ STATIC_ASSERT(FAST_ELEMENTS == 2); |
+ STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
Branch(fail, ls, scratch, |
- Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); |
+ Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
Branch(fail, hi, scratch, |
- Operand(Map::kMaximumBitField2FastElementValue)); |
+ Operand(Map::kMaximumBitField2FastHoleyElementValue)); |
} |
-void MacroAssembler::CheckFastSmiOnlyElements(Register map, |
- Register scratch, |
- Label* fail) { |
- STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
+void MacroAssembler::CheckFastSmiElements(Register map, |
+ Register scratch, |
+ Label* fail) { |
+ STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
+ STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
Branch(fail, hi, scratch, |
- Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); |
+ Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); |
} |
@@ -3469,22 +3475,17 @@ void MacroAssembler::CompareMapAndBranch(Register obj, |
lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
Operand right = Operand(map); |
if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { |
- Map* transitioned_fast_element_map( |
- map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL)); |
- ASSERT(transitioned_fast_element_map == NULL || |
- map->elements_kind() != FAST_ELEMENTS); |
- if (transitioned_fast_element_map != NULL) { |
- Branch(early_success, eq, scratch, right); |
- right = Operand(Handle<Map>(transitioned_fast_element_map)); |
- } |
- |
- Map* transitioned_double_map( |
- map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL)); |
- ASSERT(transitioned_double_map == NULL || |
- map->elements_kind() == FAST_SMI_ONLY_ELEMENTS); |
- if (transitioned_double_map != NULL) { |
- Branch(early_success, eq, scratch, right); |
- right = Operand(Handle<Map>(transitioned_double_map)); |
+ ElementsKind kind = map->elements_kind(); |
+ if (IsFastElementsKind(kind)) { |
+ bool packed = IsFastPackedElementsKind(kind); |
+ Map* current_map = *map; |
+ while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { |
+ kind = GetNextMoreGeneralFastElementsKind(kind, packed); |
+ current_map = current_map->LookupElementsTransitionMap(kind, NULL); |
+ if (!current_map) break; |
+ Branch(early_success, eq, scratch, right); |
+ right = Operand(Handle<Map>(current_map)); |
+ } |
} |
} |
@@ -4443,27 +4444,37 @@ void MacroAssembler::LoadTransitionedArrayMapConditional( |
lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
// Check that the function's map is the same as the expected cached map. |
- int expected_index = |
- Context::GetContextMapIndexFromElementsKind(expected_kind); |
- lw(at, MemOperand(scratch, Context::SlotOffset(expected_index))); |
- Branch(no_map_match, ne, map_in_out, Operand(at)); |
+ lw(scratch, |
+ MemOperand(scratch, |
+ Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
+ size_t offset = expected_kind * kPointerSize + |
+ FixedArrayBase::kHeaderSize; |
+ Branch(no_map_match, ne, map_in_out, Operand(scratch)); |
// Use the transitioned cached map. |
- int trans_index = |
- Context::GetContextMapIndexFromElementsKind(transitioned_kind); |
- lw(map_in_out, MemOperand(scratch, Context::SlotOffset(trans_index))); |
+ offset = transitioned_kind * kPointerSize + |
+ FixedArrayBase::kHeaderSize; |
+ lw(map_in_out, FieldMemOperand(scratch, offset)); |
} |
void MacroAssembler::LoadInitialArrayMap( |
- Register function_in, Register scratch, Register map_out) { |
+ Register function_in, Register scratch, |
+ Register map_out, bool can_have_holes) { |
ASSERT(!function_in.is(map_out)); |
Label done; |
lw(map_out, FieldMemOperand(function_in, |
JSFunction::kPrototypeOrInitialMapOffset)); |
if (!FLAG_smi_only_arrays) { |
- LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
- FAST_ELEMENTS, |
+ ElementsKind kind = can_have_holes ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; |
+ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
+ kind, |
+ map_out, |
+ scratch, |
+ &done); |
+ } else if (can_have_holes) { |
+ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
+ FAST_HOLEY_SMI_ELEMENTS, |
map_out, |
scratch, |
&done); |