| 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 4736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4747 | 4747 |
| 4748 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4748 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 4749 __ mov(r0, Operand(Smi::FromInt(instance_size))); | 4749 __ mov(r0, Operand(Smi::FromInt(instance_size))); |
| 4750 __ push(r0); | 4750 __ push(r0); |
| 4751 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); | 4751 CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); |
| 4752 __ StoreToSafepointRegisterSlot(r0, result); | 4752 __ StoreToSafepointRegisterSlot(r0, result); |
| 4753 } | 4753 } |
| 4754 | 4754 |
| 4755 | 4755 |
| 4756 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4756 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| 4757 Heap* heap = isolate()->heap(); | 4757 Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
| 4758 ElementsKind boilerplate_elements_kind = | 4758 ElementsKind boilerplate_elements_kind = |
| 4759 instr->hydrogen()->boilerplate_elements_kind(); | 4759 instr->hydrogen()->boilerplate_elements_kind(); |
| 4760 | 4760 |
| 4761 // Deopt if the array literal boilerplate ElementsKind is of a type different | 4761 // Deopt if the array literal boilerplate ElementsKind is of a type different |
| 4762 // than the expected one. The check isn't necessary if the boilerplate has | 4762 // than the expected one. The check isn't necessary if the boilerplate has |
| 4763 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. | 4763 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. |
| 4764 if (CanTransitionToMoreGeneralFastElementsKind( | 4764 if (CanTransitionToMoreGeneralFastElementsKind( |
| 4765 boilerplate_elements_kind, true)) { | 4765 boilerplate_elements_kind, true)) { |
| 4766 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate_object()); | 4766 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate_object()); |
| 4767 // Load map into r2. | 4767 // Load map into r2. |
| 4768 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 4768 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 4769 // Load the map's "bit field 2". | 4769 // Load the map's "bit field 2". |
| 4770 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); | 4770 __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); |
| 4771 // Retrieve elements_kind from bit field 2. | 4771 // Retrieve elements_kind from bit field 2. |
| 4772 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); | 4772 __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
| 4773 __ cmp(r2, Operand(boilerplate_elements_kind)); | 4773 __ cmp(r2, Operand(boilerplate_elements_kind)); |
| 4774 DeoptimizeIf(ne, instr->environment()); | 4774 DeoptimizeIf(ne, instr->environment()); |
| 4775 } | 4775 } |
| 4776 | 4776 |
| 4777 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4777 // Set up the parameters to the stub/runtime call. |
| 4778 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 4778 __ LoadHeapObject(r3, literals); |
| 4779 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4779 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 4780 // Boilerplate already exists, constant elements are never accessed. | 4780 // Boilerplate already exists, constant elements are never accessed. |
| 4781 // Pass an empty fixed array. | 4781 // Pass an empty fixed array. |
| 4782 __ mov(r1, Operand(Handle<FixedArray>(heap->empty_fixed_array()))); | 4782 __ mov(r1, Operand(isolate()->factory()->empty_fixed_array())); |
| 4783 __ Push(r3, r2, r1); | 4783 __ Push(r3, r2, r1); |
| 4784 | 4784 |
| 4785 // Pick the right runtime function or stub to call. | 4785 // Pick the right runtime function or stub to call. |
| 4786 int length = instr->hydrogen()->length(); | 4786 int length = instr->hydrogen()->length(); |
| 4787 if (instr->hydrogen()->IsCopyOnWrite()) { | 4787 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 4788 ASSERT(instr->hydrogen()->depth() == 1); | 4788 ASSERT(instr->hydrogen()->depth() == 1); |
| 4789 FastCloneShallowArrayStub::Mode mode = | 4789 FastCloneShallowArrayStub::Mode mode = |
| 4790 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 4790 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 4791 FastCloneShallowArrayStub stub(mode, length); | 4791 FastCloneShallowArrayStub stub(mode, length); |
| 4792 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4792 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5398 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5399 __ ldr(result, FieldMemOperand(scratch, | 5399 __ ldr(result, FieldMemOperand(scratch, |
| 5400 FixedArray::kHeaderSize - kPointerSize)); | 5400 FixedArray::kHeaderSize - kPointerSize)); |
| 5401 __ bind(&done); | 5401 __ bind(&done); |
| 5402 } | 5402 } |
| 5403 | 5403 |
| 5404 | 5404 |
| 5405 #undef __ | 5405 #undef __ |
| 5406 | 5406 |
| 5407 } } // namespace v8::internal | 5407 } } // namespace v8::internal |
| OLD | NEW |