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

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

Issue 6517010: Fix a potential crash bug in keyed calls for non-string keys. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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 | « no previous file | src/arm/macro-assembler-arm.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Probe the string dictionary in the |elements| register. Jump to the 108 // Probe the string dictionary in the |elements| register. Jump to the
109 // |done| label if a property with the given name is found. Jump to 109 // |done| label if a property with the given name is found. Jump to
110 // the |miss| label otherwise. 110 // the |miss| label otherwise.
111 static void GenerateStringDictionaryProbes(MacroAssembler* masm, 111 static void GenerateStringDictionaryProbes(MacroAssembler* masm,
112 Label* miss, 112 Label* miss,
113 Label* done, 113 Label* done,
114 Register elements, 114 Register elements,
115 Register name, 115 Register name,
116 Register scratch1, 116 Register scratch1,
117 Register scratch2) { 117 Register scratch2) {
118 // Assert that name contains a string.
119 if (FLAG_debug_code) __ AbortIfNotString(name);
120
118 // Compute the capacity mask. 121 // Compute the capacity mask.
119 const int kCapacityOffset = StringDictionary::kHeaderSize + 122 const int kCapacityOffset = StringDictionary::kHeaderSize +
120 StringDictionary::kCapacityIndex * kPointerSize; 123 StringDictionary::kCapacityIndex * kPointerSize;
121 __ ldr(scratch1, FieldMemOperand(elements, kCapacityOffset)); 124 __ ldr(scratch1, FieldMemOperand(elements, kCapacityOffset));
122 __ mov(scratch1, Operand(scratch1, ASR, kSmiTagSize)); // convert smi to int 125 __ mov(scratch1, Operand(scratch1, ASR, kSmiTagSize)); // convert smi to int
123 __ sub(scratch1, scratch1, Operand(1)); 126 __ sub(scratch1, scratch1, Operand(1));
124 127
125 const int kElementsStartOffset = StringDictionary::kHeaderSize + 128 const int kElementsStartOffset = StringDictionary::kHeaderSize +
126 StringDictionary::kElementsStartIndex * kPointerSize; 129 StringDictionary::kElementsStartIndex * kPointerSize;
127 130
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 __ jmp(&index_smi); 839 __ jmp(&index_smi);
837 } 840 }
838 841
839 842
840 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { 843 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
841 // ----------- S t a t e ------------- 844 // ----------- S t a t e -------------
842 // -- r2 : name 845 // -- r2 : name
843 // -- lr : return address 846 // -- lr : return address
844 // ----------------------------------- 847 // -----------------------------------
845 848
849 // Check if the name is a string.
850 Label miss;
851 __ tst(r2, Operand(kSmiTagMask));
852 __ b(eq, &miss);
853 __ IsObjectJSStringType(r2, r0, &miss);
854
846 GenerateCallNormal(masm, argc); 855 GenerateCallNormal(masm, argc);
856 __ bind(&miss);
847 GenerateMiss(masm, argc); 857 GenerateMiss(masm, argc);
848 } 858 }
849 859
850 860
851 // Defined in ic.cc. 861 // Defined in ic.cc.
852 Object* LoadIC_Miss(Arguments args); 862 Object* LoadIC_Miss(Arguments args);
853 863
854 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 864 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
855 // ----------- S t a t e ------------- 865 // ----------- S t a t e -------------
856 // -- r2 : name 866 // -- r2 : name
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 Register reg = Assembler::GetRn(instr_at_patch); 1783 Register reg = Assembler::GetRn(instr_at_patch);
1774 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1784 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1775 patcher.EmitCondition(eq); 1785 patcher.EmitCondition(eq);
1776 } 1786 }
1777 } 1787 }
1778 1788
1779 1789
1780 } } // namespace v8::internal 1790 } } // namespace v8::internal
1781 1791
1782 #endif // V8_TARGET_ARCH_ARM 1792 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698