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 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4596 } | 4596 } |
4597 } else { | 4597 } else { |
4598 UNREACHABLE(); | 4598 UNREACHABLE(); |
4599 } | 4599 } |
4600 } | 4600 } |
4601 } | 4601 } |
4602 | 4602 |
4603 | 4603 |
4604 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 4604 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
4605 int size = instr->hydrogen()->total_size(); | 4605 int size = instr->hydrogen()->total_size(); |
| 4606 ElementsKind boilerplate_elements_kind = |
| 4607 instr->hydrogen()->boilerplate()->GetElementsKind(); |
| 4608 |
| 4609 // Deopt if the literal boilerplate ElementsKind is of a type different than |
| 4610 // the expected one. The check isn't necessary if the boilerplate has already |
| 4611 // been converted to FAST_ELEMENTS. |
| 4612 if (boilerplate_elements_kind != FAST_ELEMENTS) { |
| 4613 __ LoadHeapObject(a1, instr->hydrogen()->boilerplate()); |
| 4614 // Load map into a2. |
| 4615 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 4616 // Load the map's "bit field 2". |
| 4617 __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset)); |
| 4618 // Retrieve elements_kind from bit field 2. |
| 4619 __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4620 DeoptimizeIf(ne, instr->environment(), a2, |
| 4621 Operand(boilerplate_elements_kind)); |
| 4622 } |
4606 | 4623 |
4607 // Allocate all objects that are part of the literal in one big | 4624 // Allocate all objects that are part of the literal in one big |
4608 // allocation. This avoids multiple limit checks. | 4625 // allocation. This avoids multiple limit checks. |
4609 Label allocated, runtime_allocate; | 4626 Label allocated, runtime_allocate; |
4610 __ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); | 4627 __ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT); |
4611 __ jmp(&allocated); | 4628 __ jmp(&allocated); |
4612 | 4629 |
4613 __ bind(&runtime_allocate); | 4630 __ bind(&runtime_allocate); |
4614 __ li(a0, Operand(Smi::FromInt(size))); | 4631 __ li(a0, Operand(Smi::FromInt(size))); |
4615 __ push(a0); | 4632 __ push(a0); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5110 __ Subu(scratch, result, scratch); | 5127 __ Subu(scratch, result, scratch); |
5111 __ lw(result, FieldMemOperand(scratch, | 5128 __ lw(result, FieldMemOperand(scratch, |
5112 FixedArray::kHeaderSize - kPointerSize)); | 5129 FixedArray::kHeaderSize - kPointerSize)); |
5113 __ bind(&done); | 5130 __ bind(&done); |
5114 } | 5131 } |
5115 | 5132 |
5116 | 5133 |
5117 #undef __ | 5134 #undef __ |
5118 | 5135 |
5119 } } // namespace v8::internal | 5136 } } // namespace v8::internal |
OLD | NEW |