Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: patch V8 to 6.7.288.46 #21260

Closed
wants to merge 1 commit into from
Closed
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 deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 6
#define V8_MINOR_VERSION 7
#define V8_BUILD_NUMBER 288
#define V8_PATCH_LEVEL 45
#define V8_PATCH_LEVEL 46

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
25 changes: 25 additions & 0 deletions deps/v8/src/code-stub-assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,18 @@ TNode<Smi> CodeStubAssembler::SmiFromInt32(SloppyTNode<Int32T> value) {
WordShl(value_intptr, SmiShiftBitsConstant()));
}

TNode<BoolT> CodeStubAssembler::IsValidPositiveSmi(TNode<IntPtrT> value) {
intptr_t constant_value;
if (ToIntPtrConstant(value, constant_value)) {
return (static_cast<uintptr_t>(constant_value) <=
static_cast<uintptr_t>(Smi::kMaxValue))
? Int32TrueConstant()
: Int32FalseConstant();
}

return UintPtrLessThanOrEqual(value, IntPtrConstant(Smi::kMaxValue));
}

TNode<Smi> CodeStubAssembler::SmiTag(SloppyTNode<IntPtrT> value) {
int32_t constant_value;
if (ToInt32Constant(value, constant_value) && Smi::IsValid(constant_value)) {
Expand Down Expand Up @@ -1002,6 +1014,19 @@ void CodeStubAssembler::GotoIfForceSlowPath(Label* if_true) {

Node* CodeStubAssembler::AllocateRaw(Node* size_in_bytes, AllocationFlags flags,
Node* top_address, Node* limit_address) {
// TODO(jgruber, chromium:848672): TNodeify AllocateRaw.
// TODO(jgruber, chromium:848672): Call FatalProcessOutOfMemory if this fails.
{
intptr_t constant_value;
if (ToIntPtrConstant(size_in_bytes, constant_value)) {
CHECK(Internals::IsValidSmi(constant_value));
CHECK_GT(constant_value, 0);
} else {
CSA_CHECK(this,
IsValidPositiveSmi(UncheckedCast<IntPtrT>(size_in_bytes)));
}
}

Node* top = Load(MachineType::Pointer(), top_address);
Node* limit = Load(MachineType::Pointer(), limit_address);

Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/code-stub-assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
TNode<Object> index,
TNode<IntPtrT> length);

// Returns true iff the given value fits into smi range and is >= 0.
TNode<BoolT> IsValidPositiveSmi(TNode<IntPtrT> value);

// Tag an IntPtr as a Smi value.
TNode<Smi> SmiTag(SloppyTNode<IntPtrT> value);
// Untag a Smi value as an IntPtr.
Expand Down
43 changes: 43 additions & 0 deletions deps/v8/test/cctest/test-code-stub-assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,49 @@ TEST(ToUint32) {
ft.CheckThrows(factory->match_symbol());
}

namespace {
void IsValidPositiveSmiCase(Isolate* isolate, intptr_t value, bool expected) {
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate, kNumParams);

CodeStubAssembler m(asm_tester.state());
m.Return(
m.SelectBooleanConstant(m.IsValidPositiveSmi(m.IntPtrConstant(value))));

FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
MaybeHandle<Object> maybe_handle = ft.Call();

if (expected) {
CHECK(maybe_handle.ToHandleChecked()->IsTrue(isolate));
} else {
CHECK(maybe_handle.ToHandleChecked()->IsFalse(isolate));
}
}
} // namespace

TEST(IsValidPositiveSmi) {
Isolate* isolate(CcTest::InitIsolateOnce());

IsValidPositiveSmiCase(isolate, -1, false);
IsValidPositiveSmiCase(isolate, 0, true);
IsValidPositiveSmiCase(isolate, 1, true);

#ifdef V8_TARGET_ARCH_32_BIT
IsValidPositiveSmiCase(isolate, 0x3FFFFFFFU, true);
IsValidPositiveSmiCase(isolate, 0xC0000000U, false);
IsValidPositiveSmiCase(isolate, 0x40000000U, false);
IsValidPositiveSmiCase(isolate, 0xBFFFFFFFU, false);
#else
typedef std::numeric_limits<int32_t> int32_limits;
IsValidPositiveSmiCase(isolate, int32_limits::max(), true);
IsValidPositiveSmiCase(isolate, int32_limits::min(), false);
IsValidPositiveSmiCase(isolate,
static_cast<intptr_t>(int32_limits::max()) + 1, false);
IsValidPositiveSmiCase(isolate,
static_cast<intptr_t>(int32_limits::min()) - 1, false);
#endif
}

TEST(FixedArrayAccessSmiIndex) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate);
Expand Down