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

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

Issue 8554004: Catch non-string subject in RegExpExecStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 9 years, 1 month 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/ia32/code-stubs-ia32.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 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 Label seq_string; 4600 Label seq_string;
4601 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 4601 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
4602 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); 4602 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset));
4603 // First check for flat string. 4603 // First check for flat string.
4604 __ and_(r1, r0, Operand(kIsNotStringMask | kStringRepresentationMask), SetCC); 4604 __ and_(r1, r0, Operand(kIsNotStringMask | kStringRepresentationMask), SetCC);
4605 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 4605 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
4606 __ b(eq, &seq_string); 4606 __ b(eq, &seq_string);
4607 4607
4608 // subject: Subject string 4608 // subject: Subject string
4609 // regexp_data: RegExp data (FixedArray) 4609 // regexp_data: RegExp data (FixedArray)
4610 // r1: whether subject is a string and if yes, its string representation
4610 // Check for flat cons string or sliced string. 4611 // Check for flat cons string or sliced string.
4611 // A flat cons string is a cons string where the second part is the empty 4612 // A flat cons string is a cons string where the second part is the empty
4612 // string. In that case the subject string is just the first part of the cons 4613 // string. In that case the subject string is just the first part of the cons
4613 // string. Also in this case the first part of the cons string is known to be 4614 // string. Also in this case the first part of the cons string is known to be
4614 // a sequential string or an external string. 4615 // a sequential string or an external string.
4615 // In the case of a sliced string its offset has to be taken into account. 4616 // In the case of a sliced string its offset has to be taken into account.
4616 Label cons_string, check_encoding; 4617 Label cons_string, check_encoding;
4617 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 4618 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
4618 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 4619 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
4620 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
4619 __ cmp(r1, Operand(kExternalStringTag)); 4621 __ cmp(r1, Operand(kExternalStringTag));
4620 __ b(lt, &cons_string); 4622 __ b(lt, &cons_string);
4621 __ b(eq, &runtime); 4623 __ b(eq, &runtime);
4622 4624
4625 // Catch non-string subject (should already have been guarded against).
4626 STATIC_ASSERT(kIsNotStringTag != 0);
4627 __ tst(r1, Immediate(kIsNotStringMask));
4628 __ b(ne, &runtime);
4629
4623 // String is sliced. 4630 // String is sliced.
4624 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 4631 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset));
4625 __ mov(r9, Operand(r9, ASR, kSmiTagSize)); 4632 __ mov(r9, Operand(r9, ASR, kSmiTagSize));
4626 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 4633 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
4627 // r9: offset of sliced string, smi-tagged. 4634 // r9: offset of sliced string, smi-tagged.
4628 __ jmp(&check_encoding); 4635 __ jmp(&check_encoding);
4629 // String is a cons string, check whether it is flat. 4636 // String is a cons string, check whether it is flat.
4630 __ bind(&cons_string); 4637 __ bind(&cons_string);
4631 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); 4638 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset));
4632 __ LoadRoot(r1, Heap::kEmptyStringRootIndex); 4639 __ LoadRoot(r1, Heap::kEmptyStringRootIndex);
(...skipping 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after
7161 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, 7168 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10,
7162 &slow_elements); 7169 &slow_elements);
7163 __ Ret(); 7170 __ Ret();
7164 } 7171 }
7165 7172
7166 #undef __ 7173 #undef __
7167 7174
7168 } } // namespace v8::internal 7175 } } // namespace v8::internal
7169 7176
7170 #endif // V8_TARGET_ARCH_ARM 7177 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698