Chromium Code Reviews| 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 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2440 Label done, fail; | 2440 Label done, fail; |
| 2441 __ lw(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); | 2441 __ lw(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 2442 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | 2442 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
| 2443 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at)); | 2443 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at)); |
| 2444 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot. | 2444 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot. |
| 2445 __ Branch(&done, eq, scratch, Operand(at)); | 2445 __ Branch(&done, eq, scratch, Operand(at)); |
| 2446 // |scratch| still contains |input|'s map. | 2446 // |scratch| still contains |input|'s map. |
| 2447 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); | 2447 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); |
| 2448 __ Ext(scratch, scratch, Map::kElementsKindShift, | 2448 __ Ext(scratch, scratch, Map::kElementsKindShift, |
| 2449 Map::kElementsKindBitCount); | 2449 Map::kElementsKindBitCount); |
| 2450 __ Branch(&done, eq, scratch, | 2450 __ Branch(&fail, lt, scratch, |
| 2451 Operand(FAST_ELEMENTS)); | 2451 Operand(GetInitialFastElementsKind())); |
| 2452 __ Branch(&done, le, scratch, | |
| 2453 Operand(TERMINAL_FAST_ELEMENTS_KIND)); | |
| 2452 __ Branch(&fail, lt, scratch, | 2454 __ Branch(&fail, lt, scratch, |
| 2453 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); | 2455 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2454 __ Branch(&done, le, scratch, | 2456 __ Branch(&done, le, scratch, |
| 2455 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); | 2457 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); |
| 2456 __ bind(&fail); | 2458 __ bind(&fail); |
| 2457 __ Abort("Check for fast or external elements failed."); | 2459 __ Abort("Check for fast or external elements failed."); |
| 2458 __ bind(&done); | 2460 __ bind(&done); |
| 2459 } | 2461 } |
| 2460 } | 2462 } |
| 2461 | 2463 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2534 if (key_is_constant) { | 2536 if (key_is_constant) { |
| 2535 __ Addu(elements, elements, Operand(constant_key * (1 << shift_size) + | 2537 __ Addu(elements, elements, Operand(constant_key * (1 << shift_size) + |
| 2536 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 2538 FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 2537 } else { | 2539 } else { |
| 2538 __ sll(scratch, key, shift_size); | 2540 __ sll(scratch, key, shift_size); |
| 2539 __ Addu(elements, elements, Operand(scratch)); | 2541 __ Addu(elements, elements, Operand(scratch)); |
| 2540 __ Addu(elements, elements, | 2542 __ Addu(elements, elements, |
| 2541 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 2543 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
| 2542 } | 2544 } |
| 2543 | 2545 |
| 2544 __ lw(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); | 2546 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2545 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); | 2547 __ lw(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); |
| 2548 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); | |
| 2549 } | |
| 2546 | 2550 |
| 2547 __ ldc1(result, MemOperand(elements)); | 2551 __ ldc1(result, MemOperand(elements)); |
| 2548 } | 2552 } |
| 2549 | 2553 |
| 2550 | 2554 |
| 2551 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2555 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2552 LLoadKeyedSpecializedArrayElement* instr) { | 2556 LLoadKeyedSpecializedArrayElement* instr) { |
| 2553 Register external_pointer = ToRegister(instr->external_pointer()); | 2557 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2554 Register key = no_reg; | 2558 Register key = no_reg; |
| 2555 ElementsKind elements_kind = instr->elements_kind(); | 2559 ElementsKind elements_kind = instr->elements_kind(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2615 // TODO(danno): we could be more clever here, perhaps having a special | 2619 // TODO(danno): we could be more clever here, perhaps having a special |
| 2616 // version of the stub that detects if the overflow case actually | 2620 // version of the stub that detects if the overflow case actually |
| 2617 // happens, and generate code that returns a double rather than int. | 2621 // happens, and generate code that returns a double rather than int. |
| 2618 DeoptimizeIf(Ugreater_equal, instr->environment(), | 2622 DeoptimizeIf(Ugreater_equal, instr->environment(), |
| 2619 result, Operand(0x80000000)); | 2623 result, Operand(0x80000000)); |
| 2620 break; | 2624 break; |
| 2621 case EXTERNAL_FLOAT_ELEMENTS: | 2625 case EXTERNAL_FLOAT_ELEMENTS: |
| 2622 case EXTERNAL_DOUBLE_ELEMENTS: | 2626 case EXTERNAL_DOUBLE_ELEMENTS: |
| 2623 case FAST_DOUBLE_ELEMENTS: | 2627 case FAST_DOUBLE_ELEMENTS: |
| 2624 case FAST_ELEMENTS: | 2628 case FAST_ELEMENTS: |
| 2625 case FAST_SMI_ONLY_ELEMENTS: | 2629 case FAST_SMI_ELEMENTS: |
| 2630 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
| 2631 case FAST_HOLEY_ELEMENTS: | |
| 2632 case FAST_HOLEY_SMI_ELEMENTS: | |
| 2626 case DICTIONARY_ELEMENTS: | 2633 case DICTIONARY_ELEMENTS: |
| 2627 case NON_STRICT_ARGUMENTS_ELEMENTS: | 2634 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 2628 UNREACHABLE(); | 2635 UNREACHABLE(); |
| 2629 break; | 2636 break; |
| 2630 } | 2637 } |
| 2631 } | 2638 } |
| 2632 } | 2639 } |
| 2633 | 2640 |
| 2634 | 2641 |
| 2635 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2642 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3633 __ sh(value, mem_operand); | 3640 __ sh(value, mem_operand); |
| 3634 break; | 3641 break; |
| 3635 case EXTERNAL_INT_ELEMENTS: | 3642 case EXTERNAL_INT_ELEMENTS: |
| 3636 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3643 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3637 __ sw(value, mem_operand); | 3644 __ sw(value, mem_operand); |
| 3638 break; | 3645 break; |
| 3639 case EXTERNAL_FLOAT_ELEMENTS: | 3646 case EXTERNAL_FLOAT_ELEMENTS: |
| 3640 case EXTERNAL_DOUBLE_ELEMENTS: | 3647 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3641 case FAST_DOUBLE_ELEMENTS: | 3648 case FAST_DOUBLE_ELEMENTS: |
| 3642 case FAST_ELEMENTS: | 3649 case FAST_ELEMENTS: |
| 3643 case FAST_SMI_ONLY_ELEMENTS: | 3650 case FAST_SMI_ELEMENTS: |
| 3651 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
| 3652 case FAST_HOLEY_ELEMENTS: | |
| 3653 case FAST_HOLEY_SMI_ELEMENTS: | |
| 3644 case DICTIONARY_ELEMENTS: | 3654 case DICTIONARY_ELEMENTS: |
| 3645 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3655 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3646 UNREACHABLE(); | 3656 UNREACHABLE(); |
| 3647 break; | 3657 break; |
| 3648 } | 3658 } |
| 3649 } | 3659 } |
| 3650 } | 3660 } |
| 3651 | 3661 |
| 3652 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3662 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 3653 ASSERT(ToRegister(instr->object()).is(a2)); | 3663 ASSERT(ToRegister(instr->object()).is(a2)); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3671 ElementsKind from_kind = from_map->elements_kind(); | 3681 ElementsKind from_kind = from_map->elements_kind(); |
| 3672 ElementsKind to_kind = to_map->elements_kind(); | 3682 ElementsKind to_kind = to_map->elements_kind(); |
| 3673 | 3683 |
| 3674 __ mov(ToRegister(instr->result()), object_reg); | 3684 __ mov(ToRegister(instr->result()), object_reg); |
| 3675 | 3685 |
| 3676 Label not_applicable; | 3686 Label not_applicable; |
| 3677 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); | 3687 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
| 3678 __ Branch(¬_applicable, ne, scratch, Operand(from_map)); | 3688 __ Branch(¬_applicable, ne, scratch, Operand(from_map)); |
| 3679 | 3689 |
| 3680 __ li(new_map_reg, Operand(to_map)); | 3690 __ li(new_map_reg, Operand(to_map)); |
| 3681 if (from_kind == FAST_SMI_ONLY_ELEMENTS && to_kind == FAST_ELEMENTS) { | 3691 if (IsFastSmiElementsKind(from_kind) && IsFastObjectElementsKind(to_kind)) { |
| 3682 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); | 3692 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
| 3683 // Write barrier. | 3693 // Write barrier. |
| 3684 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, | 3694 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, |
| 3685 scratch, kRAHasBeenSaved, kDontSaveFPRegs); | 3695 scratch, kRAHasBeenSaved, kDontSaveFPRegs); |
| 3686 } else if (from_kind == FAST_SMI_ONLY_ELEMENTS && | 3696 } else if (IsFastSmiElementsKind(from_kind) && |
| 3687 to_kind == FAST_DOUBLE_ELEMENTS) { | 3697 IsFastDoubleElementsKind(to_kind)) { |
| 3688 Register fixed_object_reg = ToRegister(instr->temp_reg()); | 3698 Register fixed_object_reg = ToRegister(instr->temp_reg()); |
| 3689 ASSERT(fixed_object_reg.is(a2)); | 3699 ASSERT(fixed_object_reg.is(a2)); |
| 3690 ASSERT(new_map_reg.is(a3)); | 3700 ASSERT(new_map_reg.is(a3)); |
| 3691 __ mov(fixed_object_reg, object_reg); | 3701 __ mov(fixed_object_reg, object_reg); |
| 3692 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), | 3702 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), |
| 3693 RelocInfo::CODE_TARGET, instr); | 3703 RelocInfo::CODE_TARGET, instr); |
| 3694 } else if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { | 3704 } else if (IsFastDoubleElementsKind(from_kind) && |
| 3705 IsFastElementsKind(to_kind)) { | |
|
Jakob Kummerow
2012/05/22 17:36:49
IsFastObjectElementsKind(to_kind) ?
danno
2012/05/23 14:25:36
Done.
| |
| 3695 Register fixed_object_reg = ToRegister(instr->temp_reg()); | 3706 Register fixed_object_reg = ToRegister(instr->temp_reg()); |
| 3696 ASSERT(fixed_object_reg.is(a2)); | 3707 ASSERT(fixed_object_reg.is(a2)); |
| 3697 ASSERT(new_map_reg.is(a3)); | 3708 ASSERT(new_map_reg.is(a3)); |
| 3698 __ mov(fixed_object_reg, object_reg); | 3709 __ mov(fixed_object_reg, object_reg); |
| 3699 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), | 3710 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), |
| 3700 RelocInfo::CODE_TARGET, instr); | 3711 RelocInfo::CODE_TARGET, instr); |
| 3701 } else { | 3712 } else { |
| 3702 UNREACHABLE(); | 3713 UNREACHABLE(); |
| 3703 } | 3714 } |
| 3704 __ bind(¬_applicable); | 3715 __ bind(¬_applicable); |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4439 } | 4450 } |
| 4440 | 4451 |
| 4441 | 4452 |
| 4442 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4453 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| 4443 Heap* heap = isolate()->heap(); | 4454 Heap* heap = isolate()->heap(); |
| 4444 ElementsKind boilerplate_elements_kind = | 4455 ElementsKind boilerplate_elements_kind = |
| 4445 instr->hydrogen()->boilerplate_elements_kind(); | 4456 instr->hydrogen()->boilerplate_elements_kind(); |
| 4446 | 4457 |
| 4447 // 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 |
| 4448 // 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 |
| 4449 // already been converted to FAST_ELEMENTS. | 4460 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. |
| 4450 if (boilerplate_elements_kind != FAST_ELEMENTS) { | 4461 if (boilerplate_elements_kind != TERMINAL_FAST_ELEMENTS_KIND) { |
|
Jakob Kummerow
2012/05/22 17:36:49
Other arches ask "if (CanTransitionToMoreGeneralFa
danno
2012/05/23 14:25:36
Done.
| |
| 4451 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); | 4462 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); |
| 4452 // Load map into a2. | 4463 // Load map into a2. |
| 4453 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 4464 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 4454 // Load the map's "bit field 2". | 4465 // Load the map's "bit field 2". |
| 4455 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); | 4466 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); |
| 4456 // Retrieve elements_kind from bit field 2. | 4467 // Retrieve elements_kind from bit field 2. |
| 4457 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 4468 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4458 DeoptimizeIf(ne, | 4469 DeoptimizeIf(ne, |
| 4459 instr->environment(), | 4470 instr->environment(), |
| 4460 a2, | 4471 a2, |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5121 __ Subu(scratch, result, scratch); | 5132 __ Subu(scratch, result, scratch); |
| 5122 __ lw(result, FieldMemOperand(scratch, | 5133 __ lw(result, FieldMemOperand(scratch, |
| 5123 FixedArray::kHeaderSize - kPointerSize)); | 5134 FixedArray::kHeaderSize - kPointerSize)); |
| 5124 __ bind(&done); | 5135 __ bind(&done); |
| 5125 } | 5136 } |
| 5126 | 5137 |
| 5127 | 5138 |
| 5128 #undef __ | 5139 #undef __ |
| 5129 | 5140 |
| 5130 } } // namespace v8::internal | 5141 } } // namespace v8::internal |
| OLD | NEW |