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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // 6 bytes (jne slow_label). | 173 // 6 bytes (jne slow_label). |
174 const int LoadIC::kOffsetToLoadInstruction = 13; | 174 const int LoadIC::kOffsetToLoadInstruction = 13; |
175 | 175 |
176 | 176 |
177 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 177 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
178 // ----------- S t a t e ------------- | 178 // ----------- S t a t e ------------- |
179 // -- ecx : name | 179 // -- ecx : name |
180 // -- esp[0] : return address | 180 // -- esp[0] : return address |
181 // -- esp[4] : receiver | 181 // -- esp[4] : receiver |
182 // ----------------------------------- | 182 // ----------------------------------- |
183 | |
184 Label miss; | 183 Label miss; |
185 | 184 |
186 __ mov(eax, Operand(esp, kPointerSize)); | 185 __ mov(eax, Operand(esp, kPointerSize)); |
187 | 186 |
188 StubCompiler::GenerateLoadArrayLength(masm, eax, edx, &miss); | 187 StubCompiler::GenerateLoadArrayLength(masm, eax, edx, &miss); |
189 __ bind(&miss); | 188 __ bind(&miss); |
190 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 189 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
191 } | 190 } |
192 | 191 |
193 | 192 |
194 void LoadIC::GenerateStringLength(MacroAssembler* masm) { | 193 void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
195 // ----------- S t a t e ------------- | 194 // ----------- S t a t e ------------- |
196 // -- ecx : name | 195 // -- ecx : name |
197 // -- esp[0] : return address | 196 // -- esp[0] : return address |
198 // -- esp[4] : receiver | 197 // -- esp[4] : receiver |
199 // ----------------------------------- | 198 // ----------------------------------- |
200 | |
201 Label miss; | 199 Label miss; |
202 | 200 |
203 __ mov(eax, Operand(esp, kPointerSize)); | 201 __ mov(eax, Operand(esp, kPointerSize)); |
204 | 202 |
205 StubCompiler::GenerateLoadStringLength(masm, eax, edx, &miss); | 203 StubCompiler::GenerateLoadStringLength(masm, eax, edx, &miss); |
206 __ bind(&miss); | 204 __ bind(&miss); |
207 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 205 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
208 } | 206 } |
209 | 207 |
210 | 208 |
211 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { | 209 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
212 // ----------- S t a t e ------------- | 210 // ----------- S t a t e ------------- |
213 // -- ecx : name | 211 // -- ecx : name |
214 // -- esp[0] : return address | 212 // -- esp[0] : return address |
215 // -- esp[4] : receiver | 213 // -- esp[4] : receiver |
216 // ----------------------------------- | 214 // ----------------------------------- |
217 | |
218 Label miss; | 215 Label miss; |
219 | 216 |
220 __ mov(eax, Operand(esp, kPointerSize)); | 217 __ mov(eax, Operand(esp, kPointerSize)); |
221 | 218 |
222 StubCompiler::GenerateLoadFunctionPrototype(masm, eax, edx, ebx, &miss); | 219 StubCompiler::GenerateLoadFunctionPrototype(masm, eax, edx, ebx, &miss); |
223 __ bind(&miss); | 220 __ bind(&miss); |
224 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 221 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
225 } | 222 } |
226 | 223 |
227 | 224 |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 | 1029 |
1033 | 1030 |
1034 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { | 1031 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
1035 // ----------- S t a t e ------------- | 1032 // ----------- S t a t e ------------- |
1036 // -- ecx : name | 1033 // -- ecx : name |
1037 // -- esp[0] : return address | 1034 // -- esp[0] : return address |
1038 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1035 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1039 // -- ... | 1036 // -- ... |
1040 // -- esp[(argc + 1) * 4] : receiver | 1037 // -- esp[(argc + 1) * 4] : receiver |
1041 // ----------------------------------- | 1038 // ----------------------------------- |
1042 | |
1043 Label miss, global_object, non_global_object; | 1039 Label miss, global_object, non_global_object; |
1044 | 1040 |
1045 // Get the receiver of the function from the stack; 1 ~ return address. | 1041 // Get the receiver of the function from the stack; 1 ~ return address. |
1046 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1042 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
1047 | 1043 |
1048 // Check that the receiver isn't a smi. | 1044 // Check that the receiver isn't a smi. |
1049 __ test(edx, Immediate(kSmiTagMask)); | 1045 __ test(edx, Immediate(kSmiTagMask)); |
1050 __ j(zero, &miss, not_taken); | 1046 __ j(zero, &miss, not_taken); |
1051 | 1047 |
1052 // Check that the receiver is a valid JS object. | 1048 // Check that the receiver is a valid JS object. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 1167 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
1172 } | 1168 } |
1173 | 1169 |
1174 | 1170 |
1175 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 1171 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
1176 // ----------- S t a t e ------------- | 1172 // ----------- S t a t e ------------- |
1177 // -- ecx : name | 1173 // -- ecx : name |
1178 // -- esp[0] : return address | 1174 // -- esp[0] : return address |
1179 // -- esp[4] : receiver | 1175 // -- esp[4] : receiver |
1180 // ----------------------------------- | 1176 // ----------------------------------- |
1181 | |
1182 Label miss, probe, global; | 1177 Label miss, probe, global; |
1183 | 1178 |
1184 __ mov(eax, Operand(esp, kPointerSize)); | 1179 __ mov(eax, Operand(esp, kPointerSize)); |
1185 | 1180 |
1186 // Check that the receiver isn't a smi. | 1181 // Check that the receiver isn't a smi. |
1187 __ test(eax, Immediate(kSmiTagMask)); | 1182 __ test(eax, Immediate(kSmiTagMask)); |
1188 __ j(zero, &miss, not_taken); | 1183 __ j(zero, &miss, not_taken); |
1189 | 1184 |
1190 // Check that the receiver is a valid JS object. | 1185 // Check that the receiver is a valid JS object. |
1191 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 1186 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 | 1416 |
1422 | 1417 |
1423 void StoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 1418 void StoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
1424 // ----------- S t a t e ------------- | 1419 // ----------- S t a t e ------------- |
1425 // -- eax : value | 1420 // -- eax : value |
1426 // -- ecx : name | 1421 // -- ecx : name |
1427 // -- esp[0] : return address | 1422 // -- esp[0] : return address |
1428 // -- esp[4] : receiver | 1423 // -- esp[4] : receiver |
1429 // ----------------------------------- | 1424 // ----------------------------------- |
1430 | 1425 |
1431 // Move the return address below the arguments. | |
1432 __ pop(ebx); | 1426 __ pop(ebx); |
1433 __ push(Operand(esp, 0)); | 1427 __ push(Operand(esp, 0)); |
1434 __ push(ecx); | 1428 __ push(ecx); |
1435 __ push(eax); | 1429 __ push(eax); |
1436 __ push(ebx); | 1430 __ push(ebx); |
1437 | 1431 |
1438 // Perform tail call to the entry. | 1432 // Perform tail call to the entry. |
1439 __ TailCallRuntime(f, 3, 1); | 1433 __ TailCallRuntime(f, 3, 1); |
1440 } | 1434 } |
1441 | 1435 |
1442 | 1436 |
1443 // Defined in ic.cc. | 1437 // Defined in ic.cc. |
1444 Object* KeyedStoreIC_Miss(Arguments args); | 1438 Object* KeyedStoreIC_Miss(Arguments args); |
1445 | 1439 |
1446 void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 1440 void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
1447 // ----------- S t a t e ------------- | 1441 // ----------- S t a t e ------------- |
1448 // -- eax : value | 1442 // -- eax : value |
1449 // -- esp[0] : return address | 1443 // -- esp[0] : return address |
1450 // -- esp[4] : key | 1444 // -- esp[4] : key |
1451 // -- esp[8] : receiver | 1445 // -- esp[8] : receiver |
1452 // ----------------------------------- | 1446 // ----------------------------------- |
1453 | 1447 |
1454 // Move the return address below the arguments. | |
1455 __ pop(ecx); | 1448 __ pop(ecx); |
1456 __ push(Operand(esp, 1 * kPointerSize)); | 1449 __ push(Operand(esp, 1 * kPointerSize)); |
1457 __ push(Operand(esp, 1 * kPointerSize)); | 1450 __ push(Operand(esp, 1 * kPointerSize)); |
1458 __ push(eax); | 1451 __ push(eax); |
1459 __ push(ecx); | 1452 __ push(ecx); |
1460 | 1453 |
1461 // Do tail-call to runtime routine. | 1454 // Do tail-call to runtime routine. |
1462 __ TailCallRuntime(f, 3, 1); | 1455 __ TailCallRuntime(f, 3, 1); |
1463 } | 1456 } |
1464 | 1457 |
1465 | 1458 |
1466 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { | 1459 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { |
1467 // ----------- S t a t e ------------- | 1460 // ----------- S t a t e ------------- |
1468 // -- eax : value | 1461 // -- eax : value |
1469 // -- ecx : transition map | 1462 // -- ecx : transition map |
1470 // -- esp[0] : return address | 1463 // -- esp[0] : return address |
1471 // -- esp[4] : key | 1464 // -- esp[4] : key |
1472 // -- esp[8] : receiver | 1465 // -- esp[8] : receiver |
1473 // ----------------------------------- | 1466 // ----------------------------------- |
1474 | 1467 |
1475 // Move the return address below the arguments. | |
1476 __ pop(ebx); | 1468 __ pop(ebx); |
1477 __ push(Operand(esp, 1 * kPointerSize)); | 1469 __ push(Operand(esp, 1 * kPointerSize)); |
1478 __ push(ecx); | 1470 __ push(ecx); |
1479 __ push(eax); | 1471 __ push(eax); |
1480 __ push(ebx); | 1472 __ push(ebx); |
1481 | 1473 |
1482 // Do tail-call to runtime routine. | 1474 // Do tail-call to runtime routine. |
1483 __ TailCallRuntime( | 1475 __ TailCallRuntime( |
1484 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1476 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
1485 } | 1477 } |
1486 | 1478 |
1487 #undef __ | 1479 #undef __ |
1488 | 1480 |
1489 | 1481 |
1490 } } // namespace v8::internal | 1482 } } // namespace v8::internal |
OLD | NEW |