| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 __ push(Operand(rsp, 1 * kPointerSize)); // receiver | 604 __ push(Operand(rsp, 1 * kPointerSize)); // receiver |
| 605 __ push(Operand(rsp, 1 * kPointerSize)); // key | 605 __ push(Operand(rsp, 1 * kPointerSize)); // key |
| 606 __ push(rax); // value | 606 __ push(rax); // value |
| 607 __ push(rcx); // return address | 607 __ push(rcx); // return address |
| 608 | 608 |
| 609 // Do tail-call to runtime routine. | 609 // Do tail-call to runtime routine. |
| 610 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); | 610 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); |
| 611 } | 611 } |
| 612 | 612 |
| 613 | 613 |
| 614 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { | |
| 615 // ----------- S t a t e ------------- | |
| 616 // -- rax : value | |
| 617 // -- rcx : transition map | |
| 618 // -- rsp[0] : return address | |
| 619 // -- rsp[8] : key | |
| 620 // -- rsp[16] : receiver | |
| 621 // ----------------------------------- | |
| 622 | |
| 623 __ pop(rbx); | |
| 624 __ push(Operand(rsp, 1 * kPointerSize)); // receiver | |
| 625 __ push(rcx); // transition map | |
| 626 __ push(rax); // value | |
| 627 __ push(rbx); // return address | |
| 628 | |
| 629 // Do tail-call to runtime routine. | |
| 630 __ TailCallRuntime( | |
| 631 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | |
| 632 } | |
| 633 | |
| 634 | |
| 635 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 614 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
| 636 // ----------- S t a t e ------------- | 615 // ----------- S t a t e ------------- |
| 637 // -- rax : value | 616 // -- rax : value |
| 638 // -- rsp[0] : return address | 617 // -- rsp[0] : return address |
| 639 // -- rsp[8] : key | 618 // -- rsp[8] : key |
| 640 // -- rsp[16] : receiver | 619 // -- rsp[16] : receiver |
| 641 // ----------------------------------- | 620 // ----------------------------------- |
| 642 Label slow, fast, array, extra, check_pixel_array; | 621 Label slow, fast, array, extra, check_pixel_array; |
| 643 | 622 |
| 644 // Get the receiver from the stack. | 623 // Get the receiver from the stack. |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 Label miss; | 1280 Label miss; |
| 1302 | 1281 |
| 1303 __ movq(rax, Operand(rsp, kPointerSize)); | 1282 __ movq(rax, Operand(rsp, kPointerSize)); |
| 1304 | 1283 |
| 1305 StubCompiler::GenerateLoadStringLength(masm, rax, rdx, rbx, &miss); | 1284 StubCompiler::GenerateLoadStringLength(masm, rax, rdx, rbx, &miss); |
| 1306 __ bind(&miss); | 1285 __ bind(&miss); |
| 1307 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 1286 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
| 1308 } | 1287 } |
| 1309 | 1288 |
| 1310 | 1289 |
| 1311 | |
| 1312 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { | 1290 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { |
| 1313 // The address of the instruction following the call. | 1291 // The address of the instruction following the call. |
| 1314 Address test_instruction_address = | 1292 Address test_instruction_address = |
| 1315 address + Assembler::kCallTargetAddressOffset; | 1293 address + Assembler::kCallTargetAddressOffset; |
| 1316 // If the instruction following the call is not a test eax, nothing | 1294 // If the instruction following the call is not a test eax, nothing |
| 1317 // was inlined. | 1295 // was inlined. |
| 1318 if (*test_instruction_address != kTestEaxByte) return false; | 1296 if (*test_instruction_address != kTestEaxByte) return false; |
| 1319 | 1297 |
| 1320 Address delta_address = test_instruction_address + 1; | 1298 Address delta_address = test_instruction_address + 1; |
| 1321 // The delta to the start of the map check instruction. | 1299 // The delta to the start of the map check instruction. |
| 1322 int delta = *reinterpret_cast<int*>(delta_address); | 1300 int delta = *reinterpret_cast<int*>(delta_address); |
| 1323 | 1301 |
| 1324 // The map address is the last 8 bytes of the 10-byte | 1302 // The map address is the last 8 bytes of the 10-byte |
| 1325 // immediate move instruction, so we add 2 to get the | 1303 // immediate move instruction, so we add 2 to get the |
| 1326 // offset to the last 8 bytes. | 1304 // offset to the last 8 bytes. |
| 1327 Address map_address = test_instruction_address + delta + 2; | 1305 Address map_address = test_instruction_address + delta + 2; |
| 1328 *(reinterpret_cast<Object**>(map_address)) = map; | 1306 *(reinterpret_cast<Object**>(map_address)) = map; |
| 1329 | 1307 |
| 1330 // The offset is in the 32-bit displacement of a seven byte | 1308 // The offset is in the 32-bit displacement of a seven byte |
| 1331 // memory-to-register move instruction (REX.W 0x88 ModR/M disp32), | 1309 // memory-to-register move instruction (REX.W 0x88 ModR/M disp32), |
| 1332 // so we add 3 to get the offset of the displacement. | 1310 // so we add 3 to get the offset of the displacement. |
| 1333 Address offset_address = | 1311 Address offset_address = |
| 1334 test_instruction_address + delta + kOffsetToLoadInstruction + 3; | 1312 test_instruction_address + delta + kOffsetToLoadInstruction + 3; |
| 1335 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; | 1313 *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; |
| 1336 return true; | 1314 return true; |
| 1337 } | 1315 } |
| 1338 | 1316 |
| 1317 |
| 1339 void StoreIC::GenerateMiss(MacroAssembler* masm) { | 1318 void StoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1340 // ----------- S t a t e ------------- | 1319 // ----------- S t a t e ------------- |
| 1341 // -- rax : value | 1320 // -- rax : value |
| 1342 // -- rcx : name | 1321 // -- rcx : name |
| 1343 // -- rdx : receiver | 1322 // -- rdx : receiver |
| 1344 // -- rsp[0] : return address | 1323 // -- rsp[0] : return address |
| 1345 // ----------------------------------- | 1324 // ----------------------------------- |
| 1346 | 1325 |
| 1347 __ pop(rbx); | 1326 __ pop(rbx); |
| 1348 __ push(rdx); // receiver | 1327 __ push(rdx); // receiver |
| 1349 __ push(rcx); // name | 1328 __ push(rcx); // name |
| 1350 __ push(rax); // value | 1329 __ push(rax); // value |
| 1351 __ push(rbx); // return address | 1330 __ push(rbx); // return address |
| 1352 | 1331 |
| 1353 // Perform tail call to the entry. | 1332 // Perform tail call to the entry. |
| 1354 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); | 1333 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); |
| 1355 } | 1334 } |
| 1356 | 1335 |
| 1357 void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { | |
| 1358 // ----------- S t a t e ------------- | |
| 1359 // -- rax : value | |
| 1360 // -- rcx : Map (target of map transition) | |
| 1361 // -- rdx : receiver | |
| 1362 // -- rsp[0] : return address | |
| 1363 // ----------------------------------- | |
| 1364 | |
| 1365 __ pop(rbx); | |
| 1366 __ push(rdx); // receiver | |
| 1367 __ push(rcx); // transition map | |
| 1368 __ push(rax); // value | |
| 1369 __ push(rbx); // return address | |
| 1370 | |
| 1371 // Perform tail call to the entry. | |
| 1372 __ TailCallRuntime( | |
| 1373 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | |
| 1374 } | |
| 1375 | 1336 |
| 1376 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 1337 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 1377 // ----------- S t a t e ------------- | 1338 // ----------- S t a t e ------------- |
| 1378 // -- rax : value | 1339 // -- rax : value |
| 1379 // -- rcx : name | 1340 // -- rcx : name |
| 1380 // -- rdx : receiver | 1341 // -- rdx : receiver |
| 1381 // -- rsp[0] : return address | 1342 // -- rsp[0] : return address |
| 1382 // ----------------------------------- | 1343 // ----------------------------------- |
| 1383 | 1344 |
| 1384 // Get the receiver from the stack and probe the stub cache. | 1345 // Get the receiver from the stack and probe the stub cache. |
| 1385 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, | 1346 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, |
| 1386 NOT_IN_LOOP, | 1347 NOT_IN_LOOP, |
| 1387 MONOMORPHIC); | 1348 MONOMORPHIC); |
| 1388 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); | 1349 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); |
| 1389 | 1350 |
| 1390 // Cache miss: Jump to runtime. | 1351 // Cache miss: Jump to runtime. |
| 1391 GenerateMiss(masm); | 1352 GenerateMiss(masm); |
| 1392 } | 1353 } |
| 1393 | 1354 |
| 1394 | 1355 |
| 1395 #undef __ | 1356 #undef __ |
| 1396 | 1357 |
| 1397 | 1358 |
| 1398 } } // namespace v8::internal | 1359 } } // namespace v8::internal |
| OLD | NEW |