v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
external-reference.cc
Go to the documentation of this file.
1// Copyright 2018 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
6
7#include <optional>
8
11#include "src/api/api-inl.h"
12#include "src/base/bits.h"
13#include "src/base/ieee754.h"
15#include "src/common/globals.h"
16#include "src/date/date.h"
17#include "src/debug/debug.h"
24#include "src/heap/heap-inl.h"
25#include "src/heap/heap.h"
26#include "src/ic/stub-cache.h"
29#include "src/logging/log.h"
31#include "src/numbers/ieee754.h"
38#include "src/objects/simd.h"
46#include "third_party/fp16/src/include/fp16.h"
47
48#if V8_ENABLE_WEBASSEMBLY
50#include "src/wasm/wasm-js.h"
51#endif // V8_ENABLE_WEBASSEMBLY
52
53#ifdef V8_INTL_SUPPORT
54#include "src/base/strings.h"
56#endif // V8_INTL_SUPPORT
57
58namespace v8 {
59namespace internal {
60
61// -----------------------------------------------------------------------------
62// Common double constants.
63
65constexpr double double_one_half_constant = 0.5;
68 static_cast<double>(kMaxUInt32) + 1;
69
70constexpr struct alignas(16) {
71 uint16_t a;
72 uint16_t b;
73 uint16_t c;
74 uint16_t d;
75 uint16_t e;
76 uint16_t f;
77 uint16_t g;
78 uint16_t h;
79} fp16_absolute_constant = {0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,
80 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF};
81
82constexpr struct alignas(16) {
83 uint16_t a;
84 uint16_t b;
85 uint16_t c;
86 uint16_t d;
87 uint16_t e;
88 uint16_t f;
89 uint16_t g;
90 uint16_t h;
91} fp16_negate_constant = {0x8000, 0x8000, 0x8000, 0x8000,
92 0x8000, 0x8000, 0x8000, 0x8000};
93
94constexpr struct alignas(16) {
95 uint32_t a;
96 uint32_t b;
97 uint32_t c;
98 uint32_t d;
99} float_absolute_constant = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
100
101constexpr struct alignas(16) {
102 uint32_t a;
103 uint32_t b;
104 uint32_t c;
105 uint32_t d;
106} float_negate_constant = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
107
108constexpr struct alignas(16) {
109 uint64_t a;
110 uint64_t b;
111} double_absolute_constant = {uint64_t{0x7FFFFFFFFFFFFFFF},
112 uint64_t{0x7FFFFFFFFFFFFFFF}};
113
114constexpr struct alignas(16) {
115 uint64_t a;
116 uint64_t b;
117} double_negate_constant = {uint64_t{0x8000000000000000},
118 uint64_t{0x8000000000000000}};
119
120constexpr struct alignas(16) {
121 uint64_t a;
122 uint64_t b;
123} wasm_i8x16_swizzle_mask = {uint64_t{0x70707070'70707070},
124 uint64_t{0x70707070'70707070}};
125
126constexpr struct alignas(16) {
127 uint64_t a;
128 uint64_t b;
129} wasm_i8x16_popcnt_mask = {uint64_t{0x03020201'02010100},
130 uint64_t{0x04030302'03020201}};
131
132constexpr struct alignas(16) {
133 uint64_t a;
134 uint64_t b;
135} wasm_i8x16_splat_0x01 = {uint64_t{0x01010101'01010101},
136 uint64_t{0x01010101'01010101}};
137
138constexpr struct alignas(16) {
139 uint64_t a;
140 uint64_t b;
141} wasm_i8x16_splat_0x0f = {uint64_t{0x0F0F0F0F'0F0F0F0F},
142 uint64_t{0x0F0F0F0F'0F0F0F0F}};
143
144constexpr struct alignas(16) {
145 uint64_t a;
146 uint64_t b;
147} wasm_i8x16_splat_0x33 = {uint64_t{0x33333333'33333333},
148 uint64_t{0x33333333'33333333}};
149
150constexpr struct alignas(16) {
151 uint64_t a;
152 uint64_t b;
153} wasm_i8x16_splat_0x55 = {uint64_t{0x55555555'55555555},
154 uint64_t{0x55555555'55555555}};
155
156constexpr struct alignas(16) {
157 uint64_t a;
158 uint64_t b;
159} wasm_i16x8_splat_0x0001 = {uint64_t{0x00010001'00010001},
160 uint64_t{0x00010001'00010001}};
161
162constexpr struct alignas(16) {
163 uint64_t a;
164 uint64_t b;
165} wasm_f64x2_convert_low_i32x4_u_int_mask = {uint64_t{0x4330000043300000},
166 uint64_t{0x4330000043300000}};
167
168constexpr struct alignas(16) {
169 uint64_t a;
170 uint64_t b;
171} wasm_double_2_power_52 = {uint64_t{0x4330000000000000},
172 uint64_t{0x4330000000000000}};
173
174constexpr struct alignas(16) {
175 uint64_t a;
176 uint64_t b;
177} wasm_int32_max_as_double = {uint64_t{0x41dfffffffc00000},
178 uint64_t{0x41dfffffffc00000}};
179
180constexpr struct alignas(16) {
181 uint64_t a;
182 uint64_t b;
183} wasm_uint32_max_as_double = {uint64_t{0x41efffffffe00000},
184 uint64_t{0x41efffffffe00000}};
185
186// This is 2147483648.0, which is 1 more than INT32_MAX.
187constexpr struct alignas(16) {
188 uint32_t a;
189 uint32_t b;
190 uint32_t c;
191 uint32_t d;
193 uint32_t{0x4f00'0000},
194 uint32_t{0x4f00'0000},
195 uint32_t{0x4f00'0000},
196 uint32_t{0x4f00'0000},
198
199constexpr struct alignas(16) {
200 uint32_t a;
201 uint32_t b;
202 uint32_t c;
203 uint32_t d;
204 uint32_t e;
205 uint32_t f;
206 uint32_t g;
207 uint32_t h;
209 uint32_t{0x4f00'0000}, uint32_t{0x4f00'0000}, uint32_t{0x4f00'0000},
210 uint32_t{0x4f00'0000}, uint32_t{0x4f00'0000}, uint32_t{0x4f00'0000},
211 uint32_t{0x4f00'0000}, uint32_t{0x4f00'0000},
213
214// Implementation of ExternalReference
215
217 return (raw_ > 0 && raw_ <= static_cast<Address>(kNumIsolateFieldIds));
218}
219
221 // If this CHECK triggers, then an ExternalReference gets created with an
222 // IsolateFieldId where the root register is not available, and therefore
223 // IsolateFieldIds cannot be used, or ExternalReferences with IsolateFieldIds
224 // don't get supported yet and support should be added.
226 return raw_;
227}
228
231 return static_cast<int32_t>(
233}
234
236 switch (result_size) {
237 case 1:
239 case 2:
241 }
242 UNREACHABLE();
243}
244
245// static
249
250// static
252 Isolate* isolate, ApiFunction* fun, Type type, Address* c_functions,
253 const CFunctionInfo* const* c_signatures, unsigned num_functions) {
254#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
255 isolate->simulator_data()->RegisterFunctionsAndSignatures(
256 c_functions, c_signatures, num_functions);
257#endif // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
258 return ExternalReference(Redirect(fun->address(), type));
259}
260
261// static
265
266// static
270
271// static
276
277// static
281
285
287 return ExternalReference(IsolateFieldId::kIsolateAddress);
288}
289
291 return ExternalReference(IsolateFieldId::kJsLimitAddress);
292}
293
294ExternalReference ExternalReference::handle_scope_implementer_address(
295 Isolate* isolate) {
296 return ExternalReference(isolate->handle_scope_implementer_address());
297}
298
299#ifdef V8_ENABLE_SANDBOX
300ExternalReference ExternalReference::sandbox_base_address() {
301 return ExternalReference(Sandbox::current()->base_address());
302}
303
304ExternalReference ExternalReference::sandbox_end_address() {
305 return ExternalReference(Sandbox::current()->end_address());
306}
307
308ExternalReference ExternalReference::empty_backing_store_buffer() {
309 return ExternalReference(
310 Sandbox::current()->constants().empty_backing_store_buffer_address());
311}
312
313ExternalReference ExternalReference::external_pointer_table_address(
314 Isolate* isolate) {
315 return ExternalReference(isolate->external_pointer_table_address());
316}
317
318ExternalReference
319ExternalReference::shared_external_pointer_table_address_address(
320 Isolate* isolate) {
321 return ExternalReference(
322 isolate->shared_external_pointer_table_address_address());
323}
324
325ExternalReference ExternalReference::trusted_pointer_table_base_address(
326 Isolate* isolate) {
327 // TODO(saelo): maybe the external pointer table external references should
328 // also directly return the table base address?
329 return ExternalReference(isolate->trusted_pointer_table_base_address());
330}
331
332ExternalReference ExternalReference::shared_trusted_pointer_table_base_address(
333 Isolate* isolate) {
334 // TODO(saelo): maybe the external pointer table external references should
335 // also directly return the table base address?
336 return ExternalReference(
337 isolate->shared_trusted_pointer_table_base_address());
338}
339
340ExternalReference
342 return ExternalReference(IsolateFieldId::kCodePointerTableBaseAddress);
343}
344
345ExternalReference ExternalReference::code_pointer_table_base_address(
346 Isolate* isolate) {
347 return ExternalReference(isolate->code_pointer_table_base_address());
348}
349
350#ifndef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
351ExternalReference ExternalReference::global_code_pointer_table_base_address() {
352 return ExternalReference(
353 IsolateGroup::current()->code_pointer_table()->base_address());
354}
355#endif
356
357ExternalReference ExternalReference::memory_chunk_metadata_table_address() {
358 return ExternalReference(
359 reinterpret_cast<Address>(MemoryChunk::MetadataTableAddress()));
360}
361
362#endif // V8_ENABLE_SANDBOX
363
364#ifdef V8_ENABLE_LEAPTIERING
365
366ExternalReference ExternalReference::js_dispatch_table_address() {
367 // TODO(saelo): maybe rename to js_dispatch_table_base_address?
368 return ExternalReference(
369 IsolateGroup::current()->js_dispatch_table()->base_address());
370}
371
372#endif // V8_ENABLE_LEAPTIERING
373
374ExternalReference ExternalReference::interpreter_dispatch_table_address(
375 Isolate* isolate) {
376 return ExternalReference(isolate->interpreter()->dispatch_table_address());
377}
378
379ExternalReference ExternalReference::interpreter_dispatch_counters(
380 Isolate* isolate) {
381 return ExternalReference(
382 isolate->interpreter()->bytecode_dispatch_counters_table());
383}
384
385ExternalReference
386ExternalReference::address_of_interpreter_entry_trampoline_instruction_start(
387 Isolate* isolate) {
388 return ExternalReference(
389 isolate->interpreter()
390 ->address_of_interpreter_entry_trampoline_instruction_start());
391}
392
393ExternalReference ExternalReference::bytecode_size_table_address() {
394 return ExternalReference(
396}
397
398// static
400 return ExternalReference(
401 reinterpret_cast<Address>(counter->GetInternalPointer()));
402}
403
404// static
406 Isolate* isolate) {
407 return ExternalReference(isolate->get_address_from_id(id));
408}
409
410// static
414
415namespace {
416
417// Helper function to verify that all types in a list of types are scalar.
418// This includes primitive types (int, Address) and pointer types. We also
419// allow void.
420template <typename T>
421constexpr bool AllScalar() {
422 return std::is_scalar_v<T> || std::is_void_v<T>;
423}
424
425template <typename T1, typename T2, typename... Rest>
426constexpr bool AllScalar() {
427 return AllScalar<T1>() && AllScalar<T2, Rest...>();
428}
429
430// Checks a function pointer's type for compatibility with the
431// ExternalReference calling mechanism. Specifically, all arguments
432// as well as the result type must pass the AllScalar check above,
433// because we expect each item to fit into one register or stack slot.
434template <typename T>
435struct IsValidExternalReferenceType;
436
437template <typename Result, typename... Args>
438struct IsValidExternalReferenceType<Result (*)(Args...)> {
439 static const bool value = AllScalar<Result, Args...>();
440};
441
442template <typename Result, typename Class, typename... Args>
443struct IsValidExternalReferenceType<Result (Class::*)(Args...)> {
444 static const bool value = AllScalar<Result, Args...>();
445};
446
447} // namespace
448
449// .. for functions that will not be called through CallCFunction. For these,
450// all signatures are valid.
451#define RAW_FUNCTION_REFERENCE(Name, Target) \
452 ExternalReference ExternalReference::Name() { \
453 return ExternalReference(FUNCTION_ADDR(Target)); \
454 }
455
456// .. for functions that will be called through CallCFunction.
457#define FUNCTION_REFERENCE(Name, Target) \
458 ExternalReference ExternalReference::Name() { \
459 static_assert(IsValidExternalReferenceType<decltype(&Target)>::value); \
460 return ExternalReference(Redirect(FUNCTION_ADDR(Target))); \
461 }
462
463#define FUNCTION_REFERENCE_WITH_TYPE(Name, Target, Type) \
464 ExternalReference ExternalReference::Name() { \
465 static_assert(IsValidExternalReferenceType<decltype(&Target)>::value); \
466 return ExternalReference(Redirect(FUNCTION_ADDR(Target), Type)); \
467 }
468
469uint32_t fp64_to_fp16_raw_bits(double input) { return DoubleToFloat16(input); }
470
471// Since floating point parameters and return value are not supported
472// for C-linkage functions on 32bit architectures, we should use raw bits.
474 uint32_t lo) {
475 uint64_t input = static_cast<uint64_t>(hi) << 32 | lo;
476 return DoubleToFloat16(std::bit_cast<double, uint64_t>(input));
477}
478
479// Since floating point parameters and return value are not supported
480// for C-linkage functions on 32bit architectures, we should use raw bits.
481uint32_t fp16_raw_bits_ieee_to_fp32_raw_bits(uint32_t input) {
482 float value = fp16_ieee_to_fp32_value(input);
483 return std::bit_cast<uint32_t, float>(value);
484}
485
486FUNCTION_REFERENCE(ieee754_fp64_raw_bits_to_fp16_raw_bits_for_32bit_arch,
488
489FUNCTION_REFERENCE_WITH_TYPE(ieee754_fp64_to_fp16_raw_bits,
490 fp64_to_fp16_raw_bits, BUILTIN_INT_FP_CALL)
491
492FUNCTION_REFERENCE(ieee754_fp16_raw_bits_to_fp32_raw_bits,
494
495FUNCTION_REFERENCE(write_barrier_marking_from_code_function,
496 WriteBarrier::MarkingFromCode)
497
498FUNCTION_REFERENCE(write_barrier_indirect_pointer_marking_from_code_function,
499 WriteBarrier::IndirectPointerMarkingFromCode)
500
501FUNCTION_REFERENCE(write_barrier_shared_marking_from_code_function,
502 WriteBarrier::SharedMarkingFromCode)
503
504FUNCTION_REFERENCE(shared_barrier_from_code_function,
505 WriteBarrier::SharedFromCode)
506
507FUNCTION_REFERENCE(insert_remembered_set_function,
508 Heap::InsertIntoRememberedSetFromCode)
509
510namespace {
511
512intptr_t DebugBreakAtEntry(Isolate* isolate, Address raw_sfi) {
516 return isolate->debug()->BreakAtEntry(sfi) ? 1 : 0;
517}
518
523 std::optional<Tagged<DebugInfo>> debug_info =
524 isolate->debug()->TryGetDebugInfo(sfi);
525 if (debug_info.has_value() && debug_info.value()->HasCoverageInfo()) {
526 return debug_info.value()->coverage_info().ptr();
527 }
528 return Smi::zero().ptr();
529}
530
531} // namespace
532
533FUNCTION_REFERENCE(debug_break_at_entry_function, DebugBreakAtEntry)
534FUNCTION_REFERENCE(debug_get_coverage_info_function, DebugGetCoverageInfo)
535
536FUNCTION_REFERENCE(delete_handle_scope_extensions,
537 HandleScope::DeleteExtensions)
538
539FUNCTION_REFERENCE(ephemeron_key_write_barrier_function,
540 WriteBarrier::EphemeronKeyWriteBarrierFromCode)
541
543 Isolate* isolate, Address pointer) {
544#ifdef V8_ENABLE_SANDBOX
545 return isolate->external_pointer_table().AllocateAndInitializeEntry(
546 isolate->heap()->young_external_pointer_space(), pointer,
548#else
549 return 0;
550#endif // V8_ENABLE_SANDBOX
551}
552
553FUNCTION_REFERENCE(allocate_and_initialize_young_external_pointer_table_entry,
555
556FUNCTION_REFERENCE(get_date_field_function, JSDate::GetField)
557
558ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) {
559 return ExternalReference(isolate->date_cache()->stamp_address());
560}
561
562// static
563ExternalReference
565 Isolate* isolate) {
566 return runtime_function_table_address(isolate);
567}
568
569// static
571#ifdef USE_SIMULATOR
572 return SimulatorBase::RedirectExternalReference(external_function, type);
573#else
574 return external_function;
575#endif
576}
577
578// static
580#ifdef USE_SIMULATOR
581 return SimulatorBase::UnwrapRedirection(redirection_trampoline);
582#else
583 return redirection_trampoline;
584#endif
585}
586
587ExternalReference ExternalReference::stress_deopt_count(Isolate* isolate) {
588 return ExternalReference(isolate->stress_deopt_count_address());
589}
590
591ExternalReference ExternalReference::force_slow_path(Isolate* isolate) {
592 return ExternalReference(isolate->force_slow_path_address());
593}
594
595FUNCTION_REFERENCE(new_deoptimizer_function, Deoptimizer::New)
596
597FUNCTION_REFERENCE(compute_output_frames_function,
598 Deoptimizer::ComputeOutputFrames)
599
600#ifdef V8_ENABLE_CET_SHADOW_STACK
601FUNCTION_REFERENCE(ensure_valid_return_address,
603#endif // V8_ENABLE_CET_SHADOW_STACK
604
605#ifdef V8_ENABLE_WEBASSEMBLY
606FUNCTION_REFERENCE(wasm_switch_stacks, wasm::switch_stacks)
607FUNCTION_REFERENCE(wasm_return_switch, wasm::return_switch)
608FUNCTION_REFERENCE(wasm_switch_to_the_central_stack,
610FUNCTION_REFERENCE(wasm_switch_from_the_central_stack,
612FUNCTION_REFERENCE(wasm_switch_to_the_central_stack_for_js,
614FUNCTION_REFERENCE(wasm_switch_from_the_central_stack_for_js,
616FUNCTION_REFERENCE(wasm_grow_stack, wasm::grow_stack)
617FUNCTION_REFERENCE(wasm_shrink_stack, wasm::shrink_stack)
618FUNCTION_REFERENCE(wasm_load_old_fp, wasm::load_old_fp)
635FUNCTION_REFERENCE(wasm_float32_to_int64_sat,
637FUNCTION_REFERENCE(wasm_float32_to_uint64_sat,
639FUNCTION_REFERENCE(wasm_float64_to_int64_sat,
641FUNCTION_REFERENCE(wasm_float64_to_uint64_sat,
684FUNCTION_REFERENCE(wasm_i16x8_sconvert_f16x8,
686FUNCTION_REFERENCE(wasm_i16x8_uconvert_f16x8,
688FUNCTION_REFERENCE(wasm_f16x8_sconvert_i16x8,
690FUNCTION_REFERENCE(wasm_f16x8_uconvert_i16x8,
692FUNCTION_REFERENCE(wasm_f32x4_promote_low_f16x8,
694FUNCTION_REFERENCE(wasm_f16x8_demote_f32x4_zero,
696FUNCTION_REFERENCE(wasm_f16x8_demote_f64x2_zero,
707 BUILTIN_FP_POINTER_CALL)
708
709int32_t (&futex_emulation_wake)(void*, uint32_t) = FutexEmulation::Wake;
710FUNCTION_REFERENCE(wasm_atomic_notify, futex_emulation_wake)
711
712#define V(Name) RAW_FUNCTION_REFERENCE(wasm_##Name, wasm::Name)
714#undef V
715
716ExternalReference ExternalReference::wasm_code_pointer_table() {
718}
719
720#endif // V8_ENABLE_WEBASSEMBLY
721
722namespace {
723class GCedBuffer final : public cppgc::GarbageCollected<GCedBuffer> {
724 public:
725 void Trace(cppgc::Visitor* visitor) const {}
726};
727
728void* allocate_buffer_impl(Isolate* isolate, size_t size) {
730 isolate->heap()->cpp_heap()->GetAllocationHandle(),
733 return result;
734}
735
736} // namespace
737
738FUNCTION_REFERENCE(allocate_buffer, allocate_buffer_impl)
739
740static void f64_acos_wrapper(Address data) {
741 double input = ReadUnalignedValue<double>(data);
742 WriteUnalignedValue(data, base::ieee754::acos(input));
743}
744
745FUNCTION_REFERENCE(f64_acos_wrapper_function, f64_acos_wrapper)
746
747static void f64_asin_wrapper(Address data) {
748 double input = ReadUnalignedValue<double>(data);
749 WriteUnalignedValue<double>(data, base::ieee754::asin(input));
750}
751
752FUNCTION_REFERENCE(f64_asin_wrapper_function, f64_asin_wrapper)
753
754
755static void f64_mod_wrapper(Address data) {
756 double dividend = ReadUnalignedValue<double>(data);
757 double divisor = ReadUnalignedValue<double>(data + sizeof(dividend));
758 WriteUnalignedValue<double>(data, Modulo(dividend, divisor));
759}
760
761FUNCTION_REFERENCE(f64_mod_wrapper_function, f64_mod_wrapper)
762
763ExternalReference ExternalReference::isolate_root(Isolate* isolate) {
764 return ExternalReference(isolate->isolate_root());
765}
766
767ExternalReference ExternalReference::allocation_sites_list_address(
768 Isolate* isolate) {
769 return ExternalReference(isolate->heap()->allocation_sites_list_address());
770}
771
772ExternalReference ExternalReference::address_of_jslimit(Isolate* isolate) {
773 Address address = isolate->stack_guard()->address_of_jslimit();
774 // For efficient generated code, this should be root-register-addressable.
775 DCHECK(isolate->root_register_addressable_region().contains(address));
777}
778
779ExternalReference ExternalReference::address_of_no_heap_write_interrupt_request(
780 Isolate* isolate) {
781 Address address = isolate->stack_guard()->address_of_interrupt_request(
783 // For efficient generated code, this should be root-register-addressable.
784 DCHECK(isolate->root_register_addressable_region().contains(address));
786}
787
788ExternalReference ExternalReference::address_of_real_jslimit(Isolate* isolate) {
789 Address address = isolate->stack_guard()->address_of_real_jslimit();
790 // For efficient generated code, this should be root-register-addressable.
791 DCHECK(isolate->root_register_addressable_region().contains(address));
793}
794
795ExternalReference ExternalReference::heap_is_marking_flag_address(
796 Isolate* isolate) {
797 return ExternalReference(isolate->heap()->IsMarkingFlagAddress());
798}
799
800ExternalReference ExternalReference::heap_is_minor_marking_flag_address(
801 Isolate* isolate) {
802 return ExternalReference(isolate->heap()->IsMinorMarkingFlagAddress());
803}
804
805ExternalReference ExternalReference::is_shared_space_isolate_flag_address(
806 Isolate* isolate) {
807 return ExternalReference(
808 isolate->isolate_data()->is_shared_space_isolate_flag_address());
809}
810
811ExternalReference ExternalReference::new_space_allocation_top_address(
812 Isolate* isolate) {
813 return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress());
814}
815
816ExternalReference ExternalReference::new_space_allocation_limit_address(
817 Isolate* isolate) {
818 return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress());
819}
820
821ExternalReference ExternalReference::old_space_allocation_top_address(
822 Isolate* isolate) {
823 return ExternalReference(isolate->heap()->OldSpaceAllocationTopAddress());
824}
825
826ExternalReference ExternalReference::old_space_allocation_limit_address(
827 Isolate* isolate) {
828 return ExternalReference(isolate->heap()->OldSpaceAllocationLimitAddress());
829}
830
831ExternalReference ExternalReference::array_buffer_max_allocation_address(
832 Isolate* isolate) {
833 return ExternalReference(isolate->array_buffer_max_size_address());
834}
835
836ExternalReference ExternalReference::handle_scope_level_address(
837 Isolate* isolate) {
839}
840
841ExternalReference ExternalReference::handle_scope_next_address(
842 Isolate* isolate) {
844}
845
846ExternalReference ExternalReference::handle_scope_limit_address(
847 Isolate* isolate) {
849}
850
851ExternalReference ExternalReference::exception_address(Isolate* isolate) {
852 return ExternalReference(isolate->exception_address());
853}
854
856 Isolate* isolate) {
857 return ExternalReference(isolate->pending_message_address());
858}
859
861 LocalIsolate* local_isolate) {
862 return ExternalReference(local_isolate->pending_message_address());
863}
864
866
867ExternalReference ExternalReference::address_of_min_int() {
868 return ExternalReference(reinterpret_cast<Address>(&double_min_int_constant));
869}
870
871ExternalReference
872ExternalReference::address_of_mock_arraybuffer_allocator_flag() {
873 return ExternalReference(&v8_flags.mock_arraybuffer_allocator);
874}
875
876// TODO(jgruber): Update the other extrefs pointing at v8_flags. addresses to be
877// called address_of_FLAG_foo (easier grep-ability).
878ExternalReference ExternalReference::address_of_log_or_trace_osr() {
879 return ExternalReference(&v8_flags.log_or_trace_osr);
880}
881
882ExternalReference ExternalReference::address_of_builtin_subclassing_flag() {
883 return ExternalReference(&v8_flags.builtin_subclassing);
884}
885
886ExternalReference ExternalReference::address_of_runtime_stats_flag() {
888}
889
890ExternalReference ExternalReference::address_of_shared_string_table_flag() {
891 return ExternalReference(&v8_flags.shared_string_table);
892}
893
894#ifdef V8_ENABLE_CET_SHADOW_STACK
895ExternalReference ExternalReference::address_of_cet_compatible_flag() {
896 return ExternalReference(&v8_flags.cet_compatible);
897}
898#endif // V8_ENABLE_CET_SHADOW_STACK
899
900ExternalReference ExternalReference::script_context_mutable_heap_number_flag() {
901 return ExternalReference(&v8_flags.script_context_mutable_heap_number);
902}
903
904ExternalReference ExternalReference::additive_safe_int_feedback_flag() {
905#ifdef V8_TARGET_ARCH_64_BIT
906 return ExternalReference(&v8_flags.additive_safe_int_feedback);
907#else
908 return ExternalReference();
909#endif // V8_TARGET_ARCH_64_BIT
910}
911
912ExternalReference ExternalReference::script_context_mutable_heap_int32_flag() {
913#ifdef SUPPORT_SCRIPT_CONTEXT_MUTABLE_HEAP_INT32
914 return ExternalReference(&v8_flags.script_context_mutable_heap_int32);
915#else
916 return ExternalReference();
917#endif // SUPPORT_SCRIPT_CONTEXT_MUTABLE_HEAP_INT32
918}
919
925
931
932ExternalReference ExternalReference::address_of_one_half() {
933 return ExternalReference(
934 reinterpret_cast<Address>(&double_one_half_constant));
935}
936
937ExternalReference ExternalReference::address_of_the_hole_nan() {
938 return ExternalReference(
939 reinterpret_cast<Address>(&double_the_hole_nan_constant));
940}
941
942ExternalReference ExternalReference::address_of_uint32_bias() {
943 return ExternalReference(
944 reinterpret_cast<Address>(&double_uint32_bias_constant));
945}
946
947ExternalReference ExternalReference::address_of_fp16_abs_constant() {
948 return ExternalReference(reinterpret_cast<Address>(&fp16_absolute_constant));
949}
950
951ExternalReference ExternalReference::address_of_fp16_neg_constant() {
952 return ExternalReference(reinterpret_cast<Address>(&fp16_negate_constant));
953}
954
955ExternalReference ExternalReference::address_of_float_abs_constant() {
956 return ExternalReference(reinterpret_cast<Address>(&float_absolute_constant));
957}
958
959ExternalReference ExternalReference::address_of_float_neg_constant() {
960 return ExternalReference(reinterpret_cast<Address>(&float_negate_constant));
961}
962
963ExternalReference ExternalReference::address_of_double_abs_constant() {
964 return ExternalReference(
965 reinterpret_cast<Address>(&double_absolute_constant));
966}
967
968ExternalReference ExternalReference::address_of_double_neg_constant() {
969 return ExternalReference(reinterpret_cast<Address>(&double_negate_constant));
970}
971
972ExternalReference ExternalReference::address_of_wasm_i8x16_swizzle_mask() {
973 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_swizzle_mask));
974}
975
976ExternalReference ExternalReference::address_of_wasm_i8x16_popcnt_mask() {
977 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_popcnt_mask));
978}
979
980ExternalReference ExternalReference::address_of_wasm_i8x16_splat_0x01() {
981 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_splat_0x01));
982}
983
984ExternalReference ExternalReference::address_of_wasm_i8x16_splat_0x0f() {
985 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_splat_0x0f));
986}
987
988ExternalReference ExternalReference::address_of_wasm_i8x16_splat_0x33() {
989 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_splat_0x33));
990}
991
992ExternalReference ExternalReference::address_of_wasm_i8x16_splat_0x55() {
993 return ExternalReference(reinterpret_cast<Address>(&wasm_i8x16_splat_0x55));
994}
995
996ExternalReference ExternalReference::address_of_wasm_i16x8_splat_0x0001() {
997 return ExternalReference(reinterpret_cast<Address>(&wasm_i16x8_splat_0x0001));
998}
999
1000ExternalReference
1001ExternalReference::address_of_wasm_f64x2_convert_low_i32x4_u_int_mask() {
1002 return ExternalReference(
1004}
1005
1006ExternalReference ExternalReference::supports_wasm_simd_128_address() {
1007 return ExternalReference(
1008 reinterpret_cast<Address>(&CpuFeatures::supports_wasm_simd_128_));
1009}
1010
1011ExternalReference ExternalReference::address_of_wasm_double_2_power_52() {
1012 return ExternalReference(reinterpret_cast<Address>(&wasm_double_2_power_52));
1013}
1014
1015ExternalReference ExternalReference::address_of_wasm_int32_max_as_double() {
1016 return ExternalReference(
1017 reinterpret_cast<Address>(&wasm_int32_max_as_double));
1018}
1019
1020ExternalReference ExternalReference::address_of_wasm_uint32_max_as_double() {
1021 return ExternalReference(
1022 reinterpret_cast<Address>(&wasm_uint32_max_as_double));
1023}
1024
1025ExternalReference ExternalReference::address_of_wasm_int32_overflow_as_float() {
1026 return ExternalReference(
1027 reinterpret_cast<Address>(&wasm_int32_overflow_as_float));
1028}
1029
1030ExternalReference
1031ExternalReference::address_of_wasm_i32x8_int32_overflow_as_float() {
1032 return ExternalReference(
1033 reinterpret_cast<Address>(&wasm_i32x8_int32_overflow_as_float));
1034}
1035
1036ExternalReference ExternalReference::supports_cetss_address() {
1037 return ExternalReference(
1038 reinterpret_cast<Address>(&CpuFeatures::supports_cetss_));
1039}
1040
1041ExternalReference
1042ExternalReference::address_of_enable_experimental_regexp_engine() {
1043 return ExternalReference(&v8_flags.enable_experimental_regexp_engine);
1044}
1045
1046namespace {
1047
1048static uintptr_t BaselinePCForBytecodeOffset(Address raw_code_obj,
1049 int bytecode_offset,
1050 Address raw_bytecode_array) {
1051 Tagged<Code> code_obj = Cast<Code>(Tagged<Object>(raw_code_obj));
1052 Tagged<BytecodeArray> bytecode_array =
1053 Cast<BytecodeArray>(Tagged<Object>(raw_bytecode_array));
1054 return code_obj->GetBaselineStartPCForBytecodeOffset(bytecode_offset,
1055 bytecode_array);
1056}
1057
1058static uintptr_t BaselinePCForNextExecutedBytecode(Address raw_code_obj,
1059 int bytecode_offset,
1060 Address raw_bytecode_array) {
1061 Tagged<Code> code_obj = Cast<Code>(Tagged<Object>(raw_code_obj));
1062 Tagged<BytecodeArray> bytecode_array =
1063 Cast<BytecodeArray>(Tagged<Object>(raw_bytecode_array));
1064 return code_obj->GetBaselinePCForNextExecutedBytecode(bytecode_offset,
1065 bytecode_array);
1066}
1067
1068} // namespace
1069
1070FUNCTION_REFERENCE(baseline_pc_for_bytecode_offset, BaselinePCForBytecodeOffset)
1071FUNCTION_REFERENCE(baseline_pc_for_next_executed_bytecode,
1072 BaselinePCForNextExecutedBytecode)
1073
1074ExternalReference ExternalReference::thread_in_wasm_flag_address_address(
1075 Isolate* isolate) {
1076 return ExternalReference(isolate->thread_in_wasm_flag_address_address());
1077}
1078
1079ExternalReference ExternalReference::invoke_function_callback_generic() {
1082 ApiFunction thunk_fun(thunk_address);
1083 return ExternalReference::Create(&thunk_fun, thunk_type);
1084}
1085
1086ExternalReference ExternalReference::invoke_function_callback_optimized() {
1089 ApiFunction thunk_fun(thunk_address);
1090 return ExternalReference::Create(&thunk_fun, thunk_type);
1091}
1092
1093// static
1095 CallApiCallbackMode mode) {
1096 switch (mode) {
1098 return invoke_function_callback_generic();
1100 return invoke_function_callback_optimized();
1102 return ExternalReference();
1103 }
1104}
1105
1106ExternalReference ExternalReference::invoke_accessor_getter_callback() {
1109 ApiFunction thunk_fun(thunk_address);
1110 return ExternalReference::Create(&thunk_fun, thunk_type);
1111}
1112
1113#if V8_TARGET_ARCH_X64
1114#define re_stack_check_func RegExpMacroAssemblerX64::CheckStackGuardState
1115#elif V8_TARGET_ARCH_IA32
1116#define re_stack_check_func RegExpMacroAssemblerIA32::CheckStackGuardState
1117#elif V8_TARGET_ARCH_ARM64
1118#define re_stack_check_func RegExpMacroAssemblerARM64::CheckStackGuardState
1119#elif V8_TARGET_ARCH_ARM
1120#define re_stack_check_func RegExpMacroAssemblerARM::CheckStackGuardState
1121#elif V8_TARGET_ARCH_PPC64
1122#define re_stack_check_func RegExpMacroAssemblerPPC::CheckStackGuardState
1123#elif V8_TARGET_ARCH_MIPS64
1124#define re_stack_check_func RegExpMacroAssemblerMIPS::CheckStackGuardState
1125#elif V8_TARGET_ARCH_LOONG64
1126#define re_stack_check_func RegExpMacroAssemblerLOONG64::CheckStackGuardState
1127#elif V8_TARGET_ARCH_S390X
1128#define re_stack_check_func RegExpMacroAssemblerS390::CheckStackGuardState
1129#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
1130#define re_stack_check_func RegExpMacroAssemblerRISCV::CheckStackGuardState
1131#else
1133#endif
1134
1135FUNCTION_REFERENCE(re_check_stack_guard_state, re_stack_check_func)
1136#undef re_stack_check_func
1137
1139
1140FUNCTION_REFERENCE(re_match_for_call_from_js,
1141 IrregexpInterpreter::MatchForCallFromJs)
1142
1143FUNCTION_REFERENCE(re_experimental_match_for_call_from_js,
1144 ExperimentalRegExp::MatchForCallFromJs)
1145
1146FUNCTION_REFERENCE(re_atom_exec_raw, RegExp::AtomExecRaw)
1147
1148FUNCTION_REFERENCE(allocate_regexp_result_vector, RegExpResultVector::Allocate)
1149FUNCTION_REFERENCE(free_regexp_result_vector, RegExpResultVector::Free)
1150
1151FUNCTION_REFERENCE(re_case_insensitive_compare_unicode,
1152 NativeRegExpMacroAssembler::CaseInsensitiveCompareUnicode)
1153
1154FUNCTION_REFERENCE(re_case_insensitive_compare_non_unicode,
1155 NativeRegExpMacroAssembler::CaseInsensitiveCompareNonUnicode)
1156
1157FUNCTION_REFERENCE(re_is_character_in_range_array,
1158 RegExpMacroAssembler::IsCharacterInRangeArray)
1159
1160ExternalReference ExternalReference::re_word_character_map() {
1161 return ExternalReference(
1163}
1164
1165ExternalReference
1166ExternalReference::address_of_regexp_static_result_offsets_vector(
1167 Isolate* isolate) {
1168 return ExternalReference(
1169 isolate->address_of_regexp_static_result_offsets_vector());
1170}
1171
1172ExternalReference ExternalReference::address_of_regexp_stack_limit_address(
1173 Isolate* isolate) {
1174 return ExternalReference(isolate->regexp_stack()->limit_address_address());
1175}
1176
1177ExternalReference ExternalReference::address_of_regexp_stack_memory_top_address(
1178 Isolate* isolate) {
1179 return ExternalReference(
1180 isolate->regexp_stack()->memory_top_address_address());
1181}
1182
1183ExternalReference ExternalReference::address_of_regexp_stack_stack_pointer(
1184 Isolate* isolate) {
1185 return ExternalReference(isolate->regexp_stack()->stack_pointer_address());
1186}
1187
1189 BUILTIN_FP_CALL)
1191 BUILTIN_FP_CALL)
1192FUNCTION_REFERENCE_WITH_TYPE(ieee754_asin_function, base::ieee754::asin,
1193 BUILTIN_FP_CALL)
1194FUNCTION_REFERENCE_WITH_TYPE(ieee754_asinh_function, base::ieee754::asinh,
1195 BUILTIN_FP_CALL)
1196FUNCTION_REFERENCE_WITH_TYPE(ieee754_atan_function, base::ieee754::atan,
1197 BUILTIN_FP_CALL)
1198FUNCTION_REFERENCE_WITH_TYPE(ieee754_atanh_function, base::ieee754::atanh,
1199 BUILTIN_FP_CALL)
1200FUNCTION_REFERENCE_WITH_TYPE(ieee754_atan2_function, base::ieee754::atan2,
1201 BUILTIN_FP_FP_CALL)
1202FUNCTION_REFERENCE_WITH_TYPE(ieee754_cbrt_function, base::ieee754::cbrt,
1203 BUILTIN_FP_CALL)
1204FUNCTION_REFERENCE_WITH_TYPE(ieee754_cosh_function, base::ieee754::cosh,
1205 BUILTIN_FP_CALL)
1206FUNCTION_REFERENCE_WITH_TYPE(ieee754_exp_function, base::ieee754::exp,
1207 BUILTIN_FP_CALL)
1208FUNCTION_REFERENCE_WITH_TYPE(ieee754_expm1_function, base::ieee754::expm1,
1209 BUILTIN_FP_CALL)
1210FUNCTION_REFERENCE_WITH_TYPE(ieee754_log_function, base::ieee754::log,
1211 BUILTIN_FP_CALL)
1212FUNCTION_REFERENCE_WITH_TYPE(ieee754_log1p_function, base::ieee754::log1p,
1213 BUILTIN_FP_CALL)
1214FUNCTION_REFERENCE_WITH_TYPE(ieee754_log10_function, base::ieee754::log10,
1215 BUILTIN_FP_CALL)
1216FUNCTION_REFERENCE_WITH_TYPE(ieee754_log2_function, base::ieee754::log2,
1217 BUILTIN_FP_CALL)
1218FUNCTION_REFERENCE_WITH_TYPE(ieee754_sinh_function, base::ieee754::sinh,
1219 BUILTIN_FP_CALL)
1220FUNCTION_REFERENCE_WITH_TYPE(ieee754_tan_function, base::ieee754::tan,
1221 BUILTIN_FP_CALL)
1222FUNCTION_REFERENCE_WITH_TYPE(ieee754_tanh_function, base::ieee754::tanh,
1223 BUILTIN_FP_CALL)
1224FUNCTION_REFERENCE_WITH_TYPE(ieee754_pow_function, math::pow,
1225 BUILTIN_FP_FP_CALL)
1226
1227#if defined(V8_USE_LIBM_TRIG_FUNCTIONS)
1228ExternalReference ExternalReference::ieee754_sin_function() {
1229 static_assert(
1230 IsValidExternalReferenceType<decltype(&base::ieee754::libm_sin)>::value);
1231 static_assert(IsValidExternalReferenceType<
1232 decltype(&base::ieee754::fdlibm_sin)>::value);
1233 auto* f = v8_flags.use_libm_trig_functions ? base::ieee754::libm_sin
1234 : base::ieee754::fdlibm_sin;
1236}
1237ExternalReference ExternalReference::ieee754_cos_function() {
1238 static_assert(
1239 IsValidExternalReferenceType<decltype(&base::ieee754::libm_cos)>::value);
1240 static_assert(IsValidExternalReferenceType<
1241 decltype(&base::ieee754::fdlibm_cos)>::value);
1242 auto* f = v8_flags.use_libm_trig_functions ? base::ieee754::libm_cos
1243 : base::ieee754::fdlibm_cos;
1245}
1246#else
1248 BUILTIN_FP_CALL)
1249FUNCTION_REFERENCE_WITH_TYPE(ieee754_cos_function, base::ieee754::cos,
1250 BUILTIN_FP_CALL)
1251#endif
1252
1253void* libc_memchr(void* string, int character, size_t search_length) {
1254 return memchr(string, character, search_length);
1255}
1256
1257FUNCTION_REFERENCE(libc_memchr_function, libc_memchr)
1258
1259void* libc_memcpy(void* dest, const void* src, size_t n) {
1260 return memcpy(dest, src, n);
1261}
1262
1263FUNCTION_REFERENCE(libc_memcpy_function, libc_memcpy)
1264
1265void* libc_memmove(void* dest, const void* src, size_t n) {
1266 return memmove(dest, src, n);
1267}
1268
1269FUNCTION_REFERENCE(libc_memmove_function, libc_memmove)
1270
1271void* libc_memset(void* dest, int value, size_t n) {
1272 DCHECK_EQ(static_cast<uint8_t>(value), value);
1273 return memset(dest, value, n);
1274}
1275
1276FUNCTION_REFERENCE(libc_memset_function, libc_memset)
1277
1278void relaxed_memcpy(volatile base::Atomic8* dest,
1279 volatile const base::Atomic8* src, size_t n) {
1280 base::Relaxed_Memcpy(dest, src, n);
1281}
1282
1283FUNCTION_REFERENCE(relaxed_memcpy_function, relaxed_memcpy)
1284
1285void relaxed_memmove(volatile base::Atomic8* dest,
1286 volatile const base::Atomic8* src, size_t n) {
1287 base::Relaxed_Memmove(dest, src, n);
1288}
1289
1290FUNCTION_REFERENCE(relaxed_memmove_function, relaxed_memmove)
1291
1292ExternalReference ExternalReference::printf_function() {
1293 return ExternalReference(Redirect(FUNCTION_ADDR(std::printf)));
1294}
1295
1297
1298template <typename SubjectChar, typename PatternChar>
1303
1304FUNCTION_REFERENCE(jsarray_array_join_concat_to_sequential_string,
1306
1308
1309ExternalReference ExternalReference::search_string_raw_one_one() {
1311}
1312
1313ExternalReference ExternalReference::search_string_raw_one_two() {
1315}
1316
1317ExternalReference ExternalReference::search_string_raw_two_one() {
1319}
1320
1321ExternalReference ExternalReference::search_string_raw_two_two() {
1323}
1324
1325ExternalReference
1326ExternalReference::typed_array_and_rab_gsab_typed_array_elements_kind_shifts() {
1327 uint8_t* ptr =
1329 return ExternalReference(reinterpret_cast<Address>(ptr));
1330}
1331
1332ExternalReference
1333ExternalReference::typed_array_and_rab_gsab_typed_array_elements_kind_sizes() {
1334 uint8_t* ptr =
1336 return ExternalReference(reinterpret_cast<Address>(ptr));
1337}
1338
1339namespace {
1340
1341void StringWriteToFlatOneByte(Address source, uint8_t* sink, int32_t start,
1342 int32_t length) {
1344 sink, start, length);
1345}
1346
1347void StringWriteToFlatTwoByte(Address source, uint16_t* sink, int32_t start,
1348 int32_t length) {
1350 sink, start, length);
1351}
1352
1353const uint8_t* ExternalOneByteStringGetChars(Address string) {
1354 // The following CHECK is a workaround to prevent a CFI bug where
1355 // ExternalOneByteStringGetChars() and ExternalTwoByteStringGetChars() are
1356 // merged by the linker, resulting in one of the input type's vtable address
1357 // failing the address range check.
1358 // TODO(chromium:1160961): Consider removing the CHECK when CFI is fixed.
1359 CHECK(IsExternalOneByteString(Tagged<Object>(string)));
1360 return Cast<ExternalOneByteString>(Tagged<Object>(string))->GetChars();
1361}
1362const uint16_t* ExternalTwoByteStringGetChars(Address string) {
1363 // The following CHECK is a workaround to prevent a CFI bug where
1364 // ExternalOneByteStringGetChars() and ExternalTwoByteStringGetChars() are
1365 // merged by the linker, resulting in one of the input type's vtable address
1366 // failing the address range check.
1367 // TODO(chromium:1160961): Consider removing the CHECK when CFI is fixed.
1368 CHECK(IsExternalTwoByteString(Tagged<Object>(string)));
1369 return Cast<ExternalTwoByteString>(Tagged<Object>(string))->GetChars();
1370}
1371
1372} // namespace
1373
1374FUNCTION_REFERENCE(string_write_to_flat_one_byte, StringWriteToFlatOneByte)
1375FUNCTION_REFERENCE(string_write_to_flat_two_byte, StringWriteToFlatTwoByte)
1376
1377FUNCTION_REFERENCE(external_one_byte_string_get_chars,
1378 ExternalOneByteStringGetChars)
1379FUNCTION_REFERENCE(external_two_byte_string_get_chars,
1380 ExternalTwoByteStringGetChars)
1381
1382// See:
1383// https://lemire.me/blog/2021/06/03/computing-the-number-of-digits-of-an-integer-even-faster/
1384static constexpr uint64_t kLog10OffsetTable[] = {
1385 0x100000000, 0x1fffffff6, 0x1fffffff6, 0x1fffffff6, 0x2ffffff9c,
1386 0x2ffffff9c, 0x2ffffff9c, 0x3fffffc18, 0x3fffffc18, 0x3fffffc18,
1387 0x4ffffd8f0, 0x4ffffd8f0, 0x4ffffd8f0, 0x4ffffd8f0, 0x5fffe7960,
1388 0x5fffe7960, 0x5fffe7960, 0x6fff0bdc0, 0x6fff0bdc0, 0x6fff0bdc0,
1389 0x7ff676980, 0x7ff676980, 0x7ff676980, 0x7ff676980, 0x8fa0a1f00,
1390 0x8fa0a1f00, 0x8fa0a1f00, 0x9c4653600, 0x9c4653600, 0x9c4653600,
1391 0xa00000000, 0xa00000000,
1392};
1393
1394ExternalReference ExternalReference::address_of_log10_offset_table() {
1395 return ExternalReference(reinterpret_cast<Address>(&kLog10OffsetTable[0]));
1396}
1397
1398FUNCTION_REFERENCE(orderedhashmap_gethash_raw, OrderedHashMap::GetHash)
1399
1402 return Object::GetOrCreateHash(Tagged<Object>(raw_key), isolate).ptr();
1403}
1404
1405FUNCTION_REFERENCE(get_or_create_hash_raw, GetOrCreateHash)
1406
1411
1412FUNCTION_REFERENCE(jsreceiver_create_identity_hash,
1414
1415static uint32_t ComputeSeededIntegerHash(Isolate* isolate, int32_t key) {
1417 return ComputeSeededHash(static_cast<uint32_t>(key), HashSeed(isolate));
1418}
1419
1420FUNCTION_REFERENCE(compute_integer_hash, ComputeSeededIntegerHash)
1421
1423template <typename Dictionary, LookupMode mode>
1425 Address raw_dict,
1426 Address raw_key) {
1427 // This function cannot allocate, but there is a HandleScope because it needs
1428 // to pass Handle<Name> to the dictionary methods.
1430 HandleScope handle_scope(isolate);
1431
1433 // This function should only be used as the slow path for forwarded strings.
1434 DCHECK(Name::IsForwardingIndex(key->raw_hash_field()));
1435
1437 ReadOnlyRoots roots(isolate);
1438 uint32_t hash = key->hash();
1439 InternalIndex entry = mode == kFindExisting
1440 ? dict->FindEntry(isolate, roots, key, hash)
1441 : dict->FindInsertionEntry(isolate, roots, hash);
1442 return entry.raw_value();
1443}
1444
1446 name_dictionary_lookup_forwarded_string,
1449 name_dictionary_find_insertion_entry_forwarded_string,
1452 global_dictionary_lookup_forwarded_string,
1454FUNCTION_REFERENCE(global_dictionary_find_insertion_entry_forwarded_string,
1458 name_to_index_hashtable_lookup_forwarded_string,
1461 name_to_index_hashtable_find_insertion_entry_forwarded_string,
1464
1465FUNCTION_REFERENCE(copy_fast_number_jsarray_elements_to_typed_array,
1467FUNCTION_REFERENCE(copy_typed_array_elements_to_typed_array,
1469FUNCTION_REFERENCE(copy_typed_array_elements_slice, CopyTypedArrayElementsSlice)
1470FUNCTION_REFERENCE(try_string_to_index_or_lookup_existing,
1471 StringTable::TryStringToIndexOrLookupExisting)
1472FUNCTION_REFERENCE(string_from_forward_table,
1473 StringForwardingTable::GetForwardStringAddress)
1474FUNCTION_REFERENCE(raw_hash_from_forward_table,
1475 StringForwardingTable::GetRawHashStatic)
1476FUNCTION_REFERENCE(string_to_array_index_function, String::ToArrayIndex)
1477FUNCTION_REFERENCE(array_indexof_includes_smi_or_object,
1479FUNCTION_REFERENCE(array_indexof_includes_double, ArrayIndexOfIncludesDouble)
1480
1482 Address smi_y) {
1483 Tagged<Smi> x(smi_x);
1484 Tagged<Smi> y(smi_y);
1485 return Smi::LexicographicCompare(isolate, x, y);
1486}
1487
1488FUNCTION_REFERENCE(smi_lexicographic_compare_function,
1490
1491uint32_t HasUnpairedSurrogate(const uint16_t* code_units, size_t length) {
1492 // Use uint32_t to avoid complexity around bool return types.
1493 static constexpr uint32_t kTrue = 1;
1494 static constexpr uint32_t kFalse = 0;
1495 return unibrow::Utf16::HasUnpairedSurrogate(code_units, length) ? kTrue
1496 : kFalse;
1497}
1498
1499FUNCTION_REFERENCE(has_unpaired_surrogate, HasUnpairedSurrogate)
1500
1501void ReplaceUnpairedSurrogates(const uint16_t* source_code_units,
1502 uint16_t* dest_code_units, size_t length) {
1503 return unibrow::Utf16::ReplaceUnpairedSurrogates(source_code_units,
1504 dest_code_units, length);
1505}
1506
1507FUNCTION_REFERENCE(replace_unpaired_surrogates, ReplaceUnpairedSurrogates)
1508
1509FUNCTION_REFERENCE(mutable_big_int_absolute_add_and_canonicalize_function,
1511
1512FUNCTION_REFERENCE(mutable_big_int_absolute_compare_function,
1514
1515FUNCTION_REFERENCE(mutable_big_int_absolute_sub_and_canonicalize_function,
1517
1518FUNCTION_REFERENCE(mutable_big_int_absolute_mul_and_canonicalize_function,
1520
1521FUNCTION_REFERENCE(mutable_big_int_absolute_div_and_canonicalize_function,
1523
1524FUNCTION_REFERENCE(mutable_big_int_absolute_mod_and_canonicalize_function,
1526
1527FUNCTION_REFERENCE(mutable_big_int_bitwise_and_pp_and_canonicalize_function,
1529
1530FUNCTION_REFERENCE(mutable_big_int_bitwise_and_nn_and_canonicalize_function,
1532
1533FUNCTION_REFERENCE(mutable_big_int_bitwise_and_pn_and_canonicalize_function,
1535
1536FUNCTION_REFERENCE(mutable_big_int_bitwise_or_pp_and_canonicalize_function,
1538
1539FUNCTION_REFERENCE(mutable_big_int_bitwise_or_nn_and_canonicalize_function,
1541
1542FUNCTION_REFERENCE(mutable_big_int_bitwise_or_pn_and_canonicalize_function,
1544
1545FUNCTION_REFERENCE(mutable_big_int_bitwise_xor_pp_and_canonicalize_function,
1547
1548FUNCTION_REFERENCE(mutable_big_int_bitwise_xor_nn_and_canonicalize_function,
1550
1551FUNCTION_REFERENCE(mutable_big_int_bitwise_xor_pn_and_canonicalize_function,
1553
1554FUNCTION_REFERENCE(mutable_big_int_left_shift_and_canonicalize_function,
1556
1557FUNCTION_REFERENCE(big_int_right_shift_result_length_function,
1559
1560FUNCTION_REFERENCE(mutable_big_int_right_shift_and_canonicalize_function,
1562
1563FUNCTION_REFERENCE(check_object_type, CheckObjectType)
1564
1565#ifdef V8_INTL_SUPPORT
1566
1567static Address ConvertOneByteToLower(Address raw_src, Address raw_dst) {
1570 return Intl::ConvertOneByteToLower(src, dst).ptr();
1571}
1572FUNCTION_REFERENCE(intl_convert_one_byte_to_lower, ConvertOneByteToLower)
1573
1574ExternalReference ExternalReference::intl_to_latin1_lower_table() {
1575 uint8_t* ptr = const_cast<uint8_t*>(Intl::ToLatin1LowerTable());
1576 return ExternalReference(reinterpret_cast<Address>(ptr));
1577}
1578
1579ExternalReference ExternalReference::intl_ascii_collation_weights_l1() {
1580 uint8_t* ptr = const_cast<uint8_t*>(Intl::AsciiCollationWeightsL1());
1581 return ExternalReference(reinterpret_cast<Address>(ptr));
1582}
1583
1584ExternalReference ExternalReference::intl_ascii_collation_weights_l3() {
1585 uint8_t* ptr = const_cast<uint8_t*>(Intl::AsciiCollationWeightsL3());
1586 return ExternalReference(reinterpret_cast<Address>(ptr));
1587}
1588
1589#endif // V8_INTL_SUPPORT
1590
1591// Explicit instantiations for all combinations of 1- and 2-byte strings.
1592template ExternalReference
1595ExternalReference::search_string_raw<const uint8_t, const base::uc16>();
1597ExternalReference::search_string_raw<const base::uc16, const uint8_t>();
1599ExternalReference::search_string_raw<const base::uc16, const base::uc16>();
1600
1602 if (address <= static_cast<Address>(kNumIsolateFieldIds)) {
1603 return ExternalReference(static_cast<IsolateFieldId>(address));
1604 }
1605 return ExternalReference(address);
1606}
1607
1608ExternalReference ExternalReference::cpu_features() {
1611}
1612
1613ExternalReference ExternalReference::promise_hook_flags_address(
1614 Isolate* isolate) {
1615 return ExternalReference(isolate->promise_hook_flags_address());
1616}
1617
1618ExternalReference ExternalReference::promise_hook_address(Isolate* isolate) {
1619 return ExternalReference(isolate->promise_hook_address());
1620}
1621
1622ExternalReference ExternalReference::async_event_delegate_address(
1623 Isolate* isolate) {
1624 return ExternalReference(isolate->async_event_delegate_address());
1625}
1626
1627ExternalReference ExternalReference::debug_is_active_address(Isolate* isolate) {
1628 return ExternalReference(isolate->debug()->is_active_address());
1629}
1630
1631ExternalReference ExternalReference::debug_hook_on_function_call_address(
1632 Isolate* isolate) {
1633 return ExternalReference(isolate->debug()->hook_on_function_call_address());
1634}
1635
1636ExternalReference ExternalReference::runtime_function_table_address(
1637 Isolate* isolate) {
1638 return ExternalReference(
1639 const_cast<Runtime::Function*>(Runtime::RuntimeFunctionTable(isolate)));
1640}
1641
1646
1647FUNCTION_REFERENCE(invalidate_prototype_chains_function,
1649
1650double modulo_double_double(double x, double y) { return Modulo(x, y); }
1651
1652FUNCTION_REFERENCE_WITH_TYPE(mod_two_doubles_operation, modulo_double_double,
1653 BUILTIN_FP_FP_CALL)
1654
1655ExternalReference ExternalReference::debug_suspended_generator_address(
1656 Isolate* isolate) {
1657 return ExternalReference(isolate->debug()->suspended_generator_address());
1658}
1659
1660ExternalReference ExternalReference::context_address(Isolate* isolate) {
1661 return ExternalReference(isolate->context_address());
1662}
1663
1664FUNCTION_REFERENCE(call_enqueue_microtask_function,
1666
1667ExternalReference ExternalReference::int64_mul_high_function() {
1668 return ExternalReference(
1670}
1671
1672static int64_t atomic_pair_load(intptr_t address) {
1673 return std::atomic_load(reinterpret_cast<std::atomic<int64_t>*>(address));
1674}
1675
1676ExternalReference ExternalReference::atomic_pair_load_function() {
1678}
1679
1680static void atomic_pair_store(intptr_t address, int value_low, int value_high) {
1681 int64_t value =
1682 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1683 std::atomic_store(reinterpret_cast<std::atomic<int64_t>*>(address), value);
1684}
1685
1686ExternalReference ExternalReference::atomic_pair_store_function() {
1688}
1689
1690static int64_t atomic_pair_add(intptr_t address, int value_low,
1691 int value_high) {
1692 int64_t value =
1693 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1694 return std::atomic_fetch_add(reinterpret_cast<std::atomic<int64_t>*>(address),
1695 value);
1696}
1697
1698ExternalReference ExternalReference::atomic_pair_add_function() {
1700}
1701
1702static int64_t atomic_pair_sub(intptr_t address, int value_low,
1703 int value_high) {
1704 int64_t value =
1705 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1706 return std::atomic_fetch_sub(reinterpret_cast<std::atomic<int64_t>*>(address),
1707 value);
1708}
1709
1710ExternalReference ExternalReference::atomic_pair_sub_function() {
1712}
1713
1714static int64_t atomic_pair_and(intptr_t address, int value_low,
1715 int value_high) {
1716 int64_t value =
1717 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1718 return std::atomic_fetch_and(reinterpret_cast<std::atomic<int64_t>*>(address),
1719 value);
1720}
1721
1722ExternalReference ExternalReference::atomic_pair_and_function() {
1724}
1725
1726static int64_t atomic_pair_or(intptr_t address, int value_low, int value_high) {
1727 int64_t value =
1728 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1729 return std::atomic_fetch_or(reinterpret_cast<std::atomic<int64_t>*>(address),
1730 value);
1731}
1732
1733ExternalReference ExternalReference::atomic_pair_or_function() {
1735}
1736
1737static int64_t atomic_pair_xor(intptr_t address, int value_low,
1738 int value_high) {
1739 int64_t value =
1740 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1741 return std::atomic_fetch_xor(reinterpret_cast<std::atomic<int64_t>*>(address),
1742 value);
1743}
1744
1745ExternalReference ExternalReference::atomic_pair_xor_function() {
1747}
1748
1749static int64_t atomic_pair_exchange(intptr_t address, int value_low,
1750 int value_high) {
1751 int64_t value =
1752 static_cast<int64_t>(value_high) << 32 | (value_low & 0xFFFFFFFF);
1753 return std::atomic_exchange(reinterpret_cast<std::atomic<int64_t>*>(address),
1754 value);
1755}
1756
1757ExternalReference ExternalReference::atomic_pair_exchange_function() {
1759}
1760
1761static uint64_t atomic_pair_compare_exchange(intptr_t address,
1762 int old_value_low,
1763 int old_value_high,
1764 int new_value_low,
1765 int new_value_high) {
1766 uint64_t old_value = static_cast<uint64_t>(old_value_high) << 32 |
1767 (old_value_low & 0xFFFFFFFF);
1768 uint64_t new_value = static_cast<uint64_t>(new_value_high) << 32 |
1769 (new_value_low & 0xFFFFFFFF);
1770 std::atomic_compare_exchange_strong(
1771 reinterpret_cast<std::atomic<uint64_t>*>(address), &old_value, new_value);
1772 return old_value;
1773}
1774
1775FUNCTION_REFERENCE(atomic_pair_compare_exchange_function,
1777
1778#ifdef V8_IS_TSAN
1779namespace {
1780// Mimics the store in generated code by having a relaxed store to the same
1781// address, with the same value. This is done in order for TSAN to see these
1782// stores from generated code.
1783// Note that {value} is an int64_t irrespective of the store size. This is on
1784// purpose to keep the function signatures the same across stores. The
1785// static_cast inside the method will ignore the bits which will not be stored.
1786void tsan_relaxed_store_8_bits(Address addr, int64_t value) {
1787#if V8_TARGET_ARCH_X64
1788 base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(addr),
1789 static_cast<base::Atomic8>(value));
1790#else
1791 UNREACHABLE();
1792#endif // V8_TARGET_ARCH_X64
1793}
1794
1795void tsan_relaxed_store_16_bits(Address addr, int64_t value) {
1796#if V8_TARGET_ARCH_X64
1797 base::Relaxed_Store(reinterpret_cast<base::Atomic16*>(addr),
1798 static_cast<base::Atomic16>(value));
1799#else
1800 UNREACHABLE();
1801#endif // V8_TARGET_ARCH_X64
1802}
1803
1804void tsan_relaxed_store_32_bits(Address addr, int64_t value) {
1805#if V8_TARGET_ARCH_X64
1806 base::Relaxed_Store(reinterpret_cast<base::Atomic32*>(addr),
1807 static_cast<base::Atomic32>(value));
1808#else
1809 UNREACHABLE();
1810#endif // V8_TARGET_ARCH_X64
1811}
1812
1813void tsan_relaxed_store_64_bits(Address addr, int64_t value) {
1814#if V8_TARGET_ARCH_X64
1815 base::Relaxed_Store(reinterpret_cast<base::Atomic64*>(addr),
1816 static_cast<base::Atomic64>(value));
1817#else
1818 UNREACHABLE();
1819#endif // V8_TARGET_ARCH_X64
1820}
1821
1822// Same as above, for sequentially consistent stores.
1823void tsan_seq_cst_store_8_bits(Address addr, int64_t value) {
1824#if V8_TARGET_ARCH_X64
1825 base::SeqCst_Store(reinterpret_cast<base::Atomic8*>(addr),
1826 static_cast<base::Atomic8>(value));
1827#else
1828 UNREACHABLE();
1829#endif // V8_TARGET_ARCH_X64
1830}
1831
1832void tsan_seq_cst_store_16_bits(Address addr, int64_t value) {
1833#if V8_TARGET_ARCH_X64
1834 base::SeqCst_Store(reinterpret_cast<base::Atomic16*>(addr),
1835 static_cast<base::Atomic16>(value));
1836#else
1837 UNREACHABLE();
1838#endif // V8_TARGET_ARCH_X64
1839}
1840
1841void tsan_seq_cst_store_32_bits(Address addr, int64_t value) {
1842#if V8_TARGET_ARCH_X64
1843 base::SeqCst_Store(reinterpret_cast<base::Atomic32*>(addr),
1844 static_cast<base::Atomic32>(value));
1845#else
1846 UNREACHABLE();
1847#endif // V8_TARGET_ARCH_X64
1848}
1849
1850void tsan_seq_cst_store_64_bits(Address addr, int64_t value) {
1851#if V8_TARGET_ARCH_X64
1852 base::SeqCst_Store(reinterpret_cast<base::Atomic64*>(addr),
1853 static_cast<base::Atomic64>(value));
1854#else
1855 UNREACHABLE();
1856#endif // V8_TARGET_ARCH_X64
1857}
1858
1859// Same as above, for relaxed loads.
1860base::Atomic32 tsan_relaxed_load_32_bits(Address addr, int64_t value) {
1861#if V8_TARGET_ARCH_X64
1862 return base::Relaxed_Load(reinterpret_cast<base::Atomic32*>(addr));
1863#else
1864 UNREACHABLE();
1865#endif // V8_TARGET_ARCH_X64
1866}
1867
1868base::Atomic64 tsan_relaxed_load_64_bits(Address addr, int64_t value) {
1869#if V8_TARGET_ARCH_X64
1870 return base::Relaxed_Load(reinterpret_cast<base::Atomic64*>(addr));
1871#else
1872 UNREACHABLE();
1873#endif // V8_TARGET_ARCH_X64
1874}
1875
1876} // namespace
1877#endif // V8_IS_TSAN
1878
1880 tsan_relaxed_store_8_bits)
1881IF_TSAN(FUNCTION_REFERENCE, tsan_relaxed_store_function_16_bits,
1882 tsan_relaxed_store_16_bits)
1884 tsan_relaxed_store_32_bits)
1885IF_TSAN(FUNCTION_REFERENCE, tsan_relaxed_store_function_64_bits,
1886 tsan_relaxed_store_64_bits)
1888 tsan_seq_cst_store_8_bits)
1889IF_TSAN(FUNCTION_REFERENCE, tsan_seq_cst_store_function_16_bits,
1890 tsan_seq_cst_store_16_bits)
1892 tsan_seq_cst_store_32_bits)
1893IF_TSAN(FUNCTION_REFERENCE, tsan_seq_cst_store_function_64_bits,
1894 tsan_seq_cst_store_64_bits)
1896 tsan_relaxed_load_32_bits)
1897IF_TSAN(FUNCTION_REFERENCE, tsan_relaxed_load_function_64_bits,
1898 tsan_relaxed_load_64_bits)
1899
1900static int EnterContextWrapper(HandleScopeImplementer* hsi,
1902 Tagged<NativeContext> context =
1904 hsi->EnterContext(context);
1905 return 0;
1906}
1907
1908FUNCTION_REFERENCE(call_enter_context_function, EnterContextWrapper)
1909
1911 return lhs.raw() == rhs.raw();
1912}
1913
1915 return !(lhs == rhs);
1916}
1917
1919 if (v8_flags.predictable) {
1920 // Avoid ASLR non-determinism in predictable mode. For this, just take the
1921 // lowest 12 bit corresponding to a 4K page size.
1922 return base::hash<Address>()(reference.raw() & 0xfff);
1923 }
1924 return base::hash<Address>()(reference.raw());
1925}
1926
1927namespace {
1928static constexpr const char* GetNameOfIsolateFieldId(IsolateFieldId id) {
1929 switch (id) {
1930#define CASE(id, name, camel) \
1931 case IsolateFieldId::k##camel: \
1932 return name;
1934#undef CASE
1935#define CASE(camel, size, name) \
1936 case IsolateFieldId::k##camel: \
1937 return #name;
1939#undef CASE
1940 default:
1941 return "unknown";
1942 }
1943}
1944} // namespace
1945
1946std::ostream& operator<<(std::ostream& os, ExternalReference reference) {
1947 os << reinterpret_cast<const void*>(reference.raw());
1948 if (reference.IsIsolateFieldId()) {
1949 os << " <"
1950 << GetNameOfIsolateFieldId(static_cast<IsolateFieldId>(reference.raw()))
1951 << ">";
1952 } else {
1953 const Runtime::Function* fn =
1955 if (fn) os << " <" << fn->name << ".entry>";
1956 }
1957 return os;
1958}
1959
1960void abort_with_reason(int reason) {
1961 if (IsValidAbortReason(reason)) {
1962 const char* message = GetAbortReason(static_cast<AbortReason>(reason));
1963 base::OS::PrintError("abort: %s\n", message);
1964 } else {
1965 base::OS::PrintError("abort: <unknown reason: %d>\n", reason);
1966 }
1968 UNREACHABLE();
1969}
1970
1971#undef RAW_FUNCTION_REFERENCE
1972#undef FUNCTION_REFERENCE
1973#undef FUNCTION_REFERENCE_WITH_TYPE
1974
1975} // namespace internal
1976} // namespace v8
static void ReplaceUnpairedSurrogates(const uint16_t *source_code_units, uint16_t *dest_code_units, size_t length)
Definition unicode.cc:244
static bool HasUnpairedSurrogate(const uint16_t *code_units, size_t length)
Definition unicode-inl.h:64
v8::internal::Address address()
Definition api.h:72
static void Abort()
static bool supports_wasm_simd_128_
static unsigned supported_
static Address EnsureValidReturnAddress(Isolate *isolate, Address address)
static Deoptimizer * New(Address raw_function, DeoptimizeKind kind, Address from, int fp_to_sp_delta, Isolate *isolate)
static Address Redirect(Address external_function, Type type=ExternalReference::BUILTIN_CALL)
static V8_EXPORT_PRIVATE ExternalReference address_of_code_pointer_table_base_address()
static V8_EXPORT_PRIVATE ExternalReference address_of_load_from_stack_count(const char *function_name)
static V8_EXPORT_PRIVATE ExternalReference jslimit_address()
static ExternalReference invoke_function_callback(CallApiCallbackMode mode)
static V8_EXPORT_PRIVATE ExternalReference isolate_address()
static Address UnwrapRedirection(Address redirection_trampoline)
static V8_EXPORT_PRIVATE ExternalReference FromRawAddress(Address address)
V8_EXPORT_PRIVATE static V8_NOINLINE ExternalReference runtime_function_table_address_for_unittests(Isolate *isolate)
static V8_EXPORT_PRIVATE ExternalReference address_of_pending_message(LocalIsolate *local_isolate)
V8_EXPORT_PRIVATE Address address() const
static V8_EXPORT_PRIVATE ExternalReference address_of_store_to_stack_count(const char *function_name)
static ExternalReference Create(const SCTableReference &table_ref)
static ExternalReference search_string_raw()
static V8_EXPORT_PRIVATE int Wake(Tagged< JSArrayBuffer > array_buffer, size_t addr, uint32_t num_waiters_to_wake)
static Address current_limit_address(Isolate *isolate)
Definition handles.cc:243
static Address current_next_address(Isolate *isolate)
Definition handles.cc:239
static Address current_level_address(Isolate *isolate)
Definition handles.cc:235
static Tagged< String > ConvertOneByteToLower(Tagged< String > src, Tagged< String > dst)
static const uint8_t * ToLatin1LowerTable()
static const uint8_t * AsciiCollationWeightsL1()
static const uint8_t * AsciiCollationWeightsL3()
static constexpr intptr_t GetOffset(IsolateFieldId id)
static IsolateGroup * current()
static Address load_from_stack_count_address(const char *function_name)
Definition isolate.cc:7533
static Address store_to_stack_count_address(const char *function_name)
Definition isolate.cc:7546
static size_t GsabByteLength(Isolate *isolate, Address raw_array_buffer)
static Address ArrayJoinConcatToSequentialString(Isolate *isolate, Address raw_fixed_array, intptr_t length, Address raw_separator, Address raw_dest)
Definition objects.cc:4246
static Address GetField(Isolate *isolate, Address raw_date, Address smi_index)
static Tagged< Map > InvalidatePrototypeChains(Tagged< Map > map)
static Tagged< Smi > CreateIdentityHash(Isolate *isolate, Tagged< JSReceiver > key)
Tagged< Object > * pending_message_address()
static Address RefillCache(Isolate *isolate, Address raw_native_context)
static Address CallEnqueueMicrotask(Isolate *isolate, intptr_t microtask_queue_pointer, Address raw_microtask)
static bool IsForwardingIndex(uint32_t raw_hash_field)
Definition name-inl.h:112
static V8_EXPORT_PRIVATE Tagged< Smi > GetOrCreateHash(Tagged< Object > obj, Isolate *isolate)
Definition objects.cc:1696
static Address GetHash(Isolate *isolate, Address raw_key)
static const Function * RuntimeFunctionTable(Isolate *isolate)
Definition runtime.cc:354
static V8_EXPORT_PRIVATE const Function * FunctionForId(FunctionId id)
Definition runtime.cc:350
static const Function * FunctionForEntry(Address ref)
Definition runtime.cc:340
static V8_EXPORT_PRIVATE Address LexicographicCompare(Isolate *isolate, Tagged< Smi > x, Tagged< Smi > y)
Definition objects.cc:6618
static constexpr Tagged< Smi > zero()
Definition smi.h:99
std::atomic< int > * GetInternalPointer()
Definition counters.h:120
static void WriteToFlat(Tagged< String > source, SinkCharT *sink, uint32_t start, uint32_t length)
Definition string.cc:772
V8_INLINE constexpr StorageType ptr() const
static Address bytecode_size_table_address()
Definition bytecodes.h:1106
#define FUNCTION_ADDR(f)
Definition globals.h:712
int start
#define FUNCTION_REFERENCE_WITH_TYPE(Name, Target, Type)
#define FUNCTION_REFERENCE(Name, Target)
#define EXTERNAL_REFERENCE_LIST_ISOLATE_FIELDS(V)
#define ISOLATE_DATA_FIELDS(V)
ZoneVector< RpoNumber > & result
EmitFn fn
int x
V8_INLINE T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)
Definition allocation.h:276
unsigned short uint16_t
Definition unicode.cc:39
constexpr unsigned CountTrailingZeros(T value)
Definition bits.h:144
constexpr unsigned CountPopulation(T value)
Definition bits.h:26
int64_t SignedMulHigh64(int64_t u, int64_t v)
Definition bits.cc:24
double acosh(double x)
Definition ieee754.cc:936
double sin(double x)
Definition ieee754.cc:2450
double acos(double x)
Definition ieee754.cc:862
double asin(double x)
Definition ieee754.cc:991
void Relaxed_Store(volatile Atomic8 *ptr, Atomic8 value)
Definition atomicops.h:189
Atomic8 Relaxed_Load(volatile const Atomic8 *ptr)
Definition atomicops.h:234
void Relaxed_Memmove(volatile Atomic8 *dst, volatile const Atomic8 *src, size_t bytes)
Definition atomicops.h:388
int16_t Atomic16
Definition atomicops.h:58
void Relaxed_Memcpy(volatile Atomic8 *dst, volatile const Atomic8 *src, size_t bytes)
Definition atomicops.h:363
char Atomic8
Definition atomicops.h:57
int32_t Atomic32
Definition atomicops.h:59
void SeqCst_Store(volatile Atomic8 *ptr, Atomic8 value)
Definition atomicops.h:219
Address DebugGetCoverageInfo(Isolate *isolate, Address raw_sfi)
intptr_t DebugBreakAtEntry(Isolate *isolate, Address raw_sfi)
void f32_trunc_wrapper(Address data)
void f16x8_eq_wrapper(Address data)
void int64_to_float32_wrapper(Address data)
V8_EXPORT_PRIVATE WasmCodePointerTable * GetProcessWideWasmCodePointerTable()
void uint64_to_float32_wrapper(Address data)
void switch_stacks(Isolate *isolate, wasm::StackMemory *from)
void f16x8_min_wrapper(Address data)
int32_t memory_copy_wrapper(Address trusted_data_addr, uint32_t dst_mem_index, uint32_t src_mem_index, uintptr_t dst, uintptr_t src, uintptr_t size)
void f16x8_sqrt_wrapper(Address data)
void f16x8_qfma_wrapper(Address data)
int32_t uint64_div_wrapper(Address data)
void f64_nearest_int_wrapper(Address data)
void f16x8_floor_wrapper(Address data)
void f16x8_abs_wrapper(Address data)
uint32_t word32_rol_wrapper(uint32_t input, uint32_t shift)
void f32x4_floor_wrapper(Address data)
void f16x8_sub_wrapper(Address data)
void f16x8_sconvert_i16x8_wrapper(Address data)
Address shrink_stack(Isolate *isolate)
void float16_to_float32_wrapper(Address data)
uint32_t word32_ror_wrapper(uint32_t input, uint32_t shift)
intptr_t switch_to_the_central_stack_for_js(Isolate *isolate, Address fp)
double flat_string_to_f64(Address string_address)
Address grow_stack(Isolate *isolate, void *current_sp, size_t frame_size, size_t gap, Address current_fp)
void f16x8_demote_f64x2_zero_wrapper(Address data)
int32_t memory_init_wrapper(Address trusted_data_addr, uint32_t mem_index, uintptr_t dst, uint32_t src, uint32_t seg_index, uint32_t size)
void f16x8_pmin_wrapper(Address data)
void f16x8_lt_wrapper(Address data)
void float64_to_uint64_sat_wrapper(Address data)
void switch_from_the_central_stack(Isolate *isolate)
void f64x2_ceil_wrapper(Address data)
void f16x8_nearest_int_wrapper(Address data)
int32_t float32_to_uint64_wrapper(Address data)
void f32_nearest_int_wrapper(Address data)
int32_t float64_to_int64_wrapper(Address data)
int32_t float32_to_int64_wrapper(Address data)
void f16x8_mul_wrapper(Address data)
intptr_t switch_to_the_central_stack(Isolate *isolate, uintptr_t current_sp)
void f64x2_trunc_wrapper(Address data)
uint64_t word64_rol_wrapper(uint64_t input, uint32_t shift)
int32_t memory_fill_wrapper(Address trusted_data_addr, uint32_t mem_index, uintptr_t dst, uint8_t value, uintptr_t size)
void f16x8_neg_wrapper(Address data)
void f16x8_pmax_wrapper(Address data)
int32_t int64_div_wrapper(Address data)
void f64x2_floor_wrapper(Address data)
void f32x4_ceil_wrapper(Address data)
void f16x8_ceil_wrapper(Address data)
void float64_pow_wrapper(Address data)
void float32_to_int64_sat_wrapper(Address data)
void f32x4_trunc_wrapper(Address data)
uint64_t word64_ror_wrapper(uint64_t input, uint32_t shift)
void i16x8_uconvert_f16x8_wrapper(Address data)
void f16x8_div_wrapper(Address data)
void uint64_to_float64_wrapper(Address data)
void float64_to_int64_sat_wrapper(Address data)
void f16x8_trunc_wrapper(Address data)
void i16x8_sconvert_f16x8_wrapper(Address data)
void array_copy_wrapper(Address raw_dst_array, uint32_t dst_index, Address raw_src_array, uint32_t src_index, uint32_t length)
void array_fill_wrapper(Address raw_array, uint32_t index, uint32_t length, uint32_t emit_write_barrier, uint32_t raw_type, Address initial_value_addr)
void f16x8_demote_f32x4_zero_wrapper(Address data)
void f16x8_add_wrapper(Address data)
int32_t uint64_mod_wrapper(Address data)
void f64_ceil_wrapper(Address data)
void f32x4_nearest_int_wrapper(Address data)
void return_switch(Isolate *isolate, wasm::StackMemory *from)
void f16x8_qfms_wrapper(Address data)
void f32_floor_wrapper(Address data)
int32_t float64_to_uint64_wrapper(Address data)
void f16x8_uconvert_i16x8_wrapper(Address data)
void switch_from_the_central_stack_for_js(Isolate *isolate)
Address load_old_fp(Isolate *isolate)
void f16x8_max_wrapper(Address data)
void float32_to_float16_wrapper(Address data)
int32_t int64_mod_wrapper(Address data)
void f64_trunc_wrapper(Address data)
void f32x4_promote_low_f16x8_wrapper(Address data)
void f16x8_ne_wrapper(Address data)
void f64x2_nearest_int_wrapper(Address data)
void f32_ceil_wrapper(Address data)
void f64_floor_wrapper(Address data)
void int64_to_float64_wrapper(Address data)
void float32_to_uint64_sat_wrapper(Address data)
void f16x8_le_wrapper(Address data)
constexpr int kMinInt
Definition globals.h:375
uint32_t RightShiftResultLength(Address x_addr, uint32_t x_sign, intptr_t shift)
Definition bigint.cc:1705
constexpr struct v8::internal::alignas wasm_int32_max_as_double
tsan_relaxed_store_8_bits tsan_relaxed_store_32_bits tsan_seq_cst_store_8_bits tsan_seq_cst_store_32_bits tsan_relaxed_load_function_32_bits
tsan_relaxed_store_8_bits tsan_relaxed_store_32_bits tsan_seq_cst_store_function_8_bits
static int64_t atomic_pair_or(intptr_t address, int value_low, int value_high)
void MutableBigInt_BitwiseAndNegNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1599
bool operator!=(ExternalReference lhs, ExternalReference rhs)
static void f64_asin_wrapper(Address data)
constexpr struct v8::internal::alignas wasm_i8x16_splat_0x33
Address CheckObjectType(Address raw_value, Address raw_type, Address raw_location)
template ExternalReference ExternalReference::search_string_raw< const base::uc16, const uint8_t >()
static constexpr uint32_t kFalse
tsan_relaxed_store_8_bits tsan_relaxed_store_function_32_bits
size_t hash_value(AtomicMemoryOrder order)
static int64_t atomic_pair_add(intptr_t address, int value_low, int value_high)
void MutableBigInt_BitwiseXorNegNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1671
double Modulo(double x, double y)
Definition utils.h:105
constexpr uint64_t double_the_hole_nan_constant
constexpr struct v8::internal::alignas fp16_negate_constant
constexpr struct v8::internal::alignas wasm_i8x16_swizzle_mask
constexpr struct v8::internal::alignas double_absolute_constant
constexpr struct v8::internal::alignas wasm_uint32_max_as_double
void MutableBigInt_RightShiftAndCanonicalize(Address result_addr, Address x_addr, intptr_t shift, uint32_t must_round_down)
Definition bigint.cc:1718
Tagged(T object) -> Tagged< T >
const uint8_t * TypedArrayAndRabGsabTypedArrayElementsKindShifts()
void * libc_memset(void *dest, int value, size_t n)
void InvokeFunctionCallbackOptimized(const v8::FunctionCallbackInfo< v8::Value > &info)
Definition api.cc:12187
constexpr uint64_t kHoleNanInt64
Definition globals.h:1960
uintptr_t ArrayIndexOfIncludesDouble(Address array_start, uintptr_t array_len, uintptr_t from_index, Address search_element)
Definition simd.cc:442
BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL int character
static void f64_mod_wrapper(Address data)
void MutableBigInt_BitwiseOrNegNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1635
int32_t MutableBigInt_AbsoluteMulAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1513
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
void MutableBigInt_BitwiseOrPosPosAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1623
void * libc_memmove(void *dest, const void *src, size_t n)
void relaxed_memmove(volatile base::Atomic8 *dest, volatile const base::Atomic8 *src, size_t n)
int32_t MutableBigInt_AbsoluteCompare(Address x_addr, Address y_addr)
Definition bigint.cc:1493
const char * GetAbortReason(AbortReason reason)
void CopyTypedArrayElementsToTypedArray(Address raw_source, Address raw_destination, uintptr_t length, uintptr_t offset)
Definition elements.cc:5691
constexpr double double_min_int_constant
void MutableBigInt_BitwiseXorPosNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1683
Address GetOrCreateHash(Isolate *isolate, Address raw_key)
void MutableBigInt_BitwiseAndPosNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1611
static ExternalTwoByteStringGetChars constexpr uint64_t kLog10OffsetTable[]
constexpr struct v8::internal::alignas wasm_double_2_power_52
constexpr struct v8::internal::alignas float_negate_constant
static int64_t atomic_pair_xor(intptr_t address, int value_low, int value_high)
constexpr struct v8::internal::alignas wasm_f64x2_convert_low_i32x4_u_int_mask
static int64_t atomic_pair_exchange(intptr_t address, int value_low, int value_high)
constexpr struct v8::internal::alignas double_negate_constant
uint32_t fp16_raw_bits_ieee_to_fp32_raw_bits(uint32_t input)
void MutableBigInt_BitwiseOrPosNegAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1647
bool IsValidAbortReason(int reason_id)
void MutableBigInt_BitwiseAndPosPosAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1587
static Address InvalidatePrototypeChainsWrapper(Address raw_map)
static Address JSReceiverCreateIdentityHash(Isolate *isolate, Address raw_key)
return ComputeSeededHash(static_cast< uint32_t >(key), HashSeed(isolate))
uintptr_t ArrayIndexOfIncludesSmiOrObject(Address array_start, uintptr_t array_len, uintptr_t from_index, Address search_element)
Definition simd.cc:434
constexpr struct v8::internal::alignas wasm_i8x16_splat_0x01
void InvokeFunctionCallbackGeneric(const v8::FunctionCallbackInfo< v8::Value > &info)
Definition api.cc:12182
void MutableBigInt_AbsoluteSubAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1500
@ kExternalObjectValueTag
static void atomic_pair_store(intptr_t address, int value_low, int value_high)
constexpr struct v8::internal::alignas wasm_i8x16_splat_0x0f
WriteBarrier::EphemeronKeyWriteBarrierFromCode ExternalPointerHandle AllocateAndInitializeYoungExternalPointerTableEntry(Isolate *isolate, Address pointer)
constexpr struct v8::internal::alignas wasm_i8x16_splat_0x55
V8_EXPORT_PRIVATE FlagValues v8_flags
void CopyTypedArrayElementsSlice(Address raw_source, Address raw_destination, uintptr_t start, uintptr_t end)
Definition elements.cc:5712
uint32_t fp64_raw_bits_to_fp16_raw_bits_for_32bit_arch(uint32_t hi, uint32_t lo)
static int64_t atomic_pair_load(intptr_t address)
intptr_t SearchStringRaw(Isolate *isolate, const SubjectChar *subject_ptr, int subject_length, const PatternChar *pattern_ptr, int pattern_length, int start_index)
void MutableBigInt_AbsoluteAddAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1482
tsan_relaxed_store_8_bits tsan_relaxed_store_32_bits tsan_seq_cst_store_8_bits tsan_seq_cst_store_function_32_bits
NameDictionaryLookupForwardedString< NameDictionary, kFindInsertionEntry > NameDictionaryLookupForwardedString< GlobalDictionary, kFindInsertionEntry > NameDictionaryLookupForwardedString< NameToIndexHashTable, kFindInsertionEntry > CopyTypedArrayElementsToTypedArray StringForwardingTable::GetForwardStringAddress static ArrayIndexOfIncludesSmiOrObject Address LexicographicCompareWrapper(Isolate *isolate, Address smi_x, Address smi_y)
uint32_t ExternalPointerHandle
static int64_t atomic_pair_and(intptr_t address, int value_low, int value_high)
const uint8_t * TypedArrayAndRabGsabTypedArrayElementsKindSizes()
uint16_t DoubleToFloat16(double value)
template ExternalReference ExternalReference::search_string_raw< const base::uc16, const base::uc16 >()
void MutableBigInt_LeftShiftAndCanonicalize(Address result_addr, Address x_addr, intptr_t shift)
Definition bigint.cc:1695
return value
Definition map-inl.h:893
constexpr struct v8::internal::alignas fp16_absolute_constant
uint64_t HashSeed(Isolate *isolate)
static ExternalReference::Type BuiltinCallTypeForResultSize(int result_size)
tsan_relaxed_store_8_bits tsan_relaxed_store_32_bits tsan_seq_cst_store_8_bits tsan_seq_cst_store_32_bits tsan_relaxed_load_32_bits Address raw_context
static uint64_t atomic_pair_compare_exchange(intptr_t address, int old_value_low, int old_value_high, int new_value_low, int new_value_high)
constexpr struct v8::internal::alignas wasm_i8x16_popcnt_mask
int32_t MutableBigInt_AbsoluteModAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1563
constexpr struct v8::internal::alignas wasm_int32_overflow_as_float
template ExternalReference ExternalReference::search_string_raw< const uint8_t, const base::uc16 >()
int32_t MutableBigInt_AbsoluteDivAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1537
static size_t NameDictionaryLookupForwardedString(Isolate *isolate, Address raw_dict, Address raw_key)
void relaxed_memcpy(volatile base::Atomic8 *dest, volatile const base::Atomic8 *src, size_t n)
constexpr struct v8::internal::alignas wasm_i16x8_splat_0x0001
static int64_t atomic_pair_sub(intptr_t address, int value_low, int value_high)
void CopyFastNumberJSArrayElementsToTypedArray(Address raw_context, Address raw_source, Address raw_destination, uintptr_t length, uintptr_t offset)
Definition elements.cc:5667
void InvokeAccessorGetterCallback(v8::Local< v8::Name > property, const v8::PropertyCallbackInfo< v8::Value > &info)
Definition api.cc:12097
constexpr double double_uint32_bias_constant
constexpr uint8_t kNumIsolateFieldIds
constexpr uint32_t kMaxUInt32
Definition globals.h:387
constexpr double double_one_half_constant
static void f64_acos_wrapper(Address data)
void abort_with_reason(int reason)
void MutableBigInt_BitwiseXorPosPosAndCanonicalize(Address result_addr, Address x_addr, Address y_addr)
Definition bigint.cc:1659
void * libc_memcpy(void *dest, const void *src, size_t n)
return unibrow::Utf16::HasUnpairedSurrogate(code_units, length) ? kTrue void ReplaceUnpairedSurrogates(const uint16_t *source_code_units, uint16_t *dest_code_units, size_t length)
BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL BUILTIN_FP_CALL int size_t search_length
constexpr struct v8::internal::alignas float_absolute_constant
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
constexpr struct v8::internal::alignas wasm_i32x8_int32_overflow_as_float
#define CHECK(condition)
Definition logging.h:124
#define CHECK_NOT_NULL(val)
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define IF_TSAN(V,...)
Definition macros.h:493
static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats
#define T1(name, string, precedence)
Definition token.cc:28
#define T2(name, string, precedence)
Definition token.cc:30
#define WASM_JS_EXTERNAL_REFERENCE_LIST(V)
Definition wasm-js.h:32