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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // |done| label if a property with the given name is found leaving the | 101 // |done| label if a property with the given name is found leaving the |
102 // index into the dictionary in |r1|. Jump to the |miss| label | 102 // index into the dictionary in |r1|. Jump to the |miss| label |
103 // otherwise. | 103 // otherwise. |
104 static void GenerateStringDictionaryProbes(MacroAssembler* masm, | 104 static void GenerateStringDictionaryProbes(MacroAssembler* masm, |
105 Label* miss, | 105 Label* miss, |
106 Label* done, | 106 Label* done, |
107 Register elements, | 107 Register elements, |
108 Register name, | 108 Register name, |
109 Register r0, | 109 Register r0, |
110 Register r1) { | 110 Register r1) { |
| 111 // Assert that name contains a string. |
| 112 if (FLAG_debug_code) __ AbortIfNotString(name); |
| 113 |
111 // Compute the capacity mask. | 114 // Compute the capacity mask. |
112 const int kCapacityOffset = | 115 const int kCapacityOffset = |
113 StringDictionary::kHeaderSize + | 116 StringDictionary::kHeaderSize + |
114 StringDictionary::kCapacityIndex * kPointerSize; | 117 StringDictionary::kCapacityIndex * kPointerSize; |
115 __ SmiToInteger32(r0, FieldOperand(elements, kCapacityOffset)); | 118 __ SmiToInteger32(r0, FieldOperand(elements, kCapacityOffset)); |
116 __ decl(r0); | 119 __ decl(r0); |
117 | 120 |
118 // Generate an unrolled loop that performs a few probes before | 121 // Generate an unrolled loop that performs a few probes before |
119 // giving up. Measurements done on Gmail indicate that 2 probes | 122 // giving up. Measurements done on Gmail indicate that 2 probes |
120 // cover ~93% of loads from dictionaries. | 123 // cover ~93% of loads from dictionaries. |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 // ----------- S t a t e ------------- | 1229 // ----------- S t a t e ------------- |
1227 // rcx : function name | 1230 // rcx : function name |
1228 // rsp[0] : return address | 1231 // rsp[0] : return address |
1229 // rsp[8] : argument argc | 1232 // rsp[8] : argument argc |
1230 // rsp[16] : argument argc - 1 | 1233 // rsp[16] : argument argc - 1 |
1231 // ... | 1234 // ... |
1232 // rsp[argc * 8] : argument 1 | 1235 // rsp[argc * 8] : argument 1 |
1233 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1236 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1234 // ----------------------------------- | 1237 // ----------------------------------- |
1235 | 1238 |
| 1239 // Check if the name is a string. |
| 1240 Label miss; |
| 1241 __ JumpIfSmi(rcx, &miss); |
| 1242 Condition cond = masm->IsObjectStringType(rcx, rax, rax); |
| 1243 __ j(NegateCondition(cond), &miss); |
1236 GenerateCallNormal(masm, argc); | 1244 GenerateCallNormal(masm, argc); |
| 1245 __ bind(&miss); |
1237 GenerateMiss(masm, argc); | 1246 GenerateMiss(masm, argc); |
1238 } | 1247 } |
1239 | 1248 |
1240 | 1249 |
1241 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { | 1250 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { |
1242 // ----------- S t a t e ------------- | 1251 // ----------- S t a t e ------------- |
1243 // rcx : function name | 1252 // rcx : function name |
1244 // rsp[0] : return address | 1253 // rsp[0] : return address |
1245 // rsp[8] : argument argc | 1254 // rsp[8] : argument argc |
1246 // rsp[16] : argument argc - 1 | 1255 // rsp[16] : argument argc - 1 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1754 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
1746 ? not_zero | 1755 ? not_zero |
1747 : zero; | 1756 : zero; |
1748 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1757 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1749 } | 1758 } |
1750 | 1759 |
1751 | 1760 |
1752 } } // namespace v8::internal | 1761 } } // namespace v8::internal |
1753 | 1762 |
1754 #endif // V8_TARGET_ARCH_X64 | 1763 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |