Remove JS natives support, step 3

The natives blob was deprecated in V8 7.8. This CL removes all related
functionality, including:

- Build system support, i.e.: generation of natives_blob.bin and the
v8_extra_library_files gn flag.
- Related scripts (js2c.py, concatenate-files.py).
- Related API functions (SetNativesDataBlob,
InitializeExternalStartupData).
- Natives bootstrapping logic.
- The InternalArray type (previously exposed through natives).
- Other natives-exposed builtins.
- Inlining of these builtins.
- The dedicated 'uncached external one byte string' type.

Step 1 landed in https://crrev.com/c/1824944.
Step 2 landed in https://crrev.com/c/1835536.
Step 3 (this CL) removes these all functionality related to natives
support in V8.

Bug: v8:7624
Change-Id: Ice6c2662781efe8417231805276476d32bc5a625
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1844771
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64446}
This commit is contained in:
Jakob Gruber 2019-10-22 06:59:35 +02:00 committed by Commit Bot
parent aadd1e61d0
commit c4f502ed4d
52 changed files with 135 additions and 2273 deletions

View File

@ -154,10 +154,6 @@ declare_args() {
# Controls the threshold for on-heap/off-heap Typed Arrays.
v8_typed_array_max_size_in_heap = 64
# List of extra files to snapshot. They will be snapshotted in order so
# if files export symbols used by later files, they should go first.
v8_extra_library_files = []
v8_enable_gdbjit =
((v8_current_cpu == "x86" || v8_current_cpu == "x64") &&
(is_linux || is_mac)) || (v8_current_cpu == "ppc64" && is_linux)
@ -261,10 +257,6 @@ assert(
!v8_enable_pointer_compression || !v8_enable_shared_ro_heap,
"Pointer compression is not supported with shared read-only heap enabled")
assert(v8_extra_library_files == [],
"v8_extra_library_files is no longer supported. Consider implementing " +
"custom API in C++ instead.")
v8_random_seed = "314159265"
v8_toolset_for_shell = "host"
@ -826,31 +818,6 @@ template("asm_to_inline_asm") {
}
}
action("js2c_extras") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "tools/js2c.py"
sources = v8_extra_library_files
outputs = [
"$target_gen_dir/extras-libraries.cc",
]
args = [
rebase_path("$target_gen_dir/extras-libraries.cc", root_build_dir),
"EXTRAS",
] + rebase_path(sources, root_build_dir)
if (v8_use_external_startup_data) {
outputs += [ "$target_gen_dir/libraries_extras.bin" ]
args += [
"--startup_blob",
rebase_path("$target_gen_dir/libraries_extras.bin", root_build_dir),
]
}
}
if (is_android && enable_java_templates) {
android_assets("v8_external_startup_data_assets") {
if (v8_use_external_startup_data) {
@ -859,9 +826,6 @@ if (is_android && enable_java_templates) {
deps = [
"//v8",
]
sources = [
"$root_out_dir/natives_blob.bin",
]
renaming_sources = [ "$root_out_dir/snapshot_blob.bin" ]
if (current_cpu == "arm" || current_cpu == "x86" ||
current_cpu == "mipsel") {
@ -874,33 +838,6 @@ if (is_android && enable_java_templates) {
}
}
if (v8_use_external_startup_data) {
action("natives_blob") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_extras",
]
# NOSORT
sources = [
"$target_gen_dir/libraries_extras.bin",
]
outputs = [
"$root_out_dir/natives_blob.bin",
]
data = [
"$root_out_dir/natives_blob.bin",
]
script = "tools/concatenate-files.py"
args = rebase_path(sources + outputs, root_build_dir)
}
}
action("postmortem-metadata") {
# Only targets in this file and the top-level visibility target can
# depend on this.
@ -1010,7 +947,6 @@ torque_files = [
"src/builtins/boolean.tq",
"src/builtins/collections.tq",
"src/builtins/data-view.tq",
"src/builtins/extras-utils.tq",
"src/builtins/frames.tq",
"src/builtins/growable-fixed-array.tq",
"src/builtins/internal-coverage.tq",
@ -1411,7 +1347,6 @@ v8_source_set("v8_nosnapshot") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_extras",
":torque_generated_initializers",
]
@ -1420,7 +1355,6 @@ v8_source_set("v8_nosnapshot") {
]
sources = [
"$target_gen_dir/extras-libraries.cc",
"src/snapshot/embedded/embedded-empty.cc",
"src/snapshot/snapshot-empty.cc",
]
@ -1437,10 +1371,6 @@ if (!v8_use_external_startup_data) {
"//:gn_visibility",
]
deps = [
":js2c_extras",
]
public_deps = [
# This should be public so downstream targets can declare the snapshot
# output file as their inputs.
@ -1452,7 +1382,6 @@ if (!v8_use_external_startup_data) {
public = []
sources = [
"$target_gen_dir/extras-libraries.cc",
"$target_gen_dir/snapshot.cc",
"src/init/setup-isolate-deserialize.cc",
]
@ -1475,11 +1404,9 @@ if (v8_use_external_startup_data) {
visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [
":js2c_extras",
":v8_base",
]
public_deps = [
":natives_blob",
":run_mksnapshot_default",
]
@ -1489,7 +1416,6 @@ if (v8_use_external_startup_data) {
sources = [
"src/init/setup-isolate-deserialize.cc",
"src/snapshot/natives-external.cc",
"src/snapshot/snapshot-external.cc",
]
@ -2096,7 +2022,6 @@ v8_source_set("v8_base_without_compiler") {
"src/builtins/builtins-definitions.h",
"src/builtins/builtins-descriptors.h",
"src/builtins/builtins-error.cc",
"src/builtins/builtins-extras-utils.cc",
"src/builtins/builtins-function.cc",
"src/builtins/builtins-global.cc",
"src/builtins/builtins-internal.cc",
@ -2859,8 +2784,6 @@ v8_source_set("v8_base_without_compiler") {
"src/snapshot/deserializer.h",
"src/snapshot/embedded/embedded-data.cc",
"src/snapshot/embedded/embedded-data.h",
"src/snapshot/natives-common.cc",
"src/snapshot/natives.h",
"src/snapshot/object-deserializer.cc",
"src/snapshot/object-deserializer.h",
"src/snapshot/partial-deserializer.cc",
@ -4017,8 +3940,6 @@ if (v8_enable_i18n_support) {
script = "tools/run.py"
sources = v8_extra_library_files
deps = [
":gen-regexp-special-case($v8_generator_toolchain)",
]
@ -4551,7 +4472,6 @@ group("v8_generated_cc_files") {
deps = [
":generate_bytecode_builtins_list",
":js2c_extras",
":run_torque",
"src/inspector:v8_generated_cc_files",
]

View File

@ -9142,8 +9142,6 @@ class V8_EXPORT V8 {
* handled entirely on the embedders' side.
* - The call will abort if the data is invalid.
*/
V8_DEPRECATED("The natives blob is deprecated (https://crbug.com/v8/7624).")
static void SetNativesDataBlob(StartupData* startup_blob);
static void SetSnapshotDataBlob(StartupData* startup_blob);
/** Set the callback to invoke in case of Dcheck failures. */
@ -9228,18 +9226,14 @@ class V8_EXPORT V8 {
* V8 needs to be given those external files during startup. There are
* three ways to do this:
* - InitializeExternalStartupData(const char*)
* This will look in the given directory for files "natives_blob.bin"
* and "snapshot_blob.bin" - which is what the default build calls them.
* - InitializeExternalStartupData(const char*, const char*)
* As above, but will directly use the two given file names.
* - Call SetNativesDataBlob, SetNativesDataBlob.
* This will read the blobs from the given data structures and will
* This will look in the given directory for the file "snapshot_blob.bin".
* - InitializeExternalStartupDataFromFile(const char*)
* As above, but will directly use the given file name.
* - Call SetSnapshotDataBlob.
* This will read the blobs from the given data structure and will
* not perform any file IO.
*/
static void InitializeExternalStartupData(const char* directory_path);
V8_DEPRECATED("The natives blob is deprecated (https://crbug.com/v8/7624).")
static void InitializeExternalStartupData(const char* natives_blob,
const char* snapshot_blob);
static void InitializeExternalStartupDataFromFile(const char* snapshot_blob);
/**

View File

@ -93,7 +93,6 @@
#include "src/profiler/tick-sample.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/code-serializer.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/partial-serializer.h"
#include "src/snapshot/read-only-serializer.h"
#include "src/snapshot/snapshot.h"
@ -510,10 +509,6 @@ static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) {
return false;
}
void V8::SetNativesDataBlob(StartupData* natives_blob) {
i::V8::SetNativesBlob(natives_blob);
}
void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
i::V8::SetSnapshotBlob(snapshot_blob);
}
@ -5625,9 +5620,6 @@ void v8::V8::ShutdownPlatform() { i::V8::ShutdownPlatform(); }
bool v8::V8::Initialize() {
i::V8::Initialize();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
i::ReadNatives();
#endif
return true;
}
@ -5683,9 +5675,6 @@ void v8::V8::SetReturnAddressLocationResolver(
bool v8::V8::Dispose() {
i::V8::TearDown();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
i::DisposeNatives();
#endif
return true;
}
@ -5734,11 +5723,6 @@ void v8::V8::InitializeExternalStartupData(const char* directory_path) {
i::InitializeExternalStartupData(directory_path);
}
void v8::V8::InitializeExternalStartupData(const char* natives_blob,
const char* snapshot_blob) {
i::InitializeExternalStartupData(natives_blob, snapshot_blob);
}
// static
void v8::V8::InitializeExternalStartupDataFromFile(const char* snapshot_blob) {
i::InitializeExternalStartupDataFromFile(snapshot_blob);

View File

@ -41,28 +41,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r0 : number of arguments
// -- lr : return address
// -- sp[...]: constructor arguments
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
__ SmiTst(r2);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
__ CompareObjectType(r2, r3, r4, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -2774,48 +2752,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r0 : argc
// -- r1 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ tst(r3, Operand(kSmiTagMask));
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction);
__ CompareObjectType(r3, r3, r4, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction);
// Figure out the right elements kind
__ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into |result|. We only need the first byte,
// but the following bit field extraction takes care of that anyway.
__ ldr(r3, FieldMemOperand(r3, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(r3);
// Initial elements kind should be packed elements.
__ cmp(r3, Operand(PACKED_ELEMENTS));
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray);
// No arguments should be passed.
__ cmp(r0, Operand(0));
__ Assert(eq, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
int AddressOffset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -39,30 +39,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x0 : number of arguments
// -- lr : return address
// -- sp[...]: constructor arguments
// -----------------------------------
ASM_LOCATION("Builtins::Generate_InternalArrayConstructor");
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ LoadTaggedPointerField(
x10, FieldMemOperand(x1, JSFunction::kPrototypeOrInitialMapOffset));
__ Tst(x10, kSmiTagMask);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
__ CompareObjectType(x10, x11, x12, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -3350,55 +3326,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x0 : argc
// -- x1 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Register constructor = x1;
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
Label unexpected_map, map_ok;
// Initial map for the builtin Array function should be a map.
__ LoadTaggedPointerField(
x10,
FieldMemOperand(constructor, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ JumpIfSmi(x10, &unexpected_map);
__ JumpIfObjectType(x10, x10, x11, MAP_TYPE, &map_ok);
__ Bind(&unexpected_map);
__ Abort(AbortReason::kUnexpectedInitialMapForArrayFunction);
__ Bind(&map_ok);
Register kind = w3;
// Figure out the right elements kind
__ LoadTaggedPointerField(
x10,
FieldMemOperand(constructor, JSFunction::kPrototypeOrInitialMapOffset));
// Retrieve elements_kind from map.
__ LoadElementsKindFromMap(kind, x10);
// Initial elements kind should be packed elements.
__ Cmp(kind, PACKED_ELEMENTS);
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray);
// No arguments should be passed.
__ Cmp(x0, 0);
__ Assert(eq, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
// The number of register that CallApiFunctionAndReturn will need to save on

View File

@ -2233,16 +2233,5 @@ GENERATE_ARRAY_CTOR(SingleArgument, HoleyDouble, HOLEY_DOUBLE_ELEMENTS,
#undef GENERATE_ARRAY_CTOR
TF_BUILTIN(InternalArrayNoArgumentConstructor_Packed, ArrayBuiltinsAssembler) {
using Descriptor = ArrayNoArgumentConstructorDescriptor;
TNode<Map> array_map =
CAST(LoadObjectField(Parameter(Descriptor::kFunction),
JSFunction::kPrototypeOrInitialMapOffset));
TNode<JSArray> array = AllocateJSArray(
PACKED_ELEMENTS, array_map,
IntPtrConstant(JSArray::kPreallocatedArrayElements), SmiConstant(0));
Return(array);
}
} // namespace internal
} // namespace v8

View File

@ -312,9 +312,6 @@ namespace internal {
TFC(ArraySingleArgumentConstructor_HoleyDouble_DisableAllocationSites, \
ArraySingleArgumentConstructor) \
TFC(ArrayNArgumentsConstructor, ArrayNArgumentsConstructor) \
ASM(InternalArrayConstructor, JSTrampoline) \
ASM(InternalArrayConstructorImpl, JSTrampoline) \
TFC(InternalArrayNoArgumentConstructor_Packed, ArrayNoArgumentConstructor) \
CPP(ArrayConcat) \
/* ES6 #sec-array.isarray */ \
TFJ(ArrayIsArray, 1, kReceiver, kArg) \
@ -525,10 +522,6 @@ namespace internal {
CPP(MakeTypeError) \
CPP(MakeURIError) \
\
/* ExtrasUtils */ \
CPP(ExtrasUtilsUncurryThis) \
CPP(ExtrasUtilsCallReflectApply) \
\
/* Function */ \
CPP(FunctionConstructor) \
ASM(FunctionPrototypeApply, Dummy) \
@ -805,12 +798,6 @@ namespace internal {
TFJ(PromiseAllSettled, 1, kReceiver, kIterable) \
TFJ(PromiseAllSettledResolveElementClosure, 1, kReceiver, kValue) \
TFJ(PromiseAllSettledRejectElementClosure, 1, kReceiver, kValue) \
/* V8 Extras: v8.createPromise(parent) */ \
TFJ(PromiseInternalConstructor, 1, kReceiver, kParent) \
/* V8 Extras: v8.rejectPromise(promise, reason) */ \
TFJ(PromiseInternalReject, 2, kReceiver, kPromise, kReason) \
/* V8 Extras: v8.resolvePromise(promise, resolution) */ \
TFJ(PromiseInternalResolve, 2, kReceiver, kPromise, kResolution) \
\
/* Reflect */ \
ASM(ReflectApply, Dummy) \

View File

@ -1,93 +0,0 @@
// 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/builtins/builtins-utils-inl.h"
#include "src/builtins/builtins.h"
#include "src/objects/elements.h"
#include "src/logging/counters.h"
#include "src/objects/objects-inl.h"
namespace v8 {
namespace internal {
namespace {
enum UncurryThisFunctionContextSlot {
kFunctionSlot = Context::MIN_CONTEXT_SLOTS,
kFunctionContextLength,
};
} // namespace
// These functions are key for safe meta-programming:
// http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
//
// Technically they could all be derived from combinations of
// Function.prototype.{bind,call,apply} but that introduces lots of layers of
// indirection.
//
// Equivalent to:
//
// function uncurryThis(func) {
// return function(thisArg, ...args) {
// return %reflect_apply(func, thisArg, args);
// };
// };
//
BUILTIN(ExtrasUtilsUncurryThis) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
Handle<JSFunction> function = args.at<JSFunction>(1);
Handle<NativeContext> native_context(isolate->context().native_context(),
isolate);
Handle<Context> context = isolate->factory()->NewBuiltinContext(
native_context,
static_cast<int>(UncurryThisFunctionContextSlot::kFunctionContextLength));
context->set(static_cast<int>(UncurryThisFunctionContextSlot::kFunctionSlot),
*function);
Handle<SharedFunctionInfo> info =
isolate->factory()->NewSharedFunctionInfoForBuiltin(
isolate->factory()->empty_string(),
Builtins::kExtrasUtilsCallReflectApply, kNormalFunction);
info->DontAdaptArguments();
Handle<Map> map = isolate->strict_function_without_prototype_map();
Handle<JSFunction> new_bound_function =
isolate->factory()->NewFunctionFromSharedFunctionInfo(map, info, context);
return *new_bound_function;
}
BUILTIN(ExtrasUtilsCallReflectApply) {
HandleScope scope(isolate);
Handle<Context> context(isolate->context(), isolate);
Handle<NativeContext> native_context(isolate->context().native_context(),
isolate);
Handle<JSFunction> function(
JSFunction::cast(context->get(
static_cast<int>(UncurryThisFunctionContextSlot::kFunctionSlot))),
isolate);
Handle<Object> this_arg = args.at(1);
int const rest_args_atart = 2;
Arguments argv(args.length() - rest_args_atart,
args.address_of_arg_at(rest_args_atart));
Handle<JSArray> rest_args_array = isolate->factory()->NewJSArray(0);
RETURN_FAILURE_ON_EXCEPTION(
isolate, ArrayConstructInitializeElements(rest_args_array, &argv));
Handle<Object> reflect_apply_args[] = {function, this_arg, rest_args_array};
Handle<JSFunction> reflect_apply(native_context->reflect_apply(), isolate);
RETURN_RESULT_OR_FAILURE(
isolate,
Execution::Call(isolate, reflect_apply,
isolate->factory()->undefined_value(),
arraysize(reflect_apply_args), reflect_apply_args));
}
} // namespace internal
} // namespace v8

View File

@ -1083,51 +1083,6 @@ TF_BUILTIN(PromiseConstructor, PromiseBuiltinsAssembler) {
}
}
// V8 Extras: v8.createPromise(parent)
TF_BUILTIN(PromiseInternalConstructor, PromiseBuiltinsAssembler) {
const TNode<Object> parent = CAST(Parameter(Descriptor::kParent));
const TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Return(AllocateAndInitJSPromise(context, parent));
}
// V8 Extras: v8.rejectPromise(promise, reason)
TF_BUILTIN(PromiseInternalReject, PromiseBuiltinsAssembler) {
Node* const promise = Parameter(Descriptor::kPromise);
Node* const reason = Parameter(Descriptor::kReason);
Node* const context = Parameter(Descriptor::kContext);
// Main V8 Extras invariant that {promise} is still "pending" at
// this point, aka that {promise} is not resolved multiple times.
Label if_promise_is_settled(this, Label::kDeferred);
GotoIfNot(IsPromiseStatus(PromiseStatus(promise), v8::Promise::kPending),
&if_promise_is_settled);
// We pass true to trigger the debugger's on exception handler.
Return(CallBuiltin(Builtins::kRejectPromise, context, promise, reason,
TrueConstant()));
BIND(&if_promise_is_settled);
Abort(AbortReason::kPromiseAlreadySettled);
}
// V8 Extras: v8.resolvePromise(promise, resolution)
TF_BUILTIN(PromiseInternalResolve, PromiseBuiltinsAssembler) {
Node* const promise = Parameter(Descriptor::kPromise);
Node* const resolution = Parameter(Descriptor::kResolution);
Node* const context = Parameter(Descriptor::kContext);
// Main V8 Extras invariant that {promise} is still "pending" at
// this point, aka that {promise} is not resolved multiple times.
Label if_promise_is_settled(this, Label::kDeferred);
GotoIfNot(IsPromiseStatus(PromiseStatus(promise), v8::Promise::kPending),
&if_promise_is_settled);
Return(CallBuiltin(Builtins::kResolvePromise, context, promise, resolution));
BIND(&if_promise_is_settled);
Abort(AbortReason::kPromiseAlreadySettled);
}
// ES#sec-promise.prototype.then
// Promise.prototype.then ( onFulfilled, onRejected )
TF_BUILTIN(PromisePrototypeThen, PromiseBuiltinsAssembler) {

View File

@ -1,24 +0,0 @@
// 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.
namespace extras_utils {
extern runtime CreatePrivateSymbol(Context, JSAny): PrivateSymbol;
extern runtime PromiseMarkAsHandled(Context, JSAny): Undefined;
extern runtime PromiseStatus(Context, JSAny): Smi;
javascript builtin ExtrasUtilsCreatePrivateSymbol(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny {
return CreatePrivateSymbol(context, arguments[0]);
}
javascript builtin ExtrasUtilsMarkPromiseAsHandled(
js-implicit context: Context, receiver: JSAny)(...arguments): Undefined {
return PromiseMarkAsHandled(context, arguments[0]);
}
javascript builtin ExtrasUtilsPromiseState(
js-implicit context: Context, receiver: JSAny)(...arguments): Smi {
return PromiseStatus(context, arguments[0]);
}
}

View File

@ -1838,31 +1838,6 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc
// -- esp[0] : return address
// -- esp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray function should be a map.
__ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ test(ecx, Immediate(kSmiTagMask));
__ Assert(not_zero,
AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
__ CmpObjectType(ecx, MAP_TYPE, ecx);
__ Assert(equal,
AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ push(ebp);
__ mov(ebp, esp);
@ -2932,49 +2907,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ ret(0);
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc
// -- edi : constructor
// -- esp[0] : return address
// -- esp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ test(ecx, Immediate(kSmiTagMask));
__ Assert(not_zero, AbortReason::kUnexpectedInitialMapForArrayFunction);
__ CmpObjectType(ecx, MAP_TYPE, ecx);
__ Assert(equal, AbortReason::kUnexpectedInitialMapForArrayFunction);
// Figure out the right elements kind
__ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into |result|. We only need the first byte,
// but the following masking takes care of that anyway.
__ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(ecx);
// Initial elements kind should be packed elements.
__ cmp(ecx, Immediate(PACKED_ELEMENTS));
__ Assert(equal, AbortReason::kInvalidElementsKindForInternalPackedArray);
// No arguments should be passed.
__ test(eax, eax);
__ Assert(zero, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
// Generates an Operand for saving parameters after PrepareCallApiFunction.

View File

@ -36,29 +36,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : number of arguments
// -- ra : return address
// -- sp[...]: constructor arguments
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
__ SmiTst(a2, t0);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
t0, Operand(zero_reg));
__ GetObjectType(a2, a3, t0);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
t0, Operand(MAP_TYPE));
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -2774,51 +2751,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : argc
// -- a1 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ SmiTst(a3, kScratchReg);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction,
kScratchReg, Operand(zero_reg));
__ GetObjectType(a3, a3, t0);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction, t0,
Operand(MAP_TYPE));
// Figure out the right elements kind.
__ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into a3. We only need the first byte,
// but the following bit field extraction takes care of that anyway.
__ lbu(a3, FieldMemOperand(a3, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(a3);
// Initial elements kind should be packed elements.
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray, a3,
Operand(PACKED_ELEMENTS));
// No arguments should be passed.
__ Assert(eq, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray,
a0, Operand(0));
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
int AddressOffset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -36,29 +36,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : number of arguments
// -- ra : return address
// -- sp[...]: constructor arguments
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ Ld(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
__ SmiTst(a2, a4);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
a4, Operand(zero_reg));
__ GetObjectType(a2, a3, a4);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
a4, Operand(MAP_TYPE));
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -2813,51 +2790,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : argc
// -- a1 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ Ld(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ SmiTst(a3, kScratchReg);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction,
kScratchReg, Operand(zero_reg));
__ GetObjectType(a3, a3, a4);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction, a4,
Operand(MAP_TYPE));
// Figure out the right elements kind.
__ Ld(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into a3. We only need the first byte,
// but the following bit field extraction takes care of that anyway.
__ Lbu(a3, FieldMemOperand(a3, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(a3);
// Initial elements kind should be packed elements.
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray, a3,
Operand(PACKED_ELEMENTS));
// No arguments should be passed.
__ Assert(eq, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray,
a0, Operand(static_cast<int64_t>(0)));
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
int AddressOffset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -34,29 +34,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : number of arguments
// -- lr : return address
// -- sp[...]: constructor arguments
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ LoadP(r5, FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset));
__ TestIfSmi(r5, r0);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
cr0);
__ CompareObjectType(r5, r6, r7, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -2917,47 +2894,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : argc
// -- r4 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ LoadP(r6, FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ TestIfSmi(r6, r0);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction, cr0);
__ CompareObjectType(r6, r6, r7, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction);
// Figure out the right elements kind
__ LoadP(r6, FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into |result|.
__ lbz(r6, FieldMemOperand(r6, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(r6);
// Initial elements kind should be packed elements.
__ cmpi(r6, Operand(PACKED_ELEMENTS));
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray);
// No arguments should be passed.
__ cmpi(r3, Operand(0));
__ Assert(eq, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -34,29 +34,6 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : number of arguments
// -- lr : return address
// -- sp[...]: constructor arguments
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ LoadP(r4, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset));
__ TestIfSmi(r4);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForInternalArrayFunction,
cr0);
__ CompareObjectType(r4, r5, r6, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
Runtime::FunctionId function_id) {
// ----------- S t a t e -------------
@ -2966,42 +2943,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : argc
// -- r3 : constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ LoadP(r5, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
__ TestIfSmi(r5);
__ Assert(ne, AbortReason::kUnexpectedInitialMapForArrayFunction, cr0);
__ CompareObjectType(r5, r5, r6, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedInitialMapForArrayFunction);
// Figure out the right elements kind
__ LoadP(r5, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into |result|.
__ LoadlB(r5, FieldMemOperand(r5, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(r5);
__ CmpP(r5, Operand(PACKED_ELEMENTS));
__ Assert(eq, AbortReason::kInvalidElementsKindForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -1842,32 +1842,6 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
RelocInfo::CODE_TARGET);
}
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rax : argc
// -- rsp[0] : return address
// -- rsp[8] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// Initial map for the builtin InternalArray functions should be maps.
__ LoadTaggedPointerField(
rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
STATIC_ASSERT(kSmiTag == 0);
Condition not_smi = NegateCondition(masm->CheckSmi(rbx));
__ Check(not_smi,
AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
__ CmpObjectType(rbx, MAP_TYPE, rcx);
__ Check(equal, AbortReason::kUnexpectedInitialMapForInternalArrayFunction);
}
// Run the native code for the InternalArray function called as a normal
// function.
__ Jump(BUILTIN_CODE(masm->isolate(), InternalArrayConstructorImpl),
RelocInfo::CODE_TARGET);
}
static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ pushq(rbp);
__ movq(rbp, rsp);
@ -2926,52 +2900,6 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
__ ret(0);
}
void Builtins::Generate_InternalArrayConstructorImpl(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rax : argc
// -- rdi : constructor
// -- rsp[0] : return address
// -- rsp[8] : last argument
// -----------------------------------
if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
// builtin Array functions which always have maps.
// Initial map for the builtin Array function should be a map.
__ LoadTaggedPointerField(
rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a nullptr and a Smi.
STATIC_ASSERT(kSmiTag == 0);
Condition not_smi = NegateCondition(masm->CheckSmi(rcx));
__ Check(not_smi, AbortReason::kUnexpectedInitialMapForArrayFunction);
__ CmpObjectType(rcx, MAP_TYPE, rcx);
__ Check(equal, AbortReason::kUnexpectedInitialMapForArrayFunction);
// Figure out the right elements kind
__ LoadTaggedPointerField(
rcx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
// Load the map's "bit field 2" into |result|. We only need the first byte,
// but the following masking takes care of that anyway.
__ movzxbq(rcx, FieldOperand(rcx, Map::kBitField2Offset));
// Retrieve elements_kind from bit field 2.
__ DecodeField<Map::ElementsKindBits>(rcx);
// Initial elements kind should be packed elements.
__ cmpl(rcx, Immediate(PACKED_ELEMENTS));
__ Assert(equal, AbortReason::kInvalidElementsKindForInternalPackedArray);
// No arguments should be passed.
__ testq(rax, rax);
__ Assert(zero, AbortReason::kWrongNumberOfArgumentsForInternalPackedArray);
}
__ Jump(
BUILTIN_CODE(masm->isolate(), InternalArrayNoArgumentConstructor_Packed),
RelocInfo::CODE_TARGET);
}
namespace {
int Offset(ExternalReference ref0, ExternalReference ref1) {

View File

@ -26,8 +26,6 @@ namespace internal {
V(kInputStringTooLong, "Input string too long") \
V(kInvalidBytecode, "Invalid bytecode") \
V(kInvalidBytecodeAdvance, "Cannot advance current bytecode, ") \
V(kInvalidElementsKindForInternalPackedArray, \
"Invalid ElementsKind for InternalPackedArray") \
V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
V(kInvalidJumpTableIndex, "Invalid jump table index") \
V(kInvalidParametersAndRegistersInGenerator, \
@ -66,8 +64,6 @@ namespace internal {
"Unexpected runtime function id for the InvokeIntrinsic bytecode") \
V(kUnexpectedInitialMapForArrayFunction, \
"Unexpected initial map for Array function") \
V(kUnexpectedInitialMapForInternalArrayFunction, \
"Unexpected initial map for InternalArray function") \
V(kUnexpectedLevelAfterReturnFromApiCall, \
"Unexpected level after return from api call") \
V(kUnexpectedNegativeValue, "Unexpected negative value") \
@ -86,8 +82,6 @@ namespace internal {
"Wrong number of arguments for intrinsic") \
V(kWrongFunctionCodeStart, "Wrong value in code start register passed") \
V(kWrongFunctionContext, "Wrong context passed to function") \
V(kWrongNumberOfArgumentsForInternalPackedArray, \
"Wrong number of arguments for InternalPackedArray") \
V(kUnexpectedThreadInWasmSet, "thread_in_wasm flag was already set") \
V(kUnexpectedThreadInWasmUnset, "thread_in_wasm flag was not set")

View File

@ -3673,12 +3673,6 @@ Reduction JSCallReducer::ReduceJSCall(Node* node,
return ReduceArrayIterator(node, IterationKind::kKeys);
case Builtins::kTypedArrayPrototypeValues:
return ReduceArrayIterator(node, IterationKind::kValues);
case Builtins::kPromiseInternalConstructor:
return ReducePromiseInternalConstructor(node);
case Builtins::kPromiseInternalReject:
return ReducePromiseInternalReject(node);
case Builtins::kPromiseInternalResolve:
return ReducePromiseInternalResolve(node);
case Builtins::kPromisePrototypeCatch:
return ReducePromisePrototypeCatch(node);
case Builtins::kPromisePrototypeFinally:
@ -5813,70 +5807,6 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
return Replace(promise);
}
// V8 Extras: v8.createPromise(parent)
Reduction JSCallReducer::ReducePromiseInternalConstructor(Node* node) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
// Check that promises aren't being observed through (debug) hooks.
if (!dependencies()->DependOnPromiseHookProtector()) return NoChange();
// Create a new pending promise.
Node* value = effect =
graph()->NewNode(javascript()->CreatePromise(), context, effect);
ReplaceWithValue(node, value, effect);
return Replace(value);
}
// V8 Extras: v8.rejectPromise(promise, reason)
Reduction JSCallReducer::ReducePromiseInternalReject(Node* node) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* promise = node->op()->ValueInputCount() >= 2
? NodeProperties::GetValueInput(node, 2)
: jsgraph()->UndefinedConstant();
Node* reason = node->op()->ValueInputCount() >= 3
? NodeProperties::GetValueInput(node, 3)
: jsgraph()->UndefinedConstant();
Node* debug_event = jsgraph()->TrueConstant();
Node* frame_state = NodeProperties::GetFrameStateInput(node);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
// Reject the {promise} using the given {reason}, and trigger debug logic.
Node* value = effect =
graph()->NewNode(javascript()->RejectPromise(), promise, reason,
debug_event, context, frame_state, effect, control);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
}
// V8 Extras: v8.resolvePromise(promise, resolution)
Reduction JSCallReducer::ReducePromiseInternalResolve(Node* node) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
Node* promise = node->op()->ValueInputCount() >= 2
? NodeProperties::GetValueInput(node, 2)
: jsgraph()->UndefinedConstant();
Node* resolution = node->op()->ValueInputCount() >= 3
? NodeProperties::GetValueInput(node, 3)
: jsgraph()->UndefinedConstant();
Node* frame_state = NodeProperties::GetFrameStateInput(node);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
// Resolve the {promise} using the given {resolution}.
Node* value = effect =
graph()->NewNode(javascript()->ResolvePromise(), promise, resolution,
context, frame_state, effect, control);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
}
bool JSCallReducer::DoPromiseChecks(MapInference* inference) {
if (!inference->HaveMaps()) return false;
MapHandles const& receiver_maps = inference->GetMaps();

View File

@ -2109,19 +2109,6 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
ProcessHintsForPromiseResolve(resolution_hints);
}
break;
case Builtins::kPromiseInternalResolve:
// For JSCallReducer::ReducePromiseInternalResolve and
// JSNativeContextSpecialization::ReduceJSResolvePromise.
if (arguments.size() >= 2) {
Hints const& resolution_hints =
arguments.size() >= 3
? arguments[2]
: Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(),
zone());
ProcessHintsForPromiseResolve(resolution_hints);
}
break;
case Builtins::kRegExpPrototypeTest:
case Builtins::kRegExpPrototypeTestFast:
// For JSCallReducer::ReduceRegExpPrototypeTest.

View File

@ -43,7 +43,6 @@
#include "src/parsing/parsing.h"
#include "src/parsing/scanner-character-streams.h"
#include "src/sanitizer/msan.h"
#include "src/snapshot/natives.h"
#include "src/trap-handler/trap-handler.h"
#include "src/utils/ostreams.h"
#include "src/utils/utils.h"

View File

@ -36,7 +36,6 @@
#include "src/objects/js-generator-inl.h"
#include "src/objects/js-promise-inl.h"
#include "src/objects/slots.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-objects-inl.h"

View File

@ -16,7 +16,6 @@
#include "src/handles/global-handles.h"
#include "src/init/bootstrapper.h"
#include "src/objects/objects.h"
#include "src/snapshot/natives.h"
#include "src/utils/ostreams.h"
#include "src/utils/vector.h"
#include "src/zone/zone-chunk-list.h"

View File

@ -1348,22 +1348,6 @@ MaybeHandle<String> Factory::NewExternalStringFromTwoByte(
return external_string;
}
Handle<ExternalOneByteString> Factory::NewNativeSourceString(
const ExternalOneByteString::Resource* resource) {
size_t length = resource->length();
DCHECK_LE(length, static_cast<size_t>(String::kMaxLength));
Handle<Map> map = native_source_string_map();
Handle<ExternalOneByteString> external_string(
ExternalOneByteString::cast(New(map, AllocationType::kOld)), isolate());
external_string->set_length(static_cast<int>(length));
external_string->set_hash_field(String::kEmptyHashField);
external_string->SetResource(isolate(), resource);
isolate()->heap()->RegisterExternalString(*external_string);
return external_string;
}
Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
Handle<Map> map(isolate()->native_context()->initial_string_iterator_map(),
isolate());

View File

@ -372,10 +372,6 @@ class V8_EXPORT_PRIVATE Factory {
const ExternalOneByteString::Resource* resource);
V8_WARN_UNUSED_RESULT MaybeHandle<String> NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource);
// Create a new external string object for one-byte encoded native script.
// It does not cache the resource data pointer.
Handle<ExternalOneByteString> NewNativeSourceString(
const ExternalOneByteString::Resource* resource);
// Create a symbol in old or read-only space.
Handle<Symbol> NewSymbol(AllocationType allocation = AllocationType::kOld);

View File

@ -66,7 +66,6 @@
#include "src/objects/slots-inl.h"
#include "src/regexp/regexp.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/serializer-common.h"
#include "src/snapshot/snapshot.h"
#include "src/strings/string-stream.h"

View File

@ -385,16 +385,6 @@ bool Heap::CreateInitialMaps() {
roots_table()[entry.index] = map.ptr();
}
{ // Create a separate external one byte string map for native sources.
Map map;
AllocationResult allocation =
AllocateMap(UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE,
ExternalOneByteString::kUncachedSize);
if (!allocation.To(&map)) return false;
map.SetConstructorFunctionIndex(Context::STRING_FUNCTION_INDEX);
set_native_source_string_map(map);
}
ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array)
roots.fixed_double_array_map().set_elements_kind(HOLEY_DOUBLE_ELEMENTS);
ALLOCATE_VARSIZE_MAP(FEEDBACK_METADATA_TYPE, feedback_metadata)

View File

@ -52,7 +52,6 @@
#include "src/objects/property-cell.h"
#include "src/objects/slots-inl.h"
#include "src/objects/templates.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-js.h"
@ -106,15 +105,6 @@ Bootstrapper::Bootstrapper(Isolate* isolate)
nesting_(0),
extensions_cache_(Script::TYPE_EXTENSION) {}
Handle<String> Bootstrapper::GetNativeSource(NativeType type, int index) {
NativesExternalStringResource* resource =
new NativesExternalStringResource(type, index);
Handle<ExternalOneByteString> source_code =
isolate_->factory()->NewNativeSourceString(resource);
DCHECK(source_code->is_uncached());
return source_code;
}
void Bootstrapper::Initialize(bool create_heap_objects) {
extensions_cache_.Initialize(isolate_, create_heap_objects);
}
@ -216,8 +206,6 @@ class Genesis {
void InitializeExperimentalGlobal();
void InitializeIteratorFunctions();
void InitializeCallSiteBuiltins();
// Depending on the situation, expose and/or get rid of the utils object.
void ConfigureUtilsObject();
#define DECLARE_FEATURE_INITIALIZATION(id, descr) void InitializeGlobal_##id();
@ -232,14 +220,12 @@ class Genesis {
};
Handle<JSFunction> CreateArrayBuffer(Handle<String> name,
ArrayBufferKind array_buffer_kind);
void InstallInternalPackedArrayFunction(Handle<JSObject> prototype,
const char* name);
void InstallInternalPackedArray(Handle<JSObject> target, const char* name);
bool InstallNatives();
bool InstallABunchOfRandomThings();
bool InstallExtrasBindings();
Handle<JSFunction> InstallTypedArray(const char* name,
ElementsKind elements_kind);
bool InstallExtraNatives();
void InitializeNormalizedMapCaches();
enum ExtensionTraversalState { UNVISITED, VISITED, INSTALLED };
@ -3994,58 +3980,6 @@ void Genesis::InitializeExperimentalGlobal() {
#undef FEATURE_INITIALIZE_GLOBAL
}
bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
HandleScope scope(isolate);
Vector<const char> name = ExtraNatives::GetScriptName(index);
Handle<String> source_code =
isolate->bootstrapper()->GetNativeSource(EXTRAS, index);
Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object();
Handle<Object> extras_utils = isolate->extras_utils_object();
Handle<Object> args[] = {global, binding, extras_utils};
return Bootstrapper::CompileNative(isolate, name, source_code,
arraysize(args), args, EXTENSION_CODE);
}
bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
Handle<String> source, int argc,
Handle<Object> argv[],
NativesFlag natives_flag) {
SuppressDebug compiling_natives(isolate->debug());
Handle<Context> context(isolate->context(), isolate);
Handle<String> script_name =
isolate->factory()->NewStringFromUtf8(name).ToHandleChecked();
MaybeHandle<SharedFunctionInfo> maybe_function_info =
Compiler::GetSharedFunctionInfoForScript(
isolate, source, Compiler::ScriptDetails(script_name),
ScriptOriginOptions(), nullptr, nullptr,
ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCacheNoReason,
natives_flag);
Handle<SharedFunctionInfo> function_info;
if (!maybe_function_info.ToHandle(&function_info)) return false;
DCHECK(context->IsNativeContext());
Handle<JSFunction> fun =
isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info,
context);
Handle<Object> receiver = isolate->factory()->undefined_value();
// For non-extension scripts, run script to get the function wrapper.
Handle<Object> wrapper;
if (!Execution::TryCall(isolate, fun, receiver, 0, nullptr,
Execution::MessageHandling::kKeepPending, nullptr)
.ToHandle(&wrapper)) {
return false;
}
// Then run the function wrapper.
return !Execution::TryCall(isolate, Handle<JSFunction>::cast(wrapper),
receiver, argc, argv,
Execution::MessageHandling::kKeepPending, nullptr)
.is_null();
}
bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
Factory* factory = isolate->factory();
HandleScope scope(isolate);
@ -4091,15 +4025,6 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
.is_null();
}
void Genesis::ConfigureUtilsObject() {
// We still need the utils object after deserialization.
if (isolate()->serializer_enabled()) return;
// The utils object can be removed for cases that reach this point.
HeapObject undefined = ReadOnlyRoots(heap()).undefined_value();
native_context()->set_extras_utils_object(undefined);
}
void Genesis::InitializeIteratorFunctions() {
Isolate* isolate = isolate_;
Factory* factory = isolate->factory();
@ -4645,146 +4570,13 @@ Handle<JSFunction> Genesis::CreateArrayBuffer(
return array_buffer_fun;
}
void Genesis::InstallInternalPackedArrayFunction(Handle<JSObject> prototype,
const char* function_name) {
Handle<JSObject> array_prototype(native_context()->initial_array_prototype(),
isolate());
Handle<Object> func =
JSReceiver::GetProperty(isolate(), array_prototype, function_name)
.ToHandleChecked();
JSObject::AddProperty(isolate(), prototype, function_name, func,
ALL_ATTRIBUTES_MASK);
}
void Genesis::InstallInternalPackedArray(Handle<JSObject> target,
const char* name) {
// --- I n t e r n a l A r r a y ---
// An array constructor on the builtins object that works like
// the public Array constructor, except that its prototype
// doesn't inherit from Object.prototype.
// To be used only for internal work by builtins. Instances
// must not be leaked to user code.
Handle<JSObject> prototype = factory()->NewJSObject(
isolate()->object_function(), AllocationType::kOld);
Handle<JSFunction> array_function =
InstallFunction(isolate(), target, name, JS_ARRAY_TYPE, JSArray::kSize, 0,
prototype, Builtins::kInternalArrayConstructor);
array_function->shared().DontAdaptArguments();
Handle<Map> original_map(array_function->initial_map(), isolate());
Handle<Map> initial_map = Map::Copy(isolate(), original_map, "InternalArray");
initial_map->set_elements_kind(PACKED_ELEMENTS);
JSFunction::SetInitialMap(array_function, initial_map, prototype);
// Make "length" magic on instances.
Map::EnsureDescriptorSlack(isolate(), initial_map, 1);
PropertyAttributes attribs =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
{ // Add length.
Descriptor d = Descriptor::AccessorConstant(
factory()->length_string(), factory()->array_length_accessor(),
attribs);
initial_map->AppendDescriptor(isolate(), &d);
}
JSObject::NormalizeProperties(
isolate(), prototype, KEEP_INOBJECT_PROPERTIES, 6,
"OptimizeInternalPackedArrayPrototypeForAdding");
InstallInternalPackedArrayFunction(prototype, "push");
InstallInternalPackedArrayFunction(prototype, "pop");
InstallInternalPackedArrayFunction(prototype, "shift");
InstallInternalPackedArrayFunction(prototype, "unshift");
InstallInternalPackedArrayFunction(prototype, "splice");
InstallInternalPackedArrayFunction(prototype, "slice");
JSObject::ForceSetPrototype(prototype, factory()->null_value());
JSObject::MigrateSlowToFast(prototype, 0, "Bootstrapping");
}
bool Genesis::InstallNatives() {
// TODO(jgruber): Refactor this into some kind of meaningful organization. There
// is likely no reason remaining for these objects to be installed here. For
// example, global object setup done in this function could likely move to
// InitializeGlobal.
bool Genesis::InstallABunchOfRandomThings() {
HandleScope scope(isolate());
// Set up the extras utils object as a shared container between native
// scripts and extras. (Extras consume things added there by native scripts.)
Handle<JSObject> extras_utils = factory()->NewJSObjectWithNullProto();
native_context()->set_extras_utils_object(*extras_utils);
InstallInternalPackedArray(extras_utils, "InternalPackedArray");
// Extras need the ability to store private state on their objects without
// exposing it to the outside world.
SimpleInstallFunction(isolate_, extras_utils, "createPrivateSymbol",
Builtins::kExtrasUtilsCreatePrivateSymbol, 1, false);
SimpleInstallFunction(isolate_, extras_utils, "uncurryThis",
Builtins::kExtrasUtilsUncurryThis, 1, false);
SimpleInstallFunction(isolate_, extras_utils, "markPromiseAsHandled",
Builtins::kExtrasUtilsMarkPromiseAsHandled, 1, false);
SimpleInstallFunction(isolate_, extras_utils, "promiseState",
Builtins::kExtrasUtilsPromiseState, 1, false);
// [[PromiseState]] values (for extrasUtils.promiseState())
// These values should be kept in sync with PromiseStatus in globals.h
JSObject::AddProperty(
isolate(), extras_utils, "kPROMISE_PENDING",
factory()->NewNumberFromInt(static_cast<int>(Promise::kPending)),
DONT_ENUM);
JSObject::AddProperty(
isolate(), extras_utils, "kPROMISE_FULFILLED",
factory()->NewNumberFromInt(static_cast<int>(Promise::kFulfilled)),
DONT_ENUM);
JSObject::AddProperty(
isolate(), extras_utils, "kPROMISE_REJECTED",
factory()->NewNumberFromInt(static_cast<int>(Promise::kRejected)),
DONT_ENUM);
// v8.createPromise(parent)
Handle<JSFunction> promise_internal_constructor =
SimpleCreateFunction(isolate(), factory()->empty_string(),
Builtins::kPromiseInternalConstructor, 1, true);
promise_internal_constructor->shared().set_native(false);
JSObject::AddProperty(isolate(), extras_utils, "createPromise",
promise_internal_constructor, DONT_ENUM);
// v8.rejectPromise(promise, reason)
Handle<JSFunction> promise_internal_reject =
SimpleCreateFunction(isolate(), factory()->empty_string(),
Builtins::kPromiseInternalReject, 2, true);
promise_internal_reject->shared().set_native(false);
JSObject::AddProperty(isolate(), extras_utils, "rejectPromise",
promise_internal_reject, DONT_ENUM);
// v8.resolvePromise(promise, resolution)
Handle<JSFunction> promise_internal_resolve =
SimpleCreateFunction(isolate(), factory()->empty_string(),
Builtins::kPromiseInternalResolve, 2, true);
promise_internal_resolve->shared().set_native(false);
JSObject::AddProperty(isolate(), extras_utils, "resolvePromise",
promise_internal_resolve, DONT_ENUM);
JSObject::AddProperty(isolate(), extras_utils, "isPromise",
isolate()->is_promise(), DONT_ENUM);
JSObject::MigrateSlowToFast(Handle<JSObject>::cast(extras_utils), 0,
"Bootstrapping");
{
// Builtin function for OpaqueReference -- a JSPrimitiveWrapper-based
// object, that keeps its field isolated from JavaScript code. It may store
// objects, that JavaScript code may not access.
Handle<JSObject> prototype = factory()->NewJSObject(
isolate()->object_function(), AllocationType::kOld);
Handle<JSFunction> opaque_reference_fun = CreateFunction(
isolate(), factory()->empty_string(), JS_PRIMITIVE_WRAPPER_TYPE,
JSPrimitiveWrapper::kSize, 0, prototype, Builtins::kIllegal);
native_context()->set_opaque_reference_function(*opaque_reference_fun);
}
auto fast_template_instantiations_cache = isolate()->factory()->NewFixedArray(
TemplateInfo::kFastTemplateInstantiationsCacheSize);
native_context()->set_fast_template_instantiations_cache(
@ -5086,7 +4878,7 @@ bool Genesis::InstallNatives() {
return true;
}
bool Genesis::InstallExtraNatives() {
bool Genesis::InstallExtrasBindings() {
HandleScope scope(isolate());
Handle<JSObject> extras_binding = factory()->NewJSObjectWithNullProto();
@ -5101,10 +4893,6 @@ bool Genesis::InstallExtraNatives() {
native_context()->set_extras_binding_object(*extras_binding);
for (int i = 0; i < ExtraNatives::GetBuiltinsCount(); i++) {
if (!Bootstrapper::CompileExtraBuiltin(isolate(), i)) return false;
}
return true;
}
@ -5555,6 +5343,8 @@ Genesis::Genesis(
}
DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object()));
} else {
DCHECK(native_context().is_null());
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
DCHECK_EQ(0u, context_snapshot_index);
@ -5575,8 +5365,8 @@ Genesis::Genesis(
InitializeIteratorFunctions();
InitializeCallSiteBuiltins();
if (!InstallNatives()) return;
if (!InstallExtraNatives()) return;
if (!InstallABunchOfRandomThings()) return;
if (!InstallExtrasBindings()) return;
if (!ConfigureGlobalObjects(global_proxy_template)) return;
isolate->counters()->contexts_created_from_scratch()->Increment();
@ -5613,8 +5403,6 @@ Genesis::Genesis(
ReadOnlyRoots(isolate).false_value());
}
ConfigureUtilsObject();
// We created new functions, which may require debug instrumentation.
if (isolate->debug()->is_active()) {
isolate->debug()->InstallDebugBreakTrampoline();

View File

@ -9,16 +9,13 @@
#include "src/objects/fixed-array.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/visitors.h"
#include "src/snapshot/natives.h"
namespace v8 {
namespace internal {
// A SourceCodeCache uses a FixedArray to store pairs of
// (OneByteString, SharedFunctionInfo), mapping names of native code files
// (array.js, etc.) to precompiled functions. Instead of mapping
// names to functions it might make sense to let the JS2C tool
// generate an index for each native JS file.
// A SourceCodeCache uses a FixedArray to store pairs of (OneByteString,
// SharedFunctionInfo), mapping names of native extensions code files to
// precompiled functions.
class SourceCodeCache final {
public:
explicit SourceCodeCache(Script::Type type) : type_(type) {}
@ -68,9 +65,6 @@ class Bootstrapper final {
// Traverses the pointers for memory management.
void Iterate(RootVisitor* v);
// Accessor for the native scripts source code.
Handle<String> GetNativeSource(NativeType type, int index);
// Tells whether bootstrapping is active.
bool IsActive() const { return nesting_ != 0; }
@ -86,12 +80,6 @@ class Bootstrapper final {
SourceCodeCache* extensions_cache() { return &extensions_cache_; }
static bool CompileNative(Isolate* isolate, Vector<const char> name,
Handle<String> source, int argc,
Handle<Object> argv[], NativesFlag natives_flag);
static bool CompileExtraBuiltin(Isolate* isolate, int index);
static bool CompileExperimentalExtraBuiltin(Isolate* isolate, int index);
private:
// Log newly created Map objects if no snapshot was used.
void LogAllMaps();

View File

@ -20,7 +20,6 @@ namespace internal {
namespace {
v8::StartupData g_natives;
v8::StartupData g_snapshot;
void ClearStartupData(v8::StartupData* data) {
@ -34,14 +33,9 @@ void DeleteStartupData(v8::StartupData* data) {
}
void FreeStartupData() {
DeleteStartupData(&g_natives);
DeleteStartupData(&g_snapshot);
}
// TODO(jgruber): Rename to FreeStartupData once natives support has been
// removed (https://crbug.com/v8/7624).
void FreeStartupDataSnapshotOnly() { DeleteStartupData(&g_snapshot); }
void Load(const char* blob_file, v8::StartupData* startup_data,
void (*setter_fn)(v8::StartupData*)) {
ClearStartupData(startup_data);
@ -70,10 +64,8 @@ void Load(const char* blob_file, v8::StartupData* startup_data,
}
}
void LoadFromFiles(const char* natives_blob, const char* snapshot_blob) {
Load(natives_blob, &g_natives, i::V8::SetNativesBlob);
void LoadFromFile(const char* snapshot_blob) {
Load(snapshot_blob, &g_snapshot, v8::V8::SetSnapshotDataBlob);
atexit(&FreeStartupData);
}
@ -88,25 +80,15 @@ void InitializeExternalStartupData(const char* directory_path) {
snapshot_name = "snapshot_blob_trusted.bin";
}
#endif
std::unique_ptr<char[]> natives =
base::RelativePath(directory_path, "natives_blob.bin");
std::unique_ptr<char[]> snapshot =
base::RelativePath(directory_path, snapshot_name);
LoadFromFiles(natives.get(), snapshot.get());
#endif // V8_USE_EXTERNAL_STARTUP_DATA
}
void InitializeExternalStartupData(const char* natives_blob,
const char* snapshot_blob) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
LoadFromFiles(natives_blob, snapshot_blob);
LoadFromFile(snapshot.get());
#endif // V8_USE_EXTERNAL_STARTUP_DATA
}
void InitializeExternalStartupDataFromFile(const char* snapshot_blob) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
Load(snapshot_blob, &g_snapshot, v8::V8::SetSnapshotDataBlob);
atexit(&FreeStartupDataSnapshotOnly);
LoadFromFile(snapshot_blob);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
}

View File

@ -18,9 +18,6 @@ namespace internal {
// while tools like cctest need to work in either configuration.
void InitializeExternalStartupData(const char* directory_path);
void InitializeExternalStartupData(const char* natives_blob,
const char* snapshot_blob);
void InitializeExternalStartupDataFromFile(const char* snapshot_blob);
} // namespace internal

View File

@ -23,7 +23,6 @@
#include "src/objects/elements.h"
#include "src/objects/objects-inl.h"
#include "src/profiler/heap-profiler.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/tracing/tracing-category-observer.h"
#include "src/wasm/wasm-engine.h"
@ -150,14 +149,6 @@ void V8::SetPlatformForTesting(v8::Platform* platform) {
reinterpret_cast<base::AtomicWord>(platform));
}
void V8::SetNativesBlob(StartupData* natives_blob) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
base::CallOnce(&init_natives_once, &SetNativesFromFile, natives_blob);
#else
UNREACHABLE();
#endif
}
void V8::SetSnapshotBlob(StartupData* snapshot_blob) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
base::CallOnce(&init_snapshot_once, &SetSnapshotFromFile, snapshot_blob);

View File

@ -36,7 +36,6 @@ class V8 : public AllStatic {
// Should be used only for testing.
V8_EXPORT_PRIVATE static void SetPlatformForTesting(v8::Platform* platform);
static void SetNativesBlob(StartupData* natives_blob);
static void SetSnapshotBlob(StartupData* snapshot_blob);
private:

View File

@ -119,8 +119,7 @@ enum ContextLookupFlags {
V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \
error_message_for_code_gen_from_strings) \
V(ERRORS_THROWN_INDEX, Smi, errors_thrown) \
V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_binding_object) \
V(EXTRAS_UTILS_OBJECT_INDEX, Object, extras_utils_object) \
V(EXTRAS_BINDING_OBJECT_INDEX, JSObject, extras_binding_object) \
V(FAST_ALIASED_ARGUMENTS_MAP_INDEX, Map, fast_aliased_arguments_map) \
V(FAST_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, FixedArray, \
fast_template_instantiations_cache) \
@ -217,7 +216,6 @@ enum ContextLookupFlags {
V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \
V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \
V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \
V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \
V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \
V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \
V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \

View File

@ -119,7 +119,6 @@ class Symbol;
V(Map, embedder_data_array_map, EmbedderDataArrayMap) \
V(Map, weak_cell_map, WeakCellMap) \
/* String maps */ \
V(Map, native_source_string_map, NativeSourceStringMap) \
V(Map, string_map, StringMap) \
V(Map, cons_one_byte_string_map, ConsOneByteStringMap) \
V(Map, cons_string_map, ConsStringMap) \

View File

@ -27,7 +27,6 @@
#include "src/objects/js-array-inl.h"
#include "src/objects/js-regexp-inl.h"
#include "src/objects/smi.h"
#include "src/snapshot/natives.h"
#include "src/trap-handler/trap-handler.h"
#include "src/utils/ostreams.h"
#include "src/wasm/memory-tracing.h"

View File

@ -22,7 +22,6 @@
#include "src/objects/smi.h"
#include "src/objects/string.h"
#include "src/roots/roots.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/tracing/trace-event.h"
#include "src/tracing/traced-value.h"
@ -267,21 +266,13 @@ HeapObject Deserializer::PostProcessNewObject(HeapObject obj,
call_handler_infos_.push_back(CallHandlerInfo::cast(obj));
#endif
} else if (obj.IsExternalString()) {
if (obj.map() == ReadOnlyRoots(isolate_).native_source_string_map()) {
ExternalOneByteString string = ExternalOneByteString::cast(obj);
DCHECK(string.is_uncached());
string.SetResource(
isolate_, NativesExternalStringResource::DecodeForDeserialization(
string.resource()));
} else {
ExternalString string = ExternalString::cast(obj);
uint32_t index = string.resource_as_uint32();
Address address =
static_cast<Address>(isolate_->api_external_references()[index]);
string.set_address_as_resource(address);
isolate_->heap()->UpdateExternalString(string, 0,
string.ExternalPayloadSize());
}
ExternalString string = ExternalString::cast(obj);
uint32_t index = string.resource_as_uint32();
Address address =
static_cast<Address>(isolate_->api_external_references()[index]);
string.set_address_as_resource(address);
isolate_->heap()->UpdateExternalString(string, 0,
string.ExternalPayloadSize());
isolate_->heap()->RegisterExternalString(String::cast(obj));
} else if (obj.IsJSDataView()) {
JSDataView data_view = JSDataView::cast(obj);

View File

@ -14,7 +14,6 @@
#include "src/flags/flags.h"
#include "src/sanitizer/msan.h"
#include "src/snapshot/embedded/embedded-file-writer.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/partial-serializer.h"
#include "src/snapshot/snapshot.h"
#include "src/snapshot/startup-serializer.h"

View File

@ -1,27 +0,0 @@
// Copyright 2015 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.
// The common functionality when building with internal or external natives.
#include "src/heap/heap.h"
#include "src/objects/objects-inl.h"
#include "src/snapshot/natives.h"
namespace v8 {
namespace internal {
NativesExternalStringResource::NativesExternalStringResource(NativeType type,
int index)
: type_(type), index_(index) {
Vector<const char> source;
DCHECK_LE(0, index);
CHECK_EQ(EXTRAS, type_);
DCHECK(index < ExtraNatives::GetBuiltinsCount());
source = ExtraNatives::GetScriptSource(index);
data_ = source.begin();
length_ = source.length();
}
} // namespace internal
} // namespace v8

View File

@ -1,211 +0,0 @@
// Copyright 2014 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/snapshot/natives.h"
#include "src/base/logging.h"
#include "src/snapshot/snapshot-source-sink.h"
#include "src/utils/vector.h"
#ifndef V8_USE_EXTERNAL_STARTUP_DATA
#error natives-external.cc is used only for the external snapshot build.
#endif // V8_USE_EXTERNAL_STARTUP_DATA
namespace v8 {
namespace internal {
/**
* NativesStore stores the 'native' (builtin) JS libraries.
*
* NativesStore needs to be initialized before using V8, usually by the
* embedder calling v8::SetNativesDataBlob, which calls SetNativesFromFile
* below.
*/
class NativesStore {
public:
~NativesStore() {
for (size_t i = 0; i < native_names_.size(); i++) {
native_names_[i].Dispose();
}
}
int GetBuiltinsCount() { return static_cast<int>(native_ids_.size()); }
Vector<const char> GetScriptSource(int index) {
return native_source_[index];
}
Vector<const char> GetScriptName(int index) { return native_names_[index]; }
int GetIndex(const char* id) {
for (int i = 0; i < static_cast<int>(native_ids_.size()); ++i) {
int native_id_length = native_ids_[i].length();
if ((static_cast<int>(strlen(id)) == native_id_length) &&
(strncmp(id, native_ids_[i].begin(), native_id_length) == 0)) {
return i;
}
}
UNREACHABLE();
}
Vector<const char> GetScriptsSource() {
UNREACHABLE(); // Not implemented.
}
static NativesStore* MakeFromScriptsSource(SnapshotByteSource* source) {
NativesStore* store = new NativesStore;
// We expect the libraries in the following format:
// int: # of sources.
// 2N blobs: N pairs of source name + actual source.
int library_count = source->GetIntSlow();
for (int i = 0; i < library_count; ++i) {
store->ReadNameAndContentPair(source);
}
return store;
}
private:
NativesStore() = default;
Vector<const char> NameFromId(const byte* id, int id_length) {
const char native[] = "native ";
const char extension[] = ".js";
Vector<char> name(Vector<char>::New(id_length + sizeof(native) - 1 +
sizeof(extension) - 1));
memcpy(name.begin(), native, sizeof(native) - 1);
memcpy(name.begin() + sizeof(native) - 1, id, id_length);
memcpy(name.begin() + sizeof(native) - 1 + id_length, extension,
sizeof(extension) - 1);
return Vector<const char>::cast(name);
}
void ReadNameAndContentPair(SnapshotByteSource* bytes) {
const byte* id;
const byte* source;
int id_length = bytes->GetBlob(&id);
int source_length = bytes->GetBlob(&source);
native_ids_.emplace_back(reinterpret_cast<const char*>(id), id_length);
native_source_.emplace_back(reinterpret_cast<const char*>(source),
source_length);
native_names_.push_back(NameFromId(id, id_length));
}
std::vector<Vector<const char>> native_ids_;
std::vector<Vector<const char>> native_names_;
std::vector<Vector<const char>> native_source_;
DISALLOW_COPY_AND_ASSIGN(NativesStore);
};
template<NativeType type>
class NativesHolder {
public:
static NativesStore* get() {
CHECK(holder_);
return holder_;
}
static void set(NativesStore* store) {
CHECK(store);
holder_ = store;
}
static bool empty() { return holder_ == nullptr; }
static void Dispose() {
delete holder_;
holder_ = nullptr;
}
private:
static NativesStore* holder_;
};
template <NativeType type>
NativesStore* NativesHolder<type>::holder_ = nullptr;
// The natives blob. Memory is owned by caller.
static StartupData* natives_blob_ = nullptr;
/**
* Read the Natives blob, as previously set by SetNativesFromFile.
*/
void ReadNatives() {
if (natives_blob_ && NativesHolder<EXTRAS>::empty()) {
SnapshotByteSource bytes(natives_blob_->data, natives_blob_->raw_size);
NativesHolder<EXTRAS>::set(NativesStore::MakeFromScriptsSource(&bytes));
DCHECK(!bytes.HasMore());
}
}
/**
* Set the Natives (library sources) blob, as generated by js2c + the build
* system.
*/
void SetNativesFromFile(StartupData* natives_blob) {
DCHECK(!natives_blob_);
DCHECK(natives_blob);
DCHECK(natives_blob->data);
DCHECK_GT(natives_blob->raw_size, 0);
natives_blob_ = natives_blob;
ReadNatives();
}
/**
* Release memory allocated by SetNativesFromFile.
*/
void DisposeNatives() {
NativesHolder<EXTRAS>::Dispose();
}
// Implement NativesCollection<T> bsaed on NativesHolder + NativesStore.
//
// (The callers expect a purely static interface, since this is how the
// natives are usually compiled in. Since we implement them based on
// runtime content, we have to implement this indirection to offer
// a static interface.)
template<NativeType type>
int NativesCollection<type>::GetBuiltinsCount() {
return NativesHolder<type>::get()->GetBuiltinsCount();
}
template<NativeType type>
int NativesCollection<type>::GetIndex(const char* name) {
return NativesHolder<type>::get()->GetIndex(name);
}
template <NativeType type>
Vector<const char> NativesCollection<type>::GetScriptSource(int index) {
return NativesHolder<type>::get()->GetScriptSource(index);
}
template<NativeType type>
Vector<const char> NativesCollection<type>::GetScriptName(int index) {
return NativesHolder<type>::get()->GetScriptName(index);
}
template <NativeType type>
Vector<const char> NativesCollection<type>::GetScriptsSource() {
return NativesHolder<type>::get()->GetScriptsSource();
}
// Explicit template instantiations.
#define INSTANTIATE_TEMPLATES(T) \
template int NativesCollection<T>::GetBuiltinsCount(); \
template int NativesCollection<T>::GetIndex(const char* name); \
template Vector<const char> NativesCollection<T>::GetScriptSource(int i); \
template Vector<const char> NativesCollection<T>::GetScriptName(int i); \
template Vector<const char> NativesCollection<T>::GetScriptsSource();
INSTANTIATE_TEMPLATES(EXTRAS)
#undef INSTANTIATE_TEMPLATES
} // namespace internal
} // namespace v8

View File

@ -1,85 +0,0 @@
// Copyright 2011 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.
#ifndef V8_SNAPSHOT_NATIVES_H_
#define V8_SNAPSHOT_NATIVES_H_
#include "include/v8.h"
#include "src/utils/vector.h"
#include "src/objects/objects.h"
namespace v8 { class StartupData; } // Forward declaration.
namespace v8 {
namespace internal {
enum NativeType {
EXTRAS,
};
// Extra handling for V8_EXPORT_PRIVATE in combination with USING_V8_SHARED
// since definition of methods of classes marked as dllimport is not allowed.
template <NativeType type>
#ifdef USING_V8_SHARED
class NativesCollection {
#else
class V8_EXPORT_PRIVATE NativesCollection {
#endif // USING_V8_SHARED
public:
// The following methods are implemented in js2c-generated code:
// Number of built-in scripts.
static int GetBuiltinsCount();
static int GetIndex(const char* name);
static Vector<const char> GetScriptSource(int index);
static Vector<const char> GetScriptName(int index);
static Vector<const char> GetScriptsSource();
};
using ExtraNatives = NativesCollection<EXTRAS>;
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
// Used for reading the natives at runtime. Implementation in natives-empty.cc
void SetNativesFromFile(StartupData* natives_blob);
void ReadNatives();
void DisposeNatives();
#endif
class NativesExternalStringResource final
: public v8::String::ExternalOneByteStringResource {
public:
NativesExternalStringResource(NativeType type, int index);
const char* data() const override { return data_; }
size_t length() const override { return length_; }
v8::String::ExternalOneByteStringResource* EncodeForSerialization() const {
DCHECK(type_ == EXTRAS);
intptr_t val = (index_ << 1) | 1;
val = val << kSystemPointerSizeLog2; // Pointer align.
return reinterpret_cast<v8::String::ExternalOneByteStringResource*>(val);
}
// Decode from serialization.
static NativesExternalStringResource* DecodeForDeserialization(
const v8::String::ExternalOneByteStringResource* encoded) {
intptr_t val =
reinterpret_cast<intptr_t>(encoded) >> kSystemPointerSizeLog2;
DCHECK(val & 1);
int index = static_cast<int>(val >> 1);
return new NativesExternalStringResource(EXTRAS, index);
}
private:
const char* data_;
size_t length_;
NativeType type_;
int index_;
};
} // namespace internal
} // namespace v8
#endif // V8_SNAPSHOT_NATIVES_H_

View File

@ -14,7 +14,6 @@
#include "src/objects/map.h"
#include "src/objects/slots-inl.h"
#include "src/objects/smi.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
namespace v8 {
@ -412,36 +411,20 @@ void Serializer::ObjectSerializer::SerializeJSArrayBuffer() {
}
void Serializer::ObjectSerializer::SerializeExternalString() {
Heap* heap = serializer_->isolate()->heap();
// For external strings with known resources, we replace the resource field
// with the encoded external reference, which we restore upon deserialize.
// for native native source code strings, we replace the resource field
// with the native source id.
// For the rest we serialize them to look like ordinary sequential strings.
if (object_.map() != ReadOnlyRoots(heap).native_source_string_map()) {
ExternalString string = ExternalString::cast(object_);
Address resource = string.resource_as_address();
ExternalReferenceEncoder::Value reference;
if (serializer_->external_reference_encoder_.TryEncode(resource).To(
&reference)) {
DCHECK(reference.is_from_api());
string.set_uint32_as_resource(reference.index());
SerializeObject();
string.set_address_as_resource(resource);
} else {
SerializeExternalStringAsSequentialString();
}
} else {
ExternalOneByteString string = ExternalOneByteString::cast(object_);
DCHECK(string.is_uncached());
const NativesExternalStringResource* resource =
reinterpret_cast<const NativesExternalStringResource*>(
string.resource());
// Replace the resource field with the type and index of the native source.
string.set_resource(resource->EncodeForSerialization());
ExternalString string = ExternalString::cast(object_);
Address resource = string.resource_as_address();
ExternalReferenceEncoder::Value reference;
if (serializer_->external_reference_encoder_.TryEncode(resource).To(
&reference)) {
DCHECK(reference.is_from_api());
string.set_uint32_as_resource(reference.index());
SerializeObject();
// Restore the resource field.
string.set_resource(resource);
string.set_address_as_resource(resource);
} else {
SerializeExternalStringAsSequentialString();
}
}
@ -450,7 +433,6 @@ void Serializer::ObjectSerializer::SerializeExternalStringAsSequentialString() {
// an imaginary sequential string with the same content.
ReadOnlyRoots roots(serializer_->isolate());
DCHECK(object_.IsExternalString());
DCHECK(object_.map() != roots.native_source_string_map());
ExternalString string = ExternalString::cast(object_);
int length = string.length();
Map map;

View File

@ -36,7 +36,6 @@
#include "src/deoptimizer/deoptimizer.h"
#include "src/execution/frames.h"
#include "src/objects/objects-inl.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
#include "src/utils/utils.h"
#include "test/cctest/cctest.h"

View File

@ -1,122 +0,0 @@
// Copyright 2015 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.
(function (global, binding, v8) {
'use strict';
binding.testExtraShouldReturnFive = function() {
return 5;
};
binding.testExtraShouldCallToRuntime = function() {
return binding.runtime(3);
};
binding.testFunctionToString = function() {
function foo() { return 1; }
return foo.toString();
};
binding.testStackTrace = function(f) {
return f();
}
// Exercise all of the extras utils:
// - v8.createPrivateSymbol
// - v8.uncurryThis
// - v8.InternalPackedArray
// - v8.createPromise, v8.resolvePromise, v8.rejectPromise
const Object = global.Object;
const hasOwn = v8.uncurryThis(Object.prototype.hasOwnProperty);
const Function = global.Function;
const call = v8.uncurryThis(Function.prototype.call);
const apply = v8.uncurryThis(Function.prototype.apply);
const Promise = global.Promise;
const Promise_resolve = Promise.resolve.bind(Promise);
const arrayToTest = new v8.InternalPackedArray();
arrayToTest.push(1);
arrayToTest.push(2);
arrayToTest.pop();
arrayToTest.unshift("a", "b", "c");
arrayToTest.shift();
arrayToTest.splice(0, 1);
const slicedArray = arrayToTest.slice();
const arraysOK = arrayToTest.length === 2 && arrayToTest[0] === "c" &&
arrayToTest[1] === 1 && slicedArray.length === 2 &&
slicedArray[0] === "c" && slicedArray[1] === 1;
binding.testCreatePromise = function() {
return v8.createPromise();
}
binding.testCreatePromiseWithParent = function(parent) {
return v8.createPromise(parent);
}
binding.testRejectPromise = function(promise, reason) {
return v8.rejectPromise(promise, reason);
}
binding.testResolvePromise = function(promise, resolution) {
return v8.resolvePromise(promise, resolution);
}
binding.testExtraCanUseUtils = function() {
const fulfilledPromise = v8.createPromise();
v8.resolvePromise(
fulfilledPromise,
hasOwn({ test: 'test' }, 'test') ? 1 : -1,
undefined // pass an extra arg to test arguments adapter frame
);
const fulfilledPromise2 = Promise_resolve(call(function (arg1, arg2) {
return (this.prop === arg1 && arg1 === 'value' && arg2) ? 2 : -1;
}, { prop: 'value' }, 'value', arraysOK));
const rejectedPromise = v8.createPromise();
v8.rejectPromise(rejectedPromise, apply(function (arg1, arg2) {
return (arg1 === arg2 && arg2 === 'x') ? 3 : -1;
}, null, ['x', 'x']));
const rejectedButHandledPromise = v8.createPromise();
v8.rejectPromise(rejectedButHandledPromise, 4);
v8.markPromiseAsHandled(rejectedButHandledPromise);
function promiseStateToString(promise) {
switch (v8.promiseState(promise)) {
case v8.kPROMISE_PENDING:
return "pending";
case v8.kPROMISE_FULFILLED:
return "fulfilled";
case v8.kPROMISE_REJECTED:
return "rejected";
default:
throw new Error("Unexpected value for promiseState");
}
}
let promiseStates = promiseStateToString(new Promise(() => {})) + ' ' +
promiseStateToString(fulfilledPromise) + ' ' +
promiseStateToString(rejectedPromise);
const uncurryThis = v8.uncurryThis(function (a, b, c, d, e) {
return (this + a + b + c + d + e) === 21;
})(1, 2, 3, 4, 5, 6);
return {
privateSymbol: v8.createPrivateSymbol('sym'),
fulfilledPromise, // should be fulfilled with 1
fulfilledPromise2, // should be fulfilled with 2
rejectedPromise, // should be rejected with 3
rejectedButHandledPromise, // should be rejected but have a handler
promiseStates, // should be the string "pending fulfilled rejected"
promiseIsPromise: v8.isPromise(fulfilledPromise), // should be true
thenableIsPromise: v8.isPromise({ then() { } }), // should be false
uncurryThis // should be true
};
};
})

View File

@ -38,7 +38,6 @@
#include "src/logging/log.h"
#include "src/objects/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/snapshot/natives.h"
#include "src/utils/ostreams.h"
#include "src/utils/version.h"
#include "test/cctest/cctest.h"

View File

@ -49,7 +49,6 @@
#include "src/objects/objects-inl.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/code-serializer.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/partial-deserializer.h"
#include "src/snapshot/partial-serializer.h"
#include "src/snapshot/read-only-deserializer.h"

View File

@ -61,7 +61,7 @@ def CreateFileHandlerClass(root_dirs, verbose):
def TransferD8ToDevice(adb, build_dir, device_d8_dir, verbose):
files_to_copy = ["d8", "natives_blob.bin", "snapshot_blob.bin"]
files_to_copy = ["d8", "snapshot_blob.bin"]
# Pipe the output of md5sum from the local computer to the device, checking
# the md5 hashes on the device.

View File

@ -88,7 +88,6 @@ function sync_dir {
echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE"
sync_file "$OUTDIR/$ARCH_MODE/cctest"
sync_file "$OUTDIR/$ARCH_MODE/d8"
sync_file "$OUTDIR/$ARCH_MODE/natives_blob.bin"
sync_file "$OUTDIR/$ARCH_MODE/snapshot_blob.bin"
sync_file "$OUTDIR/$ARCH_MODE/unittests"
echo ""

View File

@ -1,78 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2014 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This utility concatenates several files into one. On Unix-like systems
# it is equivalent to:
# cat file1 file2 file3 ...files... > target
#
# The reason for writing a separate utility is that 'cat' is not available
# on all supported build platforms, but Python is, and hence this provides
# us with an easy and uniform way of doing this on all platforms.
# for py2/py3 compatibility
from __future__ import print_function
import optparse
def Concatenate(filenames):
"""Concatenate files.
Args:
files: Array of file names.
The last name is the target; all earlier ones are sources.
Returns:
True, if the operation was successful.
"""
if len(filenames) < 2:
print("An error occurred generating %s:\nNothing to do." % filenames[-1])
return False
try:
with open(filenames[-1], "wb") as target:
for filename in filenames[:-1]:
with open(filename, "rb") as current:
target.write(current.read())
return True
except IOError as e:
print("An error occurred when writing %s:\n%s" % (filenames[-1], e))
return False
def main():
parser = optparse.OptionParser()
parser.set_usage("""Concatenate several files into one.
Equivalent to: cat file1 ... > target.""")
(options, args) = parser.parse_args()
exit(0 if Concatenate(args) else 1)
if __name__ == "__main__":
main()

View File

@ -1,369 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This is a utility for converting JavaScript source code into C-style
# char arrays. It is used for embedded JavaScript code in the V8
# library.
# for py2/py3 compatibility
from functools import reduce
import os, re
import optparse
import textwrap
class Error(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
def ToCArray(byte_sequence):
result = []
for chr in byte_sequence:
result.append(str(ord(chr)))
joined = ", ".join(result)
return textwrap.fill(joined, 80)
def RemoveCommentsEmptyLinesAndWhitespace(lines):
lines = re.sub(r'\n+', '\n', lines) # empty lines
lines = re.sub(r'//.*\n', '\n', lines) # end-of-line comments
lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments.
lines = re.sub(r'\s+\n', '\n', lines) # trailing whitespace
lines = re.sub(r'\n\s+', '\n', lines) # initial whitespace
return lines
def ReadFile(filename):
file = open(filename, "rt")
try:
lines = file.read()
finally:
file.close()
return lines
EVAL_PATTERN = re.compile(r'\beval\s*\(')
WITH_PATTERN = re.compile(r'\bwith\s*\(')
INVALID_ERROR_MESSAGE_PATTERN = re.compile(
r'Make(?!Generic)\w*Error\(([kA-Z]\w+)')
NEW_ERROR_PATTERN = re.compile(r'new \$\w*Error\((?!\))')
def Validate(lines):
# Because of simplified context setup, eval and with is not
# allowed in the natives files.
if EVAL_PATTERN.search(lines):
raise Error("Eval disallowed in natives.")
if WITH_PATTERN.search(lines):
raise Error("With statements disallowed in natives.")
invalid_error = INVALID_ERROR_MESSAGE_PATTERN.search(lines)
if invalid_error:
raise Error("Unknown error message template '%s'" % invalid_error.group(1))
if NEW_ERROR_PATTERN.search(lines):
raise Error("Error constructed without message template.")
# Pass lines through unchanged.
return lines
def ExpandConstants(lines, constants):
for key, value in constants:
lines = key.sub(str(value), lines)
return lines
HEADER_TEMPLATE = """\
// Copyright 2011 Google Inc. All Rights Reserved.
// This file was generated from .js source files by GYP. If you
// want to make changes to this file you should either change the
// javascript source files or the GYP script.
#include "src/init/v8.h"
#include "src/snapshot/natives.h"
#include "src/utils/utils.h"
namespace v8 {
namespace internal {
%(sources_declaration)s\
template <>
int NativesCollection<%(type)s>::GetBuiltinsCount() {
return %(builtin_count)i;
}
template <>
int NativesCollection<%(type)s>::GetIndex(const char* name) {
%(get_index_cases)s\
return -1;
}
template <>
Vector<const char> NativesCollection<%(type)s>::GetScriptSource(int index) {
%(get_script_source_cases)s\
return Vector<const char>("", 0);
}
template <>
Vector<const char> NativesCollection<%(type)s>::GetScriptName(int index) {
%(get_script_name_cases)s\
return Vector<const char>("", 0);
}
template <>
Vector<const char> NativesCollection<%(type)s>::GetScriptsSource() {
return Vector<const char>(sources, %(total_length)i);
}
} // internal
} // v8
"""
SOURCES_DECLARATION = """\
static const char sources[] = { %s };
"""
GET_INDEX_CASE = """\
if (strcmp(name, "%(id)s") == 0) return %(i)i;
"""
GET_SCRIPT_SOURCE_CASE = """\
if (index == %(i)i) return Vector<const char>(sources + %(offset)i, %(source_length)i);
"""
GET_SCRIPT_NAME_CASE = """\
if (index == %(i)i) return Vector<const char>("%(name)s", %(length)i);
"""
def BuildFilterChain():
"""Build the chain of filter functions to be applied to the sources.
Returns:
A function (string -> string) that processes a source file.
"""
filter_chain = [
RemoveCommentsEmptyLinesAndWhitespace,
Validate,
]
def chain(f1, f2):
return lambda x: f2(f1(x))
return reduce(chain, filter_chain)
def BuildExtraFilterChain():
return lambda x: RemoveCommentsEmptyLinesAndWhitespace(Validate(x))
class Sources:
def __init__(self):
self.names = []
self.modules = []
def PrepareSources(source_files, native_type, emit_js):
"""Read, prepare and assemble the list of source files.
Args:
source_files: List of JavaScript-ish source files.
native_type: String corresponding to a NativeType enum value, allowing us
to treat different types of sources differently.
emit_js: True if we should skip the byte conversion and just leave the
sources as JS strings.
Returns:
An instance of Sources.
"""
result = Sources()
filters = BuildFilterChain()
source_files_and_contents = [(f, ReadFile(f)) for f in source_files]
for (source, contents) in source_files_and_contents:
try:
lines = filters(contents)
except Error as e:
raise Error("In file %s:\n%s" % (source, str(e)))
result.modules.append(lines)
name = os.path.basename(source)[:-3]
result.names.append(name)
return result
def BuildMetadata(sources, source_bytes, native_type):
"""Build the meta data required to generate a libaries file.
Args:
sources: A Sources instance with the prepared sources.
source_bytes: A list of source bytes.
(The concatenation of all sources; might be compressed.)
native_type: The parameter for the NativesCollection template.
Returns:
A dictionary for use with HEADER_TEMPLATE.
"""
total_length = len(source_bytes)
raw_sources = "".join(sources.modules)
# The sources are expected to be ASCII-only.
try:
raw_sources.encode('ascii')
except UnicodeEncodeError:
assert False
# Loop over modules and build up indices into the source blob:
get_index_cases = []
get_script_name_cases = []
get_script_source_cases = []
offset = 0
for i in range(len(sources.modules)):
native_name = "native %s.js" % sources.names[i]
d = {
"i": i,
"id": sources.names[i],
"name": native_name,
"length": len(native_name),
"offset": offset,
"source_length": len(sources.modules[i]),
}
get_index_cases.append(GET_INDEX_CASE % d)
get_script_name_cases.append(GET_SCRIPT_NAME_CASE % d)
get_script_source_cases.append(GET_SCRIPT_SOURCE_CASE % d)
offset += len(sources.modules[i])
assert offset == len(raw_sources)
metadata = {
"builtin_count": len(sources.modules),
"sources_declaration":
SOURCES_DECLARATION % ToCArray(
source_bytes if len(source_bytes) != 0 else "\0"),
"total_length": total_length,
"get_index_cases": "".join(get_index_cases),
"get_script_source_cases": "".join(get_script_source_cases),
"get_script_name_cases": "".join(get_script_name_cases),
"type": native_type,
}
return metadata
def PutInt(blob_file, value):
assert(value >= 0 and value < (1 << 28))
if (value < 1 << 6):
size = 1
elif (value < 1 << 14):
size = 2
elif (value < 1 << 22):
size = 3
else:
size = 4
value_with_length = (value << 2) | (size - 1)
byte_sequence = bytearray()
for i in range(size):
byte_sequence.append(value_with_length & 255)
value_with_length >>= 8;
blob_file.write(byte_sequence)
def PutStr(blob_file, value):
PutInt(blob_file, len(value.encode()))
blob_file.write(value.encode())
def WriteStartupBlob(sources, startup_blob):
"""Write a startup blob, as expected by V8 Initialize ...
TODO(vogelheim): Add proper method name.
Args:
sources: A Sources instance with the prepared sources.
startup_blob_file: Name of file to write the blob to.
"""
output = open(startup_blob, "wb")
PutInt(output, len(sources.names))
for i in range(len(sources.names)):
PutStr(output, sources.names[i]);
PutStr(output, sources.modules[i]);
output.close()
def JS2C(sources, target, native_type, raw_file, startup_blob, emit_js):
prepared_sources = PrepareSources(sources, native_type, emit_js)
sources_output = "".join(prepared_sources.modules)
metadata = BuildMetadata(prepared_sources, sources_output, native_type)
# Optionally emit raw file.
if raw_file:
output = open(raw_file, "w")
output.write(sources_output)
output.close()
if startup_blob:
WriteStartupBlob(prepared_sources, startup_blob)
# Emit resulting source file.
output = open(target, "w")
if emit_js:
output.write(sources_output)
else:
output.write(HEADER_TEMPLATE % metadata)
output.close()
def main():
parser = optparse.OptionParser()
parser.add_option("--raw",
help="file to write the processed sources array to.")
parser.add_option("--startup_blob",
help="file to write the startup blob to.")
parser.add_option("--js",
help="writes a JS file output instead of a C file",
action="store_true", default=False, dest='js')
parser.add_option("--nojs", action="store_false", default=False, dest='js')
parser.set_usage("""js2c out.cc type sources.js ...
out.cc: C code to be generated.
type: type parameter for NativesCollection template.
sources.js: JS internal sources.""")
(options, args) = parser.parse_args()
JS2C(args[2:],
args[0],
args[1],
options.raw,
options.startup_blob,
options.js)
if __name__ == "__main__":
main()

View File

@ -32,7 +32,6 @@ REFBUILD_EXECUTABLE_FILES = [
SUPPLEMENTARY_FILES = [
'icudtl.dat',
'natives_blob.bin',
'snapshot_blob.bin',
'v8_build_config.json',
]

View File

@ -114,12 +114,6 @@ class _Driver(object):
# Push external startup data. Backwards compatible for revisions where
# these files didn't exist. Or for bots that don't produce these files.
self.push_file(
shell_dir,
'natives_blob.bin',
target_dir,
skip_if_missing=True,
)
self.push_file(
shell_dir,
'snapshot_blob.bin',

View File

@ -261,74 +261,73 @@ KNOWN_MAPS = {
("read_only_space", 0x01a31): (120, "EphemeronHashTableMap"),
("read_only_space", 0x01a81): (157, "EmbedderDataArrayMap"),
("read_only_space", 0x01ad1): (168, "WeakCellMap"),
("read_only_space", 0x01b21): (58, "NativeSourceStringMap"),
("read_only_space", 0x01b71): (32, "StringMap"),
("read_only_space", 0x01bc1): (41, "ConsOneByteStringMap"),
("read_only_space", 0x01c11): (33, "ConsStringMap"),
("read_only_space", 0x01c61): (37, "ThinStringMap"),
("read_only_space", 0x01cb1): (35, "SlicedStringMap"),
("read_only_space", 0x01d01): (43, "SlicedOneByteStringMap"),
("read_only_space", 0x01d51): (34, "ExternalStringMap"),
("read_only_space", 0x01da1): (42, "ExternalOneByteStringMap"),
("read_only_space", 0x01df1): (50, "UncachedExternalStringMap"),
("read_only_space", 0x01e41): (0, "InternalizedStringMap"),
("read_only_space", 0x01e91): (2, "ExternalInternalizedStringMap"),
("read_only_space", 0x01ee1): (10, "ExternalOneByteInternalizedStringMap"),
("read_only_space", 0x01f31): (18, "UncachedExternalInternalizedStringMap"),
("read_only_space", 0x01f81): (26, "UncachedExternalOneByteInternalizedStringMap"),
("read_only_space", 0x01fd1): (58, "UncachedExternalOneByteStringMap"),
("read_only_space", 0x02021): (67, "SelfReferenceMarkerMap"),
("read_only_space", 0x02089): (94, "EnumCacheMap"),
("read_only_space", 0x02129): (88, "ArrayBoilerplateDescriptionMap"),
("read_only_space", 0x02319): (97, "InterceptorInfoMap"),
("read_only_space", 0x04c59): (71, "PromiseFulfillReactionJobTaskMap"),
("read_only_space", 0x04ca9): (72, "PromiseRejectReactionJobTaskMap"),
("read_only_space", 0x04cf9): (73, "CallableTaskMap"),
("read_only_space", 0x04d49): (74, "CallbackTaskMap"),
("read_only_space", 0x04d99): (75, "PromiseResolveThenableJobTaskMap"),
("read_only_space", 0x04de9): (78, "FunctionTemplateInfoMap"),
("read_only_space", 0x04e39): (79, "ObjectTemplateInfoMap"),
("read_only_space", 0x04e89): (80, "Tuple2Map"),
("read_only_space", 0x04ed9): (81, "Tuple3Map"),
("read_only_space", 0x04f29): (82, "AccessCheckInfoMap"),
("read_only_space", 0x04f79): (83, "AccessorInfoMap"),
("read_only_space", 0x04fc9): (84, "AccessorPairMap"),
("read_only_space", 0x05019): (85, "AliasedArgumentsEntryMap"),
("read_only_space", 0x05069): (86, "AllocationMementoMap"),
("read_only_space", 0x050b9): (89, "AsmWasmDataMap"),
("read_only_space", 0x05109): (90, "AsyncGeneratorRequestMap"),
("read_only_space", 0x05159): (92, "ClassPositionsMap"),
("read_only_space", 0x051a9): (93, "DebugInfoMap"),
("read_only_space", 0x051f9): (96, "FunctionTemplateRareDataMap"),
("read_only_space", 0x05249): (99, "InterpreterDataMap"),
("read_only_space", 0x05299): (100, "PromiseCapabilityMap"),
("read_only_space", 0x052e9): (101, "PromiseReactionMap"),
("read_only_space", 0x05339): (102, "PrototypeInfoMap"),
("read_only_space", 0x05389): (103, "ScriptMap"),
("read_only_space", 0x053d9): (107, "SourcePositionTableWithFrameCacheMap"),
("read_only_space", 0x05429): (108, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x05479): (109, "StackFrameInfoMap"),
("read_only_space", 0x054c9): (110, "StackTraceFrameMap"),
("read_only_space", 0x05519): (111, "TemplateObjectDescriptionMap"),
("read_only_space", 0x05569): (112, "WasmCapiFunctionDataMap"),
("read_only_space", 0x055b9): (113, "WasmDebugInfoMap"),
("read_only_space", 0x05609): (114, "WasmExceptionTagMap"),
("read_only_space", 0x05659): (115, "WasmExportedFunctionDataMap"),
("read_only_space", 0x056a9): (116, "WasmIndirectFunctionTableMap"),
("read_only_space", 0x056f9): (117, "WasmJSFunctionDataMap"),
("read_only_space", 0x05749): (98, "InternalClassMap"),
("read_only_space", 0x05799): (105, "SmiPairMap"),
("read_only_space", 0x057e9): (104, "SmiBoxMap"),
("read_only_space", 0x05839): (106, "SortStateMap"),
("read_only_space", 0x05889): (87, "AllocationSiteWithWeakNextMap"),
("read_only_space", 0x058d9): (87, "AllocationSiteWithoutWeakNextMap"),
("read_only_space", 0x05929): (76, "LoadHandler1Map"),
("read_only_space", 0x05979): (76, "LoadHandler2Map"),
("read_only_space", 0x059c9): (76, "LoadHandler3Map"),
("read_only_space", 0x05a19): (77, "StoreHandler0Map"),
("read_only_space", 0x05a69): (77, "StoreHandler1Map"),
("read_only_space", 0x05ab9): (77, "StoreHandler2Map"),
("read_only_space", 0x05b09): (77, "StoreHandler3Map"),
("read_only_space", 0x01b21): (32, "StringMap"),
("read_only_space", 0x01b71): (41, "ConsOneByteStringMap"),
("read_only_space", 0x01bc1): (33, "ConsStringMap"),
("read_only_space", 0x01c11): (37, "ThinStringMap"),
("read_only_space", 0x01c61): (35, "SlicedStringMap"),
("read_only_space", 0x01cb1): (43, "SlicedOneByteStringMap"),
("read_only_space", 0x01d01): (34, "ExternalStringMap"),
("read_only_space", 0x01d51): (42, "ExternalOneByteStringMap"),
("read_only_space", 0x01da1): (50, "UncachedExternalStringMap"),
("read_only_space", 0x01df1): (0, "InternalizedStringMap"),
("read_only_space", 0x01e41): (2, "ExternalInternalizedStringMap"),
("read_only_space", 0x01e91): (10, "ExternalOneByteInternalizedStringMap"),
("read_only_space", 0x01ee1): (18, "UncachedExternalInternalizedStringMap"),
("read_only_space", 0x01f31): (26, "UncachedExternalOneByteInternalizedStringMap"),
("read_only_space", 0x01f81): (58, "UncachedExternalOneByteStringMap"),
("read_only_space", 0x01fd1): (67, "SelfReferenceMarkerMap"),
("read_only_space", 0x02039): (94, "EnumCacheMap"),
("read_only_space", 0x020d9): (88, "ArrayBoilerplateDescriptionMap"),
("read_only_space", 0x022c9): (97, "InterceptorInfoMap"),
("read_only_space", 0x04c09): (71, "PromiseFulfillReactionJobTaskMap"),
("read_only_space", 0x04c59): (72, "PromiseRejectReactionJobTaskMap"),
("read_only_space", 0x04ca9): (73, "CallableTaskMap"),
("read_only_space", 0x04cf9): (74, "CallbackTaskMap"),
("read_only_space", 0x04d49): (75, "PromiseResolveThenableJobTaskMap"),
("read_only_space", 0x04d99): (78, "FunctionTemplateInfoMap"),
("read_only_space", 0x04de9): (79, "ObjectTemplateInfoMap"),
("read_only_space", 0x04e39): (80, "Tuple2Map"),
("read_only_space", 0x04e89): (81, "Tuple3Map"),
("read_only_space", 0x04ed9): (82, "AccessCheckInfoMap"),
("read_only_space", 0x04f29): (83, "AccessorInfoMap"),
("read_only_space", 0x04f79): (84, "AccessorPairMap"),
("read_only_space", 0x04fc9): (85, "AliasedArgumentsEntryMap"),
("read_only_space", 0x05019): (86, "AllocationMementoMap"),
("read_only_space", 0x05069): (89, "AsmWasmDataMap"),
("read_only_space", 0x050b9): (90, "AsyncGeneratorRequestMap"),
("read_only_space", 0x05109): (92, "ClassPositionsMap"),
("read_only_space", 0x05159): (93, "DebugInfoMap"),
("read_only_space", 0x051a9): (96, "FunctionTemplateRareDataMap"),
("read_only_space", 0x051f9): (99, "InterpreterDataMap"),
("read_only_space", 0x05249): (100, "PromiseCapabilityMap"),
("read_only_space", 0x05299): (101, "PromiseReactionMap"),
("read_only_space", 0x052e9): (102, "PrototypeInfoMap"),
("read_only_space", 0x05339): (103, "ScriptMap"),
("read_only_space", 0x05389): (107, "SourcePositionTableWithFrameCacheMap"),
("read_only_space", 0x053d9): (108, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x05429): (109, "StackFrameInfoMap"),
("read_only_space", 0x05479): (110, "StackTraceFrameMap"),
("read_only_space", 0x054c9): (111, "TemplateObjectDescriptionMap"),
("read_only_space", 0x05519): (112, "WasmCapiFunctionDataMap"),
("read_only_space", 0x05569): (113, "WasmDebugInfoMap"),
("read_only_space", 0x055b9): (114, "WasmExceptionTagMap"),
("read_only_space", 0x05609): (115, "WasmExportedFunctionDataMap"),
("read_only_space", 0x05659): (116, "WasmIndirectFunctionTableMap"),
("read_only_space", 0x056a9): (117, "WasmJSFunctionDataMap"),
("read_only_space", 0x056f9): (98, "InternalClassMap"),
("read_only_space", 0x05749): (105, "SmiPairMap"),
("read_only_space", 0x05799): (104, "SmiBoxMap"),
("read_only_space", 0x057e9): (106, "SortStateMap"),
("read_only_space", 0x05839): (87, "AllocationSiteWithWeakNextMap"),
("read_only_space", 0x05889): (87, "AllocationSiteWithoutWeakNextMap"),
("read_only_space", 0x058d9): (76, "LoadHandler1Map"),
("read_only_space", 0x05929): (76, "LoadHandler2Map"),
("read_only_space", 0x05979): (76, "LoadHandler3Map"),
("read_only_space", 0x059c9): (77, "StoreHandler0Map"),
("read_only_space", 0x05a19): (77, "StoreHandler1Map"),
("read_only_space", 0x05a69): (77, "StoreHandler2Map"),
("read_only_space", 0x05ab9): (77, "StoreHandler3Map"),
("map_space", 0x00121): (1057, "ExternalMap"),
("map_space", 0x00171): (1072, "JSMessageObjectMap"),
}
@ -353,31 +352,31 @@ KNOWN_OBJECTS = {
("read_only_space", 0x00d59): "TerminationException",
("read_only_space", 0x00e01): "OptimizedOut",
("read_only_space", 0x00ea1): "StaleRegister",
("read_only_space", 0x02071): "EmptyEnumCache",
("read_only_space", 0x020d9): "EmptyPropertyArray",
("read_only_space", 0x020e9): "EmptyByteArray",
("read_only_space", 0x020f9): "EmptyObjectBoilerplateDescription",
("read_only_space", 0x02111): "EmptyArrayBoilerplateDescription",
("read_only_space", 0x02179): "EmptyClosureFeedbackCellArray",
("read_only_space", 0x02189): "EmptySloppyArgumentsElements",
("read_only_space", 0x021a9): "EmptySlowElementDictionary",
("read_only_space", 0x021f1): "EmptyOrderedHashMap",
("read_only_space", 0x02219): "EmptyOrderedHashSet",
("read_only_space", 0x02241): "EmptyFeedbackMetadata",
("read_only_space", 0x02251): "EmptyPropertyCell",
("read_only_space", 0x02279): "EmptyPropertyDictionary",
("read_only_space", 0x022c9): "NoOpInterceptorInfo",
("read_only_space", 0x02369): "EmptyWeakArrayList",
("read_only_space", 0x02381): "InfinityValue",
("read_only_space", 0x02391): "MinusZeroValue",
("read_only_space", 0x023a1): "MinusInfinityValue",
("read_only_space", 0x023b1): "SelfReferenceMarker",
("read_only_space", 0x02409): "OffHeapTrampolineRelocationInfo",
("read_only_space", 0x02421): "TrampolineTrivialCodeDataContainer",
("read_only_space", 0x02439): "TrampolinePromiseRejectionCodeDataContainer",
("read_only_space", 0x02451): "GlobalThisBindingScopeInfo",
("read_only_space", 0x024b9): "EmptyFunctionScopeInfo",
("read_only_space", 0x02509): "HashSeed",
("read_only_space", 0x02021): "EmptyEnumCache",
("read_only_space", 0x02089): "EmptyPropertyArray",
("read_only_space", 0x02099): "EmptyByteArray",
("read_only_space", 0x020a9): "EmptyObjectBoilerplateDescription",
("read_only_space", 0x020c1): "EmptyArrayBoilerplateDescription",
("read_only_space", 0x02129): "EmptyClosureFeedbackCellArray",
("read_only_space", 0x02139): "EmptySloppyArgumentsElements",
("read_only_space", 0x02159): "EmptySlowElementDictionary",
("read_only_space", 0x021a1): "EmptyOrderedHashMap",
("read_only_space", 0x021c9): "EmptyOrderedHashSet",
("read_only_space", 0x021f1): "EmptyFeedbackMetadata",
("read_only_space", 0x02201): "EmptyPropertyCell",
("read_only_space", 0x02229): "EmptyPropertyDictionary",
("read_only_space", 0x02279): "NoOpInterceptorInfo",
("read_only_space", 0x02319): "EmptyWeakArrayList",
("read_only_space", 0x02331): "InfinityValue",
("read_only_space", 0x02341): "MinusZeroValue",
("read_only_space", 0x02351): "MinusInfinityValue",
("read_only_space", 0x02361): "SelfReferenceMarker",
("read_only_space", 0x023b9): "OffHeapTrampolineRelocationInfo",
("read_only_space", 0x023d1): "TrampolineTrivialCodeDataContainer",
("read_only_space", 0x023e9): "TrampolinePromiseRejectionCodeDataContainer",
("read_only_space", 0x02401): "GlobalThisBindingScopeInfo",
("read_only_space", 0x02469): "EmptyFunctionScopeInfo",
("read_only_space", 0x024b9): "HashSeed",
("old_space", 0x00121): "ArgumentsIteratorAccessor",
("old_space", 0x00191): "ArrayLengthAccessor",
("old_space", 0x00201): "BoundFunctionLengthAccessor",