OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 // Checks the receiver for special cases (value type, slow case bits). | 413 // Checks the receiver for special cases (value type, slow case bits). |
414 // Falls through for regular JS object. | 414 // Falls through for regular JS object. |
415 static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm, | 415 static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm, |
416 Register receiver, | 416 Register receiver, |
417 Register map, | 417 Register map, |
418 Register scratch, | 418 Register scratch, |
419 int interceptor_bit, | 419 int interceptor_bit, |
420 Label* slow) { | 420 Label* slow) { |
421 // Check that the object isn't a smi. | 421 // Check that the object isn't a smi. |
422 __ BranchOnSmi(receiver, slow); | 422 __ JumpIfSmi(receiver, slow); |
423 // Get the map of the receiver. | 423 // Get the map of the receiver. |
424 __ ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 424 __ ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
425 // Check bit field. | 425 // Check bit field. |
426 __ ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); | 426 __ ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); |
427 __ tst(scratch, | 427 __ tst(scratch, |
428 Operand((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit))); | 428 Operand((1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit))); |
429 __ b(nz, slow); | 429 __ b(nz, slow); |
430 // Check that the object is some kind of JS object EXCEPT JS Value type. | 430 // Check that the object is some kind of JS object EXCEPT JS Value type. |
431 // In the case that the object is a value-wrapper object, | 431 // In the case that the object is a value-wrapper object, |
432 // we enter the runtime system to make sure that indexing into string | 432 // we enter the runtime system to make sure that indexing into string |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // ----------------------------------- | 742 // ----------------------------------- |
743 | 743 |
744 // Get the receiver of the function from the stack into r1. | 744 // Get the receiver of the function from the stack into r1. |
745 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 745 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
746 | 746 |
747 Label do_call, slow_call, slow_load, slow_reload_receiver; | 747 Label do_call, slow_call, slow_load, slow_reload_receiver; |
748 Label check_number_dictionary, check_string, lookup_monomorphic_cache; | 748 Label check_number_dictionary, check_string, lookup_monomorphic_cache; |
749 Label index_smi, index_string; | 749 Label index_smi, index_string; |
750 | 750 |
751 // Check that the key is a smi. | 751 // Check that the key is a smi. |
752 __ BranchOnNotSmi(r2, &check_string); | 752 __ JumpIfNotSmi(r2, &check_string); |
753 __ bind(&index_smi); | 753 __ bind(&index_smi); |
754 // Now the key is known to be a smi. This place is also jumped to from below | 754 // Now the key is known to be a smi. This place is also jumped to from below |
755 // where a numeric string is converted to a smi. | 755 // where a numeric string is converted to a smi. |
756 | 756 |
757 GenerateKeyedLoadReceiverCheck( | 757 GenerateKeyedLoadReceiverCheck( |
758 masm, r1, r0, r3, Map::kHasIndexedInterceptor, &slow_call); | 758 masm, r1, r0, r3, Map::kHasIndexedInterceptor, &slow_call); |
759 | 759 |
760 GenerateFastArrayLoad( | 760 GenerateFastArrayLoad( |
761 masm, r1, r2, r4, r3, r0, r1, &check_number_dictionary, &slow_load); | 761 masm, r1, r2, r4, r3, r0, r1, &check_number_dictionary, &slow_load); |
762 __ IncrementCounter(&Counters::keyed_call_generic_smi_fast, 1, r0, r3); | 762 __ IncrementCounter(&Counters::keyed_call_generic_smi_fast, 1, r0, r3); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 // -- r0 : key | 1158 // -- r0 : key |
1159 // -- r1 : receiver | 1159 // -- r1 : receiver |
1160 // ----------------------------------- | 1160 // ----------------------------------- |
1161 Label slow, check_string, index_smi, index_string, property_array_property; | 1161 Label slow, check_string, index_smi, index_string, property_array_property; |
1162 Label check_pixel_array, probe_dictionary, check_number_dictionary; | 1162 Label check_pixel_array, probe_dictionary, check_number_dictionary; |
1163 | 1163 |
1164 Register key = r0; | 1164 Register key = r0; |
1165 Register receiver = r1; | 1165 Register receiver = r1; |
1166 | 1166 |
1167 // Check that the key is a smi. | 1167 // Check that the key is a smi. |
1168 __ BranchOnNotSmi(key, &check_string); | 1168 __ JumpIfNotSmi(key, &check_string); |
1169 __ bind(&index_smi); | 1169 __ bind(&index_smi); |
1170 // Now the key is known to be a smi. This place is also jumped to from below | 1170 // Now the key is known to be a smi. This place is also jumped to from below |
1171 // where a numeric string is converted to a smi. | 1171 // where a numeric string is converted to a smi. |
1172 | 1172 |
1173 GenerateKeyedLoadReceiverCheck( | 1173 GenerateKeyedLoadReceiverCheck( |
1174 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); | 1174 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); |
1175 | 1175 |
1176 // Check the "has fast elements" bit in the receiver's map which is | 1176 // Check the "has fast elements" bit in the receiver's map which is |
1177 // now in r2. | 1177 // now in r2. |
1178 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); | 1178 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1339 |
1340 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 1340 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
1341 // ---------- S t a t e -------------- | 1341 // ---------- S t a t e -------------- |
1342 // -- lr : return address | 1342 // -- lr : return address |
1343 // -- r0 : key | 1343 // -- r0 : key |
1344 // -- r1 : receiver | 1344 // -- r1 : receiver |
1345 // ----------------------------------- | 1345 // ----------------------------------- |
1346 Label slow; | 1346 Label slow; |
1347 | 1347 |
1348 // Check that the receiver isn't a smi. | 1348 // Check that the receiver isn't a smi. |
1349 __ BranchOnSmi(r1, &slow); | 1349 __ JumpIfSmi(r1, &slow); |
1350 | 1350 |
1351 // Check that the key is an array index, that is Uint32. | 1351 // Check that the key is an array index, that is Uint32. |
1352 __ tst(r0, Operand(kSmiTagMask | kSmiSignMask)); | 1352 __ tst(r0, Operand(kSmiTagMask | kSmiSignMask)); |
1353 __ b(ne, &slow); | 1353 __ b(ne, &slow); |
1354 | 1354 |
1355 // Get the map of the receiver. | 1355 // Get the map of the receiver. |
1356 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 1356 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
1357 | 1357 |
1358 // Check that it has indexed interceptor and access checks | 1358 // Check that it has indexed interceptor and access checks |
1359 // are not enabled for this object. | 1359 // are not enabled for this object. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 GenerateRuntimeSetProperty(masm); | 1463 GenerateRuntimeSetProperty(masm); |
1464 | 1464 |
1465 // Check whether the elements is a pixel array. | 1465 // Check whether the elements is a pixel array. |
1466 // r4: elements map. | 1466 // r4: elements map. |
1467 __ bind(&check_pixel_array); | 1467 __ bind(&check_pixel_array); |
1468 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex); | 1468 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex); |
1469 __ cmp(r4, ip); | 1469 __ cmp(r4, ip); |
1470 __ b(ne, &slow); | 1470 __ b(ne, &slow); |
1471 // Check that the value is a smi. If a conversion is needed call into the | 1471 // Check that the value is a smi. If a conversion is needed call into the |
1472 // runtime to convert and clamp. | 1472 // runtime to convert and clamp. |
1473 __ BranchOnNotSmi(value, &slow); | 1473 __ JumpIfNotSmi(value, &slow); |
1474 __ mov(r4, Operand(key, ASR, kSmiTagSize)); // Untag the key. | 1474 __ mov(r4, Operand(key, ASR, kSmiTagSize)); // Untag the key. |
1475 __ ldr(ip, FieldMemOperand(elements, PixelArray::kLengthOffset)); | 1475 __ ldr(ip, FieldMemOperand(elements, PixelArray::kLengthOffset)); |
1476 __ cmp(r4, Operand(ip)); | 1476 __ cmp(r4, Operand(ip)); |
1477 __ b(hs, &slow); | 1477 __ b(hs, &slow); |
1478 __ mov(r5, Operand(value, ASR, kSmiTagSize)); // Untag the value. | 1478 __ mov(r5, Operand(value, ASR, kSmiTagSize)); // Untag the value. |
1479 __ Usat(r5, 8, Operand(r5)); // Clamp the value to [0..255]. | 1479 __ Usat(r5, 8, Operand(r5)); // Clamp the value to [0..255]. |
1480 | 1480 |
1481 // Get the pointer to the external array. This clobbers elements. | 1481 // Get the pointer to the external array. This clobbers elements. |
1482 __ ldr(elements, | 1482 __ ldr(elements, |
1483 FieldMemOperand(elements, PixelArray::kExternalPointerOffset)); | 1483 FieldMemOperand(elements, PixelArray::kExternalPointerOffset)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 // to JSArray. | 1582 // to JSArray. |
1583 // Value must be a number, but only smis are accepted as the most common case. | 1583 // Value must be a number, but only smis are accepted as the most common case. |
1584 | 1584 |
1585 Label miss; | 1585 Label miss; |
1586 | 1586 |
1587 Register receiver = r1; | 1587 Register receiver = r1; |
1588 Register value = r0; | 1588 Register value = r0; |
1589 Register scratch = r3; | 1589 Register scratch = r3; |
1590 | 1590 |
1591 // Check that the receiver isn't a smi. | 1591 // Check that the receiver isn't a smi. |
1592 __ BranchOnSmi(receiver, &miss); | 1592 __ JumpIfSmi(receiver, &miss); |
1593 | 1593 |
1594 // Check that the object is a JS array. | 1594 // Check that the object is a JS array. |
1595 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE); | 1595 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE); |
1596 __ b(ne, &miss); | 1596 __ b(ne, &miss); |
1597 | 1597 |
1598 // Check that elements are FixedArray. | 1598 // Check that elements are FixedArray. |
1599 // We rely on StoreIC_ArrayLength below to deal with all types of | 1599 // We rely on StoreIC_ArrayLength below to deal with all types of |
1600 // fast elements (including COW). | 1600 // fast elements (including COW). |
1601 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset)); | 1601 __ ldr(scratch, FieldMemOperand(receiver, JSArray::kElementsOffset)); |
1602 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE); | 1602 __ CompareObjectType(scratch, scratch, scratch, FIXED_ARRAY_TYPE); |
1603 __ b(ne, &miss); | 1603 __ b(ne, &miss); |
1604 | 1604 |
1605 // Check that value is a smi. | 1605 // Check that value is a smi. |
1606 __ BranchOnNotSmi(value, &miss); | 1606 __ JumpIfNotSmi(value, &miss); |
1607 | 1607 |
1608 // Prepare tail call to StoreIC_ArrayLength. | 1608 // Prepare tail call to StoreIC_ArrayLength. |
1609 __ Push(receiver, value); | 1609 __ Push(receiver, value); |
1610 | 1610 |
1611 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength)); | 1611 ExternalReference ref = ExternalReference(IC_Utility(kStoreIC_ArrayLength)); |
1612 __ TailCallExternalReference(ref, 2, 1); | 1612 __ TailCallExternalReference(ref, 2, 1); |
1613 | 1613 |
1614 __ bind(&miss); | 1614 __ bind(&miss); |
1615 | 1615 |
1616 GenerateMiss(masm); | 1616 GenerateMiss(masm); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 | 1704 |
1705 | 1705 |
1706 void PatchInlinedSmiCode(Address address) { | 1706 void PatchInlinedSmiCode(Address address) { |
1707 // Currently there is no smi inlining in the ARM full code generator. | 1707 // Currently there is no smi inlining in the ARM full code generator. |
1708 } | 1708 } |
1709 | 1709 |
1710 | 1710 |
1711 } } // namespace v8::internal | 1711 } } // namespace v8::internal |
1712 | 1712 |
1713 #endif // V8_TARGET_ARCH_ARM | 1713 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |