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

Unified Diff: src/builtins/builtins-regexp.cc

Issue 2452923002: [regexp] Use SameValue in @@search as specced (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | test/mjsunit/regexp.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-regexp.cc
diff --git a/src/builtins/builtins-regexp.cc b/src/builtins/builtins-regexp.cc
index d993e82f2eae7ee0a2545f712ae43f22b0810db6..f7375ba86e09b15f6151803c86338f5ebe27c7c2 100644
--- a/src/builtins/builtins-regexp.cc
+++ b/src/builtins/builtins-regexp.cc
@@ -1158,8 +1158,7 @@ BUILTIN(RegExpPrototypeSearch) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, previous_last_index_obj,
RegExpUtils::GetLastIndex(isolate, recv));
- if (!previous_last_index_obj->IsSmi() ||
- Smi::cast(*previous_last_index_obj)->value() != 0) {
+ if (!previous_last_index_obj->SameValue(Smi::kZero)) {
RETURN_FAILURE_ON_EXCEPTION(isolate,
RegExpUtils::SetLastIndex(isolate, recv, 0));
}
@@ -1174,10 +1173,9 @@ BUILTIN(RegExpPrototypeSearch) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, current_last_index_obj,
RegExpUtils::GetLastIndex(isolate, recv));
- Maybe<bool> is_last_index_unchanged =
- Object::Equals(current_last_index_obj, previous_last_index_obj);
- if (is_last_index_unchanged.IsNothing()) return isolate->pending_exception();
- if (!is_last_index_unchanged.FromJust()) {
+ const bool is_last_index_unchanged =
+ current_last_index_obj->SameValue(*previous_last_index_obj);
+ if (!is_last_index_unchanged) {
if (previous_last_index_obj->IsSmi()) {
RETURN_FAILURE_ON_EXCEPTION(
isolate,
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | test/mjsunit/regexp.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698