| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 5160 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
| 5161 // Load the map's "bit field 2". | 5161 // Load the map's "bit field 2". |
| 5162 __ movb(rbx, FieldOperand(rbx, Map::kBitField2Offset)); | 5162 __ movb(rbx, FieldOperand(rbx, Map::kBitField2Offset)); |
| 5163 // Retrieve elements_kind from bit field 2. | 5163 // Retrieve elements_kind from bit field 2. |
| 5164 __ and_(rbx, Immediate(Map::kElementsKindMask)); | 5164 __ and_(rbx, Immediate(Map::kElementsKindMask)); |
| 5165 __ cmpb(rbx, Immediate(boilerplate_elements_kind << | 5165 __ cmpb(rbx, Immediate(boilerplate_elements_kind << |
| 5166 Map::kElementsKindShift)); | 5166 Map::kElementsKindShift)); |
| 5167 DeoptimizeIf(not_equal, instr->environment()); | 5167 DeoptimizeIf(not_equal, instr->environment()); |
| 5168 } | 5168 } |
| 5169 | 5169 |
| 5170 // Set up the parameters to the stub/runtime call. | 5170 // Set up the parameters to the stub/runtime call and pick the right |
| 5171 __ PushHeapObject(literals); | 5171 // runtime function or stub to call. Boilerplate already exists, |
| 5172 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 5172 // constant elements are never accessed, pass an empty fixed array. |
| 5173 // Boilerplate already exists, constant elements are never accessed. | |
| 5174 // Pass an empty fixed array. | |
| 5175 __ Push(isolate()->factory()->empty_fixed_array()); | |
| 5176 | |
| 5177 // Pick the right runtime function or stub to call. | |
| 5178 int length = instr->hydrogen()->length(); | 5173 int length = instr->hydrogen()->length(); |
| 5179 if (instr->hydrogen()->IsCopyOnWrite()) { | 5174 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 5180 ASSERT(instr->hydrogen()->depth() == 1); | 5175 ASSERT(instr->hydrogen()->depth() == 1); |
| 5176 __ LoadHeapObject(rax, literals); |
| 5177 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index())); |
| 5178 __ Move(rcx, isolate()->factory()->empty_fixed_array()); |
| 5181 FastCloneShallowArrayStub::Mode mode = | 5179 FastCloneShallowArrayStub::Mode mode = |
| 5182 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 5180 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 5183 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); | 5181 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); |
| 5184 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 5182 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5185 } else if (instr->hydrogen()->depth() > 1) { | 5183 } else if (instr->hydrogen()->depth() > 1) { |
| 5184 __ PushHeapObject(literals); |
| 5185 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
| 5186 __ Push(isolate()->factory()->empty_fixed_array()); |
| 5186 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 5187 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
| 5187 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 5188 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 5189 __ PushHeapObject(literals); |
| 5190 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
| 5191 __ Push(isolate()->factory()->empty_fixed_array()); |
| 5188 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 5192 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
| 5189 } else { | 5193 } else { |
| 5194 __ LoadHeapObject(rax, literals); |
| 5195 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index())); |
| 5196 __ Move(rcx, isolate()->factory()->empty_fixed_array()); |
| 5190 FastCloneShallowArrayStub::Mode mode = | 5197 FastCloneShallowArrayStub::Mode mode = |
| 5191 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 5198 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| 5192 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 5199 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 5193 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 5200 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 5194 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 5201 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 5195 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 5202 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 5196 } | 5203 } |
| 5197 } | 5204 } |
| 5198 | 5205 |
| 5199 | 5206 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5838 FixedArray::kHeaderSize - kPointerSize)); | 5845 FixedArray::kHeaderSize - kPointerSize)); |
| 5839 __ bind(&done); | 5846 __ bind(&done); |
| 5840 } | 5847 } |
| 5841 | 5848 |
| 5842 | 5849 |
| 5843 #undef __ | 5850 #undef __ |
| 5844 | 5851 |
| 5845 } } // namespace v8::internal | 5852 } } // namespace v8::internal |
| 5846 | 5853 |
| 5847 #endif // V8_TARGET_ARCH_X64 | 5854 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |