2016-03-17 13:14:11 +00:00
|
|
|
// Copyright 2016 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-table.h"
|
|
|
|
|
|
|
|
#include "src/accessors.h"
|
|
|
|
#include "src/assembler.h"
|
|
|
|
#include "src/counters.h"
|
|
|
|
#include "src/ic/stub-cache.h"
|
2017-10-04 21:08:55 +00:00
|
|
|
#include "src/trap-handler/trap-handler.h"
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-11-15 08:58:54 +00:00
|
|
|
#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
|
|
|
|
#define SYMBOLIZE_FUNCTION
|
|
|
|
#include <execinfo.h>
|
2017-04-25 03:01:11 +00:00
|
|
|
#include <vector>
|
2016-11-15 08:58:54 +00:00
|
|
|
#endif // DEBUG && V8_OS_LINUX && !V8_OS_ANDROID
|
|
|
|
|
2016-03-17 13:14:11 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
// Forward declarations for C++ builtins.
|
|
|
|
#define FORWARD_DECLARE(Name) \
|
|
|
|
Object* Builtin_##Name(int argc, Object** args, Isolate* isolate);
|
|
|
|
BUILTIN_LIST_C(FORWARD_DECLARE)
|
|
|
|
#undef FORWARD_DECLARE
|
|
|
|
|
2016-03-17 13:14:11 +00:00
|
|
|
ExternalReferenceTable* ExternalReferenceTable::instance(Isolate* isolate) {
|
|
|
|
ExternalReferenceTable* external_reference_table =
|
|
|
|
isolate->external_reference_table();
|
2017-10-13 16:33:03 +00:00
|
|
|
if (external_reference_table == nullptr) {
|
2016-03-17 13:14:11 +00:00
|
|
|
external_reference_table = new ExternalReferenceTable(isolate);
|
|
|
|
isolate->set_external_reference_table(external_reference_table);
|
|
|
|
}
|
|
|
|
return external_reference_table;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
|
2016-11-14 07:17:22 +00:00
|
|
|
// nullptr is preserved through serialization/deserialization.
|
|
|
|
Add(nullptr, "nullptr");
|
2016-07-18 08:47:04 +00:00
|
|
|
AddReferences(isolate);
|
|
|
|
AddBuiltins(isolate);
|
|
|
|
AddRuntimeFunctions(isolate);
|
|
|
|
AddIsolateAddresses(isolate);
|
|
|
|
AddAccessors(isolate);
|
|
|
|
AddStubCache(isolate);
|
|
|
|
}
|
|
|
|
|
2017-08-11 10:26:42 +00:00
|
|
|
const char* ExternalReferenceTable::ResolveSymbol(void* address) {
|
2016-11-15 08:58:54 +00:00
|
|
|
#ifdef SYMBOLIZE_FUNCTION
|
2017-08-11 10:26:42 +00:00
|
|
|
char** names = backtrace_symbols(&address, 1);
|
|
|
|
const char* name = names[0];
|
|
|
|
// The array of names is malloc'ed. However, each name string is static
|
|
|
|
// and do not need to be freed.
|
|
|
|
free(names);
|
|
|
|
return name;
|
2016-11-15 08:58:54 +00:00
|
|
|
#else
|
|
|
|
return "<unresolved>";
|
|
|
|
#endif // SYMBOLIZE_FUNCTION
|
|
|
|
}
|
|
|
|
|
2017-09-11 13:02:28 +00:00
|
|
|
void ExternalReferenceTable::Add(Address address, const char* name) {
|
|
|
|
refs_.emplace_back(address, name);
|
|
|
|
}
|
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddReferences(Isolate* isolate) {
|
2016-03-17 13:14:11 +00:00
|
|
|
// Miscellaneous
|
|
|
|
Add(ExternalReference::roots_array_start(isolate).address(),
|
|
|
|
"Heap::roots_array_start()");
|
|
|
|
Add(ExternalReference::address_of_stack_limit(isolate).address(),
|
|
|
|
"StackGuard::address_of_jslimit()");
|
|
|
|
Add(ExternalReference::address_of_real_stack_limit(isolate).address(),
|
|
|
|
"StackGuard::address_of_real_jslimit()");
|
|
|
|
Add(ExternalReference::new_space_allocation_limit_address(isolate).address(),
|
|
|
|
"Heap::NewSpaceAllocationLimitAddress()");
|
|
|
|
Add(ExternalReference::new_space_allocation_top_address(isolate).address(),
|
|
|
|
"Heap::NewSpaceAllocationTopAddress()");
|
|
|
|
Add(ExternalReference::mod_two_doubles_operation(isolate).address(),
|
|
|
|
"mod_two_doubles");
|
|
|
|
Add(ExternalReference::handle_scope_next_address(isolate).address(),
|
|
|
|
"HandleScope::next");
|
|
|
|
Add(ExternalReference::handle_scope_limit_address(isolate).address(),
|
|
|
|
"HandleScope::limit");
|
|
|
|
Add(ExternalReference::handle_scope_level_address(isolate).address(),
|
|
|
|
"HandleScope::level");
|
|
|
|
Add(ExternalReference::new_deoptimizer_function(isolate).address(),
|
|
|
|
"Deoptimizer::New()");
|
|
|
|
Add(ExternalReference::compute_output_frames_function(isolate).address(),
|
|
|
|
"Deoptimizer::ComputeOutputFrames()");
|
|
|
|
Add(ExternalReference::address_of_min_int().address(),
|
|
|
|
"LDoubleConstant::min_int");
|
|
|
|
Add(ExternalReference::address_of_one_half().address(),
|
|
|
|
"LDoubleConstant::one_half");
|
|
|
|
Add(ExternalReference::isolate_address(isolate).address(), "isolate");
|
2017-09-05 09:24:39 +00:00
|
|
|
Add(ExternalReference::builtins_address(isolate).address(), "builtins");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::interpreter_dispatch_table_address(isolate).address(),
|
|
|
|
"Interpreter::dispatch_table_address");
|
2017-08-25 20:56:04 +00:00
|
|
|
Add(ExternalReference::bytecode_size_table_address(isolate).address(),
|
|
|
|
"Bytecodes::bytecode_size_table_address");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::address_of_negative_infinity().address(),
|
|
|
|
"LDoubleConstant::negative_infinity");
|
|
|
|
Add(ExternalReference::power_double_double_function(isolate).address(),
|
|
|
|
"power_double_double_function");
|
[builtins] Unify most of the remaining Math builtins.
Import fdlibm versions of acos, acosh, asin and asinh, which are more
precise and produce the same result across platforms (we were using
libm versions for asin and acos so far, where both speed and precision
depended on the operating system so far). Introduce appropriate TurboFan
operators for these functions and use them both for inlining and for the
generic builtin.
Also migrate the Math.imul and Math.fround builtins to TurboFan builtins
to ensure that their behavior is always exactly the same as the inlined
TurboFan version (i.e. C++ truncation semantics for double to float
don't necessarily meet the JavaScript semantics).
For completeness, also migrate Math.sign, which can even get some nice
love in TurboFan.
Drive-by-fix: Some alpha-sorting on the Math related functions, and
cleanup the list of Math intrinsics that we have to export via the
native context currently.
BUG=v8:3266,v8:3496,v8:3509,v8:3952,v8:5169,v8:5170,v8:5171,v8:5172
TBR=rossberg@chromium.org
R=franzih@chromium.org
Review-Url: https://codereview.chromium.org/2116753002
Cr-Commit-Position: refs/heads/master@{#37476}
2016-07-01 11:11:33 +00:00
|
|
|
Add(ExternalReference::ieee754_acos_function(isolate).address(),
|
|
|
|
"base::ieee754::acos");
|
|
|
|
Add(ExternalReference::ieee754_acosh_function(isolate).address(),
|
|
|
|
"base::ieee754::acosh");
|
|
|
|
Add(ExternalReference::ieee754_asin_function(isolate).address(),
|
|
|
|
"base::ieee754::asin");
|
|
|
|
Add(ExternalReference::ieee754_asinh_function(isolate).address(),
|
|
|
|
"base::ieee754::asinh");
|
2016-06-13 07:06:49 +00:00
|
|
|
Add(ExternalReference::ieee754_atan_function(isolate).address(),
|
|
|
|
"base::ieee754::atan");
|
2016-06-17 09:13:22 +00:00
|
|
|
Add(ExternalReference::ieee754_atanh_function(isolate).address(),
|
|
|
|
"base::ieee754::atanh");
|
[builtins] Unify most of the remaining Math builtins.
Import fdlibm versions of acos, acosh, asin and asinh, which are more
precise and produce the same result across platforms (we were using
libm versions for asin and acos so far, where both speed and precision
depended on the operating system so far). Introduce appropriate TurboFan
operators for these functions and use them both for inlining and for the
generic builtin.
Also migrate the Math.imul and Math.fround builtins to TurboFan builtins
to ensure that their behavior is always exactly the same as the inlined
TurboFan version (i.e. C++ truncation semantics for double to float
don't necessarily meet the JavaScript semantics).
For completeness, also migrate Math.sign, which can even get some nice
love in TurboFan.
Drive-by-fix: Some alpha-sorting on the Math related functions, and
cleanup the list of Math intrinsics that we have to export via the
native context currently.
BUG=v8:3266,v8:3496,v8:3509,v8:3952,v8:5169,v8:5170,v8:5171,v8:5172
TBR=rossberg@chromium.org
R=franzih@chromium.org
Review-Url: https://codereview.chromium.org/2116753002
Cr-Commit-Position: refs/heads/master@{#37476}
2016-07-01 11:11:33 +00:00
|
|
|
Add(ExternalReference::ieee754_atan2_function(isolate).address(),
|
|
|
|
"base::ieee754::atan2");
|
2016-06-20 05:51:37 +00:00
|
|
|
Add(ExternalReference::ieee754_cbrt_function(isolate).address(),
|
|
|
|
"base::ieee754::cbrt");
|
2016-06-17 15:21:48 +00:00
|
|
|
Add(ExternalReference::ieee754_cos_function(isolate).address(),
|
|
|
|
"base::ieee754::cos");
|
2016-06-30 08:41:05 +00:00
|
|
|
Add(ExternalReference::ieee754_cosh_function(isolate).address(),
|
|
|
|
"base::ieee754::cosh");
|
2016-06-17 05:19:35 +00:00
|
|
|
Add(ExternalReference::ieee754_exp_function(isolate).address(),
|
|
|
|
"base::ieee754::exp");
|
2016-06-17 09:13:22 +00:00
|
|
|
Add(ExternalReference::ieee754_expm1_function(isolate).address(),
|
|
|
|
"base::ieee754::expm1");
|
2016-06-10 05:51:58 +00:00
|
|
|
Add(ExternalReference::ieee754_log_function(isolate).address(),
|
|
|
|
"base::ieee754::log");
|
2016-06-13 05:46:38 +00:00
|
|
|
Add(ExternalReference::ieee754_log1p_function(isolate).address(),
|
|
|
|
"base::ieee754::log1p");
|
2016-06-16 11:22:32 +00:00
|
|
|
Add(ExternalReference::ieee754_log10_function(isolate).address(),
|
|
|
|
"base::ieee754::log10");
|
2016-06-20 05:51:37 +00:00
|
|
|
Add(ExternalReference::ieee754_log2_function(isolate).address(),
|
|
|
|
"base::ieee754::log2");
|
2016-06-17 15:21:48 +00:00
|
|
|
Add(ExternalReference::ieee754_sin_function(isolate).address(),
|
|
|
|
"base::ieee754::sin");
|
2016-06-30 08:41:05 +00:00
|
|
|
Add(ExternalReference::ieee754_sinh_function(isolate).address(),
|
|
|
|
"base::ieee754::sinh");
|
2016-06-20 05:51:37 +00:00
|
|
|
Add(ExternalReference::ieee754_tan_function(isolate).address(),
|
|
|
|
"base::ieee754::tan");
|
2016-06-30 08:41:05 +00:00
|
|
|
Add(ExternalReference::ieee754_tanh_function(isolate).address(),
|
|
|
|
"base::ieee754::tanh");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::store_buffer_top(isolate).address(),
|
|
|
|
"store_buffer_top");
|
2017-08-03 11:17:17 +00:00
|
|
|
Add(ExternalReference::heap_is_marking_flag_address(isolate).address(),
|
|
|
|
"heap_is_marking_flag_address");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::address_of_the_hole_nan().address(), "the_hole_nan");
|
|
|
|
Add(ExternalReference::get_date_field_function(isolate).address(),
|
|
|
|
"JSDate::GetField");
|
|
|
|
Add(ExternalReference::date_cache_stamp(isolate).address(),
|
|
|
|
"date_cache_stamp");
|
|
|
|
Add(ExternalReference::address_of_pending_message_obj(isolate).address(),
|
|
|
|
"address_of_pending_message_obj");
|
|
|
|
Add(ExternalReference::cpu_features().address(), "cpu_features");
|
|
|
|
Add(ExternalReference::old_space_allocation_top_address(isolate).address(),
|
|
|
|
"Heap::OldSpaceAllocationTopAddress");
|
|
|
|
Add(ExternalReference::old_space_allocation_limit_address(isolate).address(),
|
|
|
|
"Heap::OldSpaceAllocationLimitAddress");
|
|
|
|
Add(ExternalReference::allocation_sites_list_address(isolate).address(),
|
|
|
|
"Heap::allocation_sites_list_address()");
|
|
|
|
Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias");
|
|
|
|
Add(ExternalReference::is_profiling_address(isolate).address(),
|
2016-06-09 05:23:34 +00:00
|
|
|
"Isolate::is_profiling");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::scheduled_exception_address(isolate).address(),
|
|
|
|
"Isolate::scheduled_exception");
|
|
|
|
Add(ExternalReference::invoke_function_callback(isolate).address(),
|
|
|
|
"InvokeFunctionCallback");
|
|
|
|
Add(ExternalReference::invoke_accessor_getter_callback(isolate).address(),
|
|
|
|
"InvokeAccessorGetterCallback");
|
|
|
|
Add(ExternalReference::wasm_f32_trunc(isolate).address(),
|
|
|
|
"wasm::f32_trunc_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f32_floor(isolate).address(),
|
|
|
|
"wasm::f32_floor_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f32_ceil(isolate).address(),
|
|
|
|
"wasm::f32_ceil_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f32_nearest_int(isolate).address(),
|
|
|
|
"wasm::f32_nearest_int_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f64_trunc(isolate).address(),
|
|
|
|
"wasm::f64_trunc_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f64_floor(isolate).address(),
|
|
|
|
"wasm::f64_floor_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f64_ceil(isolate).address(),
|
|
|
|
"wasm::f64_ceil_wrapper");
|
|
|
|
Add(ExternalReference::wasm_f64_nearest_int(isolate).address(),
|
|
|
|
"wasm::f64_nearest_int_wrapper");
|
|
|
|
Add(ExternalReference::wasm_int64_to_float32(isolate).address(),
|
|
|
|
"wasm::int64_to_float32_wrapper");
|
|
|
|
Add(ExternalReference::wasm_uint64_to_float32(isolate).address(),
|
|
|
|
"wasm::uint64_to_float32_wrapper");
|
|
|
|
Add(ExternalReference::wasm_int64_to_float64(isolate).address(),
|
|
|
|
"wasm::int64_to_float64_wrapper");
|
|
|
|
Add(ExternalReference::wasm_uint64_to_float64(isolate).address(),
|
|
|
|
"wasm::uint64_to_float64_wrapper");
|
|
|
|
Add(ExternalReference::wasm_float32_to_int64(isolate).address(),
|
|
|
|
"wasm::float32_to_int64_wrapper");
|
|
|
|
Add(ExternalReference::wasm_float32_to_uint64(isolate).address(),
|
|
|
|
"wasm::float32_to_uint64_wrapper");
|
|
|
|
Add(ExternalReference::wasm_float64_to_int64(isolate).address(),
|
|
|
|
"wasm::float64_to_int64_wrapper");
|
|
|
|
Add(ExternalReference::wasm_float64_to_uint64(isolate).address(),
|
|
|
|
"wasm::float64_to_uint64_wrapper");
|
2016-07-20 14:24:47 +00:00
|
|
|
Add(ExternalReference::wasm_float64_pow(isolate).address(),
|
|
|
|
"wasm::float64_pow");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::wasm_int64_div(isolate).address(), "wasm::int64_div");
|
|
|
|
Add(ExternalReference::wasm_int64_mod(isolate).address(), "wasm::int64_mod");
|
|
|
|
Add(ExternalReference::wasm_uint64_div(isolate).address(),
|
|
|
|
"wasm::uint64_div");
|
|
|
|
Add(ExternalReference::wasm_uint64_mod(isolate).address(),
|
|
|
|
"wasm::uint64_mod");
|
2016-04-21 07:45:36 +00:00
|
|
|
Add(ExternalReference::wasm_word32_ctz(isolate).address(),
|
|
|
|
"wasm::word32_ctz");
|
|
|
|
Add(ExternalReference::wasm_word64_ctz(isolate).address(),
|
|
|
|
"wasm::word64_ctz");
|
|
|
|
Add(ExternalReference::wasm_word32_popcnt(isolate).address(),
|
|
|
|
"wasm::word32_popcnt");
|
|
|
|
Add(ExternalReference::wasm_word64_popcnt(isolate).address(),
|
|
|
|
"wasm::word64_popcnt");
|
2017-10-04 21:08:55 +00:00
|
|
|
// If the trap handler is not supported, the optimizer will remove these
|
|
|
|
// runtime functions. In this case, the arm simulator will break if we add
|
|
|
|
// them to the external reference table.
|
2017-10-06 21:30:57 +00:00
|
|
|
#ifdef V8_TARGET_ARCH_X64
|
|
|
|
Add(ExternalReference::wasm_set_thread_in_wasm_flag(isolate).address(),
|
|
|
|
"wasm::set_thread_in_wasm_flag");
|
|
|
|
Add(ExternalReference::wasm_clear_thread_in_wasm_flag(isolate).address(),
|
|
|
|
"wasm::clear_thread_in_wasm_flag");
|
|
|
|
#endif
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::f64_acos_wrapper_function(isolate).address(),
|
|
|
|
"f64_acos_wrapper");
|
|
|
|
Add(ExternalReference::f64_asin_wrapper_function(isolate).address(),
|
|
|
|
"f64_asin_wrapper");
|
|
|
|
Add(ExternalReference::f64_mod_wrapper_function(isolate).address(),
|
|
|
|
"f64_mod_wrapper");
|
[wasm] Introduce the TrapIf and TrapUnless operators to generate trap code.
Some instructions in WebAssembly trap for some inputs, which means that the
execution is terminated and (at least at the moment) a JavaScript exception is
thrown. Examples for traps are out-of-bounds memory accesses, or integer
divisions by zero.
Without the TrapIf and TrapUnless operators trap check in WebAssembly introduces 5
TurboFan nodes (branch, if_true, if_false, trap-reason constant, trap-position
constant), in addition to the trap condition itself. Additionally, each
WebAssembly function has four TurboFan nodes (merge, effect_phi, 2 phis) whose
number of inputs is linear to the number of trap checks in the function.
Especially for functions with high numbers of trap checks we observe a
significant slowdown in compilation time, down to 0.22 MiB/s in the sqlite
benchmark instead of the average of 3 MiB/s in other benchmarks. By introducing
a TrapIf common operator only a single node is necessary per trap check, in
addition to the trap condition. Also the nodes which are shared between trap
checks (merge, effect_phi, 2 phis) would disappear. First measurements suggest a
speedup of 30-50% on average.
This CL only implements TrapIf and TrapUnless on x64. The implementation is also
hidden behind the --wasm-trap-if flag.
Please take a special look at how the source position is transfered from the
instruction selector to the code generator, and at the context that is used for
the runtime call.
R=titzer@chromium.org
Review-Url: https://codereview.chromium.org/2562393002
Cr-Commit-Position: refs/heads/master@{#41720}
2016-12-15 13:31:29 +00:00
|
|
|
Add(ExternalReference::wasm_call_trap_callback_for_testing(isolate).address(),
|
|
|
|
"wasm::call_trap_callback_for_testing");
|
2016-12-16 13:24:07 +00:00
|
|
|
Add(ExternalReference::libc_memchr_function(isolate).address(),
|
|
|
|
"libc_memchr");
|
[builtins] Copy array contents using JS in ConstructByArrayLike.
The last CL https://chromium-review.googlesource.com/c/456707/ caused
some pretty heavy performance regressions. After experimenting, it
seems the easiest and most straight-forward way to copy the elements
into the new typed array is to do it in JS.
Adds a fast path for typed arrays, where the source typed array has
the same elements kind, in which case we can just copy the backing
store using memcpy.
This CL also removes regression test 319120 which is from a pwn2own
vulnerability. The old code path enforced a maximum byte_length
that was too low, which this change removes. The length property of
the typed array must be a Smi, but the byte_length, which can be up
to 8x larger than length for a Float64Array, can be a heap number.
We can also re-use some of the logic from ConstructByLength when
deciding whether to allocate the buffer on- or off-heap, so that
is factored out into InitializeBasedOnLength. We can also re-use
the DoInitialize helper instead of calling into the runtime,
meaning we can remove InitializeFromArrayLike.
BUG=v8:5977,chromium:705503,chromium:705394
Change-Id: I63372652091d4bdf3a9491acef9b4e3ac793a755
Reviewed-on: https://chromium-review.googlesource.com/459621
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44301}
2017-03-30 13:16:55 +00:00
|
|
|
Add(ExternalReference::libc_memcpy_function(isolate).address(),
|
|
|
|
"libc_memcpy");
|
2017-05-17 14:39:34 +00:00
|
|
|
Add(ExternalReference::libc_memmove_function(isolate).address(),
|
|
|
|
"libc_memmove");
|
2017-03-02 13:35:39 +00:00
|
|
|
Add(ExternalReference::libc_memset_function(isolate).address(),
|
|
|
|
"libc_memset");
|
2017-10-20 11:49:37 +00:00
|
|
|
Add(ExternalReference::printf_function(isolate).address(), "printf");
|
2017-04-13 14:41:22 +00:00
|
|
|
Add(ExternalReference::try_internalize_string_function(isolate).address(),
|
|
|
|
"try_internalize_string_function");
|
2017-08-03 14:27:11 +00:00
|
|
|
Add(ExternalReference::check_object_type(isolate).address(),
|
|
|
|
"check_object_type");
|
2017-05-05 15:59:08 +00:00
|
|
|
#ifdef V8_INTL_SUPPORT
|
|
|
|
Add(ExternalReference::intl_convert_one_byte_to_lower(isolate).address(),
|
|
|
|
"intl_convert_one_byte_to_lower");
|
|
|
|
Add(ExternalReference::intl_to_latin1_lower_table(isolate).address(),
|
|
|
|
"intl_to_latin1_lower_table");
|
|
|
|
#endif // V8_INTL_SUPPORT
|
2017-04-19 10:47:03 +00:00
|
|
|
Add(ExternalReference::search_string_raw<const uint8_t, const uint8_t>(
|
|
|
|
isolate)
|
|
|
|
.address(),
|
|
|
|
"search_string_raw<1-byte, 1-byte>");
|
|
|
|
Add(ExternalReference::search_string_raw<const uint8_t, const uc16>(isolate)
|
|
|
|
.address(),
|
|
|
|
"search_string_raw<1-byte, 2-byte>");
|
|
|
|
Add(ExternalReference::search_string_raw<const uc16, const uint8_t>(isolate)
|
|
|
|
.address(),
|
|
|
|
"search_string_raw<2-byte, 1-byte>");
|
|
|
|
Add(ExternalReference::search_string_raw<const uc16, const uc16>(isolate)
|
|
|
|
.address(),
|
|
|
|
"search_string_raw<1-byte, 2-byte>");
|
2017-07-10 11:30:04 +00:00
|
|
|
Add(ExternalReference::orderedhashmap_gethash_raw(isolate).address(),
|
|
|
|
"orderedhashmap_gethash_raw");
|
2017-08-22 01:02:06 +00:00
|
|
|
Add(ExternalReference::get_or_create_hash_raw(isolate).address(),
|
|
|
|
"get_or_create_hash_raw");
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ExternalReference::log_enter_external_function(isolate).address(),
|
|
|
|
"Logger::EnterExternal");
|
|
|
|
Add(ExternalReference::log_leave_external_function(isolate).address(),
|
|
|
|
"Logger::LeaveExternal");
|
|
|
|
Add(ExternalReference::address_of_minus_one_half().address(),
|
|
|
|
"double_constants.minus_one_half");
|
|
|
|
Add(ExternalReference::stress_deopt_count(isolate).address(),
|
|
|
|
"Isolate::stress_deopt_count_address()");
|
|
|
|
Add(ExternalReference::runtime_function_table_address(isolate).address(),
|
|
|
|
"Runtime::runtime_function_table_address()");
|
2016-07-21 11:01:44 +00:00
|
|
|
Add(ExternalReference::address_of_float_abs_constant().address(),
|
|
|
|
"float_absolute_constant");
|
|
|
|
Add(ExternalReference::address_of_float_neg_constant().address(),
|
|
|
|
"float_negate_constant");
|
|
|
|
Add(ExternalReference::address_of_double_abs_constant().address(),
|
|
|
|
"double_absolute_constant");
|
|
|
|
Add(ExternalReference::address_of_double_neg_constant().address(),
|
|
|
|
"double_negate_constant");
|
[inspector] change target promise for kDebugWillHandle & kDebugDidHandle
- kDebugPromiseCreated(task, parent_task)
This event occurs when promise is created (PromiseHookType::Init). V8Debugger uses this event to maintain task -> parent task map.
- kDebugEnqueueAsyncFunction(task)
This event occurs when first internal promise for async function is created. V8Debugger collects stack trace at this point.
- kDebugEnqueuePromiseResolve(task),
This event occurs when Promise fulfills with resolved status. V8Debugger collects stack trace at this point.
- kDebugEnqueuePromiseReject(task),
This event occurs when Promise fulfills with rejected status. V8Debugger collects stack trace at this point.
- kDebugPromiseCollected,
This event occurs when Promise is collected and no other chained callbacks can be added. V8Debugger removes information about async task for this promise.
- kDebugWillHandle,
This event occurs when chained promise function (either resolve or reject handler) is called. V8Debugger installs parent promise's stack (based on task -> parent_task map) as current if available or current promise's scheduled stack otherwise.
- kDebugDidHandle,
This event occurs after chained promise function has finished. V8Debugger restores asynchronous call chain to previous one.
With this change all instrumentation calls are related to current promise (before WillHandle and DidHandle were related to next async task).
Before V8Debugger supported only the following:
- asyncTaskScheduled(task1)
- asyncTaskStarted(task1)
- asyncTaskFinished(task1)
Now V8Debugger supports the following:
- asyncTaskScheduled(parent_task)
..
- asyncTaskCreated(task, parent_task),
- asyncTaskStarted(task), uses parent_task scheduled stack
- asyncTaskScheduled(task)
- asyncTaskFinished(task)
Additionally: WillHandle and DidHandle were migrated to PromiseHook API.
More details: https://docs.google.com/document/d/1u19N45f1gSF7M39mGsycJEK3IPyJgIXCBnWyiPeuJFE
BUG=v8:5738
R=dgozman@chromium.org,gsathya@chromium.org,yangguo@chromium.org
Review-Url: https://codereview.chromium.org/2650803003
Cr-Commit-Position: refs/heads/master@{#42644}
2017-01-25 07:05:43 +00:00
|
|
|
Add(ExternalReference::promise_hook_or_debug_is_active_address(isolate)
|
|
|
|
.address(),
|
|
|
|
"Isolate::promise_hook_or_debug_is_active_address()");
|
2016-03-17 13:14:11 +00:00
|
|
|
|
|
|
|
// Debug addresses
|
|
|
|
Add(ExternalReference::debug_is_active_address(isolate).address(),
|
|
|
|
"Debug::is_active_address()");
|
2017-01-12 14:18:45 +00:00
|
|
|
Add(ExternalReference::debug_hook_on_function_call_address(isolate).address(),
|
|
|
|
"Debug::hook_on_function_call_address()");
|
2016-06-14 11:07:40 +00:00
|
|
|
Add(ExternalReference::debug_last_step_action_address(isolate).address(),
|
2016-03-17 13:14:11 +00:00
|
|
|
"Debug::step_in_enabled_address()");
|
2016-06-03 15:30:42 +00:00
|
|
|
Add(ExternalReference::debug_suspended_generator_address(isolate).address(),
|
|
|
|
"Debug::step_suspended_generator_address()");
|
2017-01-27 07:31:03 +00:00
|
|
|
Add(ExternalReference::debug_restart_fp_address(isolate).address(),
|
|
|
|
"Debug::restart_fp_address()");
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2017-03-31 09:20:13 +00:00
|
|
|
Add(ExternalReference::address_of_regexp_dotall_flag(isolate).address(),
|
|
|
|
"FLAG_harmony_regexp_dotall");
|
|
|
|
|
2016-03-17 13:14:11 +00:00
|
|
|
#ifndef V8_INTERPRETED_REGEXP
|
|
|
|
Add(ExternalReference::re_case_insensitive_compare_uc16(isolate).address(),
|
|
|
|
"NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
|
|
|
|
Add(ExternalReference::re_check_stack_guard_state(isolate).address(),
|
|
|
|
"RegExpMacroAssembler*::CheckStackGuardState()");
|
|
|
|
Add(ExternalReference::re_grow_stack(isolate).address(),
|
|
|
|
"NativeRegExpMacroAssembler::GrowStack()");
|
|
|
|
Add(ExternalReference::re_word_character_map().address(),
|
|
|
|
"NativeRegExpMacroAssembler::word_character_map");
|
|
|
|
Add(ExternalReference::address_of_regexp_stack_limit(isolate).address(),
|
|
|
|
"RegExpStack::limit_address()");
|
|
|
|
Add(ExternalReference::address_of_regexp_stack_memory_address(isolate)
|
|
|
|
.address(),
|
|
|
|
"RegExpStack::memory_address()");
|
|
|
|
Add(ExternalReference::address_of_regexp_stack_memory_size(isolate).address(),
|
|
|
|
"RegExpStack::memory_size()");
|
|
|
|
Add(ExternalReference::address_of_static_offsets_vector(isolate).address(),
|
|
|
|
"OffsetsVector::static_offsets_vector");
|
|
|
|
#endif // V8_INTERPRETED_REGEXP
|
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
// Runtime entries
|
|
|
|
Add(ExternalReference::delete_handle_scope_extensions(isolate).address(),
|
|
|
|
"HandleScope::DeleteExtensions");
|
|
|
|
Add(ExternalReference::incremental_marking_record_write_function(isolate)
|
|
|
|
.address(),
|
|
|
|
"IncrementalMarking::RecordWrite");
|
|
|
|
Add(ExternalReference::store_buffer_overflow_function(isolate).address(),
|
|
|
|
"StoreBuffer::StoreBufferOverflow");
|
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddBuiltins(Isolate* isolate) {
|
|
|
|
struct CBuiltinEntry {
|
|
|
|
Address address;
|
2016-03-17 13:14:11 +00:00
|
|
|
const char* name;
|
|
|
|
};
|
2016-07-18 08:47:04 +00:00
|
|
|
static const CBuiltinEntry c_builtins[] = {
|
|
|
|
#define DEF_ENTRY(Name, ...) {FUNCTION_ADDR(&Builtin_##Name), "Builtin_" #Name},
|
2016-07-14 12:45:56 +00:00
|
|
|
BUILTIN_LIST_C(DEF_ENTRY)
|
|
|
|
#undef DEF_ENTRY
|
2016-03-17 13:14:11 +00:00
|
|
|
};
|
|
|
|
for (unsigned i = 0; i < arraysize(c_builtins); ++i) {
|
2016-07-18 08:47:04 +00:00
|
|
|
Add(ExternalReference(c_builtins[i].address, isolate).address(),
|
|
|
|
c_builtins[i].name);
|
2016-03-17 13:14:11 +00:00
|
|
|
}
|
2016-07-18 08:47:04 +00:00
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddRuntimeFunctions(Isolate* isolate) {
|
|
|
|
struct RuntimeEntry {
|
|
|
|
Runtime::FunctionId id;
|
|
|
|
const char* name;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const RuntimeEntry runtime_functions[] = {
|
2016-03-17 13:14:11 +00:00
|
|
|
#define RUNTIME_ENTRY(name, i1, i2) {Runtime::k##name, "Runtime::" #name},
|
|
|
|
FOR_EACH_INTRINSIC(RUNTIME_ENTRY)
|
|
|
|
#undef RUNTIME_ENTRY
|
|
|
|
};
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < arraysize(runtime_functions); ++i) {
|
2016-07-18 08:47:04 +00:00
|
|
|
ExternalReference ref(runtime_functions[i].id, isolate);
|
2016-03-17 13:14:11 +00:00
|
|
|
Add(ref.address(), runtime_functions[i].name);
|
|
|
|
}
|
2016-07-18 08:47:04 +00:00
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddIsolateAddresses(Isolate* isolate) {
|
2016-03-17 13:14:11 +00:00
|
|
|
// Top addresses
|
|
|
|
static const char* address_names[] = {
|
|
|
|
#define BUILD_NAME_LITERAL(Name, name) "Isolate::" #name "_address",
|
2017-10-13 16:33:03 +00:00
|
|
|
FOR_EACH_ISOLATE_ADDRESS_NAME(BUILD_NAME_LITERAL) nullptr
|
2016-03-17 13:14:11 +00:00
|
|
|
#undef BUILD_NAME_LITERAL
|
|
|
|
};
|
|
|
|
|
2017-06-23 12:21:39 +00:00
|
|
|
for (int i = 0; i < IsolateAddressId::kIsolateAddressCount; ++i) {
|
|
|
|
Add(isolate->get_address_from_id(static_cast<IsolateAddressId>(i)),
|
2016-03-17 13:14:11 +00:00
|
|
|
address_names[i]);
|
|
|
|
}
|
2016-07-18 08:47:04 +00:00
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddAccessors(Isolate* isolate) {
|
2016-03-17 13:14:11 +00:00
|
|
|
// Accessors
|
|
|
|
struct AccessorRefTable {
|
|
|
|
Address address;
|
|
|
|
const char* name;
|
|
|
|
};
|
|
|
|
|
2016-04-20 08:01:08 +00:00
|
|
|
static const AccessorRefTable getters[] = {
|
2016-12-08 12:13:34 +00:00
|
|
|
#define ACCESSOR_INFO_DECLARATION(name) \
|
|
|
|
{FUNCTION_ADDR(&Accessors::name##Getter), "Accessors::" #name "Getter"},
|
2016-11-15 07:42:55 +00:00
|
|
|
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
|
2016-03-17 13:14:11 +00:00
|
|
|
#undef ACCESSOR_INFO_DECLARATION
|
2016-04-20 08:01:08 +00:00
|
|
|
};
|
|
|
|
static const AccessorRefTable setters[] = {
|
2016-03-17 13:14:11 +00:00
|
|
|
#define ACCESSOR_SETTER_DECLARATION(name) \
|
2016-11-15 08:58:54 +00:00
|
|
|
{ FUNCTION_ADDR(&Accessors::name), "Accessors::" #name},
|
2016-11-15 07:42:55 +00:00
|
|
|
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
2016-03-17 13:14:11 +00:00
|
|
|
#undef ACCESSOR_INFO_DECLARATION
|
|
|
|
};
|
|
|
|
|
2016-04-20 08:01:08 +00:00
|
|
|
for (unsigned i = 0; i < arraysize(getters); ++i) {
|
2016-12-08 12:13:34 +00:00
|
|
|
Add(getters[i].address, getters[i].name);
|
2016-04-20 08:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < arraysize(setters); ++i) {
|
|
|
|
Add(setters[i].address, setters[i].name);
|
2016-03-17 13:14:11 +00:00
|
|
|
}
|
2016-07-18 08:47:04 +00:00
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
2016-07-18 08:47:04 +00:00
|
|
|
void ExternalReferenceTable::AddStubCache(Isolate* isolate) {
|
2016-07-13 10:24:55 +00:00
|
|
|
StubCache* load_stub_cache = isolate->load_stub_cache();
|
2016-03-17 13:14:11 +00:00
|
|
|
|
|
|
|
// Stub cache tables
|
2016-07-13 10:24:55 +00:00
|
|
|
Add(load_stub_cache->key_reference(StubCache::kPrimary).address(),
|
|
|
|
"Load StubCache::primary_->key");
|
|
|
|
Add(load_stub_cache->value_reference(StubCache::kPrimary).address(),
|
|
|
|
"Load StubCache::primary_->value");
|
|
|
|
Add(load_stub_cache->map_reference(StubCache::kPrimary).address(),
|
|
|
|
"Load StubCache::primary_->map");
|
|
|
|
Add(load_stub_cache->key_reference(StubCache::kSecondary).address(),
|
|
|
|
"Load StubCache::secondary_->key");
|
|
|
|
Add(load_stub_cache->value_reference(StubCache::kSecondary).address(),
|
|
|
|
"Load StubCache::secondary_->value");
|
|
|
|
Add(load_stub_cache->map_reference(StubCache::kSecondary).address(),
|
|
|
|
"Load StubCache::secondary_->map");
|
|
|
|
|
|
|
|
StubCache* store_stub_cache = isolate->store_stub_cache();
|
|
|
|
|
|
|
|
// Stub cache tables
|
|
|
|
Add(store_stub_cache->key_reference(StubCache::kPrimary).address(),
|
|
|
|
"Store StubCache::primary_->key");
|
|
|
|
Add(store_stub_cache->value_reference(StubCache::kPrimary).address(),
|
|
|
|
"Store StubCache::primary_->value");
|
|
|
|
Add(store_stub_cache->map_reference(StubCache::kPrimary).address(),
|
|
|
|
"Store StubCache::primary_->map");
|
|
|
|
Add(store_stub_cache->key_reference(StubCache::kSecondary).address(),
|
|
|
|
"Store StubCache::secondary_->key");
|
|
|
|
Add(store_stub_cache->value_reference(StubCache::kSecondary).address(),
|
|
|
|
"Store StubCache::secondary_->value");
|
|
|
|
Add(store_stub_cache->map_reference(StubCache::kSecondary).address(),
|
|
|
|
"Store StubCache::secondary_->map");
|
2016-07-18 08:47:04 +00:00
|
|
|
}
|
2016-03-17 13:14:11 +00:00
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|