Revert "[runtime] Inline SeqOneByteSubStringKey IsMatch and AsHandle"

This reverts commit a87a971b7e.

Reason for revert: required for revert of 
bbd740f038

Original change's description:
> [runtime] Inline SeqOneByteSubStringKey IsMatch and AsHandle
> 
> The performance actually matters to JSON parsing and this improves it by a % or
> 2.
> 
> In the longer run we should probably share the IsMatch implementation in
> StringTableKey directly and call a virtual GetBytes on the key implementation.
> 
> Change-Id: I838a106f9c8c52f0385057a52a8c0b9141ae025b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1589977
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Auto-Submit: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61183}

TBR=ishell@chromium.org,verwaest@chromium.org

Change-Id: I8797310ef7834c04b44c735ce60813e3fb596013
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1594440
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61193}
This commit is contained in:
Sigurd Schneider 2019-05-03 09:48:22 +00:00 committed by Commit Bot
parent ef3c733810
commit 100abfe599
2 changed files with 19 additions and 16 deletions

View File

@ -6477,6 +6477,23 @@ class RegExpKey : public HashTableKey {
Smi flags_;
};
Handle<String> SeqOneByteSubStringKey::AsHandle(Isolate* isolate) {
return isolate->factory()->NewOneByteInternalizedSubString(
string_, from_, length_, HashField());
}
bool SeqOneByteSubStringKey::IsMatch(Object object) {
DisallowHeapAllocation no_gc;
String string = String::cast(object);
if (string.length() != length_) return false;
if (string.IsOneByteRepresentation()) {
const uint8_t* data = string.GetChars<uint8_t>(no_gc);
return CompareChars(string_->GetChars(no_gc) + from_, data, length_) == 0;
}
const uint16_t* data = string.GetChars<uint16_t>(no_gc);
return CompareChars(string_->GetChars(no_gc) + from_, data, length_) == 0;
}
// InternalizedStringKey carries a string/internalized-string object as key.
class InternalizedStringKey : public StringTableKey {
public:

View File

@ -260,22 +260,8 @@ class SeqOneByteSubStringKey final : public StringTableKey {
#pragma warning(pop)
#endif
bool IsMatch(Object object) override {
DisallowHeapAllocation no_gc;
String string = String::cast(object);
if (string.length() != length_) return false;
if (string.IsOneByteRepresentation()) {
const uint8_t* data = string.GetChars<uint8_t>(no_gc);
return CompareChars(string_->GetChars(no_gc) + from_, data, length_) == 0;
}
const uint16_t* data = string.GetChars<uint16_t>(no_gc);
return CompareChars(string_->GetChars(no_gc) + from_, data, length_) == 0;
}
Handle<String> AsHandle(Isolate* isolate) override {
return isolate->factory()->NewOneByteInternalizedSubString(
string_, from_, length_, HashField());
}
bool IsMatch(Object string) override;
Handle<String> AsHandle(Isolate* isolate) override;
private:
Handle<SeqOneByteString> string_;