2018-03-09 11:57:08 +00:00
|
|
|
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "src/external-reference.h"
|
|
|
|
|
|
|
|
#include "src/api.h"
|
|
|
|
#include "src/base/ieee754.h"
|
|
|
|
#include "src/codegen.h"
|
|
|
|
#include "src/compiler/code-assembler.h"
|
|
|
|
#include "src/counters.h"
|
|
|
|
#include "src/debug/debug.h"
|
|
|
|
#include "src/deoptimizer.h"
|
|
|
|
#include "src/elements.h"
|
|
|
|
#include "src/heap/heap.h"
|
|
|
|
#include "src/ic/stub-cache.h"
|
|
|
|
#include "src/interpreter/interpreter.h"
|
2018-03-21 11:12:49 +00:00
|
|
|
#include "src/isolate.h"
|
2018-09-24 13:25:07 +00:00
|
|
|
#include "src/math-random.h"
|
2018-03-09 11:57:08 +00:00
|
|
|
#include "src/objects-inl.h"
|
|
|
|
#include "src/regexp/regexp-stack.h"
|
2018-04-17 07:42:30 +00:00
|
|
|
#include "src/simulator-base.h"
|
2018-03-09 11:57:08 +00:00
|
|
|
#include "src/string-search.h"
|
|
|
|
#include "src/wasm/wasm-external-refs.h"
|
|
|
|
|
|
|
|
// Include native regexp-macro-assembler.
|
|
|
|
#ifndef V8_INTERPRETED_REGEXP
|
|
|
|
#if V8_TARGET_ARCH_IA32
|
|
|
|
#include "src/regexp/ia32/regexp-macro-assembler-ia32.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_X64
|
|
|
|
#include "src/regexp/x64/regexp-macro-assembler-x64.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_ARM64
|
|
|
|
#include "src/regexp/arm64/regexp-macro-assembler-arm64.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_ARM
|
|
|
|
#include "src/regexp/arm/regexp-macro-assembler-arm.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_PPC
|
|
|
|
#include "src/regexp/ppc/regexp-macro-assembler-ppc.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_MIPS
|
|
|
|
#include "src/regexp/mips/regexp-macro-assembler-mips.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_MIPS64
|
|
|
|
#include "src/regexp/mips64/regexp-macro-assembler-mips64.h" // NOLINT
|
|
|
|
#elif V8_TARGET_ARCH_S390
|
|
|
|
#include "src/regexp/s390/regexp-macro-assembler-s390.h" // NOLINT
|
|
|
|
#else // Unknown architecture.
|
|
|
|
#error "Unknown architecture."
|
|
|
|
#endif // Target architecture.
|
|
|
|
#endif // V8_INTERPRETED_REGEXP
|
|
|
|
|
|
|
|
#ifdef V8_INTL_SUPPORT
|
2018-10-22 22:02:57 +00:00
|
|
|
#include "src/objects/intl-objects.h"
|
2018-03-09 11:57:08 +00:00
|
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Common double constants.
|
|
|
|
|
2018-04-16 16:22:19 +00:00
|
|
|
constexpr double double_min_int_constant = kMinInt;
|
|
|
|
constexpr double double_one_half_constant = 0.5;
|
|
|
|
constexpr uint64_t double_the_hole_nan_constant = kHoleNanInt64;
|
|
|
|
constexpr double double_uint32_bias_constant =
|
|
|
|
static_cast<double>(kMaxUInt32) + 1;
|
|
|
|
|
|
|
|
constexpr struct V8_ALIGNED(16) {
|
2018-03-09 11:57:08 +00:00
|
|
|
uint32_t a;
|
|
|
|
uint32_t b;
|
|
|
|
uint32_t c;
|
|
|
|
uint32_t d;
|
|
|
|
} float_absolute_constant = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
|
|
|
|
|
2018-04-16 16:22:19 +00:00
|
|
|
constexpr struct V8_ALIGNED(16) {
|
2018-03-09 11:57:08 +00:00
|
|
|
uint32_t a;
|
|
|
|
uint32_t b;
|
|
|
|
uint32_t c;
|
|
|
|
uint32_t d;
|
|
|
|
} float_negate_constant = {0x80000000, 0x80000000, 0x80000000, 0x80000000};
|
|
|
|
|
2018-04-16 16:22:19 +00:00
|
|
|
constexpr struct V8_ALIGNED(16) {
|
2018-03-09 11:57:08 +00:00
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
} double_absolute_constant = {uint64_t{0x7FFFFFFFFFFFFFFF},
|
|
|
|
uint64_t{0x7FFFFFFFFFFFFFFF}};
|
|
|
|
|
2018-04-16 16:22:19 +00:00
|
|
|
constexpr struct V8_ALIGNED(16) {
|
2018-03-09 11:57:08 +00:00
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
} double_negate_constant = {uint64_t{0x8000000000000000},
|
|
|
|
uint64_t{0x8000000000000000}};
|
|
|
|
|
|
|
|
// Implementation of ExternalReference
|
|
|
|
|
|
|
|
static ExternalReference::Type BuiltinCallTypeForResultSize(int result_size) {
|
|
|
|
switch (result_size) {
|
|
|
|
case 1:
|
|
|
|
return ExternalReference::BUILTIN_CALL;
|
|
|
|
case 2:
|
|
|
|
return ExternalReference::BUILTIN_CALL_PAIR;
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(
|
|
|
|
ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) {
|
|
|
|
return ExternalReference(Redirect(fun->address(), type));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(Runtime::FunctionId id) {
|
|
|
|
return Create(Runtime::FunctionForId(id));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(const Runtime::Function* f) {
|
|
|
|
return ExternalReference(
|
|
|
|
Redirect(f->entry, BuiltinCallTypeForResultSize(f->result_size)));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(Address address) {
|
|
|
|
return ExternalReference(Redirect(address));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
|
|
|
ExternalReference ExternalReference::isolate_address(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate);
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::builtins_address(Isolate* isolate) {
|
2018-06-05 15:51:00 +00:00
|
|
|
return ExternalReference(isolate->heap()->builtin_address(0));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::handle_scope_implementer_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->handle_scope_implementer_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::interpreter_dispatch_table_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->interpreter()->dispatch_table_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::interpreter_dispatch_counters(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
|
|
|
isolate->interpreter()->bytecode_dispatch_counters_table());
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::bytecode_size_table_address() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
|
|
|
interpreter::Bytecodes::bytecode_size_table_address());
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(StatsCounter* counter) {
|
|
|
|
return ExternalReference(
|
|
|
|
reinterpret_cast<Address>(counter->GetInternalPointer()));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(IsolateAddressId id,
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->get_address_from_id(id));
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
// static
|
|
|
|
ExternalReference ExternalReference::Create(const SCTableReference& table_ref) {
|
|
|
|
return ExternalReference(table_ref.address());
|
|
|
|
}
|
2018-03-09 11:57:08 +00:00
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference
|
|
|
|
ExternalReference::incremental_marking_record_write_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(IncrementalMarking::RecordWriteFromCode)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::store_buffer_overflow_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-08-20 13:30:37 +00:00
|
|
|
Redirect(Heap::store_buffer_overflow_function_address()));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::delete_handle_scope_extensions() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(HandleScope::DeleteExtensions)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::get_date_field_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(JSDate::GetField)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->date_cache()->stamp_address());
|
|
|
|
}
|
|
|
|
|
2018-03-09 15:59:20 +00:00
|
|
|
// static
|
|
|
|
ExternalReference
|
|
|
|
ExternalReference::runtime_function_table_address_for_unittests(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return runtime_function_table_address(isolate);
|
|
|
|
}
|
|
|
|
|
2018-03-21 11:12:49 +00:00
|
|
|
// static
|
2018-04-17 07:42:30 +00:00
|
|
|
Address ExternalReference::Redirect(Address address, Type type) {
|
|
|
|
#ifdef USE_SIMULATOR
|
|
|
|
return SimulatorBase::RedirectExternalReference(address, type);
|
|
|
|
#else
|
|
|
|
return address;
|
|
|
|
#endif
|
2018-03-21 11:12:49 +00:00
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
ExternalReference ExternalReference::stress_deopt_count(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->stress_deopt_count_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::force_slow_path(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->force_slow_path_address());
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::new_deoptimizer_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(Deoptimizer::New)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::compute_output_frames_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f32_trunc() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f32_trunc_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f32_floor() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f32_floor_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f32_ceil() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f32_ceil_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f32_nearest_int() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::f32_nearest_int_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f64_trunc() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f64_trunc_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f64_floor() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f64_floor_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f64_ceil() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::f64_ceil_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_f64_nearest_int() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::f64_nearest_int_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_int64_to_float32() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::int64_to_float32_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_uint64_to_float32() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::uint64_to_float32_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_int64_to_float64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::int64_to_float64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_uint64_to_float64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::uint64_to_float64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_float32_to_int64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::float32_to_int64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_float32_to_uint64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::float32_to_uint64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_float64_to_int64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::float64_to_int64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_float64_to_uint64() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::float64_to_uint64_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_int64_div() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::int64_div_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_int64_mod() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::int64_mod_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_uint64_div() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::uint64_div_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_uint64_mod() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::uint64_mod_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word32_ctz() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::word32_ctz_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word64_ctz() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::word64_ctz_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word32_popcnt() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::word32_popcnt_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word64_popcnt() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::word64_popcnt_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word32_rol() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::word32_rol_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_word32_ror() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::word32_ror_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-24 11:56:04 +00:00
|
|
|
static void f64_acos_wrapper(Address data) {
|
|
|
|
double input = ReadUnalignedValue<double>(data);
|
|
|
|
WriteUnalignedValue(data, base::ieee754::acos(input));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::f64_acos_wrapper_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f64_acos_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-24 11:56:04 +00:00
|
|
|
static void f64_asin_wrapper(Address data) {
|
|
|
|
double input = ReadUnalignedValue<double>(data);
|
|
|
|
WriteUnalignedValue<double>(data, base::ieee754::asin(input));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::f64_asin_wrapper_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f64_asin_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_float64_pow() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(wasm::float64_pow_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-24 11:56:04 +00:00
|
|
|
static void f64_mod_wrapper(Address data) {
|
|
|
|
double dividend = ReadUnalignedValue<double>(data);
|
|
|
|
double divisor = ReadUnalignedValue<double>(data + sizeof(dividend));
|
|
|
|
WriteUnalignedValue<double>(data, Modulo(dividend, divisor));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::f64_mod_wrapper_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f64_mod_wrapper)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::wasm_call_trap_callback_for_testing() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(wasm::call_trap_callback_for_testing)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::log_enter_external_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(Logger::EnterExternal)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::log_leave_external_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(Logger::LeaveExternal)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-10-24 22:52:04 +00:00
|
|
|
ExternalReference ExternalReference::isolate_root(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->isolate_root());
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::allocation_sites_list_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->allocation_sites_list_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::address_of_stack_limit(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->stack_guard()->address_of_jslimit());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::address_of_real_stack_limit(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->stack_guard()->address_of_real_jslimit());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::store_buffer_top(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->store_buffer_top_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::heap_is_marking_flag_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->IsMarkingFlagAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::new_space_allocation_top_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::new_space_allocation_limit_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::old_space_allocation_top_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->OldSpaceAllocationTopAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::old_space_allocation_limit_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->heap()->OldSpaceAllocationLimitAddress());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::handle_scope_level_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(HandleScope::current_level_address(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::handle_scope_next_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(HandleScope::current_next_address(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::handle_scope_limit_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(HandleScope::current_limit_address(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::scheduled_exception_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->scheduled_exception_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::address_of_pending_message_obj(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->pending_message_obj_address());
|
|
|
|
}
|
|
|
|
|
Reland "[turboassembler] Introduce hard-abort mode"
This is a reland of a462a7854a081f4f34bb4c112ee33f3d69efa309
Original change's description:
> [turboassembler] Introduce hard-abort mode
>
> For checks and assertions (mostly for debug code, like stack alignment
> or zero extension), we had two modes: Emit a call to the {Abort}
> runtime function (the default), and emit a debug break (used for
> testing, enabled via --trap-on-abort).
> In wasm, where we cannot just call a runtime function because code must
> be isolate independent, we always used the trap-on-abort behaviour.
> This causes problems for our fuzzers, which do not catch SIGTRAP, and
> hence do not detect debug code failures.
>
> This CL introduces a third mode ("hard abort"), which calls a C
> function via {ExternalReference}. The C function still outputs the
> abort reason, but does not print the stack trace. It then aborts via
> "OS::Abort", just like the runtime function.
> This will allow fuzzers to detect the crash and even find a nice error
> message.
>
> Even though this looks like a lot of code churn, it is actually not.
> Most added lines are new tests, and other changes are minimal.
>
> R=mstarzinger@chromium.org
>
> Bug: chromium:863799
> Change-Id: I77c58ff72db552d49014614436259ccfb49ba87b
> Reviewed-on: https://chromium-review.googlesource.com/1142163
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54592}
Bug: chromium:863799
Change-Id: I7729a47b4823a982a8e201df36520aa2b6ef5326
Reviewed-on: https://chromium-review.googlesource.com/1146100
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54656}
2018-07-24 14:12:47 +00:00
|
|
|
ExternalReference ExternalReference::abort_with_reason() {
|
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(i::abort_with_reason)));
|
|
|
|
}
|
|
|
|
|
2018-10-05 12:32:47 +00:00
|
|
|
ExternalReference
|
|
|
|
ExternalReference::address_of_harmony_await_optimization_flag() {
|
|
|
|
return ExternalReference(&FLAG_harmony_await_optimization);
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_min_int() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(reinterpret_cast<Address>(&double_min_int_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 15:35:29 +00:00
|
|
|
ExternalReference ExternalReference::address_of_runtime_stats_flag() {
|
|
|
|
return ExternalReference(&FLAG_runtime_stats);
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_one_half() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(
|
|
|
|
reinterpret_cast<Address>(&double_one_half_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_the_hole_nan() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-16 16:22:19 +00:00
|
|
|
reinterpret_cast<Address>(&double_the_hole_nan_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_uint32_bias() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-16 16:22:19 +00:00
|
|
|
reinterpret_cast<Address>(&double_uint32_bias_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_float_abs_constant() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(reinterpret_cast<Address>(&float_absolute_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_float_neg_constant() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(reinterpret_cast<Address>(&float_negate_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_double_abs_constant() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(
|
|
|
|
reinterpret_cast<Address>(&double_absolute_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::address_of_double_neg_constant() {
|
2018-04-16 16:22:19 +00:00
|
|
|
return ExternalReference(reinterpret_cast<Address>(&double_negate_constant));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::is_profiling_address(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->is_profiling_address());
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::invoke_function_callback() {
|
2018-03-09 11:57:08 +00:00
|
|
|
Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
|
|
|
|
ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
|
|
|
|
ApiFunction thunk_fun(thunk_address);
|
2018-04-25 07:28:14 +00:00
|
|
|
return ExternalReference::Create(&thunk_fun, thunk_type);
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::invoke_accessor_getter_callback() {
|
2018-03-09 11:57:08 +00:00
|
|
|
Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
|
|
|
|
ExternalReference::Type thunk_type = ExternalReference::PROFILING_GETTER_CALL;
|
|
|
|
ApiFunction thunk_fun(thunk_address);
|
2018-04-25 07:28:14 +00:00
|
|
|
return ExternalReference::Create(&thunk_fun, thunk_type);
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef V8_INTERPRETED_REGEXP
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::re_check_stack_guard_state(
|
|
|
|
Isolate* isolate) {
|
|
|
|
Address function;
|
|
|
|
#if V8_TARGET_ARCH_X64
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_IA32
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_ARM64
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerARM64::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_ARM
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_PPC
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerPPC::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_MIPS
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerMIPS::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_MIPS64
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerMIPS::CheckStackGuardState);
|
|
|
|
#elif V8_TARGET_ARCH_S390
|
|
|
|
function = FUNCTION_ADDR(RegExpMacroAssemblerS390::CheckStackGuardState);
|
|
|
|
#else
|
|
|
|
UNREACHABLE();
|
|
|
|
#endif
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(function));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::re_case_insensitive_compare_uc16(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(Redirect(
|
|
|
|
FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
|
|
|
|
}
|
|
|
|
|
2018-03-09 15:59:20 +00:00
|
|
|
ExternalReference ExternalReference::re_word_character_map(Isolate* isolate) {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
|
|
|
NativeRegExpMacroAssembler::word_character_map_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::address_of_static_offsets_vector(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
|
|
|
reinterpret_cast<Address>(isolate->jsregexp_static_offsets_vector()));
|
|
|
|
}
|
|
|
|
|
2018-03-12 08:46:44 +00:00
|
|
|
ExternalReference ExternalReference::address_of_regexp_stack_limit(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->regexp_stack()->limit_address());
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
ExternalReference ExternalReference::address_of_regexp_stack_memory_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->regexp_stack()->memory_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::address_of_regexp_stack_memory_size(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->regexp_stack()->memory_size_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // V8_INTERPRETED_REGEXP
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_acos_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::acos), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_acosh_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::acosh), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_asin_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::asin), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_asinh_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::asinh), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_atan_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::atan), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_atanh_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::atanh), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_atan2_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::atan2), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_cbrt_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::cbrt), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_cos_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::cos), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_cosh_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::cosh), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_exp_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::exp), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_expm1_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::expm1), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_log_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::log), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_log1p_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::log1p), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_log10_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::log10), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_log2_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::log2), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_sin_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::sin), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_sinh_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::sinh), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_tan_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::tan), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::ieee754_tanh_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(base::ieee754::tanh), BUILTIN_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* libc_memchr(void* string, int character, size_t search_length) {
|
|
|
|
return memchr(string, character, search_length);
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::libc_memchr_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(libc_memchr)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* libc_memcpy(void* dest, const void* src, size_t n) {
|
|
|
|
return memcpy(dest, src, n);
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::libc_memcpy_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(libc_memcpy)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* libc_memmove(void* dest, const void* src, size_t n) {
|
|
|
|
return memmove(dest, src, n);
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::libc_memmove_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(libc_memmove)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-06-27 16:52:37 +00:00
|
|
|
void* libc_memset(void* dest, int value, size_t n) {
|
|
|
|
DCHECK_EQ(static_cast<byte>(value), value);
|
|
|
|
return memset(dest, value, n);
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::libc_memset_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(libc_memset)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::printf_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(std::printf)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-09-24 13:25:07 +00:00
|
|
|
ExternalReference ExternalReference::refill_math_random() {
|
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(MathRandom::RefillCache)));
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
template <typename SubjectChar, typename PatternChar>
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::search_string_raw() {
|
2018-03-09 11:57:08 +00:00
|
|
|
auto f = SearchStringRaw<SubjectChar, PatternChar>;
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-10-16 12:52:25 +00:00
|
|
|
ExternalReference
|
|
|
|
ExternalReference::jsarray_array_join_concat_to_sequential_string() {
|
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(JSArray::ArrayJoinConcatToSequentialString)));
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::search_string_raw_one_one() {
|
|
|
|
return search_string_raw<const uint8_t, const uint8_t>();
|
2018-03-09 15:59:20 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::search_string_raw_one_two() {
|
|
|
|
return search_string_raw<const uint8_t, const uc16>();
|
2018-03-09 15:59:20 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::search_string_raw_two_one() {
|
|
|
|
return search_string_raw<const uc16, const uint8_t>();
|
2018-03-09 15:59:20 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::search_string_raw_two_two() {
|
|
|
|
return search_string_raw<const uc16, const uc16>();
|
2018-03-09 15:59:20 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::orderedhashmap_gethash_raw() {
|
2018-03-09 11:57:08 +00:00
|
|
|
auto f = OrderedHashMap::GetHash;
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-09-24 11:59:17 +00:00
|
|
|
ExternalReference ExternalReference::get_or_create_hash_raw() {
|
2018-11-03 00:13:22 +00:00
|
|
|
typedef Address (*GetOrCreateHash)(Isolate * isolate, Object * key);
|
2018-03-09 11:57:08 +00:00
|
|
|
GetOrCreateHash f = Object::GetOrCreateHash;
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(f)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-11-03 00:13:22 +00:00
|
|
|
static Address JSReceiverCreateIdentityHash(Isolate* isolate, JSReceiver* key) {
|
|
|
|
return JSReceiver::CreateIdentityHash(isolate, key).ptr();
|
|
|
|
}
|
|
|
|
|
2018-09-24 11:59:17 +00:00
|
|
|
ExternalReference ExternalReference::jsreceiver_create_identity_hash() {
|
2018-11-03 00:13:22 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(JSReceiverCreateIdentityHash)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-09-20 13:42:57 +00:00
|
|
|
static uint32_t ComputeSeededIntegerHash(Isolate* isolate, uint32_t key) {
|
|
|
|
DisallowHeapAllocation no_gc;
|
|
|
|
return ComputeSeededHash(key, isolate->heap()->HashSeed());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::compute_integer_hash() {
|
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(ComputeSeededIntegerHash)));
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
ExternalReference
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference::copy_fast_number_jsarray_elements_to_typed_array() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(CopyFastNumberJSArrayElementsToTypedArray)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference
|
|
|
|
ExternalReference::copy_typed_array_elements_to_typed_array() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(CopyTypedArrayElementsToTypedArray)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::copy_typed_array_elements_slice() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(CopyTypedArrayElementsSlice)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::try_internalize_string_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(StringTable::LookupStringIfExists_NoAllocate)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-11-08 21:42:34 +00:00
|
|
|
static Address LexicographicCompareWrapper(Isolate* isolate, Address smi_x,
|
|
|
|
Address smi_y) {
|
|
|
|
Smi x(smi_x);
|
|
|
|
Smi y(smi_y);
|
|
|
|
return Smi::LexicographicCompare(isolate, x, y);
|
|
|
|
}
|
|
|
|
|
2018-09-05 09:28:55 +00:00
|
|
|
ExternalReference ExternalReference::smi_lexicographic_compare_function() {
|
2018-11-08 21:42:34 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(LexicographicCompareWrapper)));
|
2018-09-05 09:28:55 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::check_object_type() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(Redirect(FUNCTION_ADDR(CheckObjectType)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef V8_INTL_SUPPORT
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::intl_convert_one_byte_to_lower() {
|
2018-10-22 22:02:57 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(Intl::ConvertOneByteToLower)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::intl_to_latin1_lower_table() {
|
2018-10-22 22:02:57 +00:00
|
|
|
uint8_t* ptr = const_cast<uint8_t*>(Intl::ToLatin1LowerTable());
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(reinterpret_cast<Address>(ptr));
|
|
|
|
}
|
|
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
|
|
|
|
// Explicit instantiations for all combinations of 1- and 2-byte strings.
|
|
|
|
template ExternalReference
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference::search_string_raw<const uint8_t, const uint8_t>();
|
2018-03-09 11:57:08 +00:00
|
|
|
template ExternalReference
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference::search_string_raw<const uint8_t, const uc16>();
|
2018-03-09 11:57:08 +00:00
|
|
|
template ExternalReference
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference::search_string_raw<const uc16, const uint8_t>();
|
2018-03-09 11:57:08 +00:00
|
|
|
template ExternalReference
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference::search_string_raw<const uc16, const uc16>();
|
2018-03-09 11:57:08 +00:00
|
|
|
|
|
|
|
ExternalReference ExternalReference::page_flags(Page* page) {
|
|
|
|
return ExternalReference(reinterpret_cast<Address>(page) +
|
|
|
|
MemoryChunk::kFlagsOffset);
|
|
|
|
}
|
|
|
|
|
2018-09-21 00:32:01 +00:00
|
|
|
ExternalReference ExternalReference::FromRawAddress(Address address) {
|
|
|
|
return ExternalReference(address);
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::cpu_features() {
|
2018-03-09 11:57:08 +00:00
|
|
|
DCHECK(CpuFeatures::initialized_);
|
|
|
|
return ExternalReference(&CpuFeatures::supported_);
|
|
|
|
}
|
|
|
|
|
2018-06-05 14:16:34 +00:00
|
|
|
ExternalReference ExternalReference::promise_hook_address(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->promise_hook_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::async_event_delegate_address(
|
2018-03-09 11:57:08 +00:00
|
|
|
Isolate* isolate) {
|
2018-06-05 14:16:34 +00:00
|
|
|
return ExternalReference(isolate->async_event_delegate_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference
|
|
|
|
ExternalReference::promise_hook_or_async_event_delegate_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
|
|
|
isolate->promise_hook_or_async_event_delegate_address());
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-10-23 12:00:37 +00:00
|
|
|
ExternalReference ExternalReference::
|
|
|
|
promise_hook_or_debug_is_active_or_async_event_delegate_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
|
|
|
isolate
|
|
|
|
->promise_hook_or_debug_is_active_or_async_event_delegate_address());
|
|
|
|
}
|
|
|
|
|
2018-08-30 13:35:12 +00:00
|
|
|
ExternalReference ExternalReference::debug_execution_mode_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->debug_execution_mode_address());
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
ExternalReference ExternalReference::debug_is_active_address(Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->debug()->is_active_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::debug_hook_on_function_call_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->debug()->hook_on_function_call_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::runtime_function_table_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(
|
|
|
|
const_cast<Runtime::Function*>(Runtime::RuntimeFunctionTable(isolate)));
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::invalidate_prototype_chains_function() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(
|
2018-04-17 07:42:30 +00:00
|
|
|
Redirect(FUNCTION_ADDR(JSObject::InvalidatePrototypeChains)));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-09-14 21:08:08 +00:00
|
|
|
double power_helper(double x, double y) {
|
2018-03-09 11:57:08 +00:00
|
|
|
int y_int = static_cast<int>(y);
|
|
|
|
if (y == y_int) {
|
|
|
|
return power_double_int(x, y_int); // Returns 1 if exponent is 0.
|
|
|
|
}
|
|
|
|
if (y == 0.5) {
|
2018-09-14 21:08:08 +00:00
|
|
|
lazily_initialize_fast_sqrt();
|
2018-03-09 11:57:08 +00:00
|
|
|
return (std::isinf(x)) ? V8_INFINITY
|
2018-09-14 21:08:08 +00:00
|
|
|
: fast_sqrt(x + 0.0); // Convert -0 to +0.
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
if (y == -0.5) {
|
2018-09-14 21:08:08 +00:00
|
|
|
lazily_initialize_fast_sqrt();
|
|
|
|
return (std::isinf(x)) ? 0 : 1.0 / fast_sqrt(x + 0.0); // Convert -0 to +0.
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
return power_double_double(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Helper function to compute x^y, where y is known to be an
|
|
|
|
// integer. Uses binary decomposition to limit the number of
|
|
|
|
// multiplications; see the discussion in "Hacker's Delight" by Henry
|
|
|
|
// S. Warren, Jr., figure 11-6, page 213.
|
|
|
|
double power_double_int(double x, int y) {
|
|
|
|
double m = (y < 0) ? 1 / x : x;
|
|
|
|
unsigned n = (y < 0) ? -y : y;
|
|
|
|
double p = 1;
|
|
|
|
while (n != 0) {
|
|
|
|
if ((n & 1) != 0) p *= m;
|
|
|
|
m *= m;
|
|
|
|
if ((n & 2) != 0) p *= m;
|
|
|
|
m *= m;
|
|
|
|
n >>= 2;
|
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
double power_double_double(double x, double y) {
|
|
|
|
// The checks for special cases can be dropped in ia32 because it has already
|
|
|
|
// been done in generated code before bailing out here.
|
|
|
|
if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) {
|
|
|
|
return std::numeric_limits<double>::quiet_NaN();
|
|
|
|
}
|
|
|
|
return Pow(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
double modulo_double_double(double x, double y) { return Modulo(x, y); }
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::power_double_double_function() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(power_double_double), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::mod_two_doubles_operation() {
|
2018-04-17 07:42:30 +00:00
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(modulo_double_double), BUILTIN_FP_FP_CALL));
|
2018-03-09 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::debug_suspended_generator_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->debug()->suspended_generator_address());
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::debug_restart_fp_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(isolate->debug()->restart_fp_address());
|
|
|
|
}
|
|
|
|
|
2018-07-13 11:31:43 +00:00
|
|
|
ExternalReference ExternalReference::wasm_thread_in_wasm_flag_address_address(
|
|
|
|
Isolate* isolate) {
|
|
|
|
return ExternalReference(reinterpret_cast<Address>(
|
|
|
|
&isolate->thread_local_top()->thread_in_wasm_flag_address_));
|
|
|
|
}
|
|
|
|
|
2018-04-25 07:28:14 +00:00
|
|
|
ExternalReference ExternalReference::fixed_typed_array_base_data_offset() {
|
2018-03-09 11:57:08 +00:00
|
|
|
return ExternalReference(reinterpret_cast<void*>(
|
|
|
|
FixedTypedArrayBase::kDataOffset - kHeapObjectTag));
|
|
|
|
}
|
|
|
|
|
2018-10-23 14:39:54 +00:00
|
|
|
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) {
|
|
|
|
uint64_t old_value = static_cast<uint64_t>(old_value_high) << 32 |
|
|
|
|
(old_value_low & 0xFFFFFFFF);
|
|
|
|
uint64_t new_value = static_cast<uint64_t>(new_value_high) << 32 |
|
|
|
|
(new_value_low & 0xFFFFFFFF);
|
|
|
|
std::atomic_compare_exchange_strong(
|
|
|
|
reinterpret_cast<std::atomic<uint64_t>*>(address), &old_value, new_value);
|
|
|
|
return old_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReference ExternalReference::atomic_pair_compare_exchange_function() {
|
|
|
|
return ExternalReference(
|
|
|
|
Redirect(FUNCTION_ADDR(atomic_pair_compare_exchange)));
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
bool operator==(ExternalReference lhs, ExternalReference rhs) {
|
|
|
|
return lhs.address() == rhs.address();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(ExternalReference lhs, ExternalReference rhs) {
|
|
|
|
return !(lhs == rhs);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t hash_value(ExternalReference reference) {
|
|
|
|
return base::hash<Address>()(reference.address());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& os, ExternalReference reference) {
|
2018-04-13 22:28:05 +00:00
|
|
|
os << reinterpret_cast<const void*>(reference.address());
|
2018-03-09 11:57:08 +00:00
|
|
|
const Runtime::Function* fn = Runtime::FunctionForEntry(reference.address());
|
|
|
|
if (fn) os << "<" << fn->name << ".entry>";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
Reland "[turboassembler] Introduce hard-abort mode"
This is a reland of a462a7854a081f4f34bb4c112ee33f3d69efa309
Original change's description:
> [turboassembler] Introduce hard-abort mode
>
> For checks and assertions (mostly for debug code, like stack alignment
> or zero extension), we had two modes: Emit a call to the {Abort}
> runtime function (the default), and emit a debug break (used for
> testing, enabled via --trap-on-abort).
> In wasm, where we cannot just call a runtime function because code must
> be isolate independent, we always used the trap-on-abort behaviour.
> This causes problems for our fuzzers, which do not catch SIGTRAP, and
> hence do not detect debug code failures.
>
> This CL introduces a third mode ("hard abort"), which calls a C
> function via {ExternalReference}. The C function still outputs the
> abort reason, but does not print the stack trace. It then aborts via
> "OS::Abort", just like the runtime function.
> This will allow fuzzers to detect the crash and even find a nice error
> message.
>
> Even though this looks like a lot of code churn, it is actually not.
> Most added lines are new tests, and other changes are minimal.
>
> R=mstarzinger@chromium.org
>
> Bug: chromium:863799
> Change-Id: I77c58ff72db552d49014614436259ccfb49ba87b
> Reviewed-on: https://chromium-review.googlesource.com/1142163
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54592}
Bug: chromium:863799
Change-Id: I7729a47b4823a982a8e201df36520aa2b6ef5326
Reviewed-on: https://chromium-review.googlesource.com/1146100
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54656}
2018-07-24 14:12:47 +00:00
|
|
|
void abort_with_reason(int reason) {
|
|
|
|
if (IsValidAbortReason(reason)) {
|
|
|
|
const char* message = GetAbortReason(static_cast<AbortReason>(reason));
|
|
|
|
base::OS::PrintError("abort: %s\n", message);
|
|
|
|
} else {
|
|
|
|
base::OS::PrintError("abort: <unknown reason: %d>\n", reason);
|
|
|
|
}
|
|
|
|
base::OS::Abort();
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
2018-03-09 11:57:08 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|