| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 __ j(equal, &probe_dictionary); | 455 __ j(equal, &probe_dictionary); |
| 456 | 456 |
| 457 // Load the map of the receiver, compute the keyed lookup cache hash | 457 // Load the map of the receiver, compute the keyed lookup cache hash |
| 458 // based on 32 bits of the map pointer and the string hash. | 458 // based on 32 bits of the map pointer and the string hash. |
| 459 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); | 459 __ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); |
| 460 __ movl(rcx, rbx); | 460 __ movl(rcx, rbx); |
| 461 __ shr(rcx, Immediate(KeyedLookupCache::kMapHashShift)); | 461 __ shr(rcx, Immediate(KeyedLookupCache::kMapHashShift)); |
| 462 __ movl(rdi, FieldOperand(rax, String::kHashFieldOffset)); | 462 __ movl(rdi, FieldOperand(rax, String::kHashFieldOffset)); |
| 463 __ shr(rdi, Immediate(String::kHashShift)); | 463 __ shr(rdi, Immediate(String::kHashShift)); |
| 464 __ xor_(rcx, rdi); | 464 __ xor_(rcx, rdi); |
| 465 __ and_(rcx, Immediate(KeyedLookupCache::kCapacityMask)); | 465 int mask = (KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask); |
| 466 __ and_(rcx, Immediate(mask)); |
| 466 | 467 |
| 467 // Load the key (consisting of map and symbol) from the cache and | 468 // Load the key (consisting of map and symbol) from the cache and |
| 468 // check for match. | 469 // check for match. |
| 470 Label try_second_entry, hit_on_first_entry, load_in_object_property; |
| 469 ExternalReference cache_keys | 471 ExternalReference cache_keys |
| 470 = ExternalReference::keyed_lookup_cache_keys(masm->isolate()); | 472 = ExternalReference::keyed_lookup_cache_keys(masm->isolate()); |
| 471 __ movq(rdi, rcx); | 473 __ movq(rdi, rcx); |
| 472 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); | 474 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); |
| 473 __ LoadAddress(kScratchRegister, cache_keys); | 475 __ LoadAddress(kScratchRegister, cache_keys); |
| 474 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); | 476 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); |
| 477 __ j(not_equal, &try_second_entry); |
| 478 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); |
| 479 __ j(equal, &hit_on_first_entry); |
| 480 |
| 481 __ bind(&try_second_entry); |
| 482 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, kPointerSize * 2)); |
| 475 __ j(not_equal, &slow); | 483 __ j(not_equal, &slow); |
| 476 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); | 484 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize * 3)); |
| 477 __ j(not_equal, &slow); | 485 __ j(not_equal, &slow); |
| 478 | 486 |
| 487 |
| 479 // Get field offset, which is a 32-bit integer. | 488 // Get field offset, which is a 32-bit integer. |
| 480 ExternalReference cache_field_offsets | 489 ExternalReference cache_field_offsets |
| 481 = ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate()); | 490 = ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate()); |
| 491 |
| 492 // Hit on second entry. |
| 493 __ LoadAddress(kScratchRegister, cache_field_offsets); |
| 494 __ addl(rcx, Immediate(1)); |
| 495 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); |
| 496 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
| 497 __ subq(rdi, rcx); |
| 498 __ j(above_equal, &property_array_property); |
| 499 __ jmp(&load_in_object_property); |
| 500 |
| 501 // Hit on first entry. |
| 502 __ bind(&hit_on_first_entry); |
| 482 __ LoadAddress(kScratchRegister, cache_field_offsets); | 503 __ LoadAddress(kScratchRegister, cache_field_offsets); |
| 483 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); | 504 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); |
| 484 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); | 505 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
| 485 __ subq(rdi, rcx); | 506 __ subq(rdi, rcx); |
| 486 __ j(above_equal, &property_array_property); | 507 __ j(above_equal, &property_array_property); |
| 487 | 508 |
| 488 // Load in-object property. | 509 // Load in-object property. |
| 510 __ bind(&load_in_object_property); |
| 489 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); | 511 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
| 490 __ addq(rcx, rdi); | 512 __ addq(rcx, rdi); |
| 491 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); | 513 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); |
| 492 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1); | 514 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1); |
| 493 __ ret(0); | 515 __ ret(0); |
| 494 | 516 |
| 495 // Load property array property. | 517 // Load property array property. |
| 496 __ bind(&property_array_property); | 518 __ bind(&property_array_property); |
| 497 __ movq(rax, FieldOperand(rdx, JSObject::kPropertiesOffset)); | 519 __ movq(rax, FieldOperand(rdx, JSObject::kPropertiesOffset)); |
| 498 __ movq(rax, FieldOperand(rax, rdi, times_pointer_size, | 520 __ movq(rax, FieldOperand(rax, rdi, times_pointer_size, |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 Condition cc = *jmp_address == Assembler::kJncShortOpcode | 1720 Condition cc = *jmp_address == Assembler::kJncShortOpcode |
| 1699 ? not_zero | 1721 ? not_zero |
| 1700 : zero; | 1722 : zero; |
| 1701 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1723 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1702 } | 1724 } |
| 1703 | 1725 |
| 1704 | 1726 |
| 1705 } } // namespace v8::internal | 1727 } } // namespace v8::internal |
| 1706 | 1728 |
| 1707 #endif // V8_TARGET_ARCH_X64 | 1729 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |