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

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
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 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3609 3609
3610 // Check for flat cons string or sliced string. 3610 // Check for flat cons string or sliced string.
3611 // A flat cons string is a cons string where the second part is the empty 3611 // 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 3612 // 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 3613 // string. Also in this case the first part of the cons string is known to be
3614 // a sequential string or an external string. 3614 // a sequential string or an external string.
3615 // In the case of a sliced string its offset has to be taken into account. 3615 // In the case of a sliced string its offset has to be taken into account.
3616 Label cons_string, check_encoding; 3616 Label cons_string, check_encoding;
3617 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 3617 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
3618 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 3618 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
3619 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
3619 __ cmp(ebx, Immediate(kExternalStringTag)); 3620 __ cmp(ebx, Immediate(kExternalStringTag));
3620 __ j(less, &cons_string); 3621 __ j(less, &cons_string);
3621 __ j(equal, &runtime); 3622 __ j(equal, &runtime);
3622 3623
3624 // Catch non-string subject (should already have been guarded against).
3625 __ test(ebx, Immediate(kIsNotStringMask));
3626 __ j(zero, &runtime);
3627
3623 // String is sliced. 3628 // String is sliced.
3624 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); 3629 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset));
3625 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); 3630 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset));
3626 // edi: offset of sliced string, smi-tagged. 3631 // edi: offset of sliced string, smi-tagged.
3627 // eax: parent string. 3632 // eax: parent string.
3628 __ jmp(&check_encoding, Label::kNear); 3633 __ jmp(&check_encoding, Label::kNear);
3629 // String is a cons string, check whether it is flat. 3634 // String is a cons string, check whether it is flat.
3630 __ bind(&cons_string); 3635 __ bind(&cons_string);
3631 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string()); 3636 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string());
3632 __ j(not_equal, &runtime); 3637 __ j(not_equal, &runtime);
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after
7124 false); 7129 false);
7125 __ pop(edx); 7130 __ pop(edx);
7126 __ ret(0); 7131 __ ret(0);
7127 } 7132 }
7128 7133
7129 #undef __ 7134 #undef __
7130 7135
7131 } } // namespace v8::internal 7136 } } // namespace v8::internal
7132 7137
7133 #endif // V8_TARGET_ARCH_IA32 7138 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698