| File: | out/../deps/v8/src/wasm/wasm-serialization.cc |
| Warning: | line 692, column 21 Moved-from object 'batch' of type 'std::vector' is moved |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | // Copyright 2017 the V8 project authors. All rights reserved. | |||
| 2 | // Use of this source code is governed by a BSD-style license that can be | |||
| 3 | // found in the LICENSE file. | |||
| 4 | ||||
| 5 | #include "src/wasm/wasm-serialization.h" | |||
| 6 | ||||
| 7 | #include "src/base/platform/wrappers.h" | |||
| 8 | #include "src/codegen/assembler-inl.h" | |||
| 9 | #include "src/codegen/external-reference-table.h" | |||
| 10 | #include "src/objects/objects-inl.h" | |||
| 11 | #include "src/objects/objects.h" | |||
| 12 | #include "src/runtime/runtime.h" | |||
| 13 | #include "src/snapshot/code-serializer.h" | |||
| 14 | #include "src/utils/ostreams.h" | |||
| 15 | #include "src/utils/utils.h" | |||
| 16 | #include "src/utils/version.h" | |||
| 17 | #include "src/wasm/code-space-access.h" | |||
| 18 | #include "src/wasm/function-compiler.h" | |||
| 19 | #include "src/wasm/module-compiler.h" | |||
| 20 | #include "src/wasm/module-decoder.h" | |||
| 21 | #include "src/wasm/wasm-code-manager.h" | |||
| 22 | #include "src/wasm/wasm-engine.h" | |||
| 23 | #include "src/wasm/wasm-module.h" | |||
| 24 | #include "src/wasm/wasm-objects-inl.h" | |||
| 25 | #include "src/wasm/wasm-objects.h" | |||
| 26 | #include "src/wasm/wasm-result.h" | |||
| 27 | ||||
| 28 | namespace v8 { | |||
| 29 | namespace internal { | |||
| 30 | namespace wasm { | |||
| 31 | ||||
| 32 | namespace { | |||
| 33 | constexpr uint8_t kLazyFunction = 2; | |||
| 34 | constexpr uint8_t kLiftoffFunction = 3; | |||
| 35 | constexpr uint8_t kTurboFanFunction = 4; | |||
| 36 | ||||
| 37 | // TODO(bbudge) Try to unify the various implementations of readers and writers | |||
| 38 | // in Wasm, e.g. StreamProcessor and ZoneBuffer, with these. | |||
| 39 | class Writer { | |||
| 40 | public: | |||
| 41 | explicit Writer(base::Vector<byte> buffer) | |||
| 42 | : start_(buffer.begin()), end_(buffer.end()), pos_(buffer.begin()) {} | |||
| 43 | ||||
| 44 | size_t bytes_written() const { return pos_ - start_; } | |||
| 45 | byte* current_location() const { return pos_; } | |||
| 46 | size_t current_size() const { return end_ - pos_; } | |||
| 47 | base::Vector<byte> current_buffer() const { | |||
| 48 | return {current_location(), current_size()}; | |||
| 49 | } | |||
| 50 | ||||
| 51 | template <typename T> | |||
| 52 | void Write(const T& value) { | |||
| 53 | DCHECK_GE(current_size(), sizeof(T))((void) 0); | |||
| 54 | WriteUnalignedValue(reinterpret_cast<Address>(current_location()), value); | |||
| 55 | pos_ += sizeof(T); | |||
| 56 | if (FLAG_trace_wasm_serialization) { | |||
| 57 | StdoutStream{} << "wrote: " << static_cast<size_t>(value) | |||
| 58 | << " sized: " << sizeof(T) << std::endl; | |||
| 59 | } | |||
| 60 | } | |||
| 61 | ||||
| 62 | void WriteVector(const base::Vector<const byte> v) { | |||
| 63 | DCHECK_GE(current_size(), v.size())((void) 0); | |||
| 64 | if (v.size() > 0) { | |||
| 65 | memcpy(current_location(), v.begin(), v.size()); | |||
| 66 | pos_ += v.size(); | |||
| 67 | } | |||
| 68 | if (FLAG_trace_wasm_serialization) { | |||
| 69 | StdoutStream{} << "wrote vector of " << v.size() << " elements" | |||
| 70 | << std::endl; | |||
| 71 | } | |||
| 72 | } | |||
| 73 | ||||
| 74 | void Skip(size_t size) { pos_ += size; } | |||
| 75 | ||||
| 76 | private: | |||
| 77 | byte* const start_; | |||
| 78 | byte* const end_; | |||
| 79 | byte* pos_; | |||
| 80 | }; | |||
| 81 | ||||
| 82 | class Reader { | |||
| 83 | public: | |||
| 84 | explicit Reader(base::Vector<const byte> buffer) | |||
| 85 | : start_(buffer.begin()), end_(buffer.end()), pos_(buffer.begin()) {} | |||
| 86 | ||||
| 87 | size_t bytes_read() const { return pos_ - start_; } | |||
| 88 | const byte* current_location() const { return pos_; } | |||
| 89 | size_t current_size() const { return end_ - pos_; } | |||
| 90 | base::Vector<const byte> current_buffer() const { | |||
| 91 | return {current_location(), current_size()}; | |||
| 92 | } | |||
| 93 | ||||
| 94 | template <typename T> | |||
| 95 | T Read() { | |||
| 96 | DCHECK_GE(current_size(), sizeof(T))((void) 0); | |||
| 97 | T value = | |||
| 98 | ReadUnalignedValue<T>(reinterpret_cast<Address>(current_location())); | |||
| 99 | pos_ += sizeof(T); | |||
| 100 | if (FLAG_trace_wasm_serialization) { | |||
| 101 | StdoutStream{} << "read: " << static_cast<size_t>(value) | |||
| 102 | << " sized: " << sizeof(T) << std::endl; | |||
| 103 | } | |||
| 104 | return value; | |||
| 105 | } | |||
| 106 | ||||
| 107 | template <typename T> | |||
| 108 | base::Vector<const T> ReadVector(size_t size) { | |||
| 109 | DCHECK_GE(current_size(), size)((void) 0); | |||
| 110 | base::Vector<const byte> bytes{pos_, size * sizeof(T)}; | |||
| 111 | pos_ += size * sizeof(T); | |||
| 112 | if (FLAG_trace_wasm_serialization) { | |||
| 113 | StdoutStream{} << "read vector of " << size << " elements of size " | |||
| 114 | << sizeof(T) << " (total size " << size * sizeof(T) << ")" | |||
| 115 | << std::endl; | |||
| 116 | } | |||
| 117 | return base::Vector<const T>::cast(bytes); | |||
| 118 | } | |||
| 119 | ||||
| 120 | void Skip(size_t size) { pos_ += size; } | |||
| 121 | ||||
| 122 | private: | |||
| 123 | const byte* const start_; | |||
| 124 | const byte* const end_; | |||
| 125 | const byte* pos_; | |||
| 126 | }; | |||
| 127 | ||||
| 128 | void WriteHeader(Writer* writer) { | |||
| 129 | writer->Write(SerializedData::kMagicNumber); | |||
| 130 | writer->Write(Version::Hash()); | |||
| 131 | writer->Write(static_cast<uint32_t>(CpuFeatures::SupportedFeatures())); | |||
| 132 | writer->Write(FlagList::Hash()); | |||
| 133 | DCHECK_EQ(WasmSerializer::kHeaderSize, writer->bytes_written())((void) 0); | |||
| 134 | } | |||
| 135 | ||||
| 136 | // On Intel, call sites are encoded as a displacement. For linking and for | |||
| 137 | // serialization/deserialization, we want to store/retrieve a tag (the function | |||
| 138 | // index). On Intel, that means accessing the raw displacement. | |||
| 139 | // On ARM64, call sites are encoded as either a literal load or a direct branch. | |||
| 140 | // Other platforms simply require accessing the target address. | |||
| 141 | void SetWasmCalleeTag(RelocInfo* rinfo, uint32_t tag) { | |||
| 142 | #if V8_TARGET_ARCH_X641 || V8_TARGET_ARCH_IA32 | |||
| 143 | DCHECK(rinfo->HasTargetAddressAddress())((void) 0); | |||
| 144 | DCHECK(!RelocInfo::IsCompressedEmbeddedObject(rinfo->rmode()))((void) 0); | |||
| 145 | WriteUnalignedValue(rinfo->target_address_address(), tag); | |||
| 146 | #elif V8_TARGET_ARCH_ARM64 | |||
| 147 | Instruction* instr = reinterpret_cast<Instruction*>(rinfo->pc()); | |||
| 148 | if (instr->IsLdrLiteralX()) { | |||
| 149 | WriteUnalignedValue(rinfo->constant_pool_entry_address(), | |||
| 150 | static_cast<Address>(tag)); | |||
| 151 | } else { | |||
| 152 | DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch())((void) 0); | |||
| 153 | instr->SetBranchImmTarget( | |||
| 154 | reinterpret_cast<Instruction*>(rinfo->pc() + tag * kInstrSize)); | |||
| 155 | } | |||
| 156 | #else | |||
| 157 | Address addr = static_cast<Address>(tag); | |||
| 158 | if (rinfo->rmode() == RelocInfo::EXTERNAL_REFERENCE) { | |||
| 159 | rinfo->set_target_external_reference(addr, SKIP_ICACHE_FLUSH); | |||
| 160 | } else if (rinfo->rmode() == RelocInfo::WASM_STUB_CALL) { | |||
| 161 | rinfo->set_wasm_stub_call_address(addr, SKIP_ICACHE_FLUSH); | |||
| 162 | } else { | |||
| 163 | rinfo->set_target_address(addr, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); | |||
| 164 | } | |||
| 165 | #endif | |||
| 166 | } | |||
| 167 | ||||
| 168 | uint32_t GetWasmCalleeTag(RelocInfo* rinfo) { | |||
| 169 | #if V8_TARGET_ARCH_X641 || V8_TARGET_ARCH_IA32 | |||
| 170 | DCHECK(!RelocInfo::IsCompressedEmbeddedObject(rinfo->rmode()))((void) 0); | |||
| 171 | return ReadUnalignedValue<uint32_t>(rinfo->target_address_address()); | |||
| 172 | #elif V8_TARGET_ARCH_ARM64 | |||
| 173 | Instruction* instr = reinterpret_cast<Instruction*>(rinfo->pc()); | |||
| 174 | if (instr->IsLdrLiteralX()) { | |||
| 175 | return ReadUnalignedValue<uint32_t>(rinfo->constant_pool_entry_address()); | |||
| 176 | } else { | |||
| 177 | DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch())((void) 0); | |||
| 178 | return static_cast<uint32_t>(instr->ImmPCOffset() / kInstrSize); | |||
| 179 | } | |||
| 180 | #else | |||
| 181 | Address addr; | |||
| 182 | if (rinfo->rmode() == RelocInfo::EXTERNAL_REFERENCE) { | |||
| 183 | addr = rinfo->target_external_reference(); | |||
| 184 | } else if (rinfo->rmode() == RelocInfo::WASM_STUB_CALL) { | |||
| 185 | addr = rinfo->wasm_stub_call_address(); | |||
| 186 | } else { | |||
| 187 | addr = rinfo->target_address(); | |||
| 188 | } | |||
| 189 | return static_cast<uint32_t>(addr); | |||
| 190 | #endif | |||
| 191 | } | |||
| 192 | ||||
| 193 | constexpr size_t kHeaderSize = sizeof(size_t); // total code size | |||
| 194 | ||||
| 195 | constexpr size_t kCodeHeaderSize = sizeof(uint8_t) + // code kind | |||
| 196 | sizeof(int) + // offset of constant pool | |||
| 197 | sizeof(int) + // offset of safepoint table | |||
| 198 | sizeof(int) + // offset of handler table | |||
| 199 | sizeof(int) + // offset of code comments | |||
| 200 | sizeof(int) + // unpadded binary size | |||
| 201 | sizeof(int) + // stack slots | |||
| 202 | sizeof(int) + // tagged parameter slots | |||
| 203 | sizeof(int) + // code size | |||
| 204 | sizeof(int) + // reloc size | |||
| 205 | sizeof(int) + // source positions size | |||
| 206 | sizeof(int) + // protected instructions size | |||
| 207 | sizeof(WasmCode::Kind) + // code kind | |||
| 208 | sizeof(ExecutionTier); // tier | |||
| 209 | ||||
| 210 | // A List of all isolate-independent external references. This is used to create | |||
| 211 | // a tag from the Address of an external reference and vice versa. | |||
| 212 | class ExternalReferenceList { | |||
| 213 | public: | |||
| 214 | ExternalReferenceList(const ExternalReferenceList&) = delete; | |||
| 215 | ExternalReferenceList& operator=(const ExternalReferenceList&) = delete; | |||
| 216 | ||||
| 217 | uint32_t tag_from_address(Address ext_ref_address) const { | |||
| 218 | auto tag_addr_less_than = [this](uint32_t tag, Address searched_addr) { | |||
| 219 | return external_reference_by_tag_[tag] < searched_addr; | |||
| 220 | }; | |||
| 221 | auto it = std::lower_bound(std::begin(tags_ordered_by_address_), | |||
| 222 | std::end(tags_ordered_by_address_), | |||
| 223 | ext_ref_address, tag_addr_less_than); | |||
| 224 | DCHECK_NE(std::end(tags_ordered_by_address_), it)((void) 0); | |||
| 225 | uint32_t tag = *it; | |||
| 226 | DCHECK_EQ(address_from_tag(tag), ext_ref_address)((void) 0); | |||
| 227 | return tag; | |||
| 228 | } | |||
| 229 | ||||
| 230 | Address address_from_tag(uint32_t tag) const { | |||
| 231 | DCHECK_GT(kNumExternalReferences, tag)((void) 0); | |||
| 232 | return external_reference_by_tag_[tag]; | |||
| 233 | } | |||
| 234 | ||||
| 235 | static const ExternalReferenceList& Get() { | |||
| 236 | static ExternalReferenceList list; // Lazily initialized. | |||
| 237 | return list; | |||
| 238 | } | |||
| 239 | ||||
| 240 | private: | |||
| 241 | // Private constructor. There will only be a single instance of this object. | |||
| 242 | ExternalReferenceList() { | |||
| 243 | for (uint32_t i = 0; i < kNumExternalReferences; ++i) { | |||
| 244 | tags_ordered_by_address_[i] = i; | |||
| 245 | } | |||
| 246 | auto addr_by_tag_less_than = [this](uint32_t a, uint32_t b) { | |||
| 247 | return external_reference_by_tag_[a] < external_reference_by_tag_[b]; | |||
| 248 | }; | |||
| 249 | std::sort(std::begin(tags_ordered_by_address_), | |||
| 250 | std::end(tags_ordered_by_address_), addr_by_tag_less_than); | |||
| 251 | } | |||
| 252 | ||||
| 253 | #define COUNT_EXTERNAL_REFERENCE(name, ...) +1 | |||
| 254 | static constexpr uint32_t kNumExternalReferencesList = | |||
| 255 | EXTERNAL_REFERENCE_LIST(COUNT_EXTERNAL_REFERENCE)COUNT_EXTERNAL_REFERENCE(abort_with_reason, "abort_with_reason" ) COUNT_EXTERNAL_REFERENCE(address_of_builtin_subclassing_flag , "FLAG_builtin_subclassing") COUNT_EXTERNAL_REFERENCE(address_of_double_abs_constant , "double_absolute_constant") COUNT_EXTERNAL_REFERENCE(address_of_double_neg_constant , "double_negate_constant") COUNT_EXTERNAL_REFERENCE(address_of_enable_experimental_regexp_engine , "address_of_enable_experimental_regexp_engine") COUNT_EXTERNAL_REFERENCE (address_of_float_abs_constant, "float_absolute_constant") COUNT_EXTERNAL_REFERENCE (address_of_float_neg_constant, "float_negate_constant") COUNT_EXTERNAL_REFERENCE (address_of_min_int, "LDoubleConstant::min_int") COUNT_EXTERNAL_REFERENCE (address_of_mock_arraybuffer_allocator_flag, "FLAG_mock_arraybuffer_allocator" ) COUNT_EXTERNAL_REFERENCE(address_of_one_half, "LDoubleConstant::one_half" ) COUNT_EXTERNAL_REFERENCE(address_of_runtime_stats_flag, "TracingFlags::runtime_stats" ) COUNT_EXTERNAL_REFERENCE(address_of_shared_string_table_flag , "FLAG_shared_string_table") COUNT_EXTERNAL_REFERENCE(address_of_the_hole_nan , "the_hole_nan") COUNT_EXTERNAL_REFERENCE(address_of_uint32_bias , "uint32_bias") COUNT_EXTERNAL_REFERENCE(baseline_pc_for_bytecode_offset , "BaselinePCForBytecodeOffset") COUNT_EXTERNAL_REFERENCE(baseline_pc_for_next_executed_bytecode , "BaselinePCForNextExecutedBytecode") COUNT_EXTERNAL_REFERENCE (bytecode_size_table_address, "Bytecodes::bytecode_size_table_address" ) COUNT_EXTERNAL_REFERENCE(check_object_type, "check_object_type" ) COUNT_EXTERNAL_REFERENCE(compute_integer_hash, "ComputeSeededHash" ) COUNT_EXTERNAL_REFERENCE(compute_output_frames_function, "Deoptimizer::ComputeOutputFrames()" ) COUNT_EXTERNAL_REFERENCE(copy_fast_number_jsarray_elements_to_typed_array , "copy_fast_number_jsarray_elements_to_typed_array") COUNT_EXTERNAL_REFERENCE (copy_typed_array_elements_slice, "copy_typed_array_elements_slice" ) COUNT_EXTERNAL_REFERENCE(copy_typed_array_elements_to_typed_array , "copy_typed_array_elements_to_typed_array") COUNT_EXTERNAL_REFERENCE (cpu_features, "cpu_features") COUNT_EXTERNAL_REFERENCE(delete_handle_scope_extensions , "HandleScope::DeleteExtensions") COUNT_EXTERNAL_REFERENCE(ephemeron_key_write_barrier_function , "Heap::EphemeronKeyWriteBarrierFromCode") COUNT_EXTERNAL_REFERENCE (f64_acos_wrapper_function, "f64_acos_wrapper") COUNT_EXTERNAL_REFERENCE (f64_asin_wrapper_function, "f64_asin_wrapper") COUNT_EXTERNAL_REFERENCE (f64_mod_wrapper_function, "f64_mod_wrapper") COUNT_EXTERNAL_REFERENCE (get_date_field_function, "JSDate::GetField") COUNT_EXTERNAL_REFERENCE (get_or_create_hash_raw, "get_or_create_hash_raw") COUNT_EXTERNAL_REFERENCE (gsab_byte_length, "GsabByteLength") COUNT_EXTERNAL_REFERENCE (ieee754_acos_function, "base::ieee754::acos") COUNT_EXTERNAL_REFERENCE (ieee754_acosh_function, "base::ieee754::acosh") COUNT_EXTERNAL_REFERENCE (ieee754_asin_function, "base::ieee754::asin") COUNT_EXTERNAL_REFERENCE (ieee754_asinh_function, "base::ieee754::asinh") COUNT_EXTERNAL_REFERENCE (ieee754_atan_function, "base::ieee754::atan") COUNT_EXTERNAL_REFERENCE (ieee754_atan2_function, "base::ieee754::atan2") COUNT_EXTERNAL_REFERENCE (ieee754_atanh_function, "base::ieee754::atanh") COUNT_EXTERNAL_REFERENCE (ieee754_cbrt_function, "base::ieee754::cbrt") COUNT_EXTERNAL_REFERENCE (ieee754_cos_function, "base::ieee754::cos") COUNT_EXTERNAL_REFERENCE (ieee754_cosh_function, "base::ieee754::cosh") COUNT_EXTERNAL_REFERENCE (ieee754_exp_function, "base::ieee754::exp") COUNT_EXTERNAL_REFERENCE (ieee754_expm1_function, "base::ieee754::expm1") COUNT_EXTERNAL_REFERENCE (ieee754_log_function, "base::ieee754::log") COUNT_EXTERNAL_REFERENCE (ieee754_log10_function, "base::ieee754::log10") COUNT_EXTERNAL_REFERENCE (ieee754_log1p_function, "base::ieee754::log1p") COUNT_EXTERNAL_REFERENCE (ieee754_log2_function, "base::ieee754::log2") COUNT_EXTERNAL_REFERENCE (ieee754_pow_function, "base::ieee754::pow") COUNT_EXTERNAL_REFERENCE (ieee754_sin_function, "base::ieee754::sin") COUNT_EXTERNAL_REFERENCE (ieee754_sinh_function, "base::ieee754::sinh") COUNT_EXTERNAL_REFERENCE (ieee754_tan_function, "base::ieee754::tan") COUNT_EXTERNAL_REFERENCE (ieee754_tanh_function, "base::ieee754::tanh") COUNT_EXTERNAL_REFERENCE (insert_remembered_set_function, "Heap::InsertIntoRememberedSetFromCode" ) COUNT_EXTERNAL_REFERENCE(invalidate_prototype_chains_function , "JSObject::InvalidatePrototypeChains()") COUNT_EXTERNAL_REFERENCE (invoke_accessor_getter_callback, "InvokeAccessorGetterCallback" ) COUNT_EXTERNAL_REFERENCE(invoke_function_callback, "InvokeFunctionCallback" ) COUNT_EXTERNAL_REFERENCE(jsarray_array_join_concat_to_sequential_string , "jsarray_array_join_concat_to_sequential_string") COUNT_EXTERNAL_REFERENCE (jsreceiver_create_identity_hash, "jsreceiver_create_identity_hash" ) COUNT_EXTERNAL_REFERENCE(libc_memchr_function, "libc_memchr" ) COUNT_EXTERNAL_REFERENCE(libc_memcpy_function, "libc_memcpy" ) COUNT_EXTERNAL_REFERENCE(libc_memmove_function, "libc_memmove" ) COUNT_EXTERNAL_REFERENCE(libc_memset_function, "libc_memset" ) COUNT_EXTERNAL_REFERENCE(relaxed_memcpy_function, "relaxed_memcpy" ) COUNT_EXTERNAL_REFERENCE(relaxed_memmove_function, "relaxed_memmove" ) COUNT_EXTERNAL_REFERENCE(mod_two_doubles_operation, "mod_two_doubles" ) COUNT_EXTERNAL_REFERENCE(mutable_big_int_absolute_add_and_canonicalize_function , "MutableBigInt_AbsoluteAddAndCanonicalize") COUNT_EXTERNAL_REFERENCE (mutable_big_int_absolute_compare_function, "MutableBigInt_AbsoluteCompare" ) COUNT_EXTERNAL_REFERENCE(mutable_big_int_absolute_sub_and_canonicalize_function , "MutableBigInt_AbsoluteSubAndCanonicalize") COUNT_EXTERNAL_REFERENCE (new_deoptimizer_function, "Deoptimizer::New()") COUNT_EXTERNAL_REFERENCE (orderedhashmap_gethash_raw, "orderedhashmap_gethash_raw") COUNT_EXTERNAL_REFERENCE (printf_function, "printf") COUNT_EXTERNAL_REFERENCE(refill_math_random , "MathRandom::RefillCache") COUNT_EXTERNAL_REFERENCE(search_string_raw_one_one , "search_string_raw_one_one") COUNT_EXTERNAL_REFERENCE(search_string_raw_one_two , "search_string_raw_one_two") COUNT_EXTERNAL_REFERENCE(search_string_raw_two_one , "search_string_raw_two_one") COUNT_EXTERNAL_REFERENCE(search_string_raw_two_two , "search_string_raw_two_two") COUNT_EXTERNAL_REFERENCE(string_write_to_flat_one_byte , "string_write_to_flat_one_byte") COUNT_EXTERNAL_REFERENCE(string_write_to_flat_two_byte , "string_write_to_flat_two_byte") COUNT_EXTERNAL_REFERENCE(external_one_byte_string_get_chars , "external_one_byte_string_get_chars") COUNT_EXTERNAL_REFERENCE (external_two_byte_string_get_chars, "external_two_byte_string_get_chars" ) COUNT_EXTERNAL_REFERENCE(smi_lexicographic_compare_function , "smi_lexicographic_compare_function") COUNT_EXTERNAL_REFERENCE (string_to_array_index_function, "String::ToArrayIndex") COUNT_EXTERNAL_REFERENCE (try_string_to_index_or_lookup_existing, "try_string_to_index_or_lookup_existing" ) COUNT_EXTERNAL_REFERENCE(wasm_call_trap_callback_for_testing , "wasm::call_trap_callback_for_testing") COUNT_EXTERNAL_REFERENCE (wasm_f32_ceil, "wasm::f32_ceil_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32_floor, "wasm::f32_floor_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32_nearest_int, "wasm::f32_nearest_int_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32_trunc, "wasm::f32_trunc_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64_ceil, "wasm::f64_ceil_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64_floor, "wasm::f64_floor_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64_nearest_int, "wasm::f64_nearest_int_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64_trunc, "wasm::f64_trunc_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_float32_to_int64, "wasm::float32_to_int64_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_float32_to_uint64, "wasm::float32_to_uint64_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_float32_to_int64_sat, "wasm::float32_to_int64_sat_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_float32_to_uint64_sat, "wasm::float32_to_uint64_sat_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_float64_pow, "wasm::float64_pow" ) COUNT_EXTERNAL_REFERENCE(wasm_float64_to_int64, "wasm::float64_to_int64_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_float64_to_uint64, "wasm::float64_to_uint64_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_float64_to_int64_sat, "wasm::float64_to_int64_sat_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_float64_to_uint64_sat, "wasm::float64_to_uint64_sat_wrapper" ) COUNT_EXTERNAL_REFERENCE(wasm_int64_div, "wasm::int64_div") COUNT_EXTERNAL_REFERENCE(wasm_int64_mod, "wasm::int64_mod") COUNT_EXTERNAL_REFERENCE (wasm_int64_to_float32, "wasm::int64_to_float32_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_int64_to_float64, "wasm::int64_to_float64_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_uint64_div, "wasm::uint64_div") COUNT_EXTERNAL_REFERENCE (wasm_uint64_mod, "wasm::uint64_mod") COUNT_EXTERNAL_REFERENCE (wasm_uint64_to_float32, "wasm::uint64_to_float32_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_uint64_to_float64, "wasm::uint64_to_float64_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_word32_ctz, "wasm::word32_ctz") COUNT_EXTERNAL_REFERENCE (wasm_word32_popcnt, "wasm::word32_popcnt") COUNT_EXTERNAL_REFERENCE (wasm_word32_rol, "wasm::word32_rol") COUNT_EXTERNAL_REFERENCE (wasm_word32_ror, "wasm::word32_ror") COUNT_EXTERNAL_REFERENCE (wasm_word64_rol, "wasm::word64_rol") COUNT_EXTERNAL_REFERENCE (wasm_word64_ror, "wasm::word64_ror") COUNT_EXTERNAL_REFERENCE (wasm_word64_ctz, "wasm::word64_ctz") COUNT_EXTERNAL_REFERENCE (wasm_word64_popcnt, "wasm::word64_popcnt") COUNT_EXTERNAL_REFERENCE (wasm_f64x2_ceil, "wasm::f64x2_ceil_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64x2_floor, "wasm::f64x2_floor_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64x2_trunc, "wasm::f64x2_trunc_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f64x2_nearest_int, "wasm::f64x2_nearest_int_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32x4_ceil, "wasm::f32x4_ceil_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32x4_floor, "wasm::f32x4_floor_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32x4_trunc, "wasm::f32x4_trunc_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_f32x4_nearest_int, "wasm::f32x4_nearest_int_wrapper") COUNT_EXTERNAL_REFERENCE (wasm_memory_init, "wasm::memory_init") COUNT_EXTERNAL_REFERENCE (wasm_memory_copy, "wasm::memory_copy") COUNT_EXTERNAL_REFERENCE (wasm_memory_fill, "wasm::memory_fill") COUNT_EXTERNAL_REFERENCE (wasm_array_copy, "wasm::array_copy") COUNT_EXTERNAL_REFERENCE (address_of_wasm_i8x16_swizzle_mask, "wasm_i8x16_swizzle_mask" ) COUNT_EXTERNAL_REFERENCE(address_of_wasm_i8x16_popcnt_mask, "wasm_i8x16_popcnt_mask") COUNT_EXTERNAL_REFERENCE(address_of_wasm_i8x16_splat_0x01 , "wasm_i8x16_splat_0x01") COUNT_EXTERNAL_REFERENCE(address_of_wasm_i8x16_splat_0x0f , "wasm_i8x16_splat_0x0f") COUNT_EXTERNAL_REFERENCE(address_of_wasm_i8x16_splat_0x33 , "wasm_i8x16_splat_0x33") COUNT_EXTERNAL_REFERENCE(address_of_wasm_i8x16_splat_0x55 , "wasm_i8x16_splat_0x55") COUNT_EXTERNAL_REFERENCE(address_of_wasm_i16x8_splat_0x0001 , "wasm_16x8_splat_0x0001") COUNT_EXTERNAL_REFERENCE(address_of_wasm_f64x2_convert_low_i32x4_u_int_mask , "wasm_f64x2_convert_low_i32x4_u_int_mask") COUNT_EXTERNAL_REFERENCE (supports_wasm_simd_128_address, "wasm::supports_wasm_simd_128_address" ) COUNT_EXTERNAL_REFERENCE(address_of_wasm_double_2_power_52, "wasm_double_2_power_52") COUNT_EXTERNAL_REFERENCE(address_of_wasm_int32_max_as_double , "wasm_int32_max_as_double") COUNT_EXTERNAL_REFERENCE(address_of_wasm_uint32_max_as_double , "wasm_uint32_max_as_double") COUNT_EXTERNAL_REFERENCE(address_of_wasm_int32_overflow_as_float , "wasm_int32_overflow_as_float") COUNT_EXTERNAL_REFERENCE(supports_cetss_address , "CpuFeatures::supports_cetss_address") COUNT_EXTERNAL_REFERENCE (write_barrier_marking_from_code_function, "WriteBarrier::MarkingFromCode" ) COUNT_EXTERNAL_REFERENCE(call_enqueue_microtask_function, "MicrotaskQueue::CallEnqueueMicrotask" ) COUNT_EXTERNAL_REFERENCE(call_enter_context_function, "call_enter_context_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_load_function, "atomic_pair_load_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_store_function, "atomic_pair_store_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_add_function, "atomic_pair_add_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_sub_function, "atomic_pair_sub_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_and_function, "atomic_pair_and_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_or_function, "atomic_pair_or_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_xor_function, "atomic_pair_xor_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_exchange_function, "atomic_pair_exchange_function" ) COUNT_EXTERNAL_REFERENCE(atomic_pair_compare_exchange_function , "atomic_pair_compare_exchange_function") COUNT_EXTERNAL_REFERENCE (js_finalization_registry_remove_cell_from_unregister_token_map , "JSFinalizationRegistry::RemoveCellFromUnregisterTokenMap") COUNT_EXTERNAL_REFERENCE(re_case_insensitive_compare_unicode , "RegExpMacroAssembler::CaseInsensitiveCompareUnicode()") COUNT_EXTERNAL_REFERENCE (re_case_insensitive_compare_non_unicode, "RegExpMacroAssembler::CaseInsensitiveCompareNonUnicode()" ) COUNT_EXTERNAL_REFERENCE(re_is_character_in_range_array, "RegExpMacroAssembler::IsCharacterInRangeArray()" ) COUNT_EXTERNAL_REFERENCE(re_check_stack_guard_state, "RegExpMacroAssembler*::CheckStackGuardState()" ) COUNT_EXTERNAL_REFERENCE(re_grow_stack, "NativeRegExpMacroAssembler::GrowStack()" ) COUNT_EXTERNAL_REFERENCE(re_word_character_map, "NativeRegExpMacroAssembler::word_character_map" ) COUNT_EXTERNAL_REFERENCE(re_match_for_call_from_js, "IrregexpInterpreter::MatchForCallFromJs" ) COUNT_EXTERNAL_REFERENCE(re_experimental_match_for_call_from_js , "ExperimentalRegExp::MatchForCallFromJs") COUNT_EXTERNAL_REFERENCE (intl_convert_one_byte_to_lower, "intl_convert_one_byte_to_lower" ) COUNT_EXTERNAL_REFERENCE(intl_to_latin1_lower_table, "intl_to_latin1_lower_table" ) COUNT_EXTERNAL_REFERENCE(intl_ascii_collation_weights_l1, "Intl::AsciiCollationWeightsL1" ) COUNT_EXTERNAL_REFERENCE(intl_ascii_collation_weights_l3, "Intl::AsciiCollationWeightsL3" ); | |||
| 256 | static constexpr uint32_t kNumExternalReferencesIntrinsics = | |||
| 257 | FOR_EACH_INTRINSIC(COUNT_EXTERNAL_REFERENCE)COUNT_EXTERNAL_REFERENCE(DebugBreakOnBytecode, 1, 2) COUNT_EXTERNAL_REFERENCE (LoadLookupSlotForCall, 1, 2) COUNT_EXTERNAL_REFERENCE(ArrayIncludes_Slow , 3, 1) COUNT_EXTERNAL_REFERENCE(ArrayIndexOf, 3, 1) COUNT_EXTERNAL_REFERENCE (ArrayIsArray, 1, 1) COUNT_EXTERNAL_REFERENCE(ArraySpeciesConstructor , 1, 1) COUNT_EXTERNAL_REFERENCE(GrowArrayElements, 2, 1) COUNT_EXTERNAL_REFERENCE (IsArray, 1, 1) COUNT_EXTERNAL_REFERENCE(NewArray, -1 , 1) COUNT_EXTERNAL_REFERENCE (NormalizeElements, 1, 1) COUNT_EXTERNAL_REFERENCE(TransitionElementsKind , 2, 1) COUNT_EXTERNAL_REFERENCE(TransitionElementsKindWithKind , 2, 1) COUNT_EXTERNAL_REFERENCE(AtomicsLoad64, 2, 1) COUNT_EXTERNAL_REFERENCE (AtomicsStore64, 3, 1) COUNT_EXTERNAL_REFERENCE(AtomicsAdd, 3 , 1) COUNT_EXTERNAL_REFERENCE(AtomicsAnd, 3, 1) COUNT_EXTERNAL_REFERENCE (AtomicsCompareExchange, 4, 1) COUNT_EXTERNAL_REFERENCE(AtomicsExchange , 3, 1) COUNT_EXTERNAL_REFERENCE(AtomicsNumWaitersForTesting, 2, 1) COUNT_EXTERNAL_REFERENCE(AtomicsNumAsyncWaitersForTesting , 0, 1) COUNT_EXTERNAL_REFERENCE(AtomicsNumUnresolvedAsyncPromisesForTesting , 2, 1) COUNT_EXTERNAL_REFERENCE(AtomicsOr, 3, 1) COUNT_EXTERNAL_REFERENCE (AtomicsSub, 3, 1) COUNT_EXTERNAL_REFERENCE(AtomicsXor, 3, 1) COUNT_EXTERNAL_REFERENCE(SetAllowAtomicsWait, 1, 1) COUNT_EXTERNAL_REFERENCE (AtomicsLoadSharedStructField, 2, 1) COUNT_EXTERNAL_REFERENCE (AtomicsStoreSharedStructField, 3, 1) COUNT_EXTERNAL_REFERENCE (AtomicsExchangeSharedStructField, 3, 1) COUNT_EXTERNAL_REFERENCE (BigIntBinaryOp, 3, 1) COUNT_EXTERNAL_REFERENCE(BigIntCompareToBigInt , 3, 1) COUNT_EXTERNAL_REFERENCE(BigIntCompareToNumber, 3, 1) COUNT_EXTERNAL_REFERENCE(BigIntCompareToString, 3, 1) COUNT_EXTERNAL_REFERENCE (BigIntEqualToBigInt, 2, 1) COUNT_EXTERNAL_REFERENCE(BigIntEqualToNumber , 2, 1) COUNT_EXTERNAL_REFERENCE(BigIntEqualToString, 2, 1) COUNT_EXTERNAL_REFERENCE (BigIntMaxLengthBits, 0, 1) COUNT_EXTERNAL_REFERENCE(BigIntToBoolean , 1, 1) COUNT_EXTERNAL_REFERENCE(BigIntToNumber, 1, 1) COUNT_EXTERNAL_REFERENCE (BigIntUnaryOp, 2, 1) COUNT_EXTERNAL_REFERENCE(ToBigInt, 1, 1 ) COUNT_EXTERNAL_REFERENCE(DefineClass, -1 , 1) COUNT_EXTERNAL_REFERENCE (LoadFromSuper, 3, 1) COUNT_EXTERNAL_REFERENCE(LoadKeyedFromSuper , 3, 1) COUNT_EXTERNAL_REFERENCE(StoreKeyedToSuper, 4, 1) COUNT_EXTERNAL_REFERENCE (StoreToSuper, 4, 1) COUNT_EXTERNAL_REFERENCE(ThrowConstructorNonCallableError , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowNotSuperConstructor, 2, 1) COUNT_EXTERNAL_REFERENCE(ThrowStaticPrototypeError, 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowSuperAlreadyCalledError, 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowSuperNotCalled, 0, 1) COUNT_EXTERNAL_REFERENCE (ThrowUnsupportedSuperError, 0, 1) COUNT_EXTERNAL_REFERENCE(MapGrow , 1, 1) COUNT_EXTERNAL_REFERENCE(MapShrink, 1, 1) COUNT_EXTERNAL_REFERENCE (SetGrow, 1, 1) COUNT_EXTERNAL_REFERENCE(SetShrink, 1, 1) COUNT_EXTERNAL_REFERENCE (TheHole, 0, 1) COUNT_EXTERNAL_REFERENCE(WeakCollectionDelete , 3, 1) COUNT_EXTERNAL_REFERENCE(WeakCollectionSet, 4, 1) COUNT_EXTERNAL_REFERENCE (CompileOptimizedOSR, 0, 1) COUNT_EXTERNAL_REFERENCE(CompileLazy , 1, 1) COUNT_EXTERNAL_REFERENCE(CompileBaseline, 1, 1) COUNT_EXTERNAL_REFERENCE (CompileMaglev_Concurrent, 1, 1) COUNT_EXTERNAL_REFERENCE(CompileMaglev_Synchronous , 1, 1) COUNT_EXTERNAL_REFERENCE(CompileTurbofan_Concurrent, 1 , 1) COUNT_EXTERNAL_REFERENCE(CompileTurbofan_Synchronous, 1, 1) COUNT_EXTERNAL_REFERENCE(InstallBaselineCode, 1, 1) COUNT_EXTERNAL_REFERENCE (HealOptimizedCodeSlot, 1, 1) COUNT_EXTERNAL_REFERENCE(InstantiateAsmJs , 4, 1) COUNT_EXTERNAL_REFERENCE(NotifyDeoptimized, 0, 1) COUNT_EXTERNAL_REFERENCE (ObserveNode, 1, 1) COUNT_EXTERNAL_REFERENCE(ResolvePossiblyDirectEval , 6, 1) COUNT_EXTERNAL_REFERENCE(VerifyType, 1, 1) COUNT_EXTERNAL_REFERENCE (DateCurrentTime, 0, 1) COUNT_EXTERNAL_REFERENCE(ClearStepping , 0, 1) COUNT_EXTERNAL_REFERENCE(CollectGarbage, 1, 1) COUNT_EXTERNAL_REFERENCE (DebugAsyncFunctionSuspended, 4, 1) COUNT_EXTERNAL_REFERENCE( DebugBreakAtEntry, 1, 1) COUNT_EXTERNAL_REFERENCE(DebugCollectCoverage , 0, 1) COUNT_EXTERNAL_REFERENCE(DebugGetLoadedScriptIds, 0, 1 ) COUNT_EXTERNAL_REFERENCE(DebugOnFunctionCall, 2, 1) COUNT_EXTERNAL_REFERENCE (DebugPopPromise, 0, 1) COUNT_EXTERNAL_REFERENCE(DebugPrepareStepInSuspendedGenerator , 0, 1) COUNT_EXTERNAL_REFERENCE(DebugPromiseThen, 1, 1) COUNT_EXTERNAL_REFERENCE (DebugPushPromise, 1, 1) COUNT_EXTERNAL_REFERENCE(DebugToggleBlockCoverage , 1, 1) COUNT_EXTERNAL_REFERENCE(DebugTogglePreciseCoverage, 1 , 1) COUNT_EXTERNAL_REFERENCE(FunctionGetInferredName, 1, 1) COUNT_EXTERNAL_REFERENCE (GetBreakLocations, 1, 1) COUNT_EXTERNAL_REFERENCE(GetGeneratorScopeCount , 1, 1) COUNT_EXTERNAL_REFERENCE(GetGeneratorScopeDetails, 2, 1) COUNT_EXTERNAL_REFERENCE(HandleDebuggerStatement, 0, 1) COUNT_EXTERNAL_REFERENCE (IsBreakOnException, 1, 1) COUNT_EXTERNAL_REFERENCE(LiveEditPatchScript , 2, 1) COUNT_EXTERNAL_REFERENCE(ProfileCreateSnapshotDataBlob , 0, 1) COUNT_EXTERNAL_REFERENCE(ScheduleBreak, 0, 1) COUNT_EXTERNAL_REFERENCE (ScriptLocationFromLine2, 4, 1) COUNT_EXTERNAL_REFERENCE(SetGeneratorScopeVariableValue , 4, 1) COUNT_EXTERNAL_REFERENCE(IncBlockCounter, 2, 1) COUNT_EXTERNAL_REFERENCE (ForInEnumerate, 1, 1) COUNT_EXTERNAL_REFERENCE(ForInHasProperty , 2, 1) COUNT_EXTERNAL_REFERENCE(Call, -1 , 1) COUNT_EXTERNAL_REFERENCE (FunctionGetScriptSource, 1, 1) COUNT_EXTERNAL_REFERENCE(FunctionGetScriptId , 1, 1) COUNT_EXTERNAL_REFERENCE(FunctionGetScriptSourcePosition , 1, 1) COUNT_EXTERNAL_REFERENCE(FunctionGetSourceCode, 1, 1) COUNT_EXTERNAL_REFERENCE(FunctionIsAPIFunction, 1, 1) COUNT_EXTERNAL_REFERENCE (IsFunction, 1, 1) COUNT_EXTERNAL_REFERENCE(AsyncFunctionAwaitCaught , 2, 1) COUNT_EXTERNAL_REFERENCE(AsyncFunctionAwaitUncaught, 2 , 1) COUNT_EXTERNAL_REFERENCE(AsyncFunctionEnter, 2, 1) COUNT_EXTERNAL_REFERENCE (AsyncFunctionReject, 2, 1) COUNT_EXTERNAL_REFERENCE(AsyncFunctionResolve , 2, 1) COUNT_EXTERNAL_REFERENCE(AsyncGeneratorAwaitCaught, 2 , 1) COUNT_EXTERNAL_REFERENCE(AsyncGeneratorAwaitUncaught, 2, 1) COUNT_EXTERNAL_REFERENCE(AsyncGeneratorHasCatchHandlerForPC , 1, 1) COUNT_EXTERNAL_REFERENCE(AsyncGeneratorReject, 2, 1) COUNT_EXTERNAL_REFERENCE (AsyncGeneratorResolve, 3, 1) COUNT_EXTERNAL_REFERENCE(AsyncGeneratorYield , 3, 1) COUNT_EXTERNAL_REFERENCE(CreateJSGeneratorObject, 2, 1 ) COUNT_EXTERNAL_REFERENCE(GeneratorClose, 1, 1) COUNT_EXTERNAL_REFERENCE (GeneratorGetFunction, 1, 1) COUNT_EXTERNAL_REFERENCE(GeneratorGetResumeMode , 1, 1) COUNT_EXTERNAL_REFERENCE(ElementsTransitionAndStoreIC_Miss , 6, 1) COUNT_EXTERNAL_REFERENCE(KeyedLoadIC_Miss, 4, 1) COUNT_EXTERNAL_REFERENCE (KeyedStoreIC_Miss, 5, 1) COUNT_EXTERNAL_REFERENCE(DefineKeyedOwnIC_Miss , 5, 1) COUNT_EXTERNAL_REFERENCE(StoreInArrayLiteralIC_Miss, 5 , 1) COUNT_EXTERNAL_REFERENCE(DefineNamedOwnIC_Slow, 3, 1) COUNT_EXTERNAL_REFERENCE (KeyedStoreIC_Slow, 3, 1) COUNT_EXTERNAL_REFERENCE(DefineKeyedOwnIC_Slow , 3, 1) COUNT_EXTERNAL_REFERENCE(LoadElementWithInterceptor, 2 , 1) COUNT_EXTERNAL_REFERENCE(LoadGlobalIC_Miss, 4, 1) COUNT_EXTERNAL_REFERENCE (LoadGlobalIC_Slow, 3, 1) COUNT_EXTERNAL_REFERENCE(LoadIC_Miss , 4, 1) COUNT_EXTERNAL_REFERENCE(LoadNoFeedbackIC_Miss, 4, 1) COUNT_EXTERNAL_REFERENCE(LoadWithReceiverIC_Miss, 5, 1) COUNT_EXTERNAL_REFERENCE (LoadWithReceiverNoFeedbackIC_Miss, 3, 1) COUNT_EXTERNAL_REFERENCE (LoadPropertyWithInterceptor, 5, 1) COUNT_EXTERNAL_REFERENCE( StoreCallbackProperty, 5, 1) COUNT_EXTERNAL_REFERENCE(StoreGlobalIC_Miss , 4, 1) COUNT_EXTERNAL_REFERENCE(StoreGlobalICNoFeedback_Miss , 2, 1) COUNT_EXTERNAL_REFERENCE(StoreGlobalIC_Slow, 5, 1) COUNT_EXTERNAL_REFERENCE (StoreIC_Miss, 5, 1) COUNT_EXTERNAL_REFERENCE(DefineNamedOwnIC_Miss , 5, 1) COUNT_EXTERNAL_REFERENCE(StoreInArrayLiteralIC_Slow, 5 , 1) COUNT_EXTERNAL_REFERENCE(StorePropertyWithInterceptor, 5 , 1) COUNT_EXTERNAL_REFERENCE(CloneObjectIC_Miss, 4, 1) COUNT_EXTERNAL_REFERENCE (KeyedHasIC_Miss, 4, 1) COUNT_EXTERNAL_REFERENCE(HasElementWithInterceptor , 2, 1) COUNT_EXTERNAL_REFERENCE(AccessCheck, 1, 1) COUNT_EXTERNAL_REFERENCE (AllocateByteArray, 1, 1) COUNT_EXTERNAL_REFERENCE(AllocateInYoungGeneration , 2, 1) COUNT_EXTERNAL_REFERENCE(AllocateInOldGeneration, 2, 1 ) COUNT_EXTERNAL_REFERENCE(AllocateSeqOneByteString, 1, 1) COUNT_EXTERNAL_REFERENCE (AllocateSeqTwoByteString, 1, 1) COUNT_EXTERNAL_REFERENCE(AllowDynamicFunction , 1, 1) COUNT_EXTERNAL_REFERENCE(CreateAsyncFromSyncIterator, 1, 1) COUNT_EXTERNAL_REFERENCE(CreateListFromArrayLike, 1, 1 ) COUNT_EXTERNAL_REFERENCE(DoubleToStringWithRadix, 2, 1) COUNT_EXTERNAL_REFERENCE (FatalProcessOutOfMemoryInAllocateRaw, 0, 1) COUNT_EXTERNAL_REFERENCE (FatalProcessOutOfMemoryInvalidArrayLength, 0, 1) COUNT_EXTERNAL_REFERENCE (GetAndResetRuntimeCallStats, -1 , 1) COUNT_EXTERNAL_REFERENCE (GetTemplateObject, 3, 1) COUNT_EXTERNAL_REFERENCE(IncrementUseCounter , 1, 1) COUNT_EXTERNAL_REFERENCE(BytecodeBudgetInterrupt, 1, 1 ) COUNT_EXTERNAL_REFERENCE(BytecodeBudgetInterruptWithStackCheck , 1, 1) COUNT_EXTERNAL_REFERENCE(NewError, 2, 1) COUNT_EXTERNAL_REFERENCE (NewForeign, 0, 1) COUNT_EXTERNAL_REFERENCE(NewReferenceError , 2, 1) COUNT_EXTERNAL_REFERENCE(NewSyntaxError, 2, 1) COUNT_EXTERNAL_REFERENCE (NewTypeError, -1 , 1) COUNT_EXTERNAL_REFERENCE(OrdinaryHasInstance , 2, 1) COUNT_EXTERNAL_REFERENCE(PromoteScheduledException, 0 , 1) COUNT_EXTERNAL_REFERENCE(ReportMessageFromMicrotask, 1, 1 ) COUNT_EXTERNAL_REFERENCE(ReThrow, 1, 1) COUNT_EXTERNAL_REFERENCE (ReThrowWithMessage, 2, 1) COUNT_EXTERNAL_REFERENCE(RunMicrotaskCallback , 2, 1) COUNT_EXTERNAL_REFERENCE(PerformMicrotaskCheckpoint, 0 , 1) COUNT_EXTERNAL_REFERENCE(SharedValueBarrierSlow, 1, 1) COUNT_EXTERNAL_REFERENCE (StackGuard, 0, 1) COUNT_EXTERNAL_REFERENCE(StackGuardWithGap , 1, 1) COUNT_EXTERNAL_REFERENCE(Throw, 1, 1) COUNT_EXTERNAL_REFERENCE (ThrowApplyNonFunction, 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowCalledNonCallable , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowConstructedNonConstructable , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowConstructorReturnedNonObject , 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowInvalidStringLength, 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowInvalidTypedArrayAlignment, 2, 1) COUNT_EXTERNAL_REFERENCE(ThrowIteratorError, 1, 1) COUNT_EXTERNAL_REFERENCE (ThrowSpreadArgError, 2, 1) COUNT_EXTERNAL_REFERENCE(ThrowIteratorResultNotAnObject , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowNoAccess, 0, 1) COUNT_EXTERNAL_REFERENCE (ThrowNotConstructor, 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowPatternAssignmentNonCoercible , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowRangeError, -1 , 1) COUNT_EXTERNAL_REFERENCE (ThrowReferenceError, 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowAccessedUninitializedVariable , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowStackOverflow, 0, 1) COUNT_EXTERNAL_REFERENCE (ThrowSymbolAsyncIteratorInvalid, 0, 1) COUNT_EXTERNAL_REFERENCE (ThrowSymbolIteratorInvalid, 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowThrowMethodMissing , 0, 1) COUNT_EXTERNAL_REFERENCE(ThrowTypeError, -1 , 1) COUNT_EXTERNAL_REFERENCE (ThrowTypeErrorIfStrict, -1 , 1) COUNT_EXTERNAL_REFERENCE(Typeof , 1, 1) COUNT_EXTERNAL_REFERENCE(UnwindAndFindExceptionHandler , 0, 1) COUNT_EXTERNAL_REFERENCE(FormatList, 2, 1) COUNT_EXTERNAL_REFERENCE (FormatListToParts, 2, 1) COUNT_EXTERNAL_REFERENCE(StringToLowerCaseIntl , 1, 1) COUNT_EXTERNAL_REFERENCE(StringToUpperCaseIntl, 1, 1) COUNT_EXTERNAL_REFERENCE(CreateArrayLiteral, 4, 1) COUNT_EXTERNAL_REFERENCE (CreateArrayLiteralWithoutAllocationSite, 2, 1) COUNT_EXTERNAL_REFERENCE (CreateObjectLiteral, 4, 1) COUNT_EXTERNAL_REFERENCE(CreateObjectLiteralWithoutAllocationSite , 2, 1) COUNT_EXTERNAL_REFERENCE(CreateRegExpLiteral, 4, 1) COUNT_EXTERNAL_REFERENCE (DynamicImportCall, -1 , 1) COUNT_EXTERNAL_REFERENCE(GetImportMetaObject , 0, 1) COUNT_EXTERNAL_REFERENCE(GetModuleNamespace, 1, 1) COUNT_EXTERNAL_REFERENCE (ArrayBufferMaxByteLength, 0, 1) COUNT_EXTERNAL_REFERENCE(GetHoleNaNLower , 0, 1) COUNT_EXTERNAL_REFERENCE(GetHoleNaNUpper, 0, 1) COUNT_EXTERNAL_REFERENCE (IsSmi, 1, 1) COUNT_EXTERNAL_REFERENCE(MaxSmi, 0, 1) COUNT_EXTERNAL_REFERENCE (NumberToStringSlow, 1, 1) COUNT_EXTERNAL_REFERENCE(StringParseFloat , 1, 1) COUNT_EXTERNAL_REFERENCE(StringParseInt, 2, 1) COUNT_EXTERNAL_REFERENCE (StringToNumber, 1, 1) COUNT_EXTERNAL_REFERENCE(TypedArrayMaxLength , 0, 1) COUNT_EXTERNAL_REFERENCE(AddDictionaryProperty, 3, 1) COUNT_EXTERNAL_REFERENCE(AddPrivateBrand, 4, 1) COUNT_EXTERNAL_REFERENCE (AllocateHeapNumber, 0, 1) COUNT_EXTERNAL_REFERENCE(CollectTypeProfile , 3, 1) COUNT_EXTERNAL_REFERENCE(CompleteInobjectSlackTrackingForMap , 1, 1) COUNT_EXTERNAL_REFERENCE(CopyDataProperties, 2, 1) COUNT_EXTERNAL_REFERENCE (CopyDataPropertiesWithExcludedPropertiesOnStack, -1 , 1) COUNT_EXTERNAL_REFERENCE (CreateDataProperty, 3, 1) COUNT_EXTERNAL_REFERENCE(CreateIterResultObject , 2, 1) COUNT_EXTERNAL_REFERENCE(CreatePrivateAccessors, 2, 1 ) COUNT_EXTERNAL_REFERENCE(DefineAccessorPropertyUnchecked, 5 , 1) COUNT_EXTERNAL_REFERENCE(DefineKeyedOwnPropertyInLiteral , 6, 1) COUNT_EXTERNAL_REFERENCE(DefineGetterPropertyUnchecked , 4, 1) COUNT_EXTERNAL_REFERENCE(DefineSetterPropertyUnchecked , 4, 1) COUNT_EXTERNAL_REFERENCE(DeleteProperty, 3, 1) COUNT_EXTERNAL_REFERENCE (GetDerivedMap, 2, 1) COUNT_EXTERNAL_REFERENCE(GetFunctionName , 1, 1) COUNT_EXTERNAL_REFERENCE(GetOwnPropertyDescriptor, 2, 1) COUNT_EXTERNAL_REFERENCE(GetOwnPropertyKeys, 2, 1) COUNT_EXTERNAL_REFERENCE (GetProperty, -1 , 1) COUNT_EXTERNAL_REFERENCE(HasFastPackedElements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasInPrototypeChain, 2, 1) COUNT_EXTERNAL_REFERENCE (HasProperty, 2, 1) COUNT_EXTERNAL_REFERENCE(InternalSetPrototype , 2, 1) COUNT_EXTERNAL_REFERENCE(IsJSReceiver, 1, 1) COUNT_EXTERNAL_REFERENCE (JSReceiverPreventExtensionsDontThrow, 1, 1) COUNT_EXTERNAL_REFERENCE (JSReceiverPreventExtensionsThrow, 1, 1) COUNT_EXTERNAL_REFERENCE (JSReceiverGetPrototypeOf, 1, 1) COUNT_EXTERNAL_REFERENCE(JSReceiverSetPrototypeOfDontThrow , 2, 1) COUNT_EXTERNAL_REFERENCE(JSReceiverSetPrototypeOfThrow , 2, 1) COUNT_EXTERNAL_REFERENCE(LoadPrivateGetter, 1, 1) COUNT_EXTERNAL_REFERENCE (LoadPrivateSetter, 1, 1) COUNT_EXTERNAL_REFERENCE(NewObject, 2, 1) COUNT_EXTERNAL_REFERENCE(ObjectCreate, 2, 1) COUNT_EXTERNAL_REFERENCE (ObjectEntries, 1, 1) COUNT_EXTERNAL_REFERENCE(ObjectEntriesSkipFastPath , 1, 1) COUNT_EXTERNAL_REFERENCE(ObjectGetOwnPropertyNames, 1 , 1) COUNT_EXTERNAL_REFERENCE(ObjectGetOwnPropertyNamesTryFast , 1, 1) COUNT_EXTERNAL_REFERENCE(ObjectHasOwnProperty, 2, 1) COUNT_EXTERNAL_REFERENCE (ObjectIsExtensible, 1, 1) COUNT_EXTERNAL_REFERENCE(ObjectKeys , 1, 1) COUNT_EXTERNAL_REFERENCE(ObjectValues, 1, 1) COUNT_EXTERNAL_REFERENCE (ObjectValuesSkipFastPath, 1, 1) COUNT_EXTERNAL_REFERENCE(OptimizeObjectForAddingMultipleProperties , 2, 1) COUNT_EXTERNAL_REFERENCE(SetDataProperties, 2, 1) COUNT_EXTERNAL_REFERENCE (SetKeyedProperty, 3, 1) COUNT_EXTERNAL_REFERENCE(DefineObjectOwnProperty , 3, 1) COUNT_EXTERNAL_REFERENCE(SetNamedProperty, 3, 1) COUNT_EXTERNAL_REFERENCE (SetOwnPropertyIgnoreAttributes, 4, 1) COUNT_EXTERNAL_REFERENCE (DefineKeyedOwnPropertyInLiteral_Simple, 3, 1) COUNT_EXTERNAL_REFERENCE (ShrinkNameDictionary, 1, 1) COUNT_EXTERNAL_REFERENCE(ShrinkSwissNameDictionary , 1, 1) COUNT_EXTERNAL_REFERENCE(ToFastProperties, 1, 1) COUNT_EXTERNAL_REFERENCE (ToLength, 1, 1) COUNT_EXTERNAL_REFERENCE(ToName, 1, 1) COUNT_EXTERNAL_REFERENCE (ToNumber, 1, 1) COUNT_EXTERNAL_REFERENCE(ToNumeric, 1, 1) COUNT_EXTERNAL_REFERENCE (ToObject, 1, 1) COUNT_EXTERNAL_REFERENCE(ToString, 1, 1) COUNT_EXTERNAL_REFERENCE (TryMigrateInstance, 1, 1) COUNT_EXTERNAL_REFERENCE(SwissTableAdd , 4, 1) COUNT_EXTERNAL_REFERENCE(SwissTableAllocate, 1, 1) COUNT_EXTERNAL_REFERENCE (SwissTableDelete, 2, 1) COUNT_EXTERNAL_REFERENCE(SwissTableDetailsAt , 2, 1) COUNT_EXTERNAL_REFERENCE(SwissTableElementsCount, 1, 1 ) COUNT_EXTERNAL_REFERENCE(SwissTableEquals, 2, 1) COUNT_EXTERNAL_REFERENCE (SwissTableFindEntry, 2, 1) COUNT_EXTERNAL_REFERENCE(SwissTableUpdate , 4, 1) COUNT_EXTERNAL_REFERENCE(SwissTableValueAt, 2, 1) COUNT_EXTERNAL_REFERENCE (SwissTableKeyAt, 2, 1) COUNT_EXTERNAL_REFERENCE(Add, 2, 1) COUNT_EXTERNAL_REFERENCE (Equal, 2, 1) COUNT_EXTERNAL_REFERENCE(GreaterThan, 2, 1) COUNT_EXTERNAL_REFERENCE (GreaterThanOrEqual, 2, 1) COUNT_EXTERNAL_REFERENCE(LessThan, 2, 1) COUNT_EXTERNAL_REFERENCE(LessThanOrEqual, 2, 1) COUNT_EXTERNAL_REFERENCE (NotEqual, 2, 1) COUNT_EXTERNAL_REFERENCE(StrictEqual, 2, 1) COUNT_EXTERNAL_REFERENCE (StrictNotEqual, 2, 1) COUNT_EXTERNAL_REFERENCE(ReferenceEqual , 2, 1) COUNT_EXTERNAL_REFERENCE(EnqueueMicrotask, 1, 1) COUNT_EXTERNAL_REFERENCE (PromiseHookAfter, 1, 1) COUNT_EXTERNAL_REFERENCE(PromiseHookBefore , 1, 1) COUNT_EXTERNAL_REFERENCE(PromiseHookInit, 2, 1) COUNT_EXTERNAL_REFERENCE (PromiseRejectEventFromStack, 2, 1) COUNT_EXTERNAL_REFERENCE( PromiseRevokeReject, 1, 1) COUNT_EXTERNAL_REFERENCE(PromiseStatus , 1, 1) COUNT_EXTERNAL_REFERENCE(RejectPromise, 3, 1) COUNT_EXTERNAL_REFERENCE (ResolvePromise, 2, 1) COUNT_EXTERNAL_REFERENCE(PromiseRejectAfterResolved , 2, 1) COUNT_EXTERNAL_REFERENCE(PromiseResolveAfterResolved, 2, 1) COUNT_EXTERNAL_REFERENCE(ConstructAggregateErrorHelper , 4, 1) COUNT_EXTERNAL_REFERENCE(ConstructInternalAggregateErrorHelper , -1 , 1) COUNT_EXTERNAL_REFERENCE(CheckProxyGetSetTrapResult , 2, 1) COUNT_EXTERNAL_REFERENCE(CheckProxyHasTrapResult, 2, 1 ) COUNT_EXTERNAL_REFERENCE(CheckProxyDeleteTrapResult, 2, 1) COUNT_EXTERNAL_REFERENCE (GetPropertyWithReceiver, 3, 1) COUNT_EXTERNAL_REFERENCE(IsJSProxy , 1, 1) COUNT_EXTERNAL_REFERENCE(JSProxyGetHandler, 1, 1) COUNT_EXTERNAL_REFERENCE (JSProxyGetTarget, 1, 1) COUNT_EXTERNAL_REFERENCE(SetPropertyWithReceiver , 4, 1) COUNT_EXTERNAL_REFERENCE(IsRegExp, 1, 1) COUNT_EXTERNAL_REFERENCE (RegExpBuildIndices, 3, 1) COUNT_EXTERNAL_REFERENCE(RegExpExec , 4, 1) COUNT_EXTERNAL_REFERENCE(RegExpExecTreatMatchAtEndAsFailure , 4, 1) COUNT_EXTERNAL_REFERENCE(RegExpExperimentalOneshotExec , 4, 1) COUNT_EXTERNAL_REFERENCE(RegExpExperimentalOneshotExecTreatMatchAtEndAsFailure , 4, 1) COUNT_EXTERNAL_REFERENCE(RegExpExecMultiple, 4, 1) COUNT_EXTERNAL_REFERENCE (RegExpInitializeAndCompile, 3, 1) COUNT_EXTERNAL_REFERENCE(RegExpReplaceRT , 3, 1) COUNT_EXTERNAL_REFERENCE(RegExpSplit, 3, 1) COUNT_EXTERNAL_REFERENCE (RegExpStringFromFlags, 1, 1) COUNT_EXTERNAL_REFERENCE(StringReplaceNonGlobalRegExpWithFunction , 3, 1) COUNT_EXTERNAL_REFERENCE(StringSplit, 3, 1) COUNT_EXTERNAL_REFERENCE (DeclareEvalFunction, 2, 1) COUNT_EXTERNAL_REFERENCE(DeclareEvalVar , 1, 1) COUNT_EXTERNAL_REFERENCE(DeclareGlobals, 2, 1) COUNT_EXTERNAL_REFERENCE (DeclareModuleExports, 2, 1) COUNT_EXTERNAL_REFERENCE(DeleteLookupSlot , 1, 1) COUNT_EXTERNAL_REFERENCE(LoadLookupSlot, 1, 1) COUNT_EXTERNAL_REFERENCE (LoadLookupSlotInsideTypeof, 1, 1) COUNT_EXTERNAL_REFERENCE(NewClosure , 2, 1) COUNT_EXTERNAL_REFERENCE(NewClosure_Tenured, 2, 1) COUNT_EXTERNAL_REFERENCE (NewFunctionContext, 1, 1) COUNT_EXTERNAL_REFERENCE(NewRestParameter , 1, 1) COUNT_EXTERNAL_REFERENCE(NewSloppyArguments, 1, 1) COUNT_EXTERNAL_REFERENCE (NewStrictArguments, 1, 1) COUNT_EXTERNAL_REFERENCE(PushBlockContext , 1, 1) COUNT_EXTERNAL_REFERENCE(PushCatchContext, 2, 1) COUNT_EXTERNAL_REFERENCE (PushWithContext, 2, 1) COUNT_EXTERNAL_REFERENCE(StoreGlobalNoHoleCheckForReplLetOrConst , 2, 1) COUNT_EXTERNAL_REFERENCE(StoreLookupSlot_Sloppy, 2, 1 ) COUNT_EXTERNAL_REFERENCE(StoreLookupSlot_SloppyHoisting, 2, 1) COUNT_EXTERNAL_REFERENCE(StoreLookupSlot_Strict, 2, 1) COUNT_EXTERNAL_REFERENCE (ThrowConstAssignError, 0, 1) COUNT_EXTERNAL_REFERENCE(ShadowRealmWrappedFunctionCreate , 2, 1) COUNT_EXTERNAL_REFERENCE(FlattenString, 1, 1) COUNT_EXTERNAL_REFERENCE (GetSubstitution, 5, 1) COUNT_EXTERNAL_REFERENCE(InternalizeString , 1, 1) COUNT_EXTERNAL_REFERENCE(StringAdd, 2, 1) COUNT_EXTERNAL_REFERENCE (StringBuilderConcat, 3, 1) COUNT_EXTERNAL_REFERENCE(StringCharCodeAt , 2, 1) COUNT_EXTERNAL_REFERENCE(StringEqual, 2, 1) COUNT_EXTERNAL_REFERENCE (StringEscapeQuotes, 1, 1) COUNT_EXTERNAL_REFERENCE(StringGreaterThan , 2, 1) COUNT_EXTERNAL_REFERENCE(StringGreaterThanOrEqual, 2, 1) COUNT_EXTERNAL_REFERENCE(StringLastIndexOf, 2, 1) COUNT_EXTERNAL_REFERENCE (StringLessThan, 2, 1) COUNT_EXTERNAL_REFERENCE(StringLessThanOrEqual , 2, 1) COUNT_EXTERNAL_REFERENCE(StringMaxLength, 0, 1) COUNT_EXTERNAL_REFERENCE (StringReplaceOneCharWithString, 3, 1) COUNT_EXTERNAL_REFERENCE (StringSubstring, 3, 1) COUNT_EXTERNAL_REFERENCE(StringToArray , 2, 1) COUNT_EXTERNAL_REFERENCE(CreatePrivateNameSymbol, 1, 1 ) COUNT_EXTERNAL_REFERENCE(CreatePrivateBrandSymbol, 1, 1) COUNT_EXTERNAL_REFERENCE (CreatePrivateSymbol, -1 , 1) COUNT_EXTERNAL_REFERENCE(SymbolDescriptiveString , 1, 1) COUNT_EXTERNAL_REFERENCE(SymbolIsPrivate, 1, 1) COUNT_EXTERNAL_REFERENCE (Abort, 1, 1) COUNT_EXTERNAL_REFERENCE(AbortCSADcheck, 1, 1) COUNT_EXTERNAL_REFERENCE (AbortJS, 1, 1) COUNT_EXTERNAL_REFERENCE(ActiveTierIsMaglev, 1 , 1) COUNT_EXTERNAL_REFERENCE(ArrayIteratorProtector, 0, 1) COUNT_EXTERNAL_REFERENCE (ArraySpeciesProtector, 0, 1) COUNT_EXTERNAL_REFERENCE(BaselineOsr , -1, 1) COUNT_EXTERNAL_REFERENCE(BenchMaglev, 2, 1) COUNT_EXTERNAL_REFERENCE (ClearFunctionFeedback, 1, 1) COUNT_EXTERNAL_REFERENCE(ClearMegamorphicStubCache , 0, 1) COUNT_EXTERNAL_REFERENCE(CompleteInobjectSlackTracking , 1, 1) COUNT_EXTERNAL_REFERENCE(ConstructConsString, 2, 1) COUNT_EXTERNAL_REFERENCE (ConstructDouble, 2, 1) COUNT_EXTERNAL_REFERENCE(ConstructSlicedString , 2, 1) COUNT_EXTERNAL_REFERENCE(DebugPrint, 1, 1) COUNT_EXTERNAL_REFERENCE (DebugPrintPtr, 1, 1) COUNT_EXTERNAL_REFERENCE(DebugTrace, 0, 1) COUNT_EXTERNAL_REFERENCE(DebugTrackRetainingPath, -1, 1) COUNT_EXTERNAL_REFERENCE (DeoptimizeFunction, 1, 1) COUNT_EXTERNAL_REFERENCE(DisableOptimizationFinalization , 0, 1) COUNT_EXTERNAL_REFERENCE(DisallowCodegenFromStrings, 1 , 1) COUNT_EXTERNAL_REFERENCE(DisassembleFunction, 1, 1) COUNT_EXTERNAL_REFERENCE (EnableCodeLoggingForTesting, 0, 1) COUNT_EXTERNAL_REFERENCE( EnsureFeedbackVectorForFunction, 1, 1) COUNT_EXTERNAL_REFERENCE (FinalizeOptimization, 0, 1) COUNT_EXTERNAL_REFERENCE(GetCallable , 0, 1) COUNT_EXTERNAL_REFERENCE(GetInitializerFunction, 1, 1 ) COUNT_EXTERNAL_REFERENCE(GetOptimizationStatus, 1, 1) COUNT_EXTERNAL_REFERENCE (GetUndetectable, 0, 1) COUNT_EXTERNAL_REFERENCE(GlobalPrint, 1, 1) COUNT_EXTERNAL_REFERENCE(HasDictionaryElements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasDoubleElements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasElementsInALargeObjectSpace , 1, 1) COUNT_EXTERNAL_REFERENCE(HasFastElements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasFastProperties, 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedBigInt64Elements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedBigUint64Elements, 1 , 1) COUNT_EXTERNAL_REFERENCE(HasFixedFloat32Elements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasFixedFloat64Elements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedInt16Elements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedInt32Elements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedInt8Elements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasFixedUint16Elements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedUint32Elements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedUint8ClampedElements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasFixedUint8Elements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasHoleyElements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasObjectElements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasOwnConstDataProperty , 2, 1) COUNT_EXTERNAL_REFERENCE(HasPackedElements, 1, 1) COUNT_EXTERNAL_REFERENCE (HasSloppyArgumentsElements, 1, 1) COUNT_EXTERNAL_REFERENCE(HasSmiElements , 1, 1) COUNT_EXTERNAL_REFERENCE(HasSmiOrObjectElements, 1, 1 ) COUNT_EXTERNAL_REFERENCE(HaveSameMap, 2, 1) COUNT_EXTERNAL_REFERENCE (HeapObjectVerify, 1, 1) COUNT_EXTERNAL_REFERENCE(ICsAreEnabled , 0, 1) COUNT_EXTERNAL_REFERENCE(InLargeObjectSpace, 1, 1) COUNT_EXTERNAL_REFERENCE (InYoungGeneration, 1, 1) COUNT_EXTERNAL_REFERENCE(Is64Bit, 0 , 1) COUNT_EXTERNAL_REFERENCE(IsAtomicsWaitAllowed, 0, 1) COUNT_EXTERNAL_REFERENCE (IsBeingInterpreted, 0, 1) COUNT_EXTERNAL_REFERENCE(IsConcatSpreadableProtector , 0, 1) COUNT_EXTERNAL_REFERENCE(IsConcurrentRecompilationSupported , 0, 1) COUNT_EXTERNAL_REFERENCE(IsDictPropertyConstTrackingEnabled , 0, 1) COUNT_EXTERNAL_REFERENCE(IsSameHeapObject, 2, 1) COUNT_EXTERNAL_REFERENCE (IsSharedString, 1, 1) COUNT_EXTERNAL_REFERENCE(MapIteratorProtector , 0, 1) COUNT_EXTERNAL_REFERENCE(NeverOptimizeFunction, 1, 1) COUNT_EXTERNAL_REFERENCE(NewRegExpWithBacktrackLimit, 3, 1) COUNT_EXTERNAL_REFERENCE (NotifyContextDisposed, 0, 1) COUNT_EXTERNAL_REFERENCE(OptimizeMaglevOnNextCall , 1, 1) COUNT_EXTERNAL_REFERENCE(OptimizeFunctionOnNextCall, - 1, 1) COUNT_EXTERNAL_REFERENCE(OptimizeOsr, -1, 1) COUNT_EXTERNAL_REFERENCE (PrepareFunctionForOptimization, -1, 1) COUNT_EXTERNAL_REFERENCE (PretenureAllocationSite, 1, 1) COUNT_EXTERNAL_REFERENCE(PrintWithNameForAssert , 2, 1) COUNT_EXTERNAL_REFERENCE(PromiseSpeciesProtector, 0, 1 ) COUNT_EXTERNAL_REFERENCE(RegExpSpeciesProtector, 0, 1) COUNT_EXTERNAL_REFERENCE (RegexpHasBytecode, 2, 1) COUNT_EXTERNAL_REFERENCE(RegexpHasNativeCode , 2, 1) COUNT_EXTERNAL_REFERENCE(RegexpIsUnmodified, 1, 1) COUNT_EXTERNAL_REFERENCE (RegexpTypeTag, 1, 1) COUNT_EXTERNAL_REFERENCE(RunningInSimulator , 0, 1) COUNT_EXTERNAL_REFERENCE(RuntimeEvaluateREPL, 1, 1) COUNT_EXTERNAL_REFERENCE (ScheduleGCInStackCheck, 0, 1) COUNT_EXTERNAL_REFERENCE(SerializeDeserializeNow , 0, 1) COUNT_EXTERNAL_REFERENCE(SetAllocationTimeout, -1 , 1 ) COUNT_EXTERNAL_REFERENCE(SetForceSlowPath, 1, 1) COUNT_EXTERNAL_REFERENCE (SetIteratorProtector, 0, 1) COUNT_EXTERNAL_REFERENCE(SharedGC , 0, 1) COUNT_EXTERNAL_REFERENCE(SimulateNewspaceFull, 0, 1) COUNT_EXTERNAL_REFERENCE (StringIteratorProtector, 0, 1) COUNT_EXTERNAL_REFERENCE(SystemBreak , 0, 1) COUNT_EXTERNAL_REFERENCE(TakeHeapSnapshot, -1, 1) COUNT_EXTERNAL_REFERENCE (TraceEnter, 0, 1) COUNT_EXTERNAL_REFERENCE(TraceExit, 1, 1) COUNT_EXTERNAL_REFERENCE (TurbofanStaticAssert, 1, 1) COUNT_EXTERNAL_REFERENCE(TypedArraySpeciesProtector , 0, 1) COUNT_EXTERNAL_REFERENCE(WaitForBackgroundOptimization , 0, 1) COUNT_EXTERNAL_REFERENCE(WebSnapshotDeserialize, -1, 1 ) COUNT_EXTERNAL_REFERENCE(WebSnapshotSerialize, -1, 1) COUNT_EXTERNAL_REFERENCE (DeoptimizeNow, 0, 1) COUNT_EXTERNAL_REFERENCE(ArrayBufferDetach , 1, 1) COUNT_EXTERNAL_REFERENCE(GrowableSharedArrayBufferByteLength , 1, 1) COUNT_EXTERNAL_REFERENCE(TypedArrayCopyElements, 3, 1 ) COUNT_EXTERNAL_REFERENCE(TypedArrayGetBuffer, 1, 1) COUNT_EXTERNAL_REFERENCE (TypedArraySet, 2, 1) COUNT_EXTERNAL_REFERENCE(TypedArraySortFast , 1, 1) COUNT_EXTERNAL_REFERENCE(ThrowWasmError, 1, 1) COUNT_EXTERNAL_REFERENCE (ThrowWasmStackOverflow, 0, 1) COUNT_EXTERNAL_REFERENCE(WasmI32AtomicWait , 4, 1) COUNT_EXTERNAL_REFERENCE(WasmI64AtomicWait, 5, 1) COUNT_EXTERNAL_REFERENCE (WasmAtomicNotify, 3, 1) COUNT_EXTERNAL_REFERENCE(WasmMemoryGrow , 2, 1) COUNT_EXTERNAL_REFERENCE(WasmStackGuard, 0, 1) COUNT_EXTERNAL_REFERENCE (WasmThrow, 2, 1) COUNT_EXTERNAL_REFERENCE(WasmReThrow, 1, 1) COUNT_EXTERNAL_REFERENCE(WasmThrowJSTypeError, 0, 1) COUNT_EXTERNAL_REFERENCE (WasmRefFunc, 1, 1) COUNT_EXTERNAL_REFERENCE(WasmFunctionTableGet , 3, 1) COUNT_EXTERNAL_REFERENCE(WasmFunctionTableSet, 4, 1) COUNT_EXTERNAL_REFERENCE (WasmTableInit, 6, 1) COUNT_EXTERNAL_REFERENCE(WasmTableCopy, 6, 1) COUNT_EXTERNAL_REFERENCE(WasmTableGrow, 3, 1) COUNT_EXTERNAL_REFERENCE (WasmTableFill, 5, 1) COUNT_EXTERNAL_REFERENCE(WasmIsValidRefValue , 3, 1) COUNT_EXTERNAL_REFERENCE(WasmCompileLazy, 2, 1) COUNT_EXTERNAL_REFERENCE (WasmCompileWrapper, 2, 1) COUNT_EXTERNAL_REFERENCE(WasmTriggerTierUp , 1, 1) COUNT_EXTERNAL_REFERENCE(WasmDebugBreak, 0, 1) COUNT_EXTERNAL_REFERENCE (WasmArrayCopy, 5, 1) COUNT_EXTERNAL_REFERENCE(WasmArrayInitFromData , 5, 1) COUNT_EXTERNAL_REFERENCE(WasmAllocateContinuation, 1, 1) COUNT_EXTERNAL_REFERENCE(WasmSyncStackLimit, 0, 1) COUNT_EXTERNAL_REFERENCE (WasmCreateResumePromise, 2, 1) COUNT_EXTERNAL_REFERENCE(DeserializeWasmModule , 2, 1) COUNT_EXTERNAL_REFERENCE(DisallowWasmCodegen, 1, 1) COUNT_EXTERNAL_REFERENCE (FreezeWasmLazyCompilation, 1, 1) COUNT_EXTERNAL_REFERENCE(GetWasmExceptionTagId , 2, 1) COUNT_EXTERNAL_REFERENCE(GetWasmExceptionValues, 1, 1 ) COUNT_EXTERNAL_REFERENCE(GetWasmRecoveredTrapCount, 0, 1) COUNT_EXTERNAL_REFERENCE (IsAsmWasmCode, 1, 1) COUNT_EXTERNAL_REFERENCE(IsLiftoffFunction , 1, 1) COUNT_EXTERNAL_REFERENCE(IsTurboFanFunction, 1, 1) COUNT_EXTERNAL_REFERENCE (IsThreadInWasm, 0, 1) COUNT_EXTERNAL_REFERENCE(IsWasmCode, 1 , 1) COUNT_EXTERNAL_REFERENCE(IsWasmTrapHandlerEnabled, 0, 1) COUNT_EXTERNAL_REFERENCE(SerializeWasmModule, 1, 1) COUNT_EXTERNAL_REFERENCE (SetWasmCompileControls, 2, 1) COUNT_EXTERNAL_REFERENCE(SetWasmInstantiateControls , 0, 1) COUNT_EXTERNAL_REFERENCE(WasmGetNumberOfInstances, 1, 1) COUNT_EXTERNAL_REFERENCE(WasmNumCodeSpaces, 1, 1) COUNT_EXTERNAL_REFERENCE (WasmTierDown, 0, 1) COUNT_EXTERNAL_REFERENCE(WasmTierUp, 0, 1 ) COUNT_EXTERNAL_REFERENCE(WasmTierUpFunction, 2, 1) COUNT_EXTERNAL_REFERENCE (WasmTraceEnter, 0, 1) COUNT_EXTERNAL_REFERENCE(WasmTraceExit , 1, 1) COUNT_EXTERNAL_REFERENCE(WasmTraceMemory, 1, 1) COUNT_EXTERNAL_REFERENCE (JSFinalizationRegistryRegisterWeakCellWithUnregisterToken, 4 , 1) COUNT_EXTERNAL_REFERENCE(JSWeakRefAddToKeptObjects, 1, 1 ) COUNT_EXTERNAL_REFERENCE(ShrinkFinalizationRegistryUnregisterTokenMap , 1, 1); | |||
| 258 | static constexpr uint32_t kNumExternalReferences = | |||
| 259 | kNumExternalReferencesList + kNumExternalReferencesIntrinsics; | |||
| 260 | #undef COUNT_EXTERNAL_REFERENCE | |||
| 261 | ||||
| 262 | Address external_reference_by_tag_[kNumExternalReferences] = { | |||
| 263 | #define EXT_REF_ADDR(name, desc) ExternalReference::name().address(), | |||
| 264 | EXTERNAL_REFERENCE_LIST(EXT_REF_ADDR)EXT_REF_ADDR(abort_with_reason, "abort_with_reason") EXT_REF_ADDR (address_of_builtin_subclassing_flag, "FLAG_builtin_subclassing" ) EXT_REF_ADDR(address_of_double_abs_constant, "double_absolute_constant" ) EXT_REF_ADDR(address_of_double_neg_constant, "double_negate_constant" ) EXT_REF_ADDR(address_of_enable_experimental_regexp_engine, "address_of_enable_experimental_regexp_engine" ) EXT_REF_ADDR(address_of_float_abs_constant, "float_absolute_constant" ) EXT_REF_ADDR(address_of_float_neg_constant, "float_negate_constant" ) EXT_REF_ADDR(address_of_min_int, "LDoubleConstant::min_int" ) EXT_REF_ADDR(address_of_mock_arraybuffer_allocator_flag, "FLAG_mock_arraybuffer_allocator" ) EXT_REF_ADDR(address_of_one_half, "LDoubleConstant::one_half" ) EXT_REF_ADDR(address_of_runtime_stats_flag, "TracingFlags::runtime_stats" ) EXT_REF_ADDR(address_of_shared_string_table_flag, "FLAG_shared_string_table" ) EXT_REF_ADDR(address_of_the_hole_nan, "the_hole_nan") EXT_REF_ADDR (address_of_uint32_bias, "uint32_bias") EXT_REF_ADDR(baseline_pc_for_bytecode_offset , "BaselinePCForBytecodeOffset") EXT_REF_ADDR(baseline_pc_for_next_executed_bytecode , "BaselinePCForNextExecutedBytecode") EXT_REF_ADDR(bytecode_size_table_address , "Bytecodes::bytecode_size_table_address") EXT_REF_ADDR(check_object_type , "check_object_type") EXT_REF_ADDR(compute_integer_hash, "ComputeSeededHash" ) EXT_REF_ADDR(compute_output_frames_function, "Deoptimizer::ComputeOutputFrames()" ) EXT_REF_ADDR(copy_fast_number_jsarray_elements_to_typed_array , "copy_fast_number_jsarray_elements_to_typed_array") EXT_REF_ADDR (copy_typed_array_elements_slice, "copy_typed_array_elements_slice" ) EXT_REF_ADDR(copy_typed_array_elements_to_typed_array, "copy_typed_array_elements_to_typed_array" ) EXT_REF_ADDR(cpu_features, "cpu_features") EXT_REF_ADDR(delete_handle_scope_extensions , "HandleScope::DeleteExtensions") EXT_REF_ADDR(ephemeron_key_write_barrier_function , "Heap::EphemeronKeyWriteBarrierFromCode") EXT_REF_ADDR(f64_acos_wrapper_function , "f64_acos_wrapper") EXT_REF_ADDR(f64_asin_wrapper_function, "f64_asin_wrapper") EXT_REF_ADDR(f64_mod_wrapper_function, "f64_mod_wrapper" ) EXT_REF_ADDR(get_date_field_function, "JSDate::GetField") EXT_REF_ADDR (get_or_create_hash_raw, "get_or_create_hash_raw") EXT_REF_ADDR (gsab_byte_length, "GsabByteLength") EXT_REF_ADDR(ieee754_acos_function , "base::ieee754::acos") EXT_REF_ADDR(ieee754_acosh_function, "base::ieee754::acosh") EXT_REF_ADDR(ieee754_asin_function, "base::ieee754::asin" ) EXT_REF_ADDR(ieee754_asinh_function, "base::ieee754::asinh" ) EXT_REF_ADDR(ieee754_atan_function, "base::ieee754::atan") EXT_REF_ADDR (ieee754_atan2_function, "base::ieee754::atan2") EXT_REF_ADDR (ieee754_atanh_function, "base::ieee754::atanh") EXT_REF_ADDR (ieee754_cbrt_function, "base::ieee754::cbrt") EXT_REF_ADDR(ieee754_cos_function , "base::ieee754::cos") EXT_REF_ADDR(ieee754_cosh_function, "base::ieee754::cosh" ) EXT_REF_ADDR(ieee754_exp_function, "base::ieee754::exp") EXT_REF_ADDR (ieee754_expm1_function, "base::ieee754::expm1") EXT_REF_ADDR (ieee754_log_function, "base::ieee754::log") EXT_REF_ADDR(ieee754_log10_function , "base::ieee754::log10") EXT_REF_ADDR(ieee754_log1p_function , "base::ieee754::log1p") EXT_REF_ADDR(ieee754_log2_function, "base::ieee754::log2") EXT_REF_ADDR(ieee754_pow_function, "base::ieee754::pow" ) EXT_REF_ADDR(ieee754_sin_function, "base::ieee754::sin") EXT_REF_ADDR (ieee754_sinh_function, "base::ieee754::sinh") EXT_REF_ADDR(ieee754_tan_function , "base::ieee754::tan") EXT_REF_ADDR(ieee754_tanh_function, "base::ieee754::tanh" ) EXT_REF_ADDR(insert_remembered_set_function, "Heap::InsertIntoRememberedSetFromCode" ) EXT_REF_ADDR(invalidate_prototype_chains_function, "JSObject::InvalidatePrototypeChains()" ) EXT_REF_ADDR(invoke_accessor_getter_callback, "InvokeAccessorGetterCallback" ) EXT_REF_ADDR(invoke_function_callback, "InvokeFunctionCallback" ) EXT_REF_ADDR(jsarray_array_join_concat_to_sequential_string , "jsarray_array_join_concat_to_sequential_string") EXT_REF_ADDR (jsreceiver_create_identity_hash, "jsreceiver_create_identity_hash" ) EXT_REF_ADDR(libc_memchr_function, "libc_memchr") EXT_REF_ADDR (libc_memcpy_function, "libc_memcpy") EXT_REF_ADDR(libc_memmove_function , "libc_memmove") EXT_REF_ADDR(libc_memset_function, "libc_memset" ) EXT_REF_ADDR(relaxed_memcpy_function, "relaxed_memcpy") EXT_REF_ADDR (relaxed_memmove_function, "relaxed_memmove") EXT_REF_ADDR(mod_two_doubles_operation , "mod_two_doubles") EXT_REF_ADDR(mutable_big_int_absolute_add_and_canonicalize_function , "MutableBigInt_AbsoluteAddAndCanonicalize") EXT_REF_ADDR(mutable_big_int_absolute_compare_function , "MutableBigInt_AbsoluteCompare") EXT_REF_ADDR(mutable_big_int_absolute_sub_and_canonicalize_function , "MutableBigInt_AbsoluteSubAndCanonicalize") EXT_REF_ADDR(new_deoptimizer_function , "Deoptimizer::New()") EXT_REF_ADDR(orderedhashmap_gethash_raw , "orderedhashmap_gethash_raw") EXT_REF_ADDR(printf_function, "printf") EXT_REF_ADDR(refill_math_random, "MathRandom::RefillCache" ) EXT_REF_ADDR(search_string_raw_one_one, "search_string_raw_one_one" ) EXT_REF_ADDR(search_string_raw_one_two, "search_string_raw_one_two" ) EXT_REF_ADDR(search_string_raw_two_one, "search_string_raw_two_one" ) EXT_REF_ADDR(search_string_raw_two_two, "search_string_raw_two_two" ) EXT_REF_ADDR(string_write_to_flat_one_byte, "string_write_to_flat_one_byte" ) EXT_REF_ADDR(string_write_to_flat_two_byte, "string_write_to_flat_two_byte" ) EXT_REF_ADDR(external_one_byte_string_get_chars, "external_one_byte_string_get_chars" ) EXT_REF_ADDR(external_two_byte_string_get_chars, "external_two_byte_string_get_chars" ) EXT_REF_ADDR(smi_lexicographic_compare_function, "smi_lexicographic_compare_function" ) EXT_REF_ADDR(string_to_array_index_function, "String::ToArrayIndex" ) EXT_REF_ADDR(try_string_to_index_or_lookup_existing, "try_string_to_index_or_lookup_existing" ) EXT_REF_ADDR(wasm_call_trap_callback_for_testing, "wasm::call_trap_callback_for_testing" ) EXT_REF_ADDR(wasm_f32_ceil, "wasm::f32_ceil_wrapper") EXT_REF_ADDR (wasm_f32_floor, "wasm::f32_floor_wrapper") EXT_REF_ADDR(wasm_f32_nearest_int , "wasm::f32_nearest_int_wrapper") EXT_REF_ADDR(wasm_f32_trunc , "wasm::f32_trunc_wrapper") EXT_REF_ADDR(wasm_f64_ceil, "wasm::f64_ceil_wrapper" ) EXT_REF_ADDR(wasm_f64_floor, "wasm::f64_floor_wrapper") EXT_REF_ADDR (wasm_f64_nearest_int, "wasm::f64_nearest_int_wrapper") EXT_REF_ADDR (wasm_f64_trunc, "wasm::f64_trunc_wrapper") EXT_REF_ADDR(wasm_float32_to_int64 , "wasm::float32_to_int64_wrapper") EXT_REF_ADDR(wasm_float32_to_uint64 , "wasm::float32_to_uint64_wrapper") EXT_REF_ADDR(wasm_float32_to_int64_sat , "wasm::float32_to_int64_sat_wrapper") EXT_REF_ADDR(wasm_float32_to_uint64_sat , "wasm::float32_to_uint64_sat_wrapper") EXT_REF_ADDR(wasm_float64_pow , "wasm::float64_pow") EXT_REF_ADDR(wasm_float64_to_int64, "wasm::float64_to_int64_wrapper" ) EXT_REF_ADDR(wasm_float64_to_uint64, "wasm::float64_to_uint64_wrapper" ) EXT_REF_ADDR(wasm_float64_to_int64_sat, "wasm::float64_to_int64_sat_wrapper" ) EXT_REF_ADDR(wasm_float64_to_uint64_sat, "wasm::float64_to_uint64_sat_wrapper" ) EXT_REF_ADDR(wasm_int64_div, "wasm::int64_div") EXT_REF_ADDR (wasm_int64_mod, "wasm::int64_mod") EXT_REF_ADDR(wasm_int64_to_float32 , "wasm::int64_to_float32_wrapper") EXT_REF_ADDR(wasm_int64_to_float64 , "wasm::int64_to_float64_wrapper") EXT_REF_ADDR(wasm_uint64_div , "wasm::uint64_div") EXT_REF_ADDR(wasm_uint64_mod, "wasm::uint64_mod" ) EXT_REF_ADDR(wasm_uint64_to_float32, "wasm::uint64_to_float32_wrapper" ) EXT_REF_ADDR(wasm_uint64_to_float64, "wasm::uint64_to_float64_wrapper" ) EXT_REF_ADDR(wasm_word32_ctz, "wasm::word32_ctz") EXT_REF_ADDR (wasm_word32_popcnt, "wasm::word32_popcnt") EXT_REF_ADDR(wasm_word32_rol , "wasm::word32_rol") EXT_REF_ADDR(wasm_word32_ror, "wasm::word32_ror" ) EXT_REF_ADDR(wasm_word64_rol, "wasm::word64_rol") EXT_REF_ADDR (wasm_word64_ror, "wasm::word64_ror") EXT_REF_ADDR(wasm_word64_ctz , "wasm::word64_ctz") EXT_REF_ADDR(wasm_word64_popcnt, "wasm::word64_popcnt" ) EXT_REF_ADDR(wasm_f64x2_ceil, "wasm::f64x2_ceil_wrapper") EXT_REF_ADDR (wasm_f64x2_floor, "wasm::f64x2_floor_wrapper") EXT_REF_ADDR( wasm_f64x2_trunc, "wasm::f64x2_trunc_wrapper") EXT_REF_ADDR(wasm_f64x2_nearest_int , "wasm::f64x2_nearest_int_wrapper") EXT_REF_ADDR(wasm_f32x4_ceil , "wasm::f32x4_ceil_wrapper") EXT_REF_ADDR(wasm_f32x4_floor, "wasm::f32x4_floor_wrapper" ) EXT_REF_ADDR(wasm_f32x4_trunc, "wasm::f32x4_trunc_wrapper") EXT_REF_ADDR(wasm_f32x4_nearest_int, "wasm::f32x4_nearest_int_wrapper" ) EXT_REF_ADDR(wasm_memory_init, "wasm::memory_init") EXT_REF_ADDR (wasm_memory_copy, "wasm::memory_copy") EXT_REF_ADDR(wasm_memory_fill , "wasm::memory_fill") EXT_REF_ADDR(wasm_array_copy, "wasm::array_copy" ) EXT_REF_ADDR(address_of_wasm_i8x16_swizzle_mask, "wasm_i8x16_swizzle_mask" ) EXT_REF_ADDR(address_of_wasm_i8x16_popcnt_mask, "wasm_i8x16_popcnt_mask" ) EXT_REF_ADDR(address_of_wasm_i8x16_splat_0x01, "wasm_i8x16_splat_0x01" ) EXT_REF_ADDR(address_of_wasm_i8x16_splat_0x0f, "wasm_i8x16_splat_0x0f" ) EXT_REF_ADDR(address_of_wasm_i8x16_splat_0x33, "wasm_i8x16_splat_0x33" ) EXT_REF_ADDR(address_of_wasm_i8x16_splat_0x55, "wasm_i8x16_splat_0x55" ) EXT_REF_ADDR(address_of_wasm_i16x8_splat_0x0001, "wasm_16x8_splat_0x0001" ) EXT_REF_ADDR(address_of_wasm_f64x2_convert_low_i32x4_u_int_mask , "wasm_f64x2_convert_low_i32x4_u_int_mask") EXT_REF_ADDR(supports_wasm_simd_128_address , "wasm::supports_wasm_simd_128_address") EXT_REF_ADDR(address_of_wasm_double_2_power_52 , "wasm_double_2_power_52") EXT_REF_ADDR(address_of_wasm_int32_max_as_double , "wasm_int32_max_as_double") EXT_REF_ADDR(address_of_wasm_uint32_max_as_double , "wasm_uint32_max_as_double") EXT_REF_ADDR(address_of_wasm_int32_overflow_as_float , "wasm_int32_overflow_as_float") EXT_REF_ADDR(supports_cetss_address , "CpuFeatures::supports_cetss_address") EXT_REF_ADDR(write_barrier_marking_from_code_function , "WriteBarrier::MarkingFromCode") EXT_REF_ADDR(call_enqueue_microtask_function , "MicrotaskQueue::CallEnqueueMicrotask") EXT_REF_ADDR(call_enter_context_function , "call_enter_context_function") EXT_REF_ADDR(atomic_pair_load_function , "atomic_pair_load_function") EXT_REF_ADDR(atomic_pair_store_function , "atomic_pair_store_function") EXT_REF_ADDR(atomic_pair_add_function , "atomic_pair_add_function") EXT_REF_ADDR(atomic_pair_sub_function , "atomic_pair_sub_function") EXT_REF_ADDR(atomic_pair_and_function , "atomic_pair_and_function") EXT_REF_ADDR(atomic_pair_or_function , "atomic_pair_or_function") EXT_REF_ADDR(atomic_pair_xor_function , "atomic_pair_xor_function") EXT_REF_ADDR(atomic_pair_exchange_function , "atomic_pair_exchange_function") EXT_REF_ADDR(atomic_pair_compare_exchange_function , "atomic_pair_compare_exchange_function") EXT_REF_ADDR(js_finalization_registry_remove_cell_from_unregister_token_map , "JSFinalizationRegistry::RemoveCellFromUnregisterTokenMap") EXT_REF_ADDR(re_case_insensitive_compare_unicode, "RegExpMacroAssembler::CaseInsensitiveCompareUnicode()" ) EXT_REF_ADDR(re_case_insensitive_compare_non_unicode, "RegExpMacroAssembler::CaseInsensitiveCompareNonUnicode()" ) EXT_REF_ADDR(re_is_character_in_range_array, "RegExpMacroAssembler::IsCharacterInRangeArray()" ) EXT_REF_ADDR(re_check_stack_guard_state, "RegExpMacroAssembler*::CheckStackGuardState()" ) EXT_REF_ADDR(re_grow_stack, "NativeRegExpMacroAssembler::GrowStack()" ) EXT_REF_ADDR(re_word_character_map, "NativeRegExpMacroAssembler::word_character_map" ) EXT_REF_ADDR(re_match_for_call_from_js, "IrregexpInterpreter::MatchForCallFromJs" ) EXT_REF_ADDR(re_experimental_match_for_call_from_js, "ExperimentalRegExp::MatchForCallFromJs" ) EXT_REF_ADDR(intl_convert_one_byte_to_lower, "intl_convert_one_byte_to_lower" ) EXT_REF_ADDR(intl_to_latin1_lower_table, "intl_to_latin1_lower_table" ) EXT_REF_ADDR(intl_ascii_collation_weights_l1, "Intl::AsciiCollationWeightsL1" ) EXT_REF_ADDR(intl_ascii_collation_weights_l3, "Intl::AsciiCollationWeightsL3" ) | |||
| 265 | #undef EXT_REF_ADDR | |||
| 266 | #define RUNTIME_ADDR(name, ...) \ | |||
| 267 | ExternalReference::Create(Runtime::k##name).address(), | |||
| 268 | FOR_EACH_INTRINSIC(RUNTIME_ADDR)RUNTIME_ADDR(DebugBreakOnBytecode, 1, 2) RUNTIME_ADDR(LoadLookupSlotForCall , 1, 2) RUNTIME_ADDR(ArrayIncludes_Slow, 3, 1) RUNTIME_ADDR(ArrayIndexOf , 3, 1) RUNTIME_ADDR(ArrayIsArray, 1, 1) RUNTIME_ADDR(ArraySpeciesConstructor , 1, 1) RUNTIME_ADDR(GrowArrayElements, 2, 1) RUNTIME_ADDR(IsArray , 1, 1) RUNTIME_ADDR(NewArray, -1 , 1) RUNTIME_ADDR(NormalizeElements , 1, 1) RUNTIME_ADDR(TransitionElementsKind, 2, 1) RUNTIME_ADDR (TransitionElementsKindWithKind, 2, 1) RUNTIME_ADDR(AtomicsLoad64 , 2, 1) RUNTIME_ADDR(AtomicsStore64, 3, 1) RUNTIME_ADDR(AtomicsAdd , 3, 1) RUNTIME_ADDR(AtomicsAnd, 3, 1) RUNTIME_ADDR(AtomicsCompareExchange , 4, 1) RUNTIME_ADDR(AtomicsExchange, 3, 1) RUNTIME_ADDR(AtomicsNumWaitersForTesting , 2, 1) RUNTIME_ADDR(AtomicsNumAsyncWaitersForTesting, 0, 1) RUNTIME_ADDR (AtomicsNumUnresolvedAsyncPromisesForTesting, 2, 1) RUNTIME_ADDR (AtomicsOr, 3, 1) RUNTIME_ADDR(AtomicsSub, 3, 1) RUNTIME_ADDR (AtomicsXor, 3, 1) RUNTIME_ADDR(SetAllowAtomicsWait, 1, 1) RUNTIME_ADDR (AtomicsLoadSharedStructField, 2, 1) RUNTIME_ADDR(AtomicsStoreSharedStructField , 3, 1) RUNTIME_ADDR(AtomicsExchangeSharedStructField, 3, 1) RUNTIME_ADDR (BigIntBinaryOp, 3, 1) RUNTIME_ADDR(BigIntCompareToBigInt, 3, 1) RUNTIME_ADDR(BigIntCompareToNumber, 3, 1) RUNTIME_ADDR(BigIntCompareToString , 3, 1) RUNTIME_ADDR(BigIntEqualToBigInt, 2, 1) RUNTIME_ADDR( BigIntEqualToNumber, 2, 1) RUNTIME_ADDR(BigIntEqualToString, 2 , 1) RUNTIME_ADDR(BigIntMaxLengthBits, 0, 1) RUNTIME_ADDR(BigIntToBoolean , 1, 1) RUNTIME_ADDR(BigIntToNumber, 1, 1) RUNTIME_ADDR(BigIntUnaryOp , 2, 1) RUNTIME_ADDR(ToBigInt, 1, 1) RUNTIME_ADDR(DefineClass , -1 , 1) RUNTIME_ADDR(LoadFromSuper, 3, 1) RUNTIME_ADDR(LoadKeyedFromSuper , 3, 1) RUNTIME_ADDR(StoreKeyedToSuper, 4, 1) RUNTIME_ADDR(StoreToSuper , 4, 1) RUNTIME_ADDR(ThrowConstructorNonCallableError, 1, 1) RUNTIME_ADDR (ThrowNotSuperConstructor, 2, 1) RUNTIME_ADDR(ThrowStaticPrototypeError , 0, 1) RUNTIME_ADDR(ThrowSuperAlreadyCalledError, 0, 1) RUNTIME_ADDR (ThrowSuperNotCalled, 0, 1) RUNTIME_ADDR(ThrowUnsupportedSuperError , 0, 1) RUNTIME_ADDR(MapGrow, 1, 1) RUNTIME_ADDR(MapShrink, 1 , 1) RUNTIME_ADDR(SetGrow, 1, 1) RUNTIME_ADDR(SetShrink, 1, 1 ) RUNTIME_ADDR(TheHole, 0, 1) RUNTIME_ADDR(WeakCollectionDelete , 3, 1) RUNTIME_ADDR(WeakCollectionSet, 4, 1) RUNTIME_ADDR(CompileOptimizedOSR , 0, 1) RUNTIME_ADDR(CompileLazy, 1, 1) RUNTIME_ADDR(CompileBaseline , 1, 1) RUNTIME_ADDR(CompileMaglev_Concurrent, 1, 1) RUNTIME_ADDR (CompileMaglev_Synchronous, 1, 1) RUNTIME_ADDR(CompileTurbofan_Concurrent , 1, 1) RUNTIME_ADDR(CompileTurbofan_Synchronous, 1, 1) RUNTIME_ADDR (InstallBaselineCode, 1, 1) RUNTIME_ADDR(HealOptimizedCodeSlot , 1, 1) RUNTIME_ADDR(InstantiateAsmJs, 4, 1) RUNTIME_ADDR(NotifyDeoptimized , 0, 1) RUNTIME_ADDR(ObserveNode, 1, 1) RUNTIME_ADDR(ResolvePossiblyDirectEval , 6, 1) RUNTIME_ADDR(VerifyType, 1, 1) RUNTIME_ADDR(DateCurrentTime , 0, 1) RUNTIME_ADDR(ClearStepping, 0, 1) RUNTIME_ADDR(CollectGarbage , 1, 1) RUNTIME_ADDR(DebugAsyncFunctionSuspended, 4, 1) RUNTIME_ADDR (DebugBreakAtEntry, 1, 1) RUNTIME_ADDR(DebugCollectCoverage, 0 , 1) RUNTIME_ADDR(DebugGetLoadedScriptIds, 0, 1) RUNTIME_ADDR (DebugOnFunctionCall, 2, 1) RUNTIME_ADDR(DebugPopPromise, 0, 1 ) RUNTIME_ADDR(DebugPrepareStepInSuspendedGenerator, 0, 1) RUNTIME_ADDR (DebugPromiseThen, 1, 1) RUNTIME_ADDR(DebugPushPromise, 1, 1) RUNTIME_ADDR(DebugToggleBlockCoverage, 1, 1) RUNTIME_ADDR(DebugTogglePreciseCoverage , 1, 1) RUNTIME_ADDR(FunctionGetInferredName, 1, 1) RUNTIME_ADDR (GetBreakLocations, 1, 1) RUNTIME_ADDR(GetGeneratorScopeCount , 1, 1) RUNTIME_ADDR(GetGeneratorScopeDetails, 2, 1) RUNTIME_ADDR (HandleDebuggerStatement, 0, 1) RUNTIME_ADDR(IsBreakOnException , 1, 1) RUNTIME_ADDR(LiveEditPatchScript, 2, 1) RUNTIME_ADDR( ProfileCreateSnapshotDataBlob, 0, 1) RUNTIME_ADDR(ScheduleBreak , 0, 1) RUNTIME_ADDR(ScriptLocationFromLine2, 4, 1) RUNTIME_ADDR (SetGeneratorScopeVariableValue, 4, 1) RUNTIME_ADDR(IncBlockCounter , 2, 1) RUNTIME_ADDR(ForInEnumerate, 1, 1) RUNTIME_ADDR(ForInHasProperty , 2, 1) RUNTIME_ADDR(Call, -1 , 1) RUNTIME_ADDR(FunctionGetScriptSource , 1, 1) RUNTIME_ADDR(FunctionGetScriptId, 1, 1) RUNTIME_ADDR( FunctionGetScriptSourcePosition, 1, 1) RUNTIME_ADDR(FunctionGetSourceCode , 1, 1) RUNTIME_ADDR(FunctionIsAPIFunction, 1, 1) RUNTIME_ADDR (IsFunction, 1, 1) RUNTIME_ADDR(AsyncFunctionAwaitCaught, 2, 1 ) RUNTIME_ADDR(AsyncFunctionAwaitUncaught, 2, 1) RUNTIME_ADDR (AsyncFunctionEnter, 2, 1) RUNTIME_ADDR(AsyncFunctionReject, 2 , 1) RUNTIME_ADDR(AsyncFunctionResolve, 2, 1) RUNTIME_ADDR(AsyncGeneratorAwaitCaught , 2, 1) RUNTIME_ADDR(AsyncGeneratorAwaitUncaught, 2, 1) RUNTIME_ADDR (AsyncGeneratorHasCatchHandlerForPC, 1, 1) RUNTIME_ADDR(AsyncGeneratorReject , 2, 1) RUNTIME_ADDR(AsyncGeneratorResolve, 3, 1) RUNTIME_ADDR (AsyncGeneratorYield, 3, 1) RUNTIME_ADDR(CreateJSGeneratorObject , 2, 1) RUNTIME_ADDR(GeneratorClose, 1, 1) RUNTIME_ADDR(GeneratorGetFunction , 1, 1) RUNTIME_ADDR(GeneratorGetResumeMode, 1, 1) RUNTIME_ADDR (ElementsTransitionAndStoreIC_Miss, 6, 1) RUNTIME_ADDR(KeyedLoadIC_Miss , 4, 1) RUNTIME_ADDR(KeyedStoreIC_Miss, 5, 1) RUNTIME_ADDR(DefineKeyedOwnIC_Miss , 5, 1) RUNTIME_ADDR(StoreInArrayLiteralIC_Miss, 5, 1) RUNTIME_ADDR (DefineNamedOwnIC_Slow, 3, 1) RUNTIME_ADDR(KeyedStoreIC_Slow, 3, 1) RUNTIME_ADDR(DefineKeyedOwnIC_Slow, 3, 1) RUNTIME_ADDR (LoadElementWithInterceptor, 2, 1) RUNTIME_ADDR(LoadGlobalIC_Miss , 4, 1) RUNTIME_ADDR(LoadGlobalIC_Slow, 3, 1) RUNTIME_ADDR(LoadIC_Miss , 4, 1) RUNTIME_ADDR(LoadNoFeedbackIC_Miss, 4, 1) RUNTIME_ADDR (LoadWithReceiverIC_Miss, 5, 1) RUNTIME_ADDR(LoadWithReceiverNoFeedbackIC_Miss , 3, 1) RUNTIME_ADDR(LoadPropertyWithInterceptor, 5, 1) RUNTIME_ADDR (StoreCallbackProperty, 5, 1) RUNTIME_ADDR(StoreGlobalIC_Miss , 4, 1) RUNTIME_ADDR(StoreGlobalICNoFeedback_Miss, 2, 1) RUNTIME_ADDR (StoreGlobalIC_Slow, 5, 1) RUNTIME_ADDR(StoreIC_Miss, 5, 1) RUNTIME_ADDR (DefineNamedOwnIC_Miss, 5, 1) RUNTIME_ADDR(StoreInArrayLiteralIC_Slow , 5, 1) RUNTIME_ADDR(StorePropertyWithInterceptor, 5, 1) RUNTIME_ADDR (CloneObjectIC_Miss, 4, 1) RUNTIME_ADDR(KeyedHasIC_Miss, 4, 1 ) RUNTIME_ADDR(HasElementWithInterceptor, 2, 1) RUNTIME_ADDR( AccessCheck, 1, 1) RUNTIME_ADDR(AllocateByteArray, 1, 1) RUNTIME_ADDR (AllocateInYoungGeneration, 2, 1) RUNTIME_ADDR(AllocateInOldGeneration , 2, 1) RUNTIME_ADDR(AllocateSeqOneByteString, 1, 1) RUNTIME_ADDR (AllocateSeqTwoByteString, 1, 1) RUNTIME_ADDR(AllowDynamicFunction , 1, 1) RUNTIME_ADDR(CreateAsyncFromSyncIterator, 1, 1) RUNTIME_ADDR (CreateListFromArrayLike, 1, 1) RUNTIME_ADDR(DoubleToStringWithRadix , 2, 1) RUNTIME_ADDR(FatalProcessOutOfMemoryInAllocateRaw, 0, 1) RUNTIME_ADDR(FatalProcessOutOfMemoryInvalidArrayLength, 0 , 1) RUNTIME_ADDR(GetAndResetRuntimeCallStats, -1 , 1) RUNTIME_ADDR (GetTemplateObject, 3, 1) RUNTIME_ADDR(IncrementUseCounter, 1 , 1) RUNTIME_ADDR(BytecodeBudgetInterrupt, 1, 1) RUNTIME_ADDR (BytecodeBudgetInterruptWithStackCheck, 1, 1) RUNTIME_ADDR(NewError , 2, 1) RUNTIME_ADDR(NewForeign, 0, 1) RUNTIME_ADDR(NewReferenceError , 2, 1) RUNTIME_ADDR(NewSyntaxError, 2, 1) RUNTIME_ADDR(NewTypeError , -1 , 1) RUNTIME_ADDR(OrdinaryHasInstance, 2, 1) RUNTIME_ADDR (PromoteScheduledException, 0, 1) RUNTIME_ADDR(ReportMessageFromMicrotask , 1, 1) RUNTIME_ADDR(ReThrow, 1, 1) RUNTIME_ADDR(ReThrowWithMessage , 2, 1) RUNTIME_ADDR(RunMicrotaskCallback, 2, 1) RUNTIME_ADDR (PerformMicrotaskCheckpoint, 0, 1) RUNTIME_ADDR(SharedValueBarrierSlow , 1, 1) RUNTIME_ADDR(StackGuard, 0, 1) RUNTIME_ADDR(StackGuardWithGap , 1, 1) RUNTIME_ADDR(Throw, 1, 1) RUNTIME_ADDR(ThrowApplyNonFunction , 1, 1) RUNTIME_ADDR(ThrowCalledNonCallable, 1, 1) RUNTIME_ADDR (ThrowConstructedNonConstructable, 1, 1) RUNTIME_ADDR(ThrowConstructorReturnedNonObject , 0, 1) RUNTIME_ADDR(ThrowInvalidStringLength, 0, 1) RUNTIME_ADDR (ThrowInvalidTypedArrayAlignment, 2, 1) RUNTIME_ADDR(ThrowIteratorError , 1, 1) RUNTIME_ADDR(ThrowSpreadArgError, 2, 1) RUNTIME_ADDR( ThrowIteratorResultNotAnObject, 1, 1) RUNTIME_ADDR(ThrowNoAccess , 0, 1) RUNTIME_ADDR(ThrowNotConstructor, 1, 1) RUNTIME_ADDR( ThrowPatternAssignmentNonCoercible, 1, 1) RUNTIME_ADDR(ThrowRangeError , -1 , 1) RUNTIME_ADDR(ThrowReferenceError, 1, 1) RUNTIME_ADDR (ThrowAccessedUninitializedVariable, 1, 1) RUNTIME_ADDR(ThrowStackOverflow , 0, 1) RUNTIME_ADDR(ThrowSymbolAsyncIteratorInvalid, 0, 1) RUNTIME_ADDR (ThrowSymbolIteratorInvalid, 0, 1) RUNTIME_ADDR(ThrowThrowMethodMissing , 0, 1) RUNTIME_ADDR(ThrowTypeError, -1 , 1) RUNTIME_ADDR(ThrowTypeErrorIfStrict , -1 , 1) RUNTIME_ADDR(Typeof, 1, 1) RUNTIME_ADDR(UnwindAndFindExceptionHandler , 0, 1) RUNTIME_ADDR(FormatList, 2, 1) RUNTIME_ADDR(FormatListToParts , 2, 1) RUNTIME_ADDR(StringToLowerCaseIntl, 1, 1) RUNTIME_ADDR (StringToUpperCaseIntl, 1, 1) RUNTIME_ADDR(CreateArrayLiteral , 4, 1) RUNTIME_ADDR(CreateArrayLiteralWithoutAllocationSite, 2, 1) RUNTIME_ADDR(CreateObjectLiteral, 4, 1) RUNTIME_ADDR(CreateObjectLiteralWithoutAllocationSite , 2, 1) RUNTIME_ADDR(CreateRegExpLiteral, 4, 1) RUNTIME_ADDR( DynamicImportCall, -1 , 1) RUNTIME_ADDR(GetImportMetaObject, 0 , 1) RUNTIME_ADDR(GetModuleNamespace, 1, 1) RUNTIME_ADDR(ArrayBufferMaxByteLength , 0, 1) RUNTIME_ADDR(GetHoleNaNLower, 0, 1) RUNTIME_ADDR(GetHoleNaNUpper , 0, 1) RUNTIME_ADDR(IsSmi, 1, 1) RUNTIME_ADDR(MaxSmi, 0, 1) RUNTIME_ADDR (NumberToStringSlow, 1, 1) RUNTIME_ADDR(StringParseFloat, 1, 1 ) RUNTIME_ADDR(StringParseInt, 2, 1) RUNTIME_ADDR(StringToNumber , 1, 1) RUNTIME_ADDR(TypedArrayMaxLength, 0, 1) RUNTIME_ADDR( AddDictionaryProperty, 3, 1) RUNTIME_ADDR(AddPrivateBrand, 4, 1) RUNTIME_ADDR(AllocateHeapNumber, 0, 1) RUNTIME_ADDR(CollectTypeProfile , 3, 1) RUNTIME_ADDR(CompleteInobjectSlackTrackingForMap, 1, 1 ) RUNTIME_ADDR(CopyDataProperties, 2, 1) RUNTIME_ADDR(CopyDataPropertiesWithExcludedPropertiesOnStack , -1 , 1) RUNTIME_ADDR(CreateDataProperty, 3, 1) RUNTIME_ADDR (CreateIterResultObject, 2, 1) RUNTIME_ADDR(CreatePrivateAccessors , 2, 1) RUNTIME_ADDR(DefineAccessorPropertyUnchecked, 5, 1) RUNTIME_ADDR (DefineKeyedOwnPropertyInLiteral, 6, 1) RUNTIME_ADDR(DefineGetterPropertyUnchecked , 4, 1) RUNTIME_ADDR(DefineSetterPropertyUnchecked, 4, 1) RUNTIME_ADDR (DeleteProperty, 3, 1) RUNTIME_ADDR(GetDerivedMap, 2, 1) RUNTIME_ADDR (GetFunctionName, 1, 1) RUNTIME_ADDR(GetOwnPropertyDescriptor , 2, 1) RUNTIME_ADDR(GetOwnPropertyKeys, 2, 1) RUNTIME_ADDR(GetProperty , -1 , 1) RUNTIME_ADDR(HasFastPackedElements, 1, 1) RUNTIME_ADDR (HasInPrototypeChain, 2, 1) RUNTIME_ADDR(HasProperty, 2, 1) RUNTIME_ADDR (InternalSetPrototype, 2, 1) RUNTIME_ADDR(IsJSReceiver, 1, 1) RUNTIME_ADDR(JSReceiverPreventExtensionsDontThrow, 1, 1) RUNTIME_ADDR (JSReceiverPreventExtensionsThrow, 1, 1) RUNTIME_ADDR(JSReceiverGetPrototypeOf , 1, 1) RUNTIME_ADDR(JSReceiverSetPrototypeOfDontThrow, 2, 1) RUNTIME_ADDR(JSReceiverSetPrototypeOfThrow, 2, 1) RUNTIME_ADDR (LoadPrivateGetter, 1, 1) RUNTIME_ADDR(LoadPrivateSetter, 1, 1 ) RUNTIME_ADDR(NewObject, 2, 1) RUNTIME_ADDR(ObjectCreate, 2, 1) RUNTIME_ADDR(ObjectEntries, 1, 1) RUNTIME_ADDR(ObjectEntriesSkipFastPath , 1, 1) RUNTIME_ADDR(ObjectGetOwnPropertyNames, 1, 1) RUNTIME_ADDR (ObjectGetOwnPropertyNamesTryFast, 1, 1) RUNTIME_ADDR(ObjectHasOwnProperty , 2, 1) RUNTIME_ADDR(ObjectIsExtensible, 1, 1) RUNTIME_ADDR(ObjectKeys , 1, 1) RUNTIME_ADDR(ObjectValues, 1, 1) RUNTIME_ADDR(ObjectValuesSkipFastPath , 1, 1) RUNTIME_ADDR(OptimizeObjectForAddingMultipleProperties , 2, 1) RUNTIME_ADDR(SetDataProperties, 2, 1) RUNTIME_ADDR(SetKeyedProperty , 3, 1) RUNTIME_ADDR(DefineObjectOwnProperty, 3, 1) RUNTIME_ADDR (SetNamedProperty, 3, 1) RUNTIME_ADDR(SetOwnPropertyIgnoreAttributes , 4, 1) RUNTIME_ADDR(DefineKeyedOwnPropertyInLiteral_Simple, 3 , 1) RUNTIME_ADDR(ShrinkNameDictionary, 1, 1) RUNTIME_ADDR(ShrinkSwissNameDictionary , 1, 1) RUNTIME_ADDR(ToFastProperties, 1, 1) RUNTIME_ADDR(ToLength , 1, 1) RUNTIME_ADDR(ToName, 1, 1) RUNTIME_ADDR(ToNumber, 1, 1 ) RUNTIME_ADDR(ToNumeric, 1, 1) RUNTIME_ADDR(ToObject, 1, 1) RUNTIME_ADDR (ToString, 1, 1) RUNTIME_ADDR(TryMigrateInstance, 1, 1) RUNTIME_ADDR (SwissTableAdd, 4, 1) RUNTIME_ADDR(SwissTableAllocate, 1, 1) RUNTIME_ADDR (SwissTableDelete, 2, 1) RUNTIME_ADDR(SwissTableDetailsAt, 2, 1) RUNTIME_ADDR(SwissTableElementsCount, 1, 1) RUNTIME_ADDR( SwissTableEquals, 2, 1) RUNTIME_ADDR(SwissTableFindEntry, 2, 1 ) RUNTIME_ADDR(SwissTableUpdate, 4, 1) RUNTIME_ADDR(SwissTableValueAt , 2, 1) RUNTIME_ADDR(SwissTableKeyAt, 2, 1) RUNTIME_ADDR(Add, 2, 1) RUNTIME_ADDR(Equal, 2, 1) RUNTIME_ADDR(GreaterThan, 2, 1) RUNTIME_ADDR(GreaterThanOrEqual, 2, 1) RUNTIME_ADDR(LessThan , 2, 1) RUNTIME_ADDR(LessThanOrEqual, 2, 1) RUNTIME_ADDR(NotEqual , 2, 1) RUNTIME_ADDR(StrictEqual, 2, 1) RUNTIME_ADDR(StrictNotEqual , 2, 1) RUNTIME_ADDR(ReferenceEqual, 2, 1) RUNTIME_ADDR(EnqueueMicrotask , 1, 1) RUNTIME_ADDR(PromiseHookAfter, 1, 1) RUNTIME_ADDR(PromiseHookBefore , 1, 1) RUNTIME_ADDR(PromiseHookInit, 2, 1) RUNTIME_ADDR(PromiseRejectEventFromStack , 2, 1) RUNTIME_ADDR(PromiseRevokeReject, 1, 1) RUNTIME_ADDR( PromiseStatus, 1, 1) RUNTIME_ADDR(RejectPromise, 3, 1) RUNTIME_ADDR (ResolvePromise, 2, 1) RUNTIME_ADDR(PromiseRejectAfterResolved , 2, 1) RUNTIME_ADDR(PromiseResolveAfterResolved, 2, 1) RUNTIME_ADDR (ConstructAggregateErrorHelper, 4, 1) RUNTIME_ADDR(ConstructInternalAggregateErrorHelper , -1 , 1) RUNTIME_ADDR(CheckProxyGetSetTrapResult, 2, 1) RUNTIME_ADDR (CheckProxyHasTrapResult, 2, 1) RUNTIME_ADDR(CheckProxyDeleteTrapResult , 2, 1) RUNTIME_ADDR(GetPropertyWithReceiver, 3, 1) RUNTIME_ADDR (IsJSProxy, 1, 1) RUNTIME_ADDR(JSProxyGetHandler, 1, 1) RUNTIME_ADDR (JSProxyGetTarget, 1, 1) RUNTIME_ADDR(SetPropertyWithReceiver , 4, 1) RUNTIME_ADDR(IsRegExp, 1, 1) RUNTIME_ADDR(RegExpBuildIndices , 3, 1) RUNTIME_ADDR(RegExpExec, 4, 1) RUNTIME_ADDR(RegExpExecTreatMatchAtEndAsFailure , 4, 1) RUNTIME_ADDR(RegExpExperimentalOneshotExec, 4, 1) RUNTIME_ADDR (RegExpExperimentalOneshotExecTreatMatchAtEndAsFailure, 4, 1) RUNTIME_ADDR(RegExpExecMultiple, 4, 1) RUNTIME_ADDR(RegExpInitializeAndCompile , 3, 1) RUNTIME_ADDR(RegExpReplaceRT, 3, 1) RUNTIME_ADDR(RegExpSplit , 3, 1) RUNTIME_ADDR(RegExpStringFromFlags, 1, 1) RUNTIME_ADDR (StringReplaceNonGlobalRegExpWithFunction, 3, 1) RUNTIME_ADDR (StringSplit, 3, 1) RUNTIME_ADDR(DeclareEvalFunction, 2, 1) RUNTIME_ADDR (DeclareEvalVar, 1, 1) RUNTIME_ADDR(DeclareGlobals, 2, 1) RUNTIME_ADDR (DeclareModuleExports, 2, 1) RUNTIME_ADDR(DeleteLookupSlot, 1 , 1) RUNTIME_ADDR(LoadLookupSlot, 1, 1) RUNTIME_ADDR(LoadLookupSlotInsideTypeof , 1, 1) RUNTIME_ADDR(NewClosure, 2, 1) RUNTIME_ADDR(NewClosure_Tenured , 2, 1) RUNTIME_ADDR(NewFunctionContext, 1, 1) RUNTIME_ADDR(NewRestParameter , 1, 1) RUNTIME_ADDR(NewSloppyArguments, 1, 1) RUNTIME_ADDR(NewStrictArguments , 1, 1) RUNTIME_ADDR(PushBlockContext, 1, 1) RUNTIME_ADDR(PushCatchContext , 2, 1) RUNTIME_ADDR(PushWithContext, 2, 1) RUNTIME_ADDR(StoreGlobalNoHoleCheckForReplLetOrConst , 2, 1) RUNTIME_ADDR(StoreLookupSlot_Sloppy, 2, 1) RUNTIME_ADDR (StoreLookupSlot_SloppyHoisting, 2, 1) RUNTIME_ADDR(StoreLookupSlot_Strict , 2, 1) RUNTIME_ADDR(ThrowConstAssignError, 0, 1) RUNTIME_ADDR (ShadowRealmWrappedFunctionCreate, 2, 1) RUNTIME_ADDR(FlattenString , 1, 1) RUNTIME_ADDR(GetSubstitution, 5, 1) RUNTIME_ADDR(InternalizeString , 1, 1) RUNTIME_ADDR(StringAdd, 2, 1) RUNTIME_ADDR(StringBuilderConcat , 3, 1) RUNTIME_ADDR(StringCharCodeAt, 2, 1) RUNTIME_ADDR(StringEqual , 2, 1) RUNTIME_ADDR(StringEscapeQuotes, 1, 1) RUNTIME_ADDR(StringGreaterThan , 2, 1) RUNTIME_ADDR(StringGreaterThanOrEqual, 2, 1) RUNTIME_ADDR (StringLastIndexOf, 2, 1) RUNTIME_ADDR(StringLessThan, 2, 1) RUNTIME_ADDR (StringLessThanOrEqual, 2, 1) RUNTIME_ADDR(StringMaxLength, 0 , 1) RUNTIME_ADDR(StringReplaceOneCharWithString, 3, 1) RUNTIME_ADDR (StringSubstring, 3, 1) RUNTIME_ADDR(StringToArray, 2, 1) RUNTIME_ADDR (CreatePrivateNameSymbol, 1, 1) RUNTIME_ADDR(CreatePrivateBrandSymbol , 1, 1) RUNTIME_ADDR(CreatePrivateSymbol, -1 , 1) RUNTIME_ADDR (SymbolDescriptiveString, 1, 1) RUNTIME_ADDR(SymbolIsPrivate, 1, 1) RUNTIME_ADDR(Abort, 1, 1) RUNTIME_ADDR(AbortCSADcheck, 1, 1) RUNTIME_ADDR(AbortJS, 1, 1) RUNTIME_ADDR(ActiveTierIsMaglev , 1, 1) RUNTIME_ADDR(ArrayIteratorProtector, 0, 1) RUNTIME_ADDR (ArraySpeciesProtector, 0, 1) RUNTIME_ADDR(BaselineOsr, -1, 1 ) RUNTIME_ADDR(BenchMaglev, 2, 1) RUNTIME_ADDR(ClearFunctionFeedback , 1, 1) RUNTIME_ADDR(ClearMegamorphicStubCache, 0, 1) RUNTIME_ADDR (CompleteInobjectSlackTracking, 1, 1) RUNTIME_ADDR(ConstructConsString , 2, 1) RUNTIME_ADDR(ConstructDouble, 2, 1) RUNTIME_ADDR(ConstructSlicedString , 2, 1) RUNTIME_ADDR(DebugPrint, 1, 1) RUNTIME_ADDR(DebugPrintPtr , 1, 1) RUNTIME_ADDR(DebugTrace, 0, 1) RUNTIME_ADDR(DebugTrackRetainingPath , -1, 1) RUNTIME_ADDR(DeoptimizeFunction, 1, 1) RUNTIME_ADDR( DisableOptimizationFinalization, 0, 1) RUNTIME_ADDR(DisallowCodegenFromStrings , 1, 1) RUNTIME_ADDR(DisassembleFunction, 1, 1) RUNTIME_ADDR( EnableCodeLoggingForTesting, 0, 1) RUNTIME_ADDR(EnsureFeedbackVectorForFunction , 1, 1) RUNTIME_ADDR(FinalizeOptimization, 0, 1) RUNTIME_ADDR (GetCallable, 0, 1) RUNTIME_ADDR(GetInitializerFunction, 1, 1 ) RUNTIME_ADDR(GetOptimizationStatus, 1, 1) RUNTIME_ADDR(GetUndetectable , 0, 1) RUNTIME_ADDR(GlobalPrint, 1, 1) RUNTIME_ADDR(HasDictionaryElements , 1, 1) RUNTIME_ADDR(HasDoubleElements, 1, 1) RUNTIME_ADDR(HasElementsInALargeObjectSpace , 1, 1) RUNTIME_ADDR(HasFastElements, 1, 1) RUNTIME_ADDR(HasFastProperties , 1, 1) RUNTIME_ADDR(HasFixedBigInt64Elements, 1, 1) RUNTIME_ADDR (HasFixedBigUint64Elements, 1, 1) RUNTIME_ADDR(HasFixedFloat32Elements , 1, 1) RUNTIME_ADDR(HasFixedFloat64Elements, 1, 1) RUNTIME_ADDR (HasFixedInt16Elements, 1, 1) RUNTIME_ADDR(HasFixedInt32Elements , 1, 1) RUNTIME_ADDR(HasFixedInt8Elements, 1, 1) RUNTIME_ADDR (HasFixedUint16Elements, 1, 1) RUNTIME_ADDR(HasFixedUint32Elements , 1, 1) RUNTIME_ADDR(HasFixedUint8ClampedElements, 1, 1) RUNTIME_ADDR (HasFixedUint8Elements, 1, 1) RUNTIME_ADDR(HasHoleyElements, 1 , 1) RUNTIME_ADDR(HasObjectElements, 1, 1) RUNTIME_ADDR(HasOwnConstDataProperty , 2, 1) RUNTIME_ADDR(HasPackedElements, 1, 1) RUNTIME_ADDR(HasSloppyArgumentsElements , 1, 1) RUNTIME_ADDR(HasSmiElements, 1, 1) RUNTIME_ADDR(HasSmiOrObjectElements , 1, 1) RUNTIME_ADDR(HaveSameMap, 2, 1) RUNTIME_ADDR(HeapObjectVerify , 1, 1) RUNTIME_ADDR(ICsAreEnabled, 0, 1) RUNTIME_ADDR(InLargeObjectSpace , 1, 1) RUNTIME_ADDR(InYoungGeneration, 1, 1) RUNTIME_ADDR(Is64Bit , 0, 1) RUNTIME_ADDR(IsAtomicsWaitAllowed, 0, 1) RUNTIME_ADDR (IsBeingInterpreted, 0, 1) RUNTIME_ADDR(IsConcatSpreadableProtector , 0, 1) RUNTIME_ADDR(IsConcurrentRecompilationSupported, 0, 1 ) RUNTIME_ADDR(IsDictPropertyConstTrackingEnabled, 0, 1) RUNTIME_ADDR (IsSameHeapObject, 2, 1) RUNTIME_ADDR(IsSharedString, 1, 1) RUNTIME_ADDR (MapIteratorProtector, 0, 1) RUNTIME_ADDR(NeverOptimizeFunction , 1, 1) RUNTIME_ADDR(NewRegExpWithBacktrackLimit, 3, 1) RUNTIME_ADDR (NotifyContextDisposed, 0, 1) RUNTIME_ADDR(OptimizeMaglevOnNextCall , 1, 1) RUNTIME_ADDR(OptimizeFunctionOnNextCall, -1, 1) RUNTIME_ADDR (OptimizeOsr, -1, 1) RUNTIME_ADDR(PrepareFunctionForOptimization , -1, 1) RUNTIME_ADDR(PretenureAllocationSite, 1, 1) RUNTIME_ADDR (PrintWithNameForAssert, 2, 1) RUNTIME_ADDR(PromiseSpeciesProtector , 0, 1) RUNTIME_ADDR(RegExpSpeciesProtector, 0, 1) RUNTIME_ADDR (RegexpHasBytecode, 2, 1) RUNTIME_ADDR(RegexpHasNativeCode, 2 , 1) RUNTIME_ADDR(RegexpIsUnmodified, 1, 1) RUNTIME_ADDR(RegexpTypeTag , 1, 1) RUNTIME_ADDR(RunningInSimulator, 0, 1) RUNTIME_ADDR(RuntimeEvaluateREPL , 1, 1) RUNTIME_ADDR(ScheduleGCInStackCheck, 0, 1) RUNTIME_ADDR (SerializeDeserializeNow, 0, 1) RUNTIME_ADDR(SetAllocationTimeout , -1 , 1) RUNTIME_ADDR(SetForceSlowPath, 1, 1) RUNTIME_ADDR(SetIteratorProtector , 0, 1) RUNTIME_ADDR(SharedGC, 0, 1) RUNTIME_ADDR(SimulateNewspaceFull , 0, 1) RUNTIME_ADDR(StringIteratorProtector, 0, 1) RUNTIME_ADDR (SystemBreak, 0, 1) RUNTIME_ADDR(TakeHeapSnapshot, -1, 1) RUNTIME_ADDR (TraceEnter, 0, 1) RUNTIME_ADDR(TraceExit, 1, 1) RUNTIME_ADDR (TurbofanStaticAssert, 1, 1) RUNTIME_ADDR(TypedArraySpeciesProtector , 0, 1) RUNTIME_ADDR(WaitForBackgroundOptimization, 0, 1) RUNTIME_ADDR (WebSnapshotDeserialize, -1, 1) RUNTIME_ADDR(WebSnapshotSerialize , -1, 1) RUNTIME_ADDR(DeoptimizeNow, 0, 1) RUNTIME_ADDR(ArrayBufferDetach , 1, 1) RUNTIME_ADDR(GrowableSharedArrayBufferByteLength, 1, 1 ) RUNTIME_ADDR(TypedArrayCopyElements, 3, 1) RUNTIME_ADDR(TypedArrayGetBuffer , 1, 1) RUNTIME_ADDR(TypedArraySet, 2, 1) RUNTIME_ADDR(TypedArraySortFast , 1, 1) RUNTIME_ADDR(ThrowWasmError, 1, 1) RUNTIME_ADDR(ThrowWasmStackOverflow , 0, 1) RUNTIME_ADDR(WasmI32AtomicWait, 4, 1) RUNTIME_ADDR(WasmI64AtomicWait , 5, 1) RUNTIME_ADDR(WasmAtomicNotify, 3, 1) RUNTIME_ADDR(WasmMemoryGrow , 2, 1) RUNTIME_ADDR(WasmStackGuard, 0, 1) RUNTIME_ADDR(WasmThrow , 2, 1) RUNTIME_ADDR(WasmReThrow, 1, 1) RUNTIME_ADDR(WasmThrowJSTypeError , 0, 1) RUNTIME_ADDR(WasmRefFunc, 1, 1) RUNTIME_ADDR(WasmFunctionTableGet , 3, 1) RUNTIME_ADDR(WasmFunctionTableSet, 4, 1) RUNTIME_ADDR (WasmTableInit, 6, 1) RUNTIME_ADDR(WasmTableCopy, 6, 1) RUNTIME_ADDR (WasmTableGrow, 3, 1) RUNTIME_ADDR(WasmTableFill, 5, 1) RUNTIME_ADDR (WasmIsValidRefValue, 3, 1) RUNTIME_ADDR(WasmCompileLazy, 2, 1 ) RUNTIME_ADDR(WasmCompileWrapper, 2, 1) RUNTIME_ADDR(WasmTriggerTierUp , 1, 1) RUNTIME_ADDR(WasmDebugBreak, 0, 1) RUNTIME_ADDR(WasmArrayCopy , 5, 1) RUNTIME_ADDR(WasmArrayInitFromData, 5, 1) RUNTIME_ADDR (WasmAllocateContinuation, 1, 1) RUNTIME_ADDR(WasmSyncStackLimit , 0, 1) RUNTIME_ADDR(WasmCreateResumePromise, 2, 1) RUNTIME_ADDR (DeserializeWasmModule, 2, 1) RUNTIME_ADDR(DisallowWasmCodegen , 1, 1) RUNTIME_ADDR(FreezeWasmLazyCompilation, 1, 1) RUNTIME_ADDR (GetWasmExceptionTagId, 2, 1) RUNTIME_ADDR(GetWasmExceptionValues , 1, 1) RUNTIME_ADDR(GetWasmRecoveredTrapCount, 0, 1) RUNTIME_ADDR (IsAsmWasmCode, 1, 1) RUNTIME_ADDR(IsLiftoffFunction, 1, 1) RUNTIME_ADDR (IsTurboFanFunction, 1, 1) RUNTIME_ADDR(IsThreadInWasm, 0, 1) RUNTIME_ADDR(IsWasmCode, 1, 1) RUNTIME_ADDR(IsWasmTrapHandlerEnabled , 0, 1) RUNTIME_ADDR(SerializeWasmModule, 1, 1) RUNTIME_ADDR( SetWasmCompileControls, 2, 1) RUNTIME_ADDR(SetWasmInstantiateControls , 0, 1) RUNTIME_ADDR(WasmGetNumberOfInstances, 1, 1) RUNTIME_ADDR (WasmNumCodeSpaces, 1, 1) RUNTIME_ADDR(WasmTierDown, 0, 1) RUNTIME_ADDR (WasmTierUp, 0, 1) RUNTIME_ADDR(WasmTierUpFunction, 2, 1) RUNTIME_ADDR (WasmTraceEnter, 0, 1) RUNTIME_ADDR(WasmTraceExit, 1, 1) RUNTIME_ADDR (WasmTraceMemory, 1, 1) RUNTIME_ADDR(JSFinalizationRegistryRegisterWeakCellWithUnregisterToken , 4, 1) RUNTIME_ADDR(JSWeakRefAddToKeptObjects, 1, 1) RUNTIME_ADDR (ShrinkFinalizationRegistryUnregisterTokenMap, 1, 1) | |||
| 269 | #undef RUNTIME_ADDR | |||
| 270 | }; | |||
| 271 | uint32_t tags_ordered_by_address_[kNumExternalReferences]; | |||
| 272 | }; | |||
| 273 | ||||
| 274 | static_assert(std::is_trivially_destructible<ExternalReferenceList>::value, | |||
| 275 | "static destructors not allowed"); | |||
| 276 | ||||
| 277 | } // namespace | |||
| 278 | ||||
| 279 | class V8_EXPORT_PRIVATE NativeModuleSerializer { | |||
| 280 | public: | |||
| 281 | NativeModuleSerializer(const NativeModule*, base::Vector<WasmCode* const>); | |||
| 282 | NativeModuleSerializer(const NativeModuleSerializer&) = delete; | |||
| 283 | NativeModuleSerializer& operator=(const NativeModuleSerializer&) = delete; | |||
| 284 | ||||
| 285 | size_t Measure() const; | |||
| 286 | bool Write(Writer* writer); | |||
| 287 | ||||
| 288 | private: | |||
| 289 | size_t MeasureCode(const WasmCode*) const; | |||
| 290 | void WriteHeader(Writer*, size_t total_code_size); | |||
| 291 | void WriteCode(const WasmCode*, Writer*); | |||
| 292 | ||||
| 293 | const NativeModule* const native_module_; | |||
| 294 | const base::Vector<WasmCode* const> code_table_; | |||
| 295 | bool write_called_ = false; | |||
| 296 | size_t total_written_code_ = 0; | |||
| 297 | int num_turbofan_functions_ = 0; | |||
| 298 | }; | |||
| 299 | ||||
| 300 | NativeModuleSerializer::NativeModuleSerializer( | |||
| 301 | const NativeModule* module, base::Vector<WasmCode* const> code_table) | |||
| 302 | : native_module_(module), code_table_(code_table) { | |||
| 303 | DCHECK_NOT_NULL(native_module_)((void) 0); | |||
| 304 | // TODO(mtrofin): persist the export wrappers. Ideally, we'd only persist | |||
| 305 | // the unique ones, i.e. the cache. | |||
| 306 | } | |||
| 307 | ||||
| 308 | size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const { | |||
| 309 | if (code == nullptr) return sizeof(uint8_t); | |||
| 310 | DCHECK_EQ(WasmCode::kWasmFunction, code->kind())((void) 0); | |||
| 311 | if (code->tier() != ExecutionTier::kTurbofan) { | |||
| 312 | return sizeof(uint8_t); | |||
| 313 | } | |||
| 314 | return kCodeHeaderSize + code->instructions().size() + | |||
| 315 | code->reloc_info().size() + code->source_positions().size() + | |||
| 316 | code->protected_instructions_data().size(); | |||
| 317 | } | |||
| 318 | ||||
| 319 | size_t NativeModuleSerializer::Measure() const { | |||
| 320 | size_t size = kHeaderSize; | |||
| 321 | for (WasmCode* code : code_table_) { | |||
| 322 | size += MeasureCode(code); | |||
| 323 | } | |||
| 324 | return size; | |||
| 325 | } | |||
| 326 | ||||
| 327 | void NativeModuleSerializer::WriteHeader(Writer* writer, | |||
| 328 | size_t total_code_size) { | |||
| 329 | // TODO(eholk): We need to properly preserve the flag whether the trap | |||
| 330 | // handler was used or not when serializing. | |||
| 331 | ||||
| 332 | writer->Write(total_code_size); | |||
| 333 | } | |||
| 334 | ||||
| 335 | void NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) { | |||
| 336 | if (code == nullptr) { | |||
| 337 | writer->Write(kLazyFunction); | |||
| 338 | return; | |||
| 339 | } | |||
| 340 | ||||
| 341 | DCHECK_EQ(WasmCode::kWasmFunction, code->kind())((void) 0); | |||
| 342 | // Only serialize TurboFan code, as Liftoff code can contain breakpoints or | |||
| 343 | // non-relocatable constants. | |||
| 344 | if (code->tier() != ExecutionTier::kTurbofan) { | |||
| 345 | // We check if the function has been executed already. If so, we serialize | |||
| 346 | // it as {kLiftoffFunction} so that upon deserialization the function will | |||
| 347 | // get compiled with Liftoff eagerly. If the function has not been executed | |||
| 348 | // yet, we serialize it as {kLazyFunction}, and the function will not get | |||
| 349 | // compiled upon deserialization. | |||
| 350 | NativeModule* native_module = code->native_module(); | |||
| 351 | uint32_t budget = | |||
| 352 | native_module->tiering_budget_array()[declared_function_index( | |||
| 353 | native_module->module(), code->index())]; | |||
| 354 | writer->Write(budget == static_cast<uint32_t>(FLAG_wasm_tiering_budget) | |||
| 355 | ? kLazyFunction | |||
| 356 | : kLiftoffFunction); | |||
| 357 | return; | |||
| 358 | } | |||
| 359 | ||||
| 360 | ++num_turbofan_functions_; | |||
| 361 | writer->Write(kTurboFanFunction); | |||
| 362 | // Write the size of the entire code section, followed by the code header. | |||
| 363 | writer->Write(code->constant_pool_offset()); | |||
| 364 | writer->Write(code->safepoint_table_offset()); | |||
| 365 | writer->Write(code->handler_table_offset()); | |||
| 366 | writer->Write(code->code_comments_offset()); | |||
| 367 | writer->Write(code->unpadded_binary_size()); | |||
| 368 | writer->Write(code->stack_slots()); | |||
| 369 | writer->Write(code->raw_tagged_parameter_slots_for_serialization()); | |||
| 370 | writer->Write(code->instructions().length()); | |||
| 371 | writer->Write(code->reloc_info().length()); | |||
| 372 | writer->Write(code->source_positions().length()); | |||
| 373 | writer->Write(code->protected_instructions_data().length()); | |||
| 374 | writer->Write(code->kind()); | |||
| 375 | writer->Write(code->tier()); | |||
| 376 | ||||
| 377 | // Get a pointer to the destination buffer, to hold relocated code. | |||
| 378 | byte* serialized_code_start = writer->current_buffer().begin(); | |||
| 379 | byte* code_start = serialized_code_start; | |||
| 380 | size_t code_size = code->instructions().size(); | |||
| 381 | writer->Skip(code_size); | |||
| 382 | // Write the reloc info, source positions, and protected code. | |||
| 383 | writer->WriteVector(code->reloc_info()); | |||
| 384 | writer->WriteVector(code->source_positions()); | |||
| 385 | writer->WriteVector(code->protected_instructions_data()); | |||
| 386 | #if V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_ARM || \ | |||
| 387 | V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_S390X || \ | |||
| 388 | V8_TARGET_ARCH_RISCV64 | |||
| 389 | // On platforms that don't support misaligned word stores, copy to an aligned | |||
| 390 | // buffer if necessary so we can relocate the serialized code. | |||
| 391 | std::unique_ptr<byte[]> aligned_buffer; | |||
| 392 | if (!IsAligned(reinterpret_cast<Address>(serialized_code_start), | |||
| 393 | kSystemPointerSize)) { | |||
| 394 | // 'byte' does not guarantee an alignment but seems to work well enough in | |||
| 395 | // practice. | |||
| 396 | aligned_buffer.reset(new byte[code_size]); | |||
| 397 | code_start = aligned_buffer.get(); | |||
| 398 | } | |||
| 399 | #endif | |||
| 400 | memcpy(code_start, code->instructions().begin(), code_size); | |||
| 401 | // Relocate the code. | |||
| 402 | int mask = RelocInfo::ModeMask(RelocInfo::WASM_CALL) | | |||
| 403 | RelocInfo::ModeMask(RelocInfo::WASM_STUB_CALL) | | |||
| 404 | RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | |||
| 405 | RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | |||
| 406 | RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |||
| 407 | RelocIterator orig_iter(code->instructions(), code->reloc_info(), | |||
| 408 | code->constant_pool(), mask); | |||
| 409 | for (RelocIterator iter( | |||
| 410 | {code_start, code->instructions().size()}, code->reloc_info(), | |||
| 411 | reinterpret_cast<Address>(code_start) + code->constant_pool_offset(), | |||
| 412 | mask); | |||
| 413 | !iter.done(); iter.next(), orig_iter.next()) { | |||
| 414 | RelocInfo::Mode mode = orig_iter.rinfo()->rmode(); | |||
| 415 | switch (mode) { | |||
| 416 | case RelocInfo::WASM_CALL: { | |||
| 417 | Address orig_target = orig_iter.rinfo()->wasm_call_address(); | |||
| 418 | uint32_t tag = | |||
| 419 | native_module_->GetFunctionIndexFromJumpTableSlot(orig_target); | |||
| 420 | SetWasmCalleeTag(iter.rinfo(), tag); | |||
| 421 | } break; | |||
| 422 | case RelocInfo::WASM_STUB_CALL: { | |||
| 423 | Address target = orig_iter.rinfo()->wasm_stub_call_address(); | |||
| 424 | uint32_t tag = native_module_->GetRuntimeStubId(target); | |||
| 425 | DCHECK_GT(WasmCode::kRuntimeStubCount, tag)((void) 0); | |||
| 426 | SetWasmCalleeTag(iter.rinfo(), tag); | |||
| 427 | } break; | |||
| 428 | case RelocInfo::EXTERNAL_REFERENCE: { | |||
| 429 | Address orig_target = orig_iter.rinfo()->target_external_reference(); | |||
| 430 | uint32_t ext_ref_tag = | |||
| 431 | ExternalReferenceList::Get().tag_from_address(orig_target); | |||
| 432 | SetWasmCalleeTag(iter.rinfo(), ext_ref_tag); | |||
| 433 | } break; | |||
| 434 | case RelocInfo::INTERNAL_REFERENCE: | |||
| 435 | case RelocInfo::INTERNAL_REFERENCE_ENCODED: { | |||
| 436 | Address orig_target = orig_iter.rinfo()->target_internal_reference(); | |||
| 437 | Address offset = orig_target - code->instruction_start(); | |||
| 438 | Assembler::deserialization_set_target_internal_reference_at( | |||
| 439 | iter.rinfo()->pc(), offset, mode); | |||
| 440 | } break; | |||
| 441 | default: | |||
| 442 | UNREACHABLE()V8_Fatal("unreachable code"); | |||
| 443 | } | |||
| 444 | } | |||
| 445 | // If we copied to an aligned buffer, copy code into serialized buffer. | |||
| 446 | if (code_start != serialized_code_start) { | |||
| 447 | memcpy(serialized_code_start, code_start, code_size); | |||
| 448 | } | |||
| 449 | total_written_code_ += code_size; | |||
| 450 | } | |||
| 451 | ||||
| 452 | bool NativeModuleSerializer::Write(Writer* writer) { | |||
| 453 | DCHECK(!write_called_)((void) 0); | |||
| 454 | write_called_ = true; | |||
| 455 | ||||
| 456 | size_t total_code_size = 0; | |||
| 457 | for (WasmCode* code : code_table_) { | |||
| 458 | if (code && code->tier() == ExecutionTier::kTurbofan) { | |||
| 459 | DCHECK(IsAligned(code->instructions().size(), kCodeAlignment))((void) 0); | |||
| 460 | total_code_size += code->instructions().size(); | |||
| 461 | } | |||
| 462 | } | |||
| 463 | WriteHeader(writer, total_code_size); | |||
| 464 | ||||
| 465 | for (WasmCode* code : code_table_) { | |||
| 466 | WriteCode(code, writer); | |||
| 467 | } | |||
| 468 | // If not a single function was written, serialization was not successful. | |||
| 469 | if (num_turbofan_functions_ == 0) return false; | |||
| 470 | ||||
| 471 | // Make sure that the serialized total code size was correct. | |||
| 472 | CHECK_EQ(total_written_code_, total_code_size)do { bool _cmp = ::v8::base::CmpEQImpl< typename ::v8::base ::pass_value_or_ref<decltype(total_written_code_)>::type , typename ::v8::base::pass_value_or_ref<decltype(total_code_size )>::type>((total_written_code_), (total_code_size)); do { if ((__builtin_expect(!!(!(_cmp)), 0))) { V8_Fatal("Check failed: %s." , "total_written_code_" " " "==" " " "total_code_size"); } } while (false); } while (false); | |||
| 473 | ||||
| 474 | return true; | |||
| 475 | } | |||
| 476 | ||||
| 477 | WasmSerializer::WasmSerializer(NativeModule* native_module) | |||
| 478 | : native_module_(native_module), | |||
| 479 | code_table_(native_module->SnapshotCodeTable()) {} | |||
| 480 | ||||
| 481 | size_t WasmSerializer::GetSerializedNativeModuleSize() const { | |||
| 482 | NativeModuleSerializer serializer(native_module_, | |||
| 483 | base::VectorOf(code_table_)); | |||
| 484 | return kHeaderSize + serializer.Measure(); | |||
| 485 | } | |||
| 486 | ||||
| 487 | bool WasmSerializer::SerializeNativeModule(base::Vector<byte> buffer) const { | |||
| 488 | NativeModuleSerializer serializer(native_module_, | |||
| 489 | base::VectorOf(code_table_)); | |||
| 490 | size_t measured_size = kHeaderSize + serializer.Measure(); | |||
| 491 | if (buffer.size() < measured_size) return false; | |||
| 492 | ||||
| 493 | Writer writer(buffer); | |||
| 494 | WriteHeader(&writer); | |||
| 495 | ||||
| 496 | if (!serializer.Write(&writer)) return false; | |||
| 497 | DCHECK_EQ(measured_size, writer.bytes_written())((void) 0); | |||
| 498 | return true; | |||
| 499 | } | |||
| 500 | ||||
| 501 | struct DeserializationUnit { | |||
| 502 | base::Vector<const byte> src_code_buffer; | |||
| 503 | std::unique_ptr<WasmCode> code; | |||
| 504 | NativeModule::JumpTablesRef jump_tables; | |||
| 505 | }; | |||
| 506 | ||||
| 507 | class DeserializationQueue { | |||
| 508 | public: | |||
| 509 | void Add(std::vector<DeserializationUnit> batch) { | |||
| 510 | DCHECK(!batch.empty())((void) 0); | |||
| 511 | base::MutexGuard guard(&mutex_); | |||
| 512 | queue_.emplace(std::move(batch)); | |||
| 513 | } | |||
| 514 | ||||
| 515 | std::vector<DeserializationUnit> Pop() { | |||
| 516 | base::MutexGuard guard(&mutex_); | |||
| 517 | if (queue_.empty()) return {}; | |||
| 518 | auto batch = std::move(queue_.front()); | |||
| 519 | queue_.pop(); | |||
| 520 | return batch; | |||
| 521 | } | |||
| 522 | ||||
| 523 | std::vector<DeserializationUnit> PopAll() { | |||
| 524 | base::MutexGuard guard(&mutex_); | |||
| 525 | if (queue_.empty()) return {}; | |||
| 526 | auto units = std::move(queue_.front()); | |||
| 527 | queue_.pop(); | |||
| 528 | while (!queue_.empty()) { | |||
| 529 | units.insert(units.end(), std::make_move_iterator(queue_.front().begin()), | |||
| 530 | std::make_move_iterator(queue_.front().end())); | |||
| 531 | queue_.pop(); | |||
| 532 | } | |||
| 533 | return units; | |||
| 534 | } | |||
| 535 | ||||
| 536 | size_t NumBatches() const { | |||
| 537 | base::MutexGuard guard(&mutex_); | |||
| 538 | return queue_.size(); | |||
| 539 | } | |||
| 540 | ||||
| 541 | private: | |||
| 542 | mutable base::Mutex mutex_; | |||
| 543 | std::queue<std::vector<DeserializationUnit>> queue_; | |||
| 544 | }; | |||
| 545 | ||||
| 546 | class V8_EXPORT_PRIVATE NativeModuleDeserializer { | |||
| 547 | public: | |||
| 548 | explicit NativeModuleDeserializer(NativeModule*); | |||
| 549 | NativeModuleDeserializer(const NativeModuleDeserializer&) = delete; | |||
| 550 | NativeModuleDeserializer& operator=(const NativeModuleDeserializer&) = delete; | |||
| 551 | ||||
| 552 | bool Read(Reader* reader); | |||
| 553 | ||||
| 554 | base::Vector<const int> lazy_functions() { | |||
| 555 | return base::VectorOf(lazy_functions_); | |||
| 556 | } | |||
| 557 | ||||
| 558 | base::Vector<const int> liftoff_functions() { | |||
| 559 | return base::VectorOf(liftoff_functions_); | |||
| 560 | } | |||
| 561 | ||||
| 562 | private: | |||
| 563 | friend class DeserializeCodeTask; | |||
| 564 | ||||
| 565 | void ReadHeader(Reader* reader); | |||
| 566 | DeserializationUnit ReadCode(int fn_index, Reader* reader); | |||
| 567 | void CopyAndRelocate(const DeserializationUnit& unit); | |||
| 568 | void Publish(std::vector<DeserializationUnit> batch); | |||
| 569 | ||||
| 570 | NativeModule* const native_module_; | |||
| 571 | #ifdef DEBUG | |||
| 572 | bool read_called_ = false; | |||
| 573 | #endif | |||
| 574 | ||||
| 575 | // Updated in {ReadCode}. | |||
| 576 | size_t remaining_code_size_ = 0; | |||
| 577 | base::Vector<byte> current_code_space_; | |||
| 578 | NativeModule::JumpTablesRef current_jump_tables_; | |||
| 579 | std::vector<int> lazy_functions_; | |||
| 580 | std::vector<int> liftoff_functions_; | |||
| 581 | }; | |||
| 582 | ||||
| 583 | class DeserializeCodeTask : public JobTask { | |||
| 584 | public: | |||
| 585 | DeserializeCodeTask(NativeModuleDeserializer* deserializer, | |||
| 586 | DeserializationQueue* reloc_queue) | |||
| 587 | : deserializer_(deserializer), reloc_queue_(reloc_queue) {} | |||
| 588 | ||||
| 589 | void Run(JobDelegate* delegate) override { | |||
| 590 | CodeSpaceWriteScope code_space_write_scope(deserializer_->native_module_); | |||
| 591 | do { | |||
| 592 | // Repeatedly publish everything that was copied already. | |||
| 593 | TryPublishing(delegate); | |||
| 594 | ||||
| 595 | auto batch = reloc_queue_->Pop(); | |||
| 596 | if (batch.empty()) break; | |||
| 597 | for (const auto& unit : batch) { | |||
| 598 | deserializer_->CopyAndRelocate(unit); | |||
| 599 | } | |||
| 600 | publish_queue_.Add(std::move(batch)); | |||
| 601 | delegate->NotifyConcurrencyIncrease(); | |||
| 602 | } while (!delegate->ShouldYield()); | |||
| 603 | } | |||
| 604 | ||||
| 605 | size_t GetMaxConcurrency(size_t /* worker_count */) const override { | |||
| 606 | // Number of copy&reloc batches, plus 1 if there is also something to | |||
| 607 | // publish. | |||
| 608 | bool publish = publishing_.load(std::memory_order_relaxed) == false && | |||
| 609 | publish_queue_.NumBatches() > 0; | |||
| 610 | return reloc_queue_->NumBatches() + (publish ? 1 : 0); | |||
| 611 | } | |||
| 612 | ||||
| 613 | private: | |||
| 614 | void TryPublishing(JobDelegate* delegate) { | |||
| 615 | // Publishing is sequential, so only start publishing if no one else is. | |||
| 616 | if (publishing_.exchange(true, std::memory_order_relaxed)) return; | |||
| 617 | ||||
| 618 | WasmCodeRefScope code_scope; | |||
| 619 | while (true) { | |||
| 620 | bool yield = false; | |||
| 621 | while (!yield) { | |||
| 622 | auto to_publish = publish_queue_.PopAll(); | |||
| 623 | if (to_publish.empty()) break; | |||
| 624 | deserializer_->Publish(std::move(to_publish)); | |||
| 625 | yield = delegate->ShouldYield(); | |||
| 626 | } | |||
| 627 | publishing_.store(false, std::memory_order_relaxed); | |||
| 628 | if (yield) break; | |||
| 629 | // After finishing publishing, check again if new work arrived in the mean | |||
| 630 | // time. If so, continue publishing. | |||
| 631 | if (publish_queue_.NumBatches() == 0) break; | |||
| 632 | if (publishing_.exchange(true, std::memory_order_relaxed)) break; | |||
| 633 | // We successfully reset {publishing_} from {false} to {true}. | |||
| 634 | } | |||
| 635 | } | |||
| 636 | ||||
| 637 | NativeModuleDeserializer* const deserializer_; | |||
| 638 | DeserializationQueue* const reloc_queue_; | |||
| 639 | DeserializationQueue publish_queue_; | |||
| 640 | std::atomic<bool> publishing_{false}; | |||
| 641 | }; | |||
| 642 | ||||
| 643 | NativeModuleDeserializer::NativeModuleDeserializer(NativeModule* native_module) | |||
| 644 | : native_module_(native_module) {} | |||
| 645 | ||||
| 646 | bool NativeModuleDeserializer::Read(Reader* reader) { | |||
| 647 | DCHECK(!read_called_)((void) 0); | |||
| 648 | #ifdef DEBUG | |||
| 649 | read_called_ = true; | |||
| 650 | #endif | |||
| 651 | ||||
| 652 | ReadHeader(reader); | |||
| 653 | uint32_t total_fns = native_module_->num_functions(); | |||
| 654 | uint32_t first_wasm_fn = native_module_->num_imported_functions(); | |||
| 655 | ||||
| 656 | WasmCodeRefScope wasm_code_ref_scope; | |||
| 657 | ||||
| 658 | DeserializationQueue reloc_queue; | |||
| 659 | ||||
| 660 | std::unique_ptr<JobHandle> job_handle = V8::GetCurrentPlatform()->PostJob( | |||
| 661 | TaskPriority::kUserVisible, | |||
| 662 | std::make_unique<DeserializeCodeTask>(this, &reloc_queue)); | |||
| 663 | ||||
| 664 | // Choose a batch size such that we do not create too small batches (>=100k | |||
| 665 | // code bytes), but also not too many (<=100 batches). | |||
| 666 | constexpr size_t kMinBatchSizeInBytes = 100000; | |||
| 667 | size_t batch_limit = | |||
| 668 | std::max(kMinBatchSizeInBytes, remaining_code_size_ / 100); | |||
| 669 | ||||
| 670 | std::vector<DeserializationUnit> batch; | |||
| 671 | size_t batch_size = 0; | |||
| 672 | CodeSpaceWriteScope code_space_write_scope(native_module_); | |||
| 673 | for (uint32_t i = first_wasm_fn; i < total_fns; ++i) { | |||
| 674 | DeserializationUnit unit = ReadCode(i, reader); | |||
| 675 | if (!unit.code) continue; | |||
| 676 | batch_size += unit.code->instructions().size(); | |||
| 677 | batch.emplace_back(std::move(unit)); | |||
| 678 | if (batch_size >= batch_limit) { | |||
| 679 | reloc_queue.Add(std::move(batch)); | |||
| 680 | DCHECK(batch.empty())((void) 0); | |||
| 681 | batch_size = 0; | |||
| 682 | job_handle->NotifyConcurrencyIncrease(); | |||
| 683 | } | |||
| 684 | } | |||
| 685 | ||||
| 686 | // We should have read the expected amount of code now, and should have fully | |||
| 687 | // utilized the allocated code space. | |||
| 688 | DCHECK_EQ(0, remaining_code_size_)((void) 0); | |||
| 689 | DCHECK_EQ(0, current_code_space_.size())((void) 0); | |||
| 690 | ||||
| 691 | if (!batch.empty()) { | |||
| 692 | reloc_queue.Add(std::move(batch)); | |||
| ||||
| 693 | job_handle->NotifyConcurrencyIncrease(); | |||
| 694 | } | |||
| 695 | ||||
| 696 | // Wait for all tasks to finish, while participating in their work. | |||
| 697 | job_handle->Join(); | |||
| 698 | ||||
| 699 | return reader->current_size() == 0; | |||
| 700 | } | |||
| 701 | ||||
| 702 | void NativeModuleDeserializer::ReadHeader(Reader* reader) { | |||
| 703 | remaining_code_size_ = reader->Read<size_t>(); | |||
| 704 | } | |||
| 705 | ||||
| 706 | DeserializationUnit NativeModuleDeserializer::ReadCode(int fn_index, | |||
| 707 | Reader* reader) { | |||
| 708 | uint8_t code_kind = reader->Read<uint8_t>(); | |||
| 709 | if (code_kind == kLazyFunction) { | |||
| 710 | lazy_functions_.push_back(fn_index); | |||
| 711 | return {}; | |||
| 712 | } | |||
| 713 | if (code_kind == kLiftoffFunction) { | |||
| 714 | liftoff_functions_.push_back(fn_index); | |||
| 715 | return {}; | |||
| 716 | } | |||
| 717 | ||||
| 718 | int constant_pool_offset = reader->Read<int>(); | |||
| 719 | int safepoint_table_offset = reader->Read<int>(); | |||
| 720 | int handler_table_offset = reader->Read<int>(); | |||
| 721 | int code_comment_offset = reader->Read<int>(); | |||
| 722 | int unpadded_binary_size = reader->Read<int>(); | |||
| 723 | int stack_slot_count = reader->Read<int>(); | |||
| 724 | uint32_t tagged_parameter_slots = reader->Read<uint32_t>(); | |||
| 725 | int code_size = reader->Read<int>(); | |||
| 726 | int reloc_size = reader->Read<int>(); | |||
| 727 | int source_position_size = reader->Read<int>(); | |||
| 728 | int protected_instructions_size = reader->Read<int>(); | |||
| 729 | WasmCode::Kind kind = reader->Read<WasmCode::Kind>(); | |||
| 730 | ExecutionTier tier = reader->Read<ExecutionTier>(); | |||
| 731 | ||||
| 732 | DCHECK(IsAligned(code_size, kCodeAlignment))((void) 0); | |||
| 733 | DCHECK_GE(remaining_code_size_, code_size)((void) 0); | |||
| 734 | if (current_code_space_.size() < static_cast<size_t>(code_size)) { | |||
| 735 | // Allocate the next code space. Don't allocate more than 90% of | |||
| 736 | // {kMaxCodeSpaceSize}, to leave some space for jump tables. | |||
| 737 | constexpr size_t kMaxReservation = | |||
| 738 | RoundUp<kCodeAlignment>(WasmCodeAllocator::kMaxCodeSpaceSize * 9 / 10); | |||
| 739 | size_t code_space_size = std::min(kMaxReservation, remaining_code_size_); | |||
| 740 | std::tie(current_code_space_, current_jump_tables_) = | |||
| 741 | native_module_->AllocateForDeserializedCode(code_space_size); | |||
| 742 | DCHECK_EQ(current_code_space_.size(), code_space_size)((void) 0); | |||
| 743 | DCHECK(current_jump_tables_.is_valid())((void) 0); | |||
| 744 | } | |||
| 745 | ||||
| 746 | DeserializationUnit unit; | |||
| 747 | unit.src_code_buffer = reader->ReadVector<byte>(code_size); | |||
| 748 | auto reloc_info = reader->ReadVector<byte>(reloc_size); | |||
| 749 | auto source_pos = reader->ReadVector<byte>(source_position_size); | |||
| 750 | auto protected_instructions = | |||
| 751 | reader->ReadVector<byte>(protected_instructions_size); | |||
| 752 | ||||
| 753 | base::Vector<uint8_t> instructions = | |||
| 754 | current_code_space_.SubVector(0, code_size); | |||
| 755 | current_code_space_ += code_size; | |||
| 756 | remaining_code_size_ -= code_size; | |||
| 757 | ||||
| 758 | unit.code = native_module_->AddDeserializedCode( | |||
| 759 | fn_index, instructions, stack_slot_count, tagged_parameter_slots, | |||
| 760 | safepoint_table_offset, handler_table_offset, constant_pool_offset, | |||
| 761 | code_comment_offset, unpadded_binary_size, protected_instructions, | |||
| 762 | reloc_info, source_pos, kind, tier); | |||
| 763 | unit.jump_tables = current_jump_tables_; | |||
| 764 | return unit; | |||
| 765 | } | |||
| 766 | ||||
| 767 | void NativeModuleDeserializer::CopyAndRelocate( | |||
| 768 | const DeserializationUnit& unit) { | |||
| 769 | memcpy(unit.code->instructions().begin(), unit.src_code_buffer.begin(), | |||
| 770 | unit.src_code_buffer.size()); | |||
| 771 | ||||
| 772 | // Relocate the code. | |||
| 773 | int mask = RelocInfo::ModeMask(RelocInfo::WASM_CALL) | | |||
| 774 | RelocInfo::ModeMask(RelocInfo::WASM_STUB_CALL) | | |||
| 775 | RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | |||
| 776 | RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | |||
| 777 | RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |||
| 778 | for (RelocIterator iter(unit.code->instructions(), unit.code->reloc_info(), | |||
| 779 | unit.code->constant_pool(), mask); | |||
| 780 | !iter.done(); iter.next()) { | |||
| 781 | RelocInfo::Mode mode = iter.rinfo()->rmode(); | |||
| 782 | switch (mode) { | |||
| 783 | case RelocInfo::WASM_CALL: { | |||
| 784 | uint32_t tag = GetWasmCalleeTag(iter.rinfo()); | |||
| 785 | Address target = | |||
| 786 | native_module_->GetNearCallTargetForFunction(tag, unit.jump_tables); | |||
| 787 | iter.rinfo()->set_wasm_call_address(target, SKIP_ICACHE_FLUSH); | |||
| 788 | break; | |||
| 789 | } | |||
| 790 | case RelocInfo::WASM_STUB_CALL: { | |||
| 791 | uint32_t tag = GetWasmCalleeTag(iter.rinfo()); | |||
| 792 | DCHECK_LT(tag, WasmCode::kRuntimeStubCount)((void) 0); | |||
| 793 | Address target = native_module_->GetNearRuntimeStubEntry( | |||
| 794 | static_cast<WasmCode::RuntimeStubId>(tag), unit.jump_tables); | |||
| 795 | iter.rinfo()->set_wasm_stub_call_address(target, SKIP_ICACHE_FLUSH); | |||
| 796 | break; | |||
| 797 | } | |||
| 798 | case RelocInfo::EXTERNAL_REFERENCE: { | |||
| 799 | uint32_t tag = GetWasmCalleeTag(iter.rinfo()); | |||
| 800 | Address address = ExternalReferenceList::Get().address_from_tag(tag); | |||
| 801 | iter.rinfo()->set_target_external_reference(address, SKIP_ICACHE_FLUSH); | |||
| 802 | break; | |||
| 803 | } | |||
| 804 | case RelocInfo::INTERNAL_REFERENCE: | |||
| 805 | case RelocInfo::INTERNAL_REFERENCE_ENCODED: { | |||
| 806 | Address offset = iter.rinfo()->target_internal_reference(); | |||
| 807 | Address target = unit.code->instruction_start() + offset; | |||
| 808 | Assembler::deserialization_set_target_internal_reference_at( | |||
| 809 | iter.rinfo()->pc(), target, mode); | |||
| 810 | break; | |||
| 811 | } | |||
| 812 | default: | |||
| 813 | UNREACHABLE()V8_Fatal("unreachable code"); | |||
| 814 | } | |||
| 815 | } | |||
| 816 | ||||
| 817 | // Finally, flush the icache for that code. | |||
| 818 | FlushInstructionCache(unit.code->instructions().begin(), | |||
| 819 | unit.code->instructions().size()); | |||
| 820 | } | |||
| 821 | ||||
| 822 | void NativeModuleDeserializer::Publish(std::vector<DeserializationUnit> batch) { | |||
| 823 | DCHECK(!batch.empty())((void) 0); | |||
| 824 | std::vector<std::unique_ptr<WasmCode>> codes; | |||
| 825 | codes.reserve(batch.size()); | |||
| 826 | for (auto& unit : batch) { | |||
| 827 | codes.emplace_back(std::move(unit).code); | |||
| 828 | } | |||
| 829 | auto published_codes = native_module_->PublishCode(base::VectorOf(codes)); | |||
| 830 | for (auto* wasm_code : published_codes) { | |||
| 831 | wasm_code->MaybePrint(); | |||
| 832 | wasm_code->Validate(); | |||
| 833 | } | |||
| 834 | } | |||
| 835 | ||||
| 836 | bool IsSupportedVersion(base::Vector<const byte> header) { | |||
| 837 | if (header.size() < WasmSerializer::kHeaderSize) return false; | |||
| 838 | byte current_version[WasmSerializer::kHeaderSize]; | |||
| 839 | Writer writer({current_version, WasmSerializer::kHeaderSize}); | |||
| 840 | WriteHeader(&writer); | |||
| 841 | return memcmp(header.begin(), current_version, WasmSerializer::kHeaderSize) == | |||
| 842 | 0; | |||
| 843 | } | |||
| 844 | ||||
| 845 | MaybeHandle<WasmModuleObject> DeserializeNativeModule( | |||
| 846 | Isolate* isolate, base::Vector<const byte> data, | |||
| 847 | base::Vector<const byte> wire_bytes_vec, | |||
| 848 | base::Vector<const char> source_url) { | |||
| 849 | if (!IsWasmCodegenAllowed(isolate, isolate->native_context())) return {}; | |||
| ||||
| 850 | if (!IsSupportedVersion(data)) return {}; | |||
| 851 | ||||
| 852 | // Make the copy of the wire bytes early, so we use the same memory for | |||
| 853 | // decoding, lookup in the native module cache, and insertion into the cache. | |||
| 854 | auto owned_wire_bytes = base::OwnedVector<uint8_t>::Of(wire_bytes_vec); | |||
| 855 | ||||
| 856 | // TODO(titzer): module features should be part of the serialization format. | |||
| 857 | WasmEngine* wasm_engine = GetWasmEngine(); | |||
| 858 | WasmFeatures enabled_features = WasmFeatures::FromIsolate(isolate); | |||
| 859 | ModuleResult decode_result = DecodeWasmModule( | |||
| 860 | enabled_features, owned_wire_bytes.start(), owned_wire_bytes.end(), false, | |||
| 861 | i::wasm::kWasmOrigin, isolate->counters(), isolate->metrics_recorder(), | |||
| 862 | isolate->GetOrRegisterRecorderContextId(isolate->native_context()), | |||
| 863 | DecodingMethod::kDeserialize, wasm_engine->allocator()); | |||
| 864 | if (decode_result.failed()) return {}; | |||
| 865 | std::shared_ptr<WasmModule> module = std::move(decode_result).value(); | |||
| 866 | CHECK_NOT_NULL(module)do { if ((__builtin_expect(!!(!((module) != nullptr)), 0))) { V8_Fatal("Check failed: %s.", "(module) != nullptr"); } } while (false); | |||
| 867 | ||||
| 868 | auto shared_native_module = wasm_engine->MaybeGetNativeModule( | |||
| 869 | module->origin, owned_wire_bytes.as_vector(), isolate); | |||
| 870 | if (shared_native_module == nullptr) { | |||
| 871 | DynamicTiering dynamic_tiering = isolate->IsWasmDynamicTieringEnabled() | |||
| 872 | ? DynamicTiering::kEnabled | |||
| 873 | : DynamicTiering::kDisabled; | |||
| 874 | const bool kIncludeLiftoff = dynamic_tiering == DynamicTiering::kDisabled; | |||
| 875 | size_t code_size_estimate = | |||
| 876 | wasm::WasmCodeManager::EstimateNativeModuleCodeSize( | |||
| 877 | module.get(), kIncludeLiftoff, dynamic_tiering); | |||
| 878 | shared_native_module = wasm_engine->NewNativeModule( | |||
| 879 | isolate, enabled_features, std::move(module), code_size_estimate); | |||
| 880 | // We have to assign a compilation ID here, as it is required for a | |||
| 881 | // potential re-compilation, e.g. triggered by | |||
| 882 | // {TierDownAllModulesPerIsolate}. The value is -2 so that it is different | |||
| 883 | // than the compilation ID of actual compilations, and also different than | |||
| 884 | // the sentinel value of the CompilationState. | |||
| 885 | shared_native_module->compilation_state()->set_compilation_id(-2); | |||
| 886 | shared_native_module->SetWireBytes(std::move(owned_wire_bytes)); | |||
| 887 | ||||
| 888 | NativeModuleDeserializer deserializer(shared_native_module.get()); | |||
| 889 | Reader reader(data + WasmSerializer::kHeaderSize); | |||
| 890 | bool error = !deserializer.Read(&reader); | |||
| 891 | if (error) { | |||
| 892 | wasm_engine->UpdateNativeModuleCache(error, &shared_native_module, | |||
| 893 | isolate); | |||
| 894 | return {}; | |||
| 895 | } | |||
| 896 | shared_native_module->compilation_state()->InitializeAfterDeserialization( | |||
| 897 | deserializer.lazy_functions(), deserializer.liftoff_functions()); | |||
| 898 | wasm_engine->UpdateNativeModuleCache(error, &shared_native_module, isolate); | |||
| 899 | } | |||
| 900 | ||||
| 901 | Handle<FixedArray> export_wrappers; | |||
| 902 | CompileJsToWasmWrappers(isolate, shared_native_module->module(), | |||
| 903 | &export_wrappers); | |||
| 904 | ||||
| 905 | Handle<Script> script = | |||
| 906 | wasm_engine->GetOrCreateScript(isolate, shared_native_module, source_url); | |||
| 907 | Handle<WasmModuleObject> module_object = WasmModuleObject::New( | |||
| 908 | isolate, shared_native_module, script, export_wrappers); | |||
| 909 | ||||
| 910 | // Finish the Wasm script now and make it public to the debugger. | |||
| 911 | isolate->debug()->OnAfterCompile(script); | |||
| 912 | ||||
| 913 | // Log the code within the generated module for profiling. | |||
| 914 | shared_native_module->LogWasmCodes(isolate, *script); | |||
| 915 | ||||
| 916 | return module_object; | |||
| 917 | } | |||
| 918 | ||||
| 919 | } // namespace wasm | |||
| 920 | } // namespace internal | |||
| 921 | } // namespace v8 |