Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 9269004: Fix keyed lookup cache to have 2 entried per bucket instead (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 edx, 466 edx,
467 eax, 467 eax,
468 ecx, 468 ecx,
469 eax, 469 eax,
470 NULL, 470 NULL,
471 &slow); 471 &slow);
472 Isolate* isolate = masm->isolate(); 472 Isolate* isolate = masm->isolate();
473 Counters* counters = isolate->counters(); 473 Counters* counters = isolate->counters();
474 __ IncrementCounter(counters->keyed_load_generic_smi(), 1); 474 __ IncrementCounter(counters->keyed_load_generic_smi(), 1);
475 __ ret(0); 475 __ ret(0);
476
477 __ bind(&check_number_dictionary); 476 __ bind(&check_number_dictionary);
478 __ mov(ebx, eax); 477 __ mov(ebx, eax);
479 __ SmiUntag(ebx); 478 __ SmiUntag(ebx);
480 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); 479 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
481 480
482 // Check whether the elements is a number dictionary. 481 // Check whether the elements is a number dictionary.
483 // edx: receiver 482 // edx: receiver
484 // ebx: untagged index 483 // ebx: untagged index
485 // eax: key 484 // eax: key
486 // ecx: elements 485 // ecx: elements
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 __ j(equal, &probe_dictionary); 527 __ j(equal, &probe_dictionary);
529 528
530 // Load the map of the receiver, compute the keyed lookup cache hash 529 // Load the map of the receiver, compute the keyed lookup cache hash
531 // based on 32 bits of the map pointer and the string hash. 530 // based on 32 bits of the map pointer and the string hash.
532 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 531 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
533 __ mov(ecx, ebx); 532 __ mov(ecx, ebx);
534 __ shr(ecx, KeyedLookupCache::kMapHashShift); 533 __ shr(ecx, KeyedLookupCache::kMapHashShift);
535 __ mov(edi, FieldOperand(eax, String::kHashFieldOffset)); 534 __ mov(edi, FieldOperand(eax, String::kHashFieldOffset));
536 __ shr(edi, String::kHashShift); 535 __ shr(edi, String::kHashShift);
537 __ xor_(ecx, edi); 536 __ xor_(ecx, edi);
538 __ and_(ecx, KeyedLookupCache::kCapacityMask); 537 __ and_(ecx, KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
539 538
540 // Load the key (consisting of map and symbol) from the cache and 539 // Load the key (consisting of map and symbol) from the cache and
541 // check for match. 540 // check for match.
541 Label try_second_entry, hit_on_first_entry, load_in_object_property;
542 ExternalReference cache_keys = 542 ExternalReference cache_keys =
543 ExternalReference::keyed_lookup_cache_keys(masm->isolate()); 543 ExternalReference::keyed_lookup_cache_keys(masm->isolate());
544 __ mov(edi, ecx); 544 __ mov(edi, ecx);
545 __ shl(edi, kPointerSizeLog2 + 1); 545 __ shl(edi, kPointerSizeLog2 + 1);
546 __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys)); 546 __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
547 __ j(not_equal, &try_second_entry);
548 __ add(edi, Immediate(kPointerSize));
549 __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
550 __ j(equal, &hit_on_first_entry);
551
552 __ bind(&try_second_entry);
553 __ lea(edi, Operand(ecx, 1));
554 __ shl(edi, kPointerSizeLog2 + 1);
555 __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
547 __ j(not_equal, &slow); 556 __ j(not_equal, &slow);
548 __ add(edi, Immediate(kPointerSize)); 557 __ add(edi, Immediate(kPointerSize));
549 __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys)); 558 __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
550 __ j(not_equal, &slow); 559 __ j(not_equal, &slow);
551 560
561
552 // Get field offset. 562 // Get field offset.
553 // edx : receiver 563 // edx : receiver
554 // ebx : receiver's map 564 // ebx : receiver's map
555 // eax : key 565 // eax : key
556 // ecx : lookup cache index 566 // ecx : lookup cache index
557 ExternalReference cache_field_offsets = 567 ExternalReference cache_field_offsets =
558 ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate()); 568 ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
569
570 // Hit on second entry.
571 __ add(ecx, Immediate(1));
572 __ mov(edi,
573 Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
574 __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
575 __ sub(edi, ecx);
576 __ j(above_equal, &property_array_property);
577 __ jmp(&load_in_object_property);
578
579 // Hit on first entry.
580 __ bind(&hit_on_first_entry);
559 __ mov(edi, 581 __ mov(edi,
560 Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets)); 582 Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
561 __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset)); 583 __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
562 __ sub(edi, ecx); 584 __ sub(edi, ecx);
563 __ j(above_equal, &property_array_property); 585 __ j(above_equal, &property_array_property);
564 586
565 // Load in-object property. 587 // Load in-object property.
588 __ bind(&load_in_object_property);
566 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset)); 589 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
567 __ add(ecx, edi); 590 __ add(ecx, edi);
568 __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0)); 591 __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0));
569 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1); 592 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
570 __ ret(0); 593 __ ret(0);
571 594
572 // Load property array property. 595 // Load property array property.
573 __ bind(&property_array_property); 596 __ bind(&property_array_property);
574 __ mov(eax, FieldOperand(edx, JSObject::kPropertiesOffset)); 597 __ mov(eax, FieldOperand(edx, JSObject::kPropertiesOffset));
575 __ mov(eax, FieldOperand(eax, edi, times_pointer_size, 598 __ mov(eax, FieldOperand(eax, edi, times_pointer_size,
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1707 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1685 ? not_zero 1708 ? not_zero
1686 : zero; 1709 : zero;
1687 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1710 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1688 } 1711 }
1689 1712
1690 1713
1691 } } // namespace v8::internal 1714 } } // namespace v8::internal
1692 1715
1693 #endif // V8_TARGET_ARCH_IA32 1716 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698