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 4806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4817 } | 4817 } |
4818 } else { | 4818 } else { |
4819 UNREACHABLE(); | 4819 UNREACHABLE(); |
4820 } | 4820 } |
4821 } | 4821 } |
4822 } | 4822 } |
4823 | 4823 |
4824 | 4824 |
4825 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 4825 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
4826 int size = instr->hydrogen()->total_size(); | 4826 int size = instr->hydrogen()->total_size(); |
| 4827 ElementsKind boilerplate_elements_kind = |
| 4828 instr->hydrogen()->boilerplate()->GetElementsKind(); |
| 4829 |
| 4830 // Deopt if the literal boilerplate ElementsKind is of a type different than |
| 4831 // the expected one. The check isn't necessary if the boilerplate has already |
| 4832 // been converted to FAST_ELEMENTS. |
| 4833 if (boilerplate_elements_kind != FAST_ELEMENTS) { |
| 4834 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
| 4835 // Load map into r2. |
| 4836 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 4837 // Load the map's "bit field 2". |
| 4838 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); |
| 4839 // Retrieve elements_kind from bit field 2. |
| 4840 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4841 __ cmp(r2, Operand(boilerplate_elements_kind)); |
| 4842 DeoptimizeIf(ne, instr->environment()); |
| 4843 } |
4827 | 4844 |
4828 // Allocate all objects that are part of the literal in one big | 4845 // Allocate all objects that are part of the literal in one big |
4829 // allocation. This avoids multiple limit checks. | 4846 // allocation. This avoids multiple limit checks. |
4830 Label allocated, runtime_allocate; | 4847 Label allocated, runtime_allocate; |
4831 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); | 4848 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
4832 __ jmp(&allocated); | 4849 __ jmp(&allocated); |
4833 | 4850 |
4834 __ bind(&runtime_allocate); | 4851 __ bind(&runtime_allocate); |
4835 __ mov(r0, Operand(Smi::FromInt(size))); | 4852 __ mov(r0, Operand(Smi::FromInt(size))); |
4836 __ push(r0); | 4853 __ push(r0); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5294 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5311 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5295 __ ldr(result, FieldMemOperand(scratch, | 5312 __ ldr(result, FieldMemOperand(scratch, |
5296 FixedArray::kHeaderSize - kPointerSize)); | 5313 FixedArray::kHeaderSize - kPointerSize)); |
5297 __ bind(&done); | 5314 __ bind(&done); |
5298 } | 5315 } |
5299 | 5316 |
5300 | 5317 |
5301 #undef __ | 5318 #undef __ |
5302 | 5319 |
5303 } } // namespace v8::internal | 5320 } } // namespace v8::internal |
OLD | NEW |