| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // For integer array types: | 840 // For integer array types: |
| 841 // rcx: value | 841 // rcx: value |
| 842 // For floating-point array type: | 842 // For floating-point array type: |
| 843 // xmm0: value as double. | 843 // xmm0: value as double. |
| 844 | 844 |
| 845 ASSERT(kSmiValueSize == 32); | 845 ASSERT(kSmiValueSize == 32); |
| 846 if (array_type == kExternalUnsignedIntArray) { | 846 if (array_type == kExternalUnsignedIntArray) { |
| 847 // For the UnsignedInt array type, we need to see whether | 847 // For the UnsignedInt array type, we need to see whether |
| 848 // the value can be represented in a Smi. If not, we need to convert | 848 // the value can be represented in a Smi. If not, we need to convert |
| 849 // it to a HeapNumber. | 849 // it to a HeapNumber. |
| 850 Label box_int; | 850 NearLabel box_int; |
| 851 | 851 |
| 852 __ JumpIfUIntNotValidSmiValue(rcx, &box_int); | 852 __ JumpIfUIntNotValidSmiValue(rcx, &box_int); |
| 853 | 853 |
| 854 __ Integer32ToSmi(rax, rcx); | 854 __ Integer32ToSmi(rax, rcx); |
| 855 __ ret(0); | 855 __ ret(0); |
| 856 | 856 |
| 857 __ bind(&box_int); | 857 __ bind(&box_int); |
| 858 | 858 |
| 859 // Allocate a HeapNumber for the int and perform int-to-double | 859 // Allocate a HeapNumber for the int and perform int-to-double |
| 860 // conversion. | 860 // conversion. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 Heap::kPixelArrayMapRootIndex); | 1025 Heap::kPixelArrayMapRootIndex); |
| 1026 __ j(not_equal, &slow); | 1026 __ j(not_equal, &slow); |
| 1027 // Check that the value is a smi. If a conversion is needed call into the | 1027 // Check that the value is a smi. If a conversion is needed call into the |
| 1028 // runtime to convert and clamp. | 1028 // runtime to convert and clamp. |
| 1029 __ JumpIfNotSmi(rax, &slow); | 1029 __ JumpIfNotSmi(rax, &slow); |
| 1030 __ cmpl(rcx, FieldOperand(rbx, PixelArray::kLengthOffset)); | 1030 __ cmpl(rcx, FieldOperand(rbx, PixelArray::kLengthOffset)); |
| 1031 __ j(above_equal, &slow); | 1031 __ j(above_equal, &slow); |
| 1032 // No more bailouts to slow case on this path, so key not needed. | 1032 // No more bailouts to slow case on this path, so key not needed. |
| 1033 __ SmiToInteger32(rdi, rax); | 1033 __ SmiToInteger32(rdi, rax); |
| 1034 { // Clamp the value to [0..255]. | 1034 { // Clamp the value to [0..255]. |
| 1035 Label done; | 1035 NearLabel done; |
| 1036 __ testl(rdi, Immediate(0xFFFFFF00)); | 1036 __ testl(rdi, Immediate(0xFFFFFF00)); |
| 1037 __ j(zero, &done); | 1037 __ j(zero, &done); |
| 1038 __ setcc(negative, rdi); // 1 if negative, 0 if positive. | 1038 __ setcc(negative, rdi); // 1 if negative, 0 if positive. |
| 1039 __ decb(rdi); // 0 if negative, 255 if positive. | 1039 __ decb(rdi); // 0 if negative, 255 if positive. |
| 1040 __ bind(&done); | 1040 __ bind(&done); |
| 1041 } | 1041 } |
| 1042 __ movq(rbx, FieldOperand(rbx, PixelArray::kExternalPointerOffset)); | 1042 __ movq(rbx, FieldOperand(rbx, PixelArray::kExternalPointerOffset)); |
| 1043 __ movb(Operand(rbx, rcx, times_1, 0), rdi); | 1043 __ movb(Operand(rbx, rcx, times_1, 0), rdi); |
| 1044 __ ret(0); | 1044 __ ret(0); |
| 1045 | 1045 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1075 // Check the key against the length in the array, compute the | 1075 // Check the key against the length in the array, compute the |
| 1076 // address to store into and fall through to fast case. | 1076 // address to store into and fall through to fast case. |
| 1077 __ SmiCompareInteger32(FieldOperand(rdx, JSArray::kLengthOffset), rcx); | 1077 __ SmiCompareInteger32(FieldOperand(rdx, JSArray::kLengthOffset), rcx); |
| 1078 __ j(below_equal, &extra); | 1078 __ j(below_equal, &extra); |
| 1079 | 1079 |
| 1080 // Fast case: Do the store. | 1080 // Fast case: Do the store. |
| 1081 __ bind(&fast); | 1081 __ bind(&fast); |
| 1082 // rax: value | 1082 // rax: value |
| 1083 // rbx: receiver's elements array (a FixedArray) | 1083 // rbx: receiver's elements array (a FixedArray) |
| 1084 // rcx: index | 1084 // rcx: index |
| 1085 Label non_smi_value; | 1085 NearLabel non_smi_value; |
| 1086 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), | 1086 __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), |
| 1087 rax); | 1087 rax); |
| 1088 __ JumpIfNotSmi(rax, &non_smi_value); | 1088 __ JumpIfNotSmi(rax, &non_smi_value); |
| 1089 __ ret(0); | 1089 __ ret(0); |
| 1090 __ bind(&non_smi_value); | 1090 __ bind(&non_smi_value); |
| 1091 // Slow case that needs to retain rcx for use by RecordWrite. | 1091 // Slow case that needs to retain rcx for use by RecordWrite. |
| 1092 // Update write barrier for the elements array address. | 1092 // Update write barrier for the elements array address. |
| 1093 __ movq(rdx, rax); | 1093 __ movq(rdx, rax); |
| 1094 __ RecordWriteNonSmi(rbx, 0, rdx, rcx); | 1094 __ RecordWriteNonSmi(rbx, 0, rdx, rcx); |
| 1095 __ ret(0); | 1095 __ ret(0); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 | 1098 |
| 1099 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, | 1099 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, |
| 1100 ExternalArrayType array_type) { | 1100 ExternalArrayType array_type) { |
| 1101 // ----------- S t a t e ------------- | 1101 // ----------- S t a t e ------------- |
| 1102 // -- rax : value | 1102 // -- rax : value |
| 1103 // -- rcx : key | 1103 // -- rcx : key |
| 1104 // -- rdx : receiver | 1104 // -- rdx : receiver |
| 1105 // -- rsp[0] : return address | 1105 // -- rsp[0] : return address |
| 1106 // ----------------------------------- | 1106 // ----------------------------------- |
| 1107 Label slow, check_heap_number; | 1107 Label slow; |
| 1108 | 1108 |
| 1109 // Check that the object isn't a smi. | 1109 // Check that the object isn't a smi. |
| 1110 __ JumpIfSmi(rdx, &slow); | 1110 __ JumpIfSmi(rdx, &slow); |
| 1111 // Get the map from the receiver. | 1111 // Get the map from the receiver. |
| 1112 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); | 1112 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); |
| 1113 // Check that the receiver does not require access checks. We need | 1113 // Check that the receiver does not require access checks. We need |
| 1114 // to do this because this generic stub does not perform map checks. | 1114 // to do this because this generic stub does not perform map checks. |
| 1115 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), | 1115 __ testb(FieldOperand(rbx, Map::kBitFieldOffset), |
| 1116 Immediate(1 << Map::kIsAccessCheckNeeded)); | 1116 Immediate(1 << Map::kIsAccessCheckNeeded)); |
| 1117 __ j(not_zero, &slow); | 1117 __ j(not_zero, &slow); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1138 // Unsigned comparison catches both negative and too-large values. | 1138 // Unsigned comparison catches both negative and too-large values. |
| 1139 __ j(above_equal, &slow); | 1139 __ j(above_equal, &slow); |
| 1140 | 1140 |
| 1141 // Handle both smis and HeapNumbers in the fast path. Go to the | 1141 // Handle both smis and HeapNumbers in the fast path. Go to the |
| 1142 // runtime for all other kinds of values. | 1142 // runtime for all other kinds of values. |
| 1143 // rax: value | 1143 // rax: value |
| 1144 // rcx: key (a smi) | 1144 // rcx: key (a smi) |
| 1145 // rdx: receiver (a JSObject) | 1145 // rdx: receiver (a JSObject) |
| 1146 // rbx: elements array | 1146 // rbx: elements array |
| 1147 // rdi: untagged key | 1147 // rdi: untagged key |
| 1148 NearLabel check_heap_number; |
| 1148 __ JumpIfNotSmi(rax, &check_heap_number); | 1149 __ JumpIfNotSmi(rax, &check_heap_number); |
| 1149 // No more branches to slow case on this path. Key and receiver not needed. | 1150 // No more branches to slow case on this path. Key and receiver not needed. |
| 1150 __ SmiToInteger32(rdx, rax); | 1151 __ SmiToInteger32(rdx, rax); |
| 1151 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); | 1152 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); |
| 1152 // rbx: base pointer of external storage | 1153 // rbx: base pointer of external storage |
| 1153 switch (array_type) { | 1154 switch (array_type) { |
| 1154 case kExternalByteArray: | 1155 case kExternalByteArray: |
| 1155 case kExternalUnsignedByteArray: | 1156 case kExternalUnsignedByteArray: |
| 1156 __ movb(Operand(rbx, rdi, times_1, 0), rdx); | 1157 __ movb(Operand(rbx, rdi, times_1, 0), rdx); |
| 1157 break; | 1158 break; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 // rsp[8] : argument argc | 1482 // rsp[8] : argument argc |
| 1482 // rsp[16] : argument argc - 1 | 1483 // rsp[16] : argument argc - 1 |
| 1483 // ... | 1484 // ... |
| 1484 // rsp[argc * 8] : argument 1 | 1485 // rsp[argc * 8] : argument 1 |
| 1485 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1486 // rsp[(argc + 1) * 8] : argument 0 = receiver |
| 1486 // ----------------------------------- | 1487 // ----------------------------------- |
| 1487 | 1488 |
| 1488 // Get the receiver of the function from the stack; 1 ~ return address. | 1489 // Get the receiver of the function from the stack; 1 ~ return address. |
| 1489 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1490 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
| 1490 | 1491 |
| 1491 Label do_call, slow_call, slow_load, slow_reload_receiver; | 1492 Label do_call, slow_call, slow_load; |
| 1492 Label check_number_dictionary, check_string, lookup_monomorphic_cache; | 1493 Label check_number_dictionary, check_string, lookup_monomorphic_cache; |
| 1493 Label index_smi, index_string; | 1494 Label index_smi, index_string; |
| 1494 | 1495 |
| 1495 // Check that the key is a smi. | 1496 // Check that the key is a smi. |
| 1496 __ JumpIfNotSmi(rcx, &check_string); | 1497 __ JumpIfNotSmi(rcx, &check_string); |
| 1497 | 1498 |
| 1498 __ bind(&index_smi); | 1499 __ bind(&index_smi); |
| 1499 // Now the key is known to be a smi. This place is also jumped to from below | 1500 // Now the key is known to be a smi. This place is also jumped to from below |
| 1500 // where a numeric string is converted to a smi. | 1501 // where a numeric string is converted to a smi. |
| 1501 | 1502 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1873 | 1874 |
| 1874 | 1875 |
| 1875 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 1876 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
| 1876 // ----------- S t a t e ------------- | 1877 // ----------- S t a t e ------------- |
| 1877 // -- rax : value | 1878 // -- rax : value |
| 1878 // -- rcx : name | 1879 // -- rcx : name |
| 1879 // -- rdx : receiver | 1880 // -- rdx : receiver |
| 1880 // -- rsp[0] : return address | 1881 // -- rsp[0] : return address |
| 1881 // ----------------------------------- | 1882 // ----------------------------------- |
| 1882 | 1883 |
| 1883 Label miss, restore_miss; | 1884 Label miss; |
| 1884 | 1885 |
| 1885 GenerateStringDictionaryReceiverCheck(masm, rdx, rbx, rdi, &miss); | 1886 GenerateStringDictionaryReceiverCheck(masm, rdx, rbx, rdi, &miss); |
| 1886 | 1887 |
| 1887 GenerateDictionaryStore(masm, &miss, rbx, rcx, rax, r8, r9); | 1888 GenerateDictionaryStore(masm, &miss, rbx, rcx, rax, r8, r9); |
| 1888 __ IncrementCounter(&Counters::store_normal_hit, 1); | 1889 __ IncrementCounter(&Counters::store_normal_hit, 1); |
| 1889 __ ret(0); | 1890 __ ret(0); |
| 1890 | 1891 |
| 1891 __ bind(&miss); | 1892 __ bind(&miss); |
| 1892 __ IncrementCounter(&Counters::store_normal_miss, 1); | 1893 __ IncrementCounter(&Counters::store_normal_miss, 1); |
| 1893 GenerateMiss(masm); | 1894 GenerateMiss(masm); |
| 1894 } | 1895 } |
| 1895 | 1896 |
| 1896 | 1897 |
| 1897 #undef __ | 1898 #undef __ |
| 1898 | 1899 |
| 1899 | 1900 |
| 1900 } } // namespace v8::internal | 1901 } } // namespace v8::internal |
| 1901 | 1902 |
| 1902 #endif // V8_TARGET_ARCH_X64 | 1903 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |