| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2447 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | 2447 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
| 2448 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at)); | 2448 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at)); |
| 2449 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot. | 2449 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot. |
| 2450 __ Branch(&done, eq, scratch, Operand(at)); | 2450 __ Branch(&done, eq, scratch, Operand(at)); |
| 2451 // |scratch| still contains |input|'s map. | 2451 // |scratch| still contains |input|'s map. |
| 2452 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); | 2452 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); |
| 2453 __ Ext(scratch, scratch, Map::kElementsKindShift, | 2453 __ Ext(scratch, scratch, Map::kElementsKindShift, |
| 2454 Map::kElementsKindBitCount); | 2454 Map::kElementsKindBitCount); |
| 2455 __ Branch(&done, eq, scratch, | 2455 __ Branch(&done, eq, scratch, |
| 2456 Operand(FAST_ELEMENTS)); | 2456 Operand(FAST_ELEMENTS)); |
| 2457 __ Branch(&done, eq, scratch, |
| 2458 Operand(FAST_HOLEY_ELEMENTS)); |
| 2457 __ Branch(&fail, lt, scratch, | 2459 __ Branch(&fail, lt, scratch, |
| 2458 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); | 2460 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2459 __ Branch(&done, le, scratch, | 2461 __ Branch(&done, le, scratch, |
| 2460 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); | 2462 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2461 __ bind(&fail); | 2463 __ bind(&fail); |
| 2462 __ Abort("Check for fast or external elements failed."); | 2464 __ Abort("Check for fast or external elements failed."); |
| 2463 __ bind(&done); | 2465 __ bind(&done); |
| 2464 } | 2466 } |
| 2465 } | 2467 } |
| 2466 | 2468 |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3678 ElementsKind from_kind = from_map->elements_kind(); | 3680 ElementsKind from_kind = from_map->elements_kind(); |
| 3679 ElementsKind to_kind = to_map->elements_kind(); | 3681 ElementsKind to_kind = to_map->elements_kind(); |
| 3680 | 3682 |
| 3681 __ mov(ToRegister(instr->result()), object_reg); | 3683 __ mov(ToRegister(instr->result()), object_reg); |
| 3682 | 3684 |
| 3683 Label not_applicable; | 3685 Label not_applicable; |
| 3684 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); | 3686 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
| 3685 __ Branch(¬_applicable, ne, scratch, Operand(from_map)); | 3687 __ Branch(¬_applicable, ne, scratch, Operand(from_map)); |
| 3686 | 3688 |
| 3687 __ li(new_map_reg, Operand(to_map)); | 3689 __ li(new_map_reg, Operand(to_map)); |
| 3688 if (from_kind == FAST_SMI_ONLY_ELEMENTS && to_kind == FAST_ELEMENTS) { | 3690 if (IsFastSmiElementsKind(from_kind) && IsFastObjectElementsKind(to_kind)) { |
| 3689 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); | 3691 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
| 3690 // Write barrier. | 3692 // Write barrier. |
| 3691 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, | 3693 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, |
| 3692 scratch, kRAHasBeenSaved, kDontSaveFPRegs); | 3694 scratch, kRAHasBeenSaved, kDontSaveFPRegs); |
| 3693 } else if (from_kind == FAST_SMI_ONLY_ELEMENTS && | 3695 } else if (IsFastSmiElementsKind(from_kind) && |
| 3694 to_kind == FAST_DOUBLE_ELEMENTS) { | 3696 IsFastDoubleElementsKind(to_kind)) { |
| 3695 Register fixed_object_reg = ToRegister(instr->temp_reg()); | 3697 Register fixed_object_reg = ToRegister(instr->temp_reg()); |
| 3696 ASSERT(fixed_object_reg.is(a2)); | 3698 ASSERT(fixed_object_reg.is(a2)); |
| 3697 ASSERT(new_map_reg.is(a3)); | 3699 ASSERT(new_map_reg.is(a3)); |
| 3698 __ mov(fixed_object_reg, object_reg); | 3700 __ mov(fixed_object_reg, object_reg); |
| 3699 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), | 3701 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), |
| 3700 RelocInfo::CODE_TARGET, instr); | 3702 RelocInfo::CODE_TARGET, instr); |
| 3701 } else if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { | 3703 } else if (IsFastDoubleElementsKind(from_kind) && |
| 3704 IsFastElementsKind(to_kind)) { |
| 3702 Register fixed_object_reg = ToRegister(instr->temp_reg()); | 3705 Register fixed_object_reg = ToRegister(instr->temp_reg()); |
| 3703 ASSERT(fixed_object_reg.is(a2)); | 3706 ASSERT(fixed_object_reg.is(a2)); |
| 3704 ASSERT(new_map_reg.is(a3)); | 3707 ASSERT(new_map_reg.is(a3)); |
| 3705 __ mov(fixed_object_reg, object_reg); | 3708 __ mov(fixed_object_reg, object_reg); |
| 3706 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), | 3709 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), |
| 3707 RelocInfo::CODE_TARGET, instr); | 3710 RelocInfo::CODE_TARGET, instr); |
| 3708 } else { | 3711 } else { |
| 3709 UNREACHABLE(); | 3712 UNREACHABLE(); |
| 3710 } | 3713 } |
| 3711 __ bind(¬_applicable); | 3714 __ bind(¬_applicable); |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4447 } | 4450 } |
| 4448 | 4451 |
| 4449 | 4452 |
| 4450 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4453 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| 4451 Heap* heap = isolate()->heap(); | 4454 Heap* heap = isolate()->heap(); |
| 4452 ElementsKind boilerplate_elements_kind = | 4455 ElementsKind boilerplate_elements_kind = |
| 4453 instr->hydrogen()->boilerplate_elements_kind(); | 4456 instr->hydrogen()->boilerplate_elements_kind(); |
| 4454 | 4457 |
| 4455 // Deopt if the array literal boilerplate ElementsKind is of a type different | 4458 // Deopt if the array literal boilerplate ElementsKind is of a type different |
| 4456 // than the expected one. The check isn't necessary if the boilerplate has | 4459 // than the expected one. The check isn't necessary if the boilerplate has |
| 4457 // already been converted to FAST_ELEMENTS. | 4460 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. |
| 4458 if (boilerplate_elements_kind != FAST_ELEMENTS) { | 4461 if (boilerplate_elements_kind != TERMINAL_FAST_ELEMENTS_KIND) { |
| 4459 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); | 4462 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); |
| 4460 // Load map into a2. | 4463 // Load map into a2. |
| 4461 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 4464 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 4462 // Load the map's "bit field 2". | 4465 // Load the map's "bit field 2". |
| 4463 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); | 4466 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); |
| 4464 // Retrieve elements_kind from bit field 2. | 4467 // Retrieve elements_kind from bit field 2. |
| 4465 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 4468 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4466 DeoptimizeIf(ne, | 4469 DeoptimizeIf(ne, |
| 4467 instr->environment(), | 4470 instr->environment(), |
| 4468 a2, | 4471 a2, |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5112 __ Subu(scratch, result, scratch); | 5115 __ Subu(scratch, result, scratch); |
| 5113 __ lw(result, FieldMemOperand(scratch, | 5116 __ lw(result, FieldMemOperand(scratch, |
| 5114 FixedArray::kHeaderSize - kPointerSize)); | 5117 FixedArray::kHeaderSize - kPointerSize)); |
| 5115 __ bind(&done); | 5118 __ bind(&done); |
| 5116 } | 5119 } |
| 5117 | 5120 |
| 5118 | 5121 |
| 5119 #undef __ | 5122 #undef __ |
| 5120 | 5123 |
| 5121 } } // namespace v8::internal | 5124 } } // namespace v8::internal |
| OLD | NEW |