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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 602773003: Eliminate special keyed load string stub in favor of uniform handlers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and ports. 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/code-stubs.h ('k') | src/ic/arm/ic-arm.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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 ExternalReference ref = ExternalReference( 684 ExternalReference ref = ExternalReference(
685 IC_Utility(IC::kLoadElementWithInterceptor), masm->isolate()); 685 IC_Utility(IC::kLoadElementWithInterceptor), masm->isolate());
686 __ TailCallExternalReference(ref, 2, 1); 686 __ TailCallExternalReference(ref, 2, 1);
687 687
688 __ bind(&slow); 688 __ bind(&slow);
689 PropertyAccessCompiler::TailCallBuiltin( 689 PropertyAccessCompiler::TailCallBuiltin(
690 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); 690 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC));
691 } 691 }
692 692
693 693
694 void LoadIndexedStringStub::Generate(MacroAssembler* masm) {
695 // Return address is on the stack.
696 Label miss;
697
698 Register receiver = LoadDescriptor::ReceiverRegister();
699 Register index = LoadDescriptor::NameRegister();
700 Register scratch = ebx;
701 DCHECK(!scratch.is(receiver) && !scratch.is(index));
702 Register result = eax;
703 DCHECK(!result.is(scratch));
704
705 // TODO(mvstanton): the generator doesn't need to verify that
706 // receiver is a string map, that is done outside the handler.
707 StringCharAtGenerator char_at_generator(receiver, index, scratch, result,
708 &miss, // When not a string.
709 &miss, // When not a number.
710 &miss, // When index out of range.
711 STRING_INDEX_IS_ARRAY_INDEX,
712 RECEIVER_IS_STRING);
713 char_at_generator.GenerateFast(masm);
714 __ ret(0);
715
716 StubRuntimeCallHelper call_helper;
717 char_at_generator.GenerateSlow(masm, call_helper);
718
719 __ bind(&miss);
720 PropertyAccessCompiler::TailCallBuiltin(
721 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC));
722 }
723
724
694 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 725 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
695 // The key is in edx and the parameter count is in eax. 726 // The key is in edx and the parameter count is in eax.
696 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index())); 727 DCHECK(edx.is(ArgumentsAccessReadDescriptor::index()));
697 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count())); 728 DCHECK(eax.is(ArgumentsAccessReadDescriptor::parameter_count()));
698 729
699 // The displacement is used for skipping the frame pointer on the 730 // The displacement is used for skipping the frame pointer on the
700 // stack. It is the offset of the last parameter (if any) relative 731 // stack. It is the offset of the last parameter (if any) relative
701 // to the frame pointer. 732 // to the frame pointer.
702 static const int kDisplacement = 1 * kPointerSize; 733 static const int kDisplacement = 1 * kPointerSize;
703 734
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 } 2771 }
2741 } 2772 }
2742 2773
2743 2774
2744 // ------------------------------------------------------------------------- 2775 // -------------------------------------------------------------------------
2745 // StringCharCodeAtGenerator 2776 // StringCharCodeAtGenerator
2746 2777
2747 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 2778 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
2748 // If the receiver is a smi trigger the non-string case. 2779 // If the receiver is a smi trigger the non-string case.
2749 STATIC_ASSERT(kSmiTag == 0); 2780 STATIC_ASSERT(kSmiTag == 0);
2750 __ JumpIfSmi(object_, receiver_not_string_); 2781 if (check_mode_ == RECEIVER_IS_UNKNOWN) {
2782 __ JumpIfSmi(object_, receiver_not_string_);
2751 2783
2752 // Fetch the instance type of the receiver into result register. 2784 // Fetch the instance type of the receiver into result register.
2753 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); 2785 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset));
2754 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); 2786 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset));
2755 // If the receiver is not a string trigger the non-string case. 2787 // If the receiver is not a string trigger the non-string case.
2756 __ test(result_, Immediate(kIsNotStringMask)); 2788 __ test(result_, Immediate(kIsNotStringMask));
2757 __ j(not_zero, receiver_not_string_); 2789 __ j(not_zero, receiver_not_string_);
2790 }
2758 2791
2759 // If the index is non-smi trigger the non-smi case. 2792 // If the index is non-smi trigger the non-smi case.
2760 STATIC_ASSERT(kSmiTag == 0); 2793 STATIC_ASSERT(kSmiTag == 0);
2761 __ JumpIfNotSmi(index_, &index_not_smi_); 2794 __ JumpIfNotSmi(index_, &index_not_smi_);
2762 __ bind(&got_smi_index_); 2795 __ bind(&got_smi_index_);
2763 2796
2764 // Check for index out of range. 2797 // Check for index out of range.
2765 __ cmp(index_, FieldOperand(object_, String::kLengthOffset)); 2798 __ cmp(index_, FieldOperand(object_, String::kLengthOffset));
2766 __ j(above_equal, index_out_of_range_); 2799 __ j(above_equal, index_out_of_range_);
2767 2800
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
4702 Operand(ebp, 7 * kPointerSize), 4735 Operand(ebp, 7 * kPointerSize),
4703 NULL); 4736 NULL);
4704 } 4737 }
4705 4738
4706 4739
4707 #undef __ 4740 #undef __
4708 4741
4709 } } // namespace v8::internal 4742 } } // namespace v8::internal
4710 4743
4711 #endif // V8_TARGET_ARCH_IA32 4744 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698