[json] Use knowledge that all fast json properties are inobject

Change-Id: Ifd8734aa682e238de54284c74209d236c7ac824f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1622110
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61699}
This commit is contained in:
Toon Verwaest 2019-05-21 14:57:05 +02:00 committed by Commit Bot
parent d45cb871e1
commit 8298e1c8aa
3 changed files with 15 additions and 6 deletions

View File

@ -612,7 +612,7 @@ Handle<Object> JsonParser<Char>::BuildJsonObject(
*factory()->mutable_heap_number_map()); *factory()->mutable_heap_number_map());
} }
} }
object->RawFastPropertyAtPut(index, value, mode); object->RawFastInobjectPropertyAtPut(index, value, mode);
} }
// Make all MutableHeapNumbers alive. // Make all MutableHeapNumbers alive.
if (!mutable_double_buffer.is_null()) { if (!mutable_double_buffer.is_null()) {
@ -1141,9 +1141,9 @@ JsonString JsonParser<Char>::ScanJsonString(bool needs_internalization) {
while (true) { while (true) {
cursor_ = std::find_if(cursor_, end_, [&bits](Char c) { cursor_ = std::find_if(cursor_, end_, [&bits](Char c) {
if (sizeof(Char) == 2) { if (sizeof(Char) == 2 && V8_UNLIKELY(c > unibrow::Latin1::kMaxChar)) {
bits |= c; bits |= c;
if (c > unibrow::Latin1::kMaxChar) return false; return false;
} }
return MayTerminateJsonString(character_json_scan_flags[c]); return MayTerminateJsonString(character_json_scan_flags[c]);
}); });

View File

@ -341,12 +341,18 @@ uint64_t JSObject::RawFastDoublePropertyAsBitsAt(FieldIndex index) {
return ReadField<uint64_t>(index.offset()); return ReadField<uint64_t>(index.offset());
} }
void JSObject::RawFastInobjectPropertyAtPut(FieldIndex index, Object value,
WriteBarrierMode mode) {
DCHECK(index.is_inobject());
int offset = index.offset();
WRITE_FIELD(*this, offset, value);
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode);
}
void JSObject::RawFastPropertyAtPut(FieldIndex index, Object value, void JSObject::RawFastPropertyAtPut(FieldIndex index, Object value,
WriteBarrierMode mode) { WriteBarrierMode mode) {
if (index.is_inobject()) { if (index.is_inobject()) {
int offset = index.offset(); RawFastInobjectPropertyAtPut(index, value, mode);
WRITE_FIELD(*this, offset, value);
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode);
} else { } else {
DCHECK_EQ(UPDATE_WRITE_BARRIER, mode); DCHECK_EQ(UPDATE_WRITE_BARRIER, mode);
property_array()->set(index.outobject_array_index(), value); property_array()->set(index.outobject_array_index(), value);

View File

@ -640,6 +640,9 @@ class JSObject : public JSReceiver {
inline void RawFastPropertyAtPut( inline void RawFastPropertyAtPut(
FieldIndex index, Object value, FieldIndex index, Object value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER); WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline void RawFastInobjectPropertyAtPut(
FieldIndex index, Object value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline void RawFastDoublePropertyAsBitsAtPut(FieldIndex index, uint64_t bits); inline void RawFastDoublePropertyAsBitsAtPut(FieldIndex index, uint64_t bits);
inline void WriteToField(int descriptor, PropertyDetails details, inline void WriteToField(int descriptor, PropertyDetails details,
Object value); Object value);