[ic] Allow strings to be used as receivers

Bug: chromium:1016709
Change-Id: Ib239336cb6dde7c5d555d31911453bff138a23e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1886921
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64617}
This commit is contained in:
Sathya Gunasekaran 2019-10-29 14:26:27 +00:00 committed by Commit Bot
parent 46648402d0
commit 6b70b09037

View File

@ -1189,7 +1189,7 @@ namespace {
bool ConvertKeyToIndex(Handle<Object> receiver, Handle<Object> key, bool ConvertKeyToIndex(Handle<Object> receiver, Handle<Object> key,
uint32_t* index) { uint32_t* index) {
if (!receiver->IsJSReceiver()) return false; DCHECK(receiver->IsJSReceiver() || receiver->IsString());
if (key->ToArrayIndex(index)) return true; if (key->ToArrayIndex(index)) return true;
if (!receiver->IsJSTypedArray()) return false; if (!receiver->IsJSTypedArray()) return false;
@ -1206,7 +1206,7 @@ bool ConvertKeyToIndex(Handle<Object> receiver, Handle<Object> key,
bool CanCache(Handle<Object> receiver, InlineCacheState state) { bool CanCache(Handle<Object> receiver, InlineCacheState state) {
if (!FLAG_use_ic || state == NO_FEEDBACK) return false; if (!FLAG_use_ic || state == NO_FEEDBACK) return false;
if (!receiver->IsJSReceiver()) return false; if (!receiver->IsJSReceiver() && !receiver->IsString()) return false;
return !receiver->IsAccessCheckNeeded() && !receiver->IsJSPrimitiveWrapper(); return !receiver->IsAccessCheckNeeded() && !receiver->IsJSPrimitiveWrapper();
} }