| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 &miss, // When not a number. | 533 &miss, // When not a number. |
| 534 &miss, // When index out of range. | 534 &miss, // When index out of range. |
| 535 STRING_INDEX_IS_ARRAY_INDEX); | 535 STRING_INDEX_IS_ARRAY_INDEX); |
| 536 char_at_generator.GenerateFast(masm); | 536 char_at_generator.GenerateFast(masm); |
| 537 __ ret(0); | 537 __ ret(0); |
| 538 | 538 |
| 539 StubRuntimeCallHelper call_helper; | 539 StubRuntimeCallHelper call_helper; |
| 540 char_at_generator.GenerateSlow(masm, call_helper); | 540 char_at_generator.GenerateSlow(masm, call_helper); |
| 541 | 541 |
| 542 __ bind(&miss); | 542 __ bind(&miss); |
| 543 GenerateMiss(masm, MISS); | 543 GenerateMiss(masm); |
| 544 } | 544 } |
| 545 | 545 |
| 546 | 546 |
| 547 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 547 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
| 548 // ----------- S t a t e ------------- | 548 // ----------- S t a t e ------------- |
| 549 // -- rax : key | 549 // -- rax : key |
| 550 // -- rdx : receiver | 550 // -- rdx : receiver |
| 551 // -- rsp[0] : return address | 551 // -- rsp[0] : return address |
| 552 // ----------------------------------- | 552 // ----------------------------------- |
| 553 Label slow; | 553 Label slow; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 576 __ PushReturnAddressFrom(rcx); | 576 __ PushReturnAddressFrom(rcx); |
| 577 | 577 |
| 578 // Perform tail call to the entry. | 578 // Perform tail call to the entry. |
| 579 __ TailCallExternalReference( | 579 __ TailCallExternalReference( |
| 580 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), | 580 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), |
| 581 masm->isolate()), | 581 masm->isolate()), |
| 582 2, | 582 2, |
| 583 1); | 583 1); |
| 584 | 584 |
| 585 __ bind(&slow); | 585 __ bind(&slow); |
| 586 GenerateMiss(masm, MISS); | 586 GenerateMiss(masm); |
| 587 } | 587 } |
| 588 | 588 |
| 589 | 589 |
| 590 static void KeyedStoreGenerateGenericHelper( | 590 static void KeyedStoreGenerateGenericHelper( |
| 591 MacroAssembler* masm, | 591 MacroAssembler* masm, |
| 592 Label* fast_object, | 592 Label* fast_object, |
| 593 Label* fast_double, | 593 Label* fast_double, |
| 594 Label* slow, | 594 Label* slow, |
| 595 KeyedStoreCheckMap check_map, | 595 KeyedStoreCheckMap check_map, |
| 596 KeyedStoreIncrementLength increment_length) { | 596 KeyedStoreIncrementLength increment_length) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // -- rsp[0] : return address | 742 // -- rsp[0] : return address |
| 743 // ----------------------------------- | 743 // ----------------------------------- |
| 744 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; | 744 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; |
| 745 Label fast_double, fast_double_grow; | 745 Label fast_double, fast_double_grow; |
| 746 Label array, extra, check_if_double_array; | 746 Label array, extra, check_if_double_array; |
| 747 | 747 |
| 748 // Check that the object isn't a smi. | 748 // Check that the object isn't a smi. |
| 749 __ JumpIfSmi(rdx, &slow_with_tagged_index); | 749 __ JumpIfSmi(rdx, &slow_with_tagged_index); |
| 750 // Get the map from the receiver. | 750 // Get the map from the receiver. |
| 751 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset)); | 751 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset)); |
| 752 // Check that the receiver does not require access checks. We need | 752 // Check that the receiver does not require access checks and is not observed. |
| 753 // to do this because this generic stub does not perform map checks. | 753 // The generic stub does not perform map checks or handle observed objects. |
| 754 __ testb(FieldOperand(r9, Map::kBitFieldOffset), | 754 __ testb(FieldOperand(r9, Map::kBitFieldOffset), |
| 755 Immediate(1 << Map::kIsAccessCheckNeeded)); | 755 Immediate(1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved)); |
| 756 __ j(not_zero, &slow_with_tagged_index); | 756 __ j(not_zero, &slow_with_tagged_index); |
| 757 // Check that the key is a smi. | 757 // Check that the key is a smi. |
| 758 __ JumpIfNotSmi(rcx, &slow_with_tagged_index); | 758 __ JumpIfNotSmi(rcx, &slow_with_tagged_index); |
| 759 __ SmiToInteger32(rcx, rcx); | 759 __ SmiToInteger32(rcx, rcx); |
| 760 | 760 |
| 761 __ CmpInstanceType(r9, JS_ARRAY_TYPE); | 761 __ CmpInstanceType(r9, JS_ARRAY_TYPE); |
| 762 __ j(equal, &array); | 762 __ j(equal, &array); |
| 763 // Check that the object is some kind of JSObject. | 763 // Check that the object is some kind of JSObject. |
| 764 __ CmpInstanceType(r9, FIRST_JS_OBJECT_TYPE); | 764 __ CmpInstanceType(r9, FIRST_JS_OBJECT_TYPE); |
| 765 __ j(below, &slow); | 765 __ j(below, &slow); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 __ Ret(); | 1264 __ Ret(); |
| 1265 __ bind(¬in); | 1265 __ bind(¬in); |
| 1266 // The unmapped lookup expects that the parameter map is in rbx. | 1266 // The unmapped lookup expects that the parameter map is in rbx. |
| 1267 Operand unmapped_location = | 1267 Operand unmapped_location = |
| 1268 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); | 1268 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); |
| 1269 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); | 1269 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); |
| 1270 __ j(equal, &slow); | 1270 __ j(equal, &slow); |
| 1271 __ movq(rax, unmapped_location); | 1271 __ movq(rax, unmapped_location); |
| 1272 __ Ret(); | 1272 __ Ret(); |
| 1273 __ bind(&slow); | 1273 __ bind(&slow); |
| 1274 GenerateMiss(masm, MISS); | 1274 GenerateMiss(masm); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 | 1277 |
| 1278 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 1278 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
| 1279 // ----------- S t a t e ------------- | 1279 // ----------- S t a t e ------------- |
| 1280 // -- rax : value | 1280 // -- rax : value |
| 1281 // -- rcx : key | 1281 // -- rcx : key |
| 1282 // -- rdx : receiver | 1282 // -- rdx : receiver |
| 1283 // -- rsp[0] : return address | 1283 // -- rsp[0] : return address |
| 1284 // ----------------------------------- | 1284 // ----------------------------------- |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1303 __ lea(r9, unmapped_location); | 1303 __ lea(r9, unmapped_location); |
| 1304 __ movq(r8, rax); | 1304 __ movq(r8, rax); |
| 1305 __ RecordWrite(rbx, | 1305 __ RecordWrite(rbx, |
| 1306 r9, | 1306 r9, |
| 1307 r8, | 1307 r8, |
| 1308 kDontSaveFPRegs, | 1308 kDontSaveFPRegs, |
| 1309 EMIT_REMEMBERED_SET, | 1309 EMIT_REMEMBERED_SET, |
| 1310 INLINE_SMI_CHECK); | 1310 INLINE_SMI_CHECK); |
| 1311 __ Ret(); | 1311 __ Ret(); |
| 1312 __ bind(&slow); | 1312 __ bind(&slow); |
| 1313 GenerateMiss(masm, MISS); | 1313 GenerateMiss(masm); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 | 1316 |
| 1317 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, | 1317 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, |
| 1318 int argc) { | 1318 int argc) { |
| 1319 // ----------- S t a t e ------------- | 1319 // ----------- S t a t e ------------- |
| 1320 // rcx : function name | 1320 // rcx : function name |
| 1321 // rsp[0] : return address | 1321 // rsp[0] : return address |
| 1322 // rsp[8] : argument argc | 1322 // rsp[8] : argument argc |
| 1323 // rsp[16] : argument argc - 1 | 1323 // rsp[16] : argument argc - 1 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 __ PopReturnAddressTo(rbx); | 1416 __ PopReturnAddressTo(rbx); |
| 1417 __ push(rax); // receiver | 1417 __ push(rax); // receiver |
| 1418 __ push(rcx); // name | 1418 __ push(rcx); // name |
| 1419 __ PushReturnAddressFrom(rbx); | 1419 __ PushReturnAddressFrom(rbx); |
| 1420 | 1420 |
| 1421 // Perform tail call to the entry. | 1421 // Perform tail call to the entry. |
| 1422 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 1422 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 | 1425 |
| 1426 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1426 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 1427 // ----------- S t a t e ------------- | 1427 // ----------- S t a t e ------------- |
| 1428 // -- rax : key | 1428 // -- rax : key |
| 1429 // -- rdx : receiver | 1429 // -- rdx : receiver |
| 1430 // -- rsp[0] : return address | 1430 // -- rsp[0] : return address |
| 1431 // ----------------------------------- | 1431 // ----------------------------------- |
| 1432 | 1432 |
| 1433 Counters* counters = masm->isolate()->counters(); | 1433 Counters* counters = masm->isolate()->counters(); |
| 1434 __ IncrementCounter(counters->keyed_load_miss(), 1); | 1434 __ IncrementCounter(counters->keyed_load_miss(), 1); |
| 1435 | 1435 |
| 1436 __ PopReturnAddressTo(rbx); | 1436 __ PopReturnAddressTo(rbx); |
| 1437 __ push(rdx); // receiver | 1437 __ push(rdx); // receiver |
| 1438 __ push(rax); // name | 1438 __ push(rax); // name |
| 1439 __ PushReturnAddressFrom(rbx); | 1439 __ PushReturnAddressFrom(rbx); |
| 1440 | 1440 |
| 1441 // Perform tail call to the entry. | 1441 // Perform tail call to the entry. |
| 1442 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1442 ExternalReference ref = |
| 1443 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), | 1443 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 1444 masm->isolate()) | |
| 1445 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | |
| 1446 __ TailCallExternalReference(ref, 2, 1); | 1444 __ TailCallExternalReference(ref, 2, 1); |
| 1447 } | 1445 } |
| 1448 | 1446 |
| 1449 | 1447 |
| 1450 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1448 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 1451 // ----------- S t a t e ------------- | 1449 // ----------- S t a t e ------------- |
| 1452 // -- rax : key | 1450 // -- rax : key |
| 1453 // -- rdx : receiver | 1451 // -- rdx : receiver |
| 1454 // -- rsp[0] : return address | 1452 // -- rsp[0] : return address |
| 1455 // ----------------------------------- | 1453 // ----------------------------------- |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 __ push(rcx); // key | 1603 __ push(rcx); // key |
| 1606 __ push(rax); // value | 1604 __ push(rax); // value |
| 1607 __ PushReturnAddressFrom(rbx); | 1605 __ PushReturnAddressFrom(rbx); |
| 1608 | 1606 |
| 1609 // Do tail-call to runtime routine. | 1607 // Do tail-call to runtime routine. |
| 1610 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); | 1608 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); |
| 1611 __ TailCallExternalReference(ref, 3, 1); | 1609 __ TailCallExternalReference(ref, 3, 1); |
| 1612 } | 1610 } |
| 1613 | 1611 |
| 1614 | 1612 |
| 1615 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1613 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
| 1616 // ----------- S t a t e ------------- | 1614 // ----------- S t a t e ------------- |
| 1617 // -- rax : value | 1615 // -- rax : value |
| 1618 // -- rcx : key | 1616 // -- rcx : key |
| 1619 // -- rdx : receiver | 1617 // -- rdx : receiver |
| 1620 // -- rsp[0] : return address | 1618 // -- rsp[0] : return address |
| 1621 // ----------------------------------- | 1619 // ----------------------------------- |
| 1622 | 1620 |
| 1623 __ PopReturnAddressTo(rbx); | 1621 __ PopReturnAddressTo(rbx); |
| 1624 __ push(rdx); // receiver | 1622 __ push(rdx); // receiver |
| 1625 __ push(rcx); // key | 1623 __ push(rcx); // key |
| 1626 __ push(rax); // value | 1624 __ push(rax); // value |
| 1627 __ PushReturnAddressFrom(rbx); | 1625 __ PushReturnAddressFrom(rbx); |
| 1628 | 1626 |
| 1629 // Do tail-call to runtime routine. | 1627 // Do tail-call to runtime routine. |
| 1630 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1628 ExternalReference ref = |
| 1631 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), | 1629 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
| 1632 masm->isolate()) | |
| 1633 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | |
| 1634 __ TailCallExternalReference(ref, 3, 1); | 1630 __ TailCallExternalReference(ref, 3, 1); |
| 1635 } | 1631 } |
| 1636 | 1632 |
| 1637 | 1633 |
| 1638 #undef __ | 1634 #undef __ |
| 1639 | 1635 |
| 1640 | 1636 |
| 1641 Condition CompareIC::ComputeCondition(Token::Value op) { | 1637 Condition CompareIC::ComputeCondition(Token::Value op) { |
| 1642 switch (op) { | 1638 switch (op) { |
| 1643 case Token::EQ_STRICT: | 1639 case Token::EQ_STRICT: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1698 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
| 1703 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1699 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1704 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1700 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1705 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1701 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1706 } | 1702 } |
| 1707 | 1703 |
| 1708 | 1704 |
| 1709 } } // namespace v8::internal | 1705 } } // namespace v8::internal |
| 1710 | 1706 |
| 1711 #endif // V8_TARGET_ARCH_X64 | 1707 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |