| 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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, | 1224 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, |
| 1225 int argc, | 1225 int argc, |
| 1226 Code::Kind kind) { | 1226 Code::Kind kind) { |
| 1227 // ----------- S t a t e ------------- | 1227 // ----------- S t a t e ------------- |
| 1228 // -- ecx : name | 1228 // -- ecx : name |
| 1229 // -- edx : receiver | 1229 // -- edx : receiver |
| 1230 // ----------------------------------- | 1230 // ----------------------------------- |
| 1231 Label number, non_number, non_string, boolean, probe, miss; | 1231 Label number, non_number, non_string, boolean, probe, miss; |
| 1232 | 1232 |
| 1233 // Probe the stub cache. | 1233 // Probe the stub cache. |
| 1234 Code::Flags flags = | 1234 Code::Flags flags = Code::ComputeFlags(kind, |
| 1235 Code::ComputeFlags(kind, NOT_IN_LOOP, MONOMORPHIC, NORMAL, argc); | 1235 NOT_IN_LOOP, |
| 1236 MONOMORPHIC, |
| 1237 Code::kNoExtraICState, |
| 1238 NORMAL, |
| 1239 argc); |
| 1236 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx, eax); | 1240 StubCache::GenerateProbe(masm, flags, edx, ecx, ebx, eax); |
| 1237 | 1241 |
| 1238 // If the stub cache probing failed, the receiver might be a value. | 1242 // If the stub cache probing failed, the receiver might be a value. |
| 1239 // For value objects, we use the map of the prototype objects for | 1243 // For value objects, we use the map of the prototype objects for |
| 1240 // the corresponding JSValue for the cache and that is what we need | 1244 // the corresponding JSValue for the cache and that is what we need |
| 1241 // to probe. | 1245 // to probe. |
| 1242 // | 1246 // |
| 1243 // Check for number. | 1247 // Check for number. |
| 1244 __ test(edx, Immediate(kSmiTagMask)); | 1248 __ test(edx, Immediate(kSmiTagMask)); |
| 1245 __ j(zero, &number, not_taken); | 1249 __ j(zero, &number, not_taken); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 | 1322 |
| 1319 // eax: elements | 1323 // eax: elements |
| 1320 // Search the dictionary placing the result in edi. | 1324 // Search the dictionary placing the result in edi. |
| 1321 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); | 1325 GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi); |
| 1322 GenerateFunctionTailCall(masm, argc, &miss); | 1326 GenerateFunctionTailCall(masm, argc, &miss); |
| 1323 | 1327 |
| 1324 __ bind(&miss); | 1328 __ bind(&miss); |
| 1325 } | 1329 } |
| 1326 | 1330 |
| 1327 | 1331 |
| 1328 static void GenerateCallMiss(MacroAssembler* masm, int argc, IC::UtilityId id) { | 1332 static void GenerateCallMiss(MacroAssembler* masm, |
| 1333 Code::ExtraICState extra_ic_state, |
| 1334 int argc, |
| 1335 IC::UtilityId id) { |
| 1329 // ----------- S t a t e ------------- | 1336 // ----------- S t a t e ------------- |
| 1330 // -- ecx : name | 1337 // -- ecx : name |
| 1331 // -- esp[0] : return address | 1338 // -- esp[0] : return address |
| 1332 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1339 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1333 // -- ... | 1340 // -- ... |
| 1334 // -- esp[(argc + 1) * 4] : receiver | 1341 // -- esp[(argc + 1) * 4] : receiver |
| 1335 // ----------------------------------- | 1342 // ----------------------------------- |
| 1336 | 1343 |
| 1337 if (id == IC::kCallIC_Miss) { | 1344 if (id == IC::kCallIC_Miss) { |
| 1338 __ IncrementCounter(&Counters::call_miss, 1); | 1345 __ IncrementCounter(&Counters::call_miss, 1); |
| 1339 } else { | 1346 } else { |
| 1340 __ IncrementCounter(&Counters::keyed_call_miss, 1); | 1347 __ IncrementCounter(&Counters::keyed_call_miss, 1); |
| 1341 } | 1348 } |
| 1342 | 1349 |
| 1343 // Get the receiver of the function from the stack; 1 ~ return address. | 1350 // Get the receiver of the function from the stack; 1 ~ return address. |
| 1344 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1351 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 1345 | 1352 |
| 1346 // Enter an internal frame. | 1353 // Enter an internal frame. |
| 1347 __ EnterInternalFrame(); | 1354 __ EnterInternalFrame(); |
| 1348 | 1355 |
| 1349 // Push the receiver and the name of the function. | 1356 // Push the receiver and the name of the function. |
| 1350 __ push(edx); | 1357 __ push(edx); |
| 1351 __ push(ecx); | 1358 __ push(ecx); |
| 1359 if (extra_ic_state != Code::kNoExtraICState) { |
| 1360 __ push(Immediate(Smi::FromInt(extra_ic_state))); |
| 1361 } |
| 1352 | 1362 |
| 1353 // Call the entry. | 1363 // Call the entry. |
| 1354 CEntryStub stub(1); | 1364 CEntryStub stub(1); |
| 1355 __ mov(eax, Immediate(2)); | 1365 __ mov(eax, Immediate((extra_ic_state == Code::kNoExtraICState) ? 2 : 3)); |
| 1356 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id)))); | 1366 __ mov(ebx, Immediate(ExternalReference(IC_Utility(id)))); |
| 1357 __ CallStub(&stub); | 1367 __ CallStub(&stub); |
| 1358 | 1368 |
| 1359 // Move result to edi and exit the internal frame. | 1369 // Move result to edi and exit the internal frame. |
| 1360 __ mov(edi, eax); | 1370 __ mov(edi, eax); |
| 1361 __ LeaveInternalFrame(); | 1371 __ LeaveInternalFrame(); |
| 1362 | 1372 |
| 1363 // Check if the receiver is a global object of some sort. | 1373 // Check if the receiver is a global object of some sort. |
| 1364 // This can happen only for regular CallIC but not KeyedCallIC. | 1374 // This can happen only for regular CallIC but not KeyedCallIC. |
| 1365 if (id == IC::kCallIC_Miss) { | 1375 if (id == IC::kCallIC_Miss) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1392 // -- ecx : name | 1402 // -- ecx : name |
| 1393 // -- esp[0] : return address | 1403 // -- esp[0] : return address |
| 1394 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1404 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1395 // -- ... | 1405 // -- ... |
| 1396 // -- esp[(argc + 1) * 4] : receiver | 1406 // -- esp[(argc + 1) * 4] : receiver |
| 1397 // ----------------------------------- | 1407 // ----------------------------------- |
| 1398 | 1408 |
| 1399 // Get the receiver of the function from the stack; 1 ~ return address. | 1409 // Get the receiver of the function from the stack; 1 ~ return address. |
| 1400 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1410 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 1401 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC); | 1411 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC); |
| 1402 GenerateMiss(masm, argc); | 1412 GenerateMiss(masm, Code::kNoExtraICState, argc); |
| 1403 } | 1413 } |
| 1404 | 1414 |
| 1405 | 1415 |
| 1406 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { | 1416 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
| 1407 // ----------- S t a t e ------------- | 1417 // ----------- S t a t e ------------- |
| 1408 // -- ecx : name | 1418 // -- ecx : name |
| 1409 // -- esp[0] : return address | 1419 // -- esp[0] : return address |
| 1410 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1420 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1411 // -- ... | 1421 // -- ... |
| 1412 // -- esp[(argc + 1) * 4] : receiver | 1422 // -- esp[(argc + 1) * 4] : receiver |
| 1413 // ----------------------------------- | 1423 // ----------------------------------- |
| 1414 | 1424 |
| 1415 GenerateCallNormal(masm, argc); | 1425 GenerateCallNormal(masm, argc); |
| 1416 GenerateMiss(masm, argc); | 1426 GenerateMiss(masm, Code::kNoExtraICState, argc); |
| 1417 } | 1427 } |
| 1418 | 1428 |
| 1419 | 1429 |
| 1420 void CallIC::GenerateMiss(MacroAssembler* masm, int argc) { | 1430 void CallIC::GenerateMiss(MacroAssembler* masm, |
| 1431 Code::ExtraICState extra_ic_state, |
| 1432 int argc) { |
| 1421 // ----------- S t a t e ------------- | 1433 // ----------- S t a t e ------------- |
| 1422 // -- ecx : name | 1434 // -- ecx : name |
| 1423 // -- esp[0] : return address | 1435 // -- esp[0] : return address |
| 1424 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1436 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1425 // -- ... | 1437 // -- ... |
| 1426 // -- esp[(argc + 1) * 4] : receiver | 1438 // -- esp[(argc + 1) * 4] : receiver |
| 1427 // ----------------------------------- | 1439 // ----------------------------------- |
| 1428 | 1440 |
| 1429 GenerateCallMiss(masm, argc, IC::kCallIC_Miss); | 1441 GenerateCallMiss(masm, extra_ic_state, argc, IC::kCallIC_Miss); |
| 1430 } | 1442 } |
| 1431 | 1443 |
| 1432 | 1444 |
| 1433 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { | 1445 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
| 1434 // ----------- S t a t e ------------- | 1446 // ----------- S t a t e ------------- |
| 1435 // -- ecx : name | 1447 // -- ecx : name |
| 1436 // -- esp[0] : return address | 1448 // -- esp[0] : return address |
| 1437 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1449 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1438 // -- ... | 1450 // -- ... |
| 1439 // -- esp[(argc + 1) * 4] : receiver | 1451 // -- esp[(argc + 1) * 4] : receiver |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 | 1565 |
| 1554 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { | 1566 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { |
| 1555 // ----------- S t a t e ------------- | 1567 // ----------- S t a t e ------------- |
| 1556 // -- ecx : name | 1568 // -- ecx : name |
| 1557 // -- esp[0] : return address | 1569 // -- esp[0] : return address |
| 1558 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1570 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
| 1559 // -- ... | 1571 // -- ... |
| 1560 // -- esp[(argc + 1) * 4] : receiver | 1572 // -- esp[(argc + 1) * 4] : receiver |
| 1561 // ----------------------------------- | 1573 // ----------------------------------- |
| 1562 | 1574 |
| 1563 GenerateCallMiss(masm, argc, IC::kKeyedCallIC_Miss); | 1575 GenerateCallMiss(masm, Code::kNoExtraICState, argc, IC::kKeyedCallIC_Miss); |
| 1564 } | 1576 } |
| 1565 | 1577 |
| 1566 | 1578 |
| 1567 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 1579 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 1568 // ----------- S t a t e ------------- | 1580 // ----------- S t a t e ------------- |
| 1569 // -- eax : receiver | 1581 // -- eax : receiver |
| 1570 // -- ecx : name | 1582 // -- ecx : name |
| 1571 // -- esp[0] : return address | 1583 // -- esp[0] : return address |
| 1572 // ----------------------------------- | 1584 // ----------------------------------- |
| 1573 | 1585 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 2119 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 2108 ? not_zero | 2120 ? not_zero |
| 2109 : zero; | 2121 : zero; |
| 2110 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 2122 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 2111 } | 2123 } |
| 2112 | 2124 |
| 2113 | 2125 |
| 2114 } } // namespace v8::internal | 2126 } } // namespace v8::internal |
| 2115 | 2127 |
| 2116 #endif // V8_TARGET_ARCH_IA32 | 2128 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |