Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.37',
'v8_embedder_string': '-node.40',

##### V8 defaults for Node.js #####

Expand Down
1 change: 1 addition & 0 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,4 @@ Kotaro Ohsugi <[email protected]>
Jing Peiyang <[email protected]>
magic-akari <[email protected]>
Ryuhei Shima <[email protected]>
Domagoj Stolfa <[email protected]>
5 changes: 3 additions & 2 deletions deps/v8/src/codegen/riscv/assembler-riscv-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ void Assembler::set_target_compressed_address_at(
Address pc, Address constant_pool, Tagged_t target,
WritableJitAllocation* jit_allocation, ICacheFlushMode icache_flush_mode) {
if (COMPRESS_POINTERS_BOOL) {
Assembler::set_uint32_constant_at(pc, constant_pool, target, jit_allocation,
icache_flush_mode);
Assembler::set_uint32_constant_at(pc, constant_pool,
static_cast<uint32_t>(target),
jit_allocation, icache_flush_mode);
} else {
UNREACHABLE();
}
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/codegen/riscv/assembler-riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,8 @@ void Assembler::bind_to(Label* L, int pos) {
trampoline_pos = get_trampoline_entry(fixup_pos);
CHECK_NE(trampoline_pos, kInvalidSlotPos);
}
CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset);
DEBUG_PRINTF("\t\ttrampolining: %d\n", trampoline_pos);
CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset);
target_at_put(fixup_pos, trampoline_pos, false);
fixup_pos = trampoline_pos;
}
Expand Down Expand Up @@ -1486,6 +1486,7 @@ void Assembler::BlockTrampolinePoolFor(int instructions) {
}

void Assembler::CheckTrampolinePool() {
if (trampoline_emitted_) return;
// Some small sequences of instructions must not be broken up by the
// insertion of a trampoline pool; such sequences are protected by setting
// either trampoline_pool_blocked_nesting_ or no_trampoline_pool_before_,
Expand All @@ -1507,7 +1508,6 @@ void Assembler::CheckTrampolinePool() {
return;
}

DCHECK(!trampoline_emitted_);
DCHECK_GE(unbound_labels_count_, 0);
if (unbound_labels_count_ > 0) {
// First we emit jump, then we emit trampoline pool.
Expand Down
15 changes: 13 additions & 2 deletions deps/v8/src/codegen/riscv/assembler-riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase,
// See Assembler::CheckConstPool for more info.
void EmitPoolGuard();

void FinishCode() { ForceConstantPoolEmissionWithoutJump(); }

#if defined(V8_TARGET_ARCH_RISCV64)
static void set_target_value_at(
Address pc, uint64_t target,
Expand Down Expand Up @@ -617,6 +619,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase,
}
}

inline int next_buffer_check() { return next_buffer_check_; }

friend class VectorUnit;
class VectorUnit {
public:
Expand Down Expand Up @@ -728,16 +732,19 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase,

// Block the emission of the trampoline pool before pc_offset.
void BlockTrampolinePoolBefore(int pc_offset) {
if (no_trampoline_pool_before_ < pc_offset)
if (no_trampoline_pool_before_ < pc_offset) {
DEBUG_PRINTF("\tBlockTrampolinePoolBefore %d\n", pc_offset);
no_trampoline_pool_before_ = pc_offset;
}
}

void StartBlockTrampolinePool() {
DEBUG_PRINTF("\tStartBlockTrampolinePool\n");
DEBUG_PRINTF("\tStartBlockTrampolinePool %d\n", pc_offset());
trampoline_pool_blocked_nesting_++;
}

void EndBlockTrampolinePool() {
DEBUG_PRINTF("\tEndBlockTrampolinePool\n");
trampoline_pool_blocked_nesting_--;
DEBUG_PRINTF("\ttrampoline_pool_blocked_nesting:%d\n",
trampoline_pool_blocked_nesting_);
Expand Down Expand Up @@ -767,6 +774,10 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase,

bool is_buffer_growth_blocked() const { return block_buffer_growth_; }

inline int ConstpoolComputesize() {
return constpool_.ComputeSize(Jump::kOmitted, Alignment::kOmitted);
}

private:
// Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512 * MB;
Expand Down
15 changes: 11 additions & 4 deletions deps/v8/src/codegen/riscv/macro-assembler-riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4926,11 +4926,21 @@ void MacroAssembler::LoadRootRegisterOffset(Register destination,

void MacroAssembler::Jump(Register target, Condition cond, Register rs,
const Operand& rt) {
BlockTrampolinePoolScope block_trampoline_pool(this);
if (cond == cc_always) {
jr(target);
DEBUG_PRINTF("\tCheckTrampolinePool pc_offset:%d %d\n", pc_offset(),
next_buffer_check() - ConstpoolComputesize());
if (!is_trampoline_emitted() &&
pc_offset() >= (next_buffer_check() - ConstpoolComputesize())) {
// We need to check trampoline pool before Constant pool.
// Here need to emit trampoline first.
// Jump(ra, al) will block trampoline pool for 1 instr.
nop();
CheckTrampolinePool();
}
ForceConstantPoolEmissionWithoutJump();
} else {
BlockTrampolinePoolScope block_trampoline_pool(this);
BRANCH_ARGS_CHECK(cond, rs, rt);
Branch(kInstrSize * 2, NegateCondition(cond), rs, rt);
jr(target);
Expand Down Expand Up @@ -5342,9 +5352,6 @@ void MacroAssembler::StoreReturnAddressAndCall(Register target) {

void MacroAssembler::Ret(Condition cond, Register rs, const Operand& rt) {
Jump(ra, cond, rs, rt);
if (cond == al) {
ForceConstantPoolEmissionWithoutJump();
}
}

void MacroAssembler::BranchLong(Label* L) {
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/execution/riscv/simulator-riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ class Simulator : public SimulatorBase {
// Return central stack view, without additional safety margins.
// Users, for example wasm::StackMemory, can add their own.
base::Vector<uint8_t> GetCentralStackView() const;
static constexpr int JSStackLimitMargin() { return kAdditionalStackMargin; }

void IterateRegistersAndStack(::heap::base::StackVisitor* visitor);

Expand Down
34 changes: 34 additions & 0 deletions deps/v8/src/maglev/riscv/maglev-ir-riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,40 @@ void CheckedIntPtrToInt32::GenerateCode(MaglevAssembler* masm,
Operand(std::numeric_limits<int32_t>::min()));
}

void CheckFloat64SameValue::SetValueLocationConstraints() {
UseRegister(target_input());
// We need two because LoadFPRImmediate needs to acquire one as well in the
// case where value() is not 0.0 or -0.0.
set_temporaries_needed((value().get_scalar() == 0) ? 1 : 2);
set_double_temporaries_needed(
value().is_nan() || (value().get_scalar() == 0) ? 0 : 1);
}

void CheckFloat64SameValue::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Label* fail = __ GetDeoptLabel(this, deoptimize_reason());
MaglevAssembler::TemporaryRegisterScope temps(masm);
DoubleRegister target = ToDoubleRegister(target_input());
if (value().is_nan()) {
__ JumpIfNotNan(target, fail);
} else {
DoubleRegister double_scratch = temps.AcquireScratchDouble();
Register scratch = temps.AcquireScratch();
__ Move(double_scratch, value().get_scalar());
__ CompareF64(scratch, EQ, double_scratch, target);
__ BranchFalseF(scratch, fail);
if (value().get_scalar() == 0) { // +0.0 or -0.0.
__ MacroAssembler::Move(scratch, target);
__ And(scratch, scratch, Operand(1ULL << 63));
if (value().get_bits() == 0) {
__ BranchTrueF(scratch, fail);
} else {
__ BranchFalseF(scratch, fail);
}
}
}
}

void Int32AddWithOverflow::SetValueLocationConstraints() {
UseRegister(left_input());
UseRegister(right_input());
Expand Down
22 changes: 0 additions & 22 deletions lib/internal/modules/esm/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const {
let debug = require('internal/util/debuglog').debuglog('async_loader_worker', (fn) => {
debug = fn;
});
let importMetaInitializer;

let importAssertionAlreadyWarned = false;

Expand Down Expand Up @@ -111,7 +110,6 @@ function defineImportAssertionAlias(context) {
* Interface for classes that implement asynchronous loader hooks that can be attached to the ModuleLoader
* via `ModuleLoader.#setAsyncLoaderHooks()`.
* @typedef {object} AsyncLoaderHooks
* @property {boolean} allowImportMetaResolve Whether to allow the use of `import.meta.resolve`.
* @property {boolean} isForAsyncLoaderHookWorker Whether the instance is running on the loader hook worker thread.
* @property {(url: string, context: object, defaultLoad: Function) => Promise<LoadResult>} load
* Calling the asynchronous `load` hook asynchronously.
Expand Down Expand Up @@ -163,8 +161,6 @@ class AsyncLoaderHooksOnLoaderHookWorker {
// Cache URLs we've already validated to avoid repeated validation
#validatedUrls = new SafeSet();

allowImportMetaResolve = false;

isForAsyncLoaderHookWorker = true;

/**
Expand Down Expand Up @@ -480,12 +476,6 @@ class AsyncLoaderHooksOnLoaderHookWorker {
waitForLoaderHookInitialization() {
// No-op
}

importMetaInitialize(meta, context, loader) {
importMetaInitializer ??= require('internal/modules/esm/initialize_import_meta').initializeImportMeta;
meta = importMetaInitializer(meta, context, loader);
return meta;
}
}
ObjectSetPrototypeOf(AsyncLoaderHooksOnLoaderHookWorker.prototype, null);

Expand Down Expand Up @@ -674,12 +664,6 @@ class AsyncLoaderHookWorker {
return body;
}
}

#importMetaInitializer = require('internal/modules/esm/initialize_import_meta').initializeImportMeta;

importMetaInitialize(meta, context, loader) {
this.#importMetaInitializer(meta, context, loader);
}
}
ObjectSetPrototypeOf(AsyncLoaderHookWorker.prototype, null);

Expand Down Expand Up @@ -817,8 +801,6 @@ function getAsyncLoaderHookWorker() {
*/
class AsyncLoaderHooksProxiedToLoaderHookWorker {

allowImportMetaResolve = true;

isForAsyncLoaderHookWorker = false;

/**
Expand Down Expand Up @@ -876,10 +858,6 @@ class AsyncLoaderHooksProxiedToLoaderHookWorker {
return asyncLoaderHookWorker.makeSyncRequest('load', undefined, url, context);
}

importMetaInitialize(meta, context, loader) {
asyncLoaderHookWorker.importMetaInitialize(meta, context, loader);
}

waitForLoaderHookInitialization() {
asyncLoaderHookWorker.waitForWorker();
}
Expand Down
83 changes: 0 additions & 83 deletions lib/internal/modules/esm/initialize_import_meta.js

This file was deleted.

Loading
Loading