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

Side by Side Diff: src/ia32/code-stubs-ia32.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 | « src/arm/code-stubs-arm.cc ('k') | src/x64/code-stubs-x64.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 3589 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 3600 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
3601 // First check for flat two byte string. 3601 // First check for flat two byte string.
3602 __ and_(ebx, 3602 __ and_(ebx,
3603 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask); 3603 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask);
3604 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); 3604 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0);
3605 __ j(zero, &seq_two_byte_string, Label::kNear); 3605 __ j(zero, &seq_two_byte_string, Label::kNear);
3606 // Any other flat string must be a flat ascii string. 3606 // Any other flat string must be a flat ascii string.
3607 __ and_(ebx, Immediate(kIsNotStringMask | kStringRepresentationMask)); 3607 __ and_(ebx, Immediate(kIsNotStringMask | kStringRepresentationMask));
3608 __ j(zero, &seq_ascii_string, Label::kNear); 3608 __ j(zero, &seq_ascii_string, Label::kNear);
3609 3609
3610 // ebx: whether subject is a string and if yes, its string representation
3610 // Check for flat cons string or sliced string. 3611 // Check for flat cons string or sliced string.
3611 // A flat cons string is a cons string where the second part is the empty 3612 // A flat cons string is a cons string where the second part is the empty
3612 // string. In that case the subject string is just the first part of the cons 3613 // string. In that case the subject string is just the first part of the cons
3613 // string. Also in this case the first part of the cons string is known to be 3614 // string. Also in this case the first part of the cons string is known to be
3614 // a sequential string or an external string. 3615 // a sequential string or an external string.
3615 // In the case of a sliced string its offset has to be taken into account. 3616 // In the case of a sliced string its offset has to be taken into account.
3616 Label cons_string, check_encoding; 3617 Label cons_string, check_encoding;
3617 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 3618 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
3618 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 3619 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
3620 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
3619 __ cmp(ebx, Immediate(kExternalStringTag)); 3621 __ cmp(ebx, Immediate(kExternalStringTag));
3620 __ j(less, &cons_string); 3622 __ j(less, &cons_string);
3621 __ j(equal, &runtime); 3623 __ j(equal, &runtime);
3622 3624
3625 // Catch non-string subject (should already have been guarded against).
3626 STATIC_ASSERT(kIsNotStringTag != 0);
3627 __ test(ebx, Immediate(kIsNotStringMask));
3628 __ j(not_zero, &runtime);
3629
3623 // String is sliced. 3630 // String is sliced.
3624 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); 3631 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset));
3625 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); 3632 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset));
3626 // edi: offset of sliced string, smi-tagged. 3633 // edi: offset of sliced string, smi-tagged.
3627 // eax: parent string. 3634 // eax: parent string.
3628 __ jmp(&check_encoding, Label::kNear); 3635 __ jmp(&check_encoding, Label::kNear);
3629 // String is a cons string, check whether it is flat. 3636 // String is a cons string, check whether it is flat.
3630 __ bind(&cons_string); 3637 __ bind(&cons_string);
3631 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string()); 3638 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string());
3632 __ j(not_equal, &runtime); 3639 __ j(not_equal, &runtime);
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after
7124 false); 7131 false);
7125 __ pop(edx); 7132 __ pop(edx);
7126 __ ret(0); 7133 __ ret(0);
7127 } 7134 }
7128 7135
7129 #undef __ 7136 #undef __
7130 7137
7131 } } // namespace v8::internal 7138 } } // namespace v8::internal
7132 7139
7133 #endif // V8_TARGET_ARCH_IA32 7140 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698