Skip to content
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
4 changes: 3 additions & 1 deletion deps/v8/src/field-type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace internal {

// static
FieldType* FieldType::None() {
return reinterpret_cast<FieldType*>(Smi::FromInt(0));
// Do not Smi::FromInt(0) here or for Any(), as that may translate
// as `nullptr` which is not a valid value for `this`.
return reinterpret_cast<FieldType*>(Smi::FromInt(2));
}

// static
Expand Down
11 changes: 11 additions & 0 deletions deps/v8/test/cctest/test-field-type-tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "src/global-handles.h"
#include "src/ic/stub-cache.h"
#include "src/macro-assembler.h"
#include "src/types.h"

using namespace v8::internal;

Expand Down Expand Up @@ -2473,6 +2474,16 @@ TEST(TransitionAccessorConstantToSameAccessorConstant) {
TestTransitionTo(transition_op, transition_op, checker);
}

TEST(FieldTypeConvertSimple) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();

Zone zone(isolate->allocator());

CHECK_EQ(FieldType::Any()->Convert(&zone), Type::Any());
CHECK_EQ(FieldType::None()->Convert(&zone), Type::None());
}

// TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
// TEST(TransitionAccessorConstantToAnotherAccessorConstant)