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

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

Issue 674913002: Use a simpler KeyedStoreGeneric stub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/ic/mips64/ic-mips64.cc ('k') | src/ic/x87/ic-x87.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax); 396 GenerateDictionaryLoad(masm, &slow, rbx, key, rax, rdi, rax);
397 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); 397 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
398 __ ret(0); 398 __ ret(0);
399 399
400 __ bind(&index_name); 400 __ bind(&index_name);
401 __ IndexFromHash(rbx, key); 401 __ IndexFromHash(rbx, key);
402 __ jmp(&index_smi); 402 __ jmp(&index_smi);
403 } 403 }
404 404
405 405
406 static void KeyedStoreGenerateGenericHelper( 406 static void KeyedStoreGenerateMegamorphicHelper(
407 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, 407 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
408 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) { 408 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) {
409 Label transition_smi_elements; 409 Label transition_smi_elements;
410 Label finish_object_store, non_double_value, transition_double_elements; 410 Label finish_object_store, non_double_value, transition_double_elements;
411 Label fast_double_without_map_check; 411 Label fast_double_without_map_check;
412 Register receiver = StoreDescriptor::ReceiverRegister(); 412 Register receiver = StoreDescriptor::ReceiverRegister();
413 Register key = StoreDescriptor::NameRegister(); 413 Register key = StoreDescriptor::NameRegister();
414 Register value = StoreDescriptor::ValueRegister(); 414 Register value = StoreDescriptor::ValueRegister();
415 DCHECK(receiver.is(rdx)); 415 DCHECK(receiver.is(rdx));
416 DCHECK(key.is(rcx)); 416 DCHECK(key.is(rcx));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, 533 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS,
534 rbx, rdi, slow); 534 rbx, rdi, slow);
535 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); 535 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS);
536 ElementsTransitionGenerator::GenerateDoubleToObject(masm, receiver, key, 536 ElementsTransitionGenerator::GenerateDoubleToObject(masm, receiver, key,
537 value, rbx, mode, slow); 537 value, rbx, mode, slow);
538 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset)); 538 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset));
539 __ jmp(&finish_object_store); 539 __ jmp(&finish_object_store);
540 } 540 }
541 541
542 542
543 void KeyedStoreIC::GenerateGeneric( 543 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
544 MacroAssembler* masm, StrictMode strict_mode, 544 StrictMode strict_mode) {
545 KeyedStoreStubCacheRequirement handler_requirement) {
546 // Return address is on the stack. 545 // Return address is on the stack.
547 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; 546 Label slow, slow_with_tagged_index, fast_object, fast_object_grow;
548 Label fast_double, fast_double_grow; 547 Label fast_double, fast_double_grow;
549 Label array, extra, check_if_double_array, maybe_name_key, miss; 548 Label array, extra, check_if_double_array, maybe_name_key, miss;
550 Register receiver = StoreDescriptor::ReceiverRegister(); 549 Register receiver = StoreDescriptor::ReceiverRegister();
551 Register key = StoreDescriptor::NameRegister(); 550 Register key = StoreDescriptor::NameRegister();
552 DCHECK(receiver.is(rdx)); 551 DCHECK(receiver.is(rdx));
553 DCHECK(key.is(rcx)); 552 DCHECK(key.is(rcx));
554 553
555 // Check that the object isn't a smi. 554 // Check that the object isn't a smi.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 586
588 __ bind(&maybe_name_key); 587 __ bind(&maybe_name_key);
589 __ movp(r9, FieldOperand(key, HeapObject::kMapOffset)); 588 __ movp(r9, FieldOperand(key, HeapObject::kMapOffset));
590 __ movzxbp(r9, FieldOperand(r9, Map::kInstanceTypeOffset)); 589 __ movzxbp(r9, FieldOperand(r9, Map::kInstanceTypeOffset));
591 __ JumpIfNotUniqueNameInstanceType(r9, &slow_with_tagged_index); 590 __ JumpIfNotUniqueNameInstanceType(r9, &slow_with_tagged_index);
592 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( 591 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
593 Code::ComputeHandlerFlags(Code::STORE_IC)); 592 Code::ComputeHandlerFlags(Code::STORE_IC));
594 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, 593 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
595 key, rbx, no_reg); 594 key, rbx, no_reg);
596 // Cache miss. 595 // Cache miss.
597 if (handler_requirement == kCallRuntimeOnMissingHandler) { 596 __ jmp(&miss);
598 __ jmp(&slow_with_tagged_index);
599 } else {
600 DCHECK(handler_requirement == kMissOnMissingHandler);
601 __ jmp(&miss);
602 }
603 597
604 // Extra capacity case: Check if there is extra capacity to 598 // Extra capacity case: Check if there is extra capacity to
605 // perform the store and update the length. Used for adding one 599 // perform the store and update the length. Used for adding one
606 // element to the array by writing to array[array.length]. 600 // element to the array by writing to array[array.length].
607 __ bind(&extra); 601 __ bind(&extra);
608 // receiver is a JSArray. 602 // receiver is a JSArray.
609 // rbx: receiver's elements array (a FixedArray) 603 // rbx: receiver's elements array (a FixedArray)
610 // flags: smicompare (receiver.length(), rbx) 604 // flags: smicompare (receiver.length(), rbx)
611 __ j(not_equal, &slow); // do not leave holes in the array 605 __ j(not_equal, &slow); // do not leave holes in the array
612 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), key); 606 __ SmiCompareInteger32(FieldOperand(rbx, FixedArray::kLengthOffset), key);
(...skipping 15 matching lines...) Expand all
628 // is the length is always a smi. 622 // is the length is always a smi.
629 __ bind(&array); 623 __ bind(&array);
630 // receiver is a JSArray. 624 // receiver is a JSArray.
631 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset)); 625 __ movp(rbx, FieldOperand(receiver, JSObject::kElementsOffset));
632 626
633 // Check the key against the length in the array, compute the 627 // Check the key against the length in the array, compute the
634 // address to store into and fall through to fast case. 628 // address to store into and fall through to fast case.
635 __ SmiCompareInteger32(FieldOperand(receiver, JSArray::kLengthOffset), key); 629 __ SmiCompareInteger32(FieldOperand(receiver, JSArray::kLengthOffset), key);
636 __ j(below_equal, &extra); 630 __ j(below_equal, &extra);
637 631
638 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow, 632 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow,
639 kCheckMap, kDontIncrementLength); 633 kCheckMap, kDontIncrementLength);
640 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, 634 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
641 &slow, kDontCheckMap, kIncrementLength); 635 &fast_double_grow, &slow, kDontCheckMap,
636 kIncrementLength);
642 637
643 if (handler_requirement == kMissOnMissingHandler) { 638 __ bind(&miss);
644 __ bind(&miss); 639 GenerateMiss(masm);
645 GenerateMiss(masm);
646 }
647 } 640 }
648 641
649 642
650 static Operand GenerateMappedArgumentsLookup( 643 static Operand GenerateMappedArgumentsLookup(
651 MacroAssembler* masm, Register object, Register key, Register scratch1, 644 MacroAssembler* masm, Register object, Register key, Register scratch1,
652 Register scratch2, Register scratch3, Label* unmapped_case, 645 Register scratch2, Register scratch3, Label* unmapped_case,
653 Label* slow_case) { 646 Label* slow_case) {
654 Heap* heap = masm->isolate()->heap(); 647 Heap* heap = masm->isolate()->heap();
655 648
656 // Check that the receiver is a JSObject. Because of the elements 649 // Check that the receiver is a JSObject. Because of the elements
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 Condition cc = 970 Condition cc =
978 (check == ENABLE_INLINED_SMI_CHECK) 971 (check == ENABLE_INLINED_SMI_CHECK)
979 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 972 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
980 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 973 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
981 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 974 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
982 } 975 }
983 } 976 }
984 } // namespace v8::internal 977 } // namespace v8::internal
985 978
986 #endif // V8_TARGET_ARCH_X64 979 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/ic/x87/ic-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698