diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-03 17:20:32 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-05 09:28:09 +0000 |
commit | bb09965444b5bb20b096a291445170876225268d (patch) | |
tree | b5f6596f7e6e941b1d7d72f0ce5181500c261529 /chromium/v8/src/regexp/regexp-utils.cc | |
parent | 7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (diff) | |
download | qtwebengine-chromium-bb09965444b5bb20b096a291445170876225268d.tar.gz |
BASELINE: Update Chromium to 58.0.3029.98
Change-Id: Ib913750d687f29e036959c62a0cabf2412a8faa7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/v8/src/regexp/regexp-utils.cc')
-rw-r--r-- | chromium/v8/src/regexp/regexp-utils.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/v8/src/regexp/regexp-utils.cc b/chromium/v8/src/regexp/regexp-utils.cc index d40431866a3..570a348f74a 100644 --- a/chromium/v8/src/regexp/regexp-utils.cc +++ b/chromium/v8/src/regexp/regexp-utils.cc @@ -145,7 +145,14 @@ bool RegExpUtils::IsUnmodifiedRegExp(Isolate* isolate, Handle<Object> obj) { if (!proto->IsJSReceiver()) return false; Handle<Map> initial_proto_initial_map = isolate->regexp_prototype_map(); - return (JSReceiver::cast(proto)->map() == *initial_proto_initial_map); + if (JSReceiver::cast(proto)->map() != *initial_proto_initial_map) { + return false; + } + + // The smi check is required to omit ToLength(lastIndex) calls with possible + // user-code execution on the fast path. + Object* last_index = JSRegExp::cast(recv)->LastIndex(); + return last_index->IsSmi() && Smi::cast(last_index)->value() >= 0; } int RegExpUtils::AdvanceStringIndex(Isolate* isolate, Handle<String> string, |