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

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 4547 matching lines...) Expand 10 before | Expand all | Expand 10 after
4558 // Check the representation and encoding of the subject string. 4558 // Check the representation and encoding of the subject string.
4559 Label seq_string; 4559 Label seq_string;
4560 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 4560 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
4561 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); 4561 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset));
4562 // First check for flat string. 4562 // First check for flat string.
4563 __ and_(r1, r0, Operand(kIsNotStringMask | kStringRepresentationMask), SetCC); 4563 __ and_(r1, r0, Operand(kIsNotStringMask | kStringRepresentationMask), SetCC);
4564 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 4564 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
4565 __ b(eq, &seq_string); 4565 __ b(eq, &seq_string);
4566 4566
4567 // subject: Subject string 4567 // subject: Subject string
4568 // regexp_data: RegExp data (FixedArray) 4568 // regexp_data: RegExp data (FixedArray)
Lasse Reichstein 2011/11/24 09:31:57 If r1 contains the instance type, then make a comm
4569 // Check for flat cons string or sliced string. 4569 // Check for flat cons string or sliced string.
4570 // A flat cons string is a cons string where the second part is the empty 4570 // A flat cons string is a cons string where the second part is the empty
4571 // string. In that case the subject string is just the first part of the cons 4571 // string. In that case the subject string is just the first part of the cons
4572 // string. Also in this case the first part of the cons string is known to be 4572 // string. Also in this case the first part of the cons string is known to be
4573 // a sequential string or an external string. 4573 // a sequential string or an external string.
4574 // In the case of a sliced string its offset has to be taken into account. 4574 // In the case of a sliced string its offset has to be taken into account.
4575 Label cons_string, check_encoding; 4575 Label cons_string, check_encoding;
4576 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 4576 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
4577 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 4577 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
4578 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
4578 __ cmp(r1, Operand(kExternalStringTag)); 4579 __ cmp(r1, Operand(kExternalStringTag));
4579 __ b(lt, &cons_string); 4580 __ b(lt, &cons_string);
4580 __ b(eq, &runtime); 4581 __ b(eq, &runtime);
4581 4582
4583 // Catch non-string subject (should already have been guarded against).
4584 __ tst(ebx, Immediate(kIsNotStringMask));
Lasse Reichstein 2011/11/24 09:31:57 If it should have been guarded against, then make
4585 __ b(eq, &runtime);
4586
4582 // String is sliced. 4587 // String is sliced.
4583 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 4588 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset));
4584 __ mov(r9, Operand(r9, ASR, kSmiTagSize)); 4589 __ mov(r9, Operand(r9, ASR, kSmiTagSize));
4585 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 4590 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
4586 // r9: offset of sliced string, smi-tagged. 4591 // r9: offset of sliced string, smi-tagged.
4587 __ jmp(&check_encoding); 4592 __ jmp(&check_encoding);
4588 // String is a cons string, check whether it is flat. 4593 // String is a cons string, check whether it is flat.
4589 __ bind(&cons_string); 4594 __ bind(&cons_string);
4590 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); 4595 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset));
4591 __ LoadRoot(r1, Heap::kEmptyStringRootIndex); 4596 __ LoadRoot(r1, Heap::kEmptyStringRootIndex);
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
7179 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, 7184 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10,
7180 &slow_elements); 7185 &slow_elements);
7181 __ Ret(); 7186 __ Ret();
7182 } 7187 }
7183 7188
7184 #undef __ 7189 #undef __
7185 7190
7186 } } // namespace v8::internal 7191 } } // namespace v8::internal
7187 7192
7188 #endif // V8_TARGET_ARCH_ARM 7193 #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