Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ia32 ready to go Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 2446 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
2447 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at)); 2447 __ Branch(USE_DELAY_SLOT, &done, eq, scratch, Operand(at));
2448 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot. 2448 __ LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); // In the delay slot.
2449 __ Branch(&done, eq, scratch, Operand(at)); 2449 __ Branch(&done, eq, scratch, Operand(at));
2450 // |scratch| still contains |input|'s map. 2450 // |scratch| still contains |input|'s map.
2451 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset)); 2451 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitField2Offset));
2452 __ Ext(scratch, scratch, Map::kElementsKindShift, 2452 __ Ext(scratch, scratch, Map::kElementsKindShift,
2453 Map::kElementsKindBitCount); 2453 Map::kElementsKindBitCount);
2454 __ Branch(&done, eq, scratch, 2454 __ Branch(&done, eq, scratch,
2455 Operand(FAST_ELEMENTS)); 2455 Operand(FAST_ELEMENTS));
2456 __ Branch(&done, eq, scratch,
2457 Operand(FAST_HOLEY_ELEMENTS));
2456 __ Branch(&fail, lt, scratch, 2458 __ Branch(&fail, lt, scratch,
2457 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND)); 2459 Operand(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND));
2458 __ Branch(&done, le, scratch, 2460 __ Branch(&done, le, scratch,
2459 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND)); 2461 Operand(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND));
2460 __ bind(&fail); 2462 __ bind(&fail);
2461 __ Abort("Check for fast or external elements failed."); 2463 __ Abort("Check for fast or external elements failed.");
2462 __ bind(&done); 2464 __ bind(&done);
2463 } 2465 }
2464 } 2466 }
2465 2467
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3675 ElementsKind from_kind = from_map->elements_kind(); 3677 ElementsKind from_kind = from_map->elements_kind();
3676 ElementsKind to_kind = to_map->elements_kind(); 3678 ElementsKind to_kind = to_map->elements_kind();
3677 3679
3678 __ mov(ToRegister(instr->result()), object_reg); 3680 __ mov(ToRegister(instr->result()), object_reg);
3679 3681
3680 Label not_applicable; 3682 Label not_applicable;
3681 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); 3683 __ lw(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset));
3682 __ Branch(&not_applicable, ne, scratch, Operand(from_map)); 3684 __ Branch(&not_applicable, ne, scratch, Operand(from_map));
3683 3685
3684 __ li(new_map_reg, Operand(to_map)); 3686 __ li(new_map_reg, Operand(to_map));
3685 if (from_kind == FAST_SMI_ONLY_ELEMENTS && to_kind == FAST_ELEMENTS) { 3687 if (IsFastSmiElementsKind(from_kind) && IsFastObjectElementsKind(to_kind)) {
3686 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); 3688 __ sw(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset));
3687 // Write barrier. 3689 // Write barrier.
3688 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, 3690 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg,
3689 scratch, kRAHasBeenSaved, kDontSaveFPRegs); 3691 scratch, kRAHasBeenSaved, kDontSaveFPRegs);
3690 } else if (from_kind == FAST_SMI_ONLY_ELEMENTS && 3692 } else if (IsFastSmiElementsKind(from_kind) &&
3691 to_kind == FAST_DOUBLE_ELEMENTS) { 3693 IsFastDoubleElementsKind(to_kind)) {
3692 Register fixed_object_reg = ToRegister(instr->temp_reg()); 3694 Register fixed_object_reg = ToRegister(instr->temp_reg());
3693 ASSERT(fixed_object_reg.is(a2)); 3695 ASSERT(fixed_object_reg.is(a2));
3694 ASSERT(new_map_reg.is(a3)); 3696 ASSERT(new_map_reg.is(a3));
3695 __ mov(fixed_object_reg, object_reg); 3697 __ mov(fixed_object_reg, object_reg);
3696 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), 3698 CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(),
3697 RelocInfo::CODE_TARGET, instr); 3699 RelocInfo::CODE_TARGET, instr);
3698 } else if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { 3700 } else if (IsFastDoubleElementsKind(from_kind) &&
3701 IsFastElementsKind(to_kind)) {
3699 Register fixed_object_reg = ToRegister(instr->temp_reg()); 3702 Register fixed_object_reg = ToRegister(instr->temp_reg());
3700 ASSERT(fixed_object_reg.is(a2)); 3703 ASSERT(fixed_object_reg.is(a2));
3701 ASSERT(new_map_reg.is(a3)); 3704 ASSERT(new_map_reg.is(a3));
3702 __ mov(fixed_object_reg, object_reg); 3705 __ mov(fixed_object_reg, object_reg);
3703 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), 3706 CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(),
3704 RelocInfo::CODE_TARGET, instr); 3707 RelocInfo::CODE_TARGET, instr);
3705 } else { 3708 } else {
3706 UNREACHABLE(); 3709 UNREACHABLE();
3707 } 3710 }
3708 __ bind(&not_applicable); 3711 __ bind(&not_applicable);
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
4443 } 4446 }
4444 4447
4445 4448
4446 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 4449 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4447 Heap* heap = isolate()->heap(); 4450 Heap* heap = isolate()->heap();
4448 ElementsKind boilerplate_elements_kind = 4451 ElementsKind boilerplate_elements_kind =
4449 instr->hydrogen()->boilerplate_elements_kind(); 4452 instr->hydrogen()->boilerplate_elements_kind();
4450 4453
4451 // Deopt if the array literal boilerplate ElementsKind is of a type different 4454 // Deopt if the array literal boilerplate ElementsKind is of a type different
4452 // than the expected one. The check isn't necessary if the boilerplate has 4455 // than the expected one. The check isn't necessary if the boilerplate has
4453 // already been converted to FAST_ELEMENTS. 4456 // already been converted to TERMINAL_FAST_ELEMENTS_KIND.
4454 if (boilerplate_elements_kind != FAST_ELEMENTS) { 4457 if (boilerplate_elements_kind != TERMINAL_FAST_ELEMENTS_KIND) {
4455 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object()); 4458 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate_object());
4456 // Load map into a2. 4459 // Load map into a2.
4457 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); 4460 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset));
4458 // Load the map's "bit field 2". 4461 // Load the map's "bit field 2".
4459 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); 4462 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset));
4460 // Retrieve elements_kind from bit field 2. 4463 // Retrieve elements_kind from bit field 2.
4461 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); 4464 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount);
4462 DeoptimizeIf(ne, 4465 DeoptimizeIf(ne,
4463 instr->environment(), 4466 instr->environment(),
4464 a2, 4467 a2,
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 __ Subu(scratch, result, scratch); 5128 __ Subu(scratch, result, scratch);
5126 __ lw(result, FieldMemOperand(scratch, 5129 __ lw(result, FieldMemOperand(scratch,
5127 FixedArray::kHeaderSize - kPointerSize)); 5130 FixedArray::kHeaderSize - kPointerSize));
5128 __ bind(&done); 5131 __ bind(&done);
5129 } 5132 }
5130 5133
5131 5134
5132 #undef __ 5135 #undef __
5133 5136
5134 } } // namespace v8::internal 5137 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698