| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_A64) | 30 #if V8_TARGET_ARCH_A64 |
| 31 | 31 |
| 32 #include "a64/assembler-a64.h" | 32 #include "a64/assembler-a64.h" |
| 33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
| 34 #include "codegen.h" | 34 #include "codegen.h" |
| 35 #include "disasm.h" | 35 #include "disasm.h" |
| 36 #include "ic-inl.h" | 36 #include "ic-inl.h" |
| 37 #include "runtime.h" | 37 #include "runtime.h" |
| 38 #include "stub-cache.h" | 38 #include "stub-cache.h" |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 // -- x0 : value | 1348 // -- x0 : value |
| 1349 // -- x1 : key | 1349 // -- x1 : key |
| 1350 // -- x2 : receiver | 1350 // -- x2 : receiver |
| 1351 // -- x3 : target map | 1351 // -- x3 : target map |
| 1352 // ----------------------------------- | 1352 // ----------------------------------- |
| 1353 // Must return the modified receiver in x0. | 1353 // Must return the modified receiver in x0. |
| 1354 Register receiver = x2; | 1354 Register receiver = x2; |
| 1355 | 1355 |
| 1356 if (!FLAG_trace_elements_transitions) { | 1356 if (!FLAG_trace_elements_transitions) { |
| 1357 Label fail; | 1357 Label fail; |
| 1358 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, | 1358 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, |
| 1359 FAST_DOUBLE_ELEMENTS); | 1359 FAST_DOUBLE_ELEMENTS); |
| 1360 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); | 1360 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); |
| 1361 __ Mov(x0, receiver); | 1361 __ Mov(x0, receiver); |
| 1362 __ Ret(); | 1362 __ Ret(); |
| 1363 __ Bind(&fail); | 1363 __ Bind(&fail); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 __ Push(receiver); | 1366 __ Push(receiver); |
| 1367 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); | 1367 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 | 1370 |
| 1371 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( | 1371 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( |
| 1372 MacroAssembler* masm) { | 1372 MacroAssembler* masm) { |
| 1373 ASM_LOCATION("KeyedStoreIC::GenerateTransitionElementsDoubleToObject"); | 1373 ASM_LOCATION("KeyedStoreIC::GenerateTransitionElementsDoubleToObject"); |
| 1374 // ---------- S t a t e -------------- | 1374 // ---------- S t a t e -------------- |
| 1375 // -- x2 : receiver | 1375 // -- x2 : receiver |
| 1376 // -- x3 : target map | 1376 // -- x3 : target map |
| 1377 // -- lr : return address | 1377 // -- lr : return address |
| 1378 // ----------------------------------- | 1378 // ----------------------------------- |
| 1379 // Must return the modified receiver in r0. | 1379 // Must return the modified receiver in r0. |
| 1380 Register receiver = x2; | 1380 Register receiver = x2; |
| 1381 | 1381 |
| 1382 if (!FLAG_trace_elements_transitions) { | 1382 if (!FLAG_trace_elements_transitions) { |
| 1383 Label fail; | 1383 Label fail; |
| 1384 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, | 1384 AllocationSiteMode mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, |
| 1385 FAST_ELEMENTS); | 1385 FAST_ELEMENTS); |
| 1386 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); | 1386 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); |
| 1387 __ Mov(x0, receiver); | 1387 __ Mov(x0, receiver); |
| 1388 __ Ret(); | 1388 __ Ret(); |
| 1389 __ Bind(&fail); | 1389 __ Bind(&fail); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 __ Push(receiver); | 1392 __ Push(receiver); |
| 1393 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1); | 1393 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1); |
| 1394 } | 1394 } |
| 1395 | 1395 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 __ JumpIfNotRoot(x10, Heap::kHeapNumberMapRootIndex, &non_double_value); | 1511 __ JumpIfNotRoot(x10, Heap::kHeapNumberMapRootIndex, &non_double_value); |
| 1512 | 1512 |
| 1513 // Value is a double. Transition FAST_SMI_ELEMENTS -> | 1513 // Value is a double. Transition FAST_SMI_ELEMENTS -> |
| 1514 // FAST_DOUBLE_ELEMENTS and complete the store. | 1514 // FAST_DOUBLE_ELEMENTS and complete the store. |
| 1515 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, | 1515 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 1516 FAST_DOUBLE_ELEMENTS, | 1516 FAST_DOUBLE_ELEMENTS, |
| 1517 receiver_map, | 1517 receiver_map, |
| 1518 x10, | 1518 x10, |
| 1519 slow); | 1519 slow); |
| 1520 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. | 1520 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. |
| 1521 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, | 1521 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, |
| 1522 FAST_DOUBLE_ELEMENTS); | 1522 FAST_DOUBLE_ELEMENTS); |
| 1523 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); | 1523 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); |
| 1524 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1524 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1525 __ B(&fast_double_without_map_check); | 1525 __ B(&fast_double_without_map_check); |
| 1526 | 1526 |
| 1527 __ Bind(&non_double_value); | 1527 __ Bind(&non_double_value); |
| 1528 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS. | 1528 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS. |
| 1529 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, | 1529 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 1530 FAST_ELEMENTS, | 1530 FAST_ELEMENTS, |
| 1531 receiver_map, | 1531 receiver_map, |
| 1532 x10, | 1532 x10, |
| 1533 slow); | 1533 slow); |
| 1534 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. | 1534 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. |
| 1535 mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); | 1535 mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); |
| 1536 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, | 1536 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, |
| 1537 slow); | 1537 slow); |
| 1538 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1538 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1539 __ B(&finish_store); | 1539 __ B(&finish_store); |
| 1540 | 1540 |
| 1541 __ Bind(&transition_double_elements); | 1541 __ Bind(&transition_double_elements); |
| 1542 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a | 1542 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a |
| 1543 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and | 1543 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and |
| 1544 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS | 1544 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS |
| 1545 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, | 1545 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, |
| 1546 FAST_ELEMENTS, | 1546 FAST_ELEMENTS, |
| 1547 receiver_map, | 1547 receiver_map, |
| 1548 x10, | 1548 x10, |
| 1549 slow); | 1549 slow); |
| 1550 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. | 1550 ASSERT(receiver_map.Is(x3)); // Transition code expects map in x3. |
| 1551 mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 1551 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 1552 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); | 1552 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); |
| 1553 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1553 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1554 __ B(&finish_store); | 1554 __ B(&finish_store); |
| 1555 } | 1555 } |
| 1556 | 1556 |
| 1557 | 1557 |
| 1558 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 1558 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 1559 StrictModeFlag strict_mode) { | 1559 StrictModeFlag strict_mode) { |
| 1560 ASM_LOCATION("KeyedStoreIC::GenerateGeneric"); | 1560 ASM_LOCATION("KeyedStoreIC::GenerateGeneric"); |
| 1561 // ---------- S t a t e -------------- | 1561 // ---------- S t a t e -------------- |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); | 1850 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); |
| 1851 // This is JumpIfSmi(smi_reg, branch_imm). | 1851 // This is JumpIfSmi(smi_reg, branch_imm). |
| 1852 patcher.tbz(smi_reg, 0, branch_imm); | 1852 patcher.tbz(smi_reg, 0, branch_imm); |
| 1853 } | 1853 } |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 | 1856 |
| 1857 } } // namespace v8::internal | 1857 } } // namespace v8::internal |
| 1858 | 1858 |
| 1859 #endif // V8_TARGET_ARCH_A64 | 1859 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |