diff options
author | Michaël Zasso <targos@protonmail.com> | 2020-11-13 12:51:53 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2020-11-15 16:46:54 +0100 |
commit | 48db20f6f53060e38b2272566b014741eb4f519f (patch) | |
tree | e2f9b4c7f69d2e4597b73b4c3c09f4371d5cc963 /deps/v8/src/objects/code-inl.h | |
parent | 79916428a48df937aa5b2b69c061d2d42181a76b (diff) | |
download | node-new-48db20f6f53060e38b2272566b014741eb4f519f.tar.gz |
deps: update V8 to 8.7.220
PR-URL: https://github.com/nodejs/node/pull/35700
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Diffstat (limited to 'deps/v8/src/objects/code-inl.h')
-rw-r--r-- | deps/v8/src/objects/code-inl.h | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/deps/v8/src/objects/code-inl.h b/deps/v8/src/objects/code-inl.h index c5a4187822..3c772f855a 100644 --- a/deps/v8/src/objects/code-inl.h +++ b/deps/v8/src/objects/code-inl.h @@ -208,21 +208,12 @@ void Code::clear_padding() { CodeSize() - (data_end - address())); } -ByteArray Code::SourcePositionTableIfCollected() const { - ReadOnlyRoots roots = GetReadOnlyRoots(); - Object maybe_table = source_position_table(); - if (maybe_table.IsUndefined(roots) || maybe_table.IsException(roots)) { - return roots.empty_byte_array(); - } - DCHECK(maybe_table.IsByteArray()); - return ByteArray::cast(maybe_table); -} - ByteArray Code::SourcePositionTable() const { Object maybe_table = source_position_table(); - DCHECK(!maybe_table.IsUndefined() && !maybe_table.IsException()); - DCHECK(maybe_table.IsByteArray()); - return ByteArray::cast(maybe_table); + if (maybe_table.IsByteArray()) return ByteArray::cast(maybe_table); + ReadOnlyRoots roots = GetReadOnlyRoots(); + DCHECK(maybe_table.IsUndefined(roots) || maybe_table.IsException(roots)); + return roots.empty_byte_array(); } Object Code::next_code_link() const { @@ -376,7 +367,8 @@ inline bool Code::is_interpreter_trampoline_builtin() const { inline bool Code::checks_optimization_marker() const { bool checks_marker = (builtin_index() == Builtins::kCompileLazy || - builtin_index() == Builtins::kInterpreterEntryTrampoline); + builtin_index() == Builtins::kInterpreterEntryTrampoline || + CodeKindChecksOptimizationMarker(kind())); return checks_marker || (CodeKindCanDeoptimize(kind()) && marked_for_deoptimization()); } @@ -709,8 +701,8 @@ int32_t BytecodeArray::parameter_count() const { ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset) ACCESSORS(BytecodeArray, handler_table, ByteArray, kHandlerTableOffset) -ACCESSORS(BytecodeArray, source_position_table, Object, - kSourcePositionTableOffset) +SYNCHRONIZED_ACCESSORS(BytecodeArray, synchronized_source_position_table, + Object, kSourcePositionTableOffset) void BytecodeArray::clear_padding() { int data_size = kHeaderSize + length(); @@ -723,40 +715,37 @@ Address BytecodeArray::GetFirstBytecodeAddress() { } bool BytecodeArray::HasSourcePositionTable() const { - Object maybe_table = source_position_table(); + Object maybe_table = synchronized_source_position_table(); return !(maybe_table.IsUndefined() || DidSourcePositionGenerationFail()); } bool BytecodeArray::DidSourcePositionGenerationFail() const { - return source_position_table().IsException(); + return synchronized_source_position_table().IsException(); } void BytecodeArray::SetSourcePositionsFailedToCollect() { - set_source_position_table(GetReadOnlyRoots().exception()); + set_synchronized_source_position_table(GetReadOnlyRoots().exception()); } ByteArray BytecodeArray::SourcePositionTable() const { - Object maybe_table = source_position_table(); + // WARNING: This function may be called from a background thread, hence + // changes to how it accesses the heap can easily lead to bugs. + Object maybe_table = synchronized_source_position_table(); if (maybe_table.IsByteArray()) return ByteArray::cast(maybe_table); ReadOnlyRoots roots = GetReadOnlyRoots(); - DCHECK(maybe_table.IsException(roots)); + DCHECK(maybe_table.IsUndefined(roots) || maybe_table.IsException(roots)); return roots.empty_byte_array(); } -ByteArray BytecodeArray::SourcePositionTableIfCollected() const { - if (!HasSourcePositionTable()) return GetReadOnlyRoots().empty_byte_array(); - - return SourcePositionTable(); -} - int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); } int BytecodeArray::SizeIncludingMetadata() { int size = BytecodeArraySize(); size += constant_pool().Size(); size += handler_table().Size(); - if (HasSourcePositionTable()) { - size += SourcePositionTable().Size(); + ByteArray table = SourcePositionTable(); + if (table.length() != 0) { + size += table.Size(); } return size; } |