[vm] Update NULL to nullptr in runtime/vm/compiler.

TEST=build
Change-Id: I54cd75bbc942e11c4d719edcc64640da67077634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291965
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2023-03-30 18:23:53 +00:00
committed by Commit Queue
parent 1ec1e7358a
commit de2abc6091
70 changed files with 1564 additions and 1524 deletions
+15 -14
View File
@@ -105,7 +105,7 @@ bool AotCallSpecializer::TryCreateICDataForUniqueTarget(
!target_function.AreValidArgumentCounts(
call->type_args_len(), call->ArgumentCountWithoutTypeArgs(),
call->argument_names().IsNull() ? 0 : call->argument_names().Length(),
/* error_message = */ NULL)) {
/* error_message = */ nullptr)) {
return false;
}
@@ -151,7 +151,8 @@ bool AotCallSpecializer::TryCreateICData(InstanceCallInstr* call) {
}
bool AotCallSpecializer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
if ((precompiler_ == NULL) || !precompiler_->get_runtime_type_is_unique()) {
if ((precompiler_ == nullptr) ||
!precompiler_->get_runtime_type_is_unique()) {
return false;
}
@@ -175,8 +176,8 @@ bool AotCallSpecializer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
static bool IsGetRuntimeType(Definition* defn) {
StaticCallInstr* call = defn->AsStaticCall();
return (call != NULL) && (call->function().recognized_kind() ==
MethodRecognizer::kObjectRuntimeType);
return (call != nullptr) && (call->function().recognized_kind() ==
MethodRecognizer::kObjectRuntimeType);
}
// Recognize a.runtimeType == b.runtimeType and fold it into
@@ -284,7 +285,7 @@ Value* AotCallSpecializer::PrepareStaticOpInput(Value* input,
input = input->CopyWithType(Z);
if (cid == kDoubleCid && input->Type()->IsNullableInt()) {
Definition* conversion = NULL;
Definition* conversion = nullptr;
if (input->Type()->ToNullableCid() == kSmiCid) {
conversion = new (Z) SmiToDoubleInstr(input, call->source());
@@ -298,7 +299,7 @@ Value* AotCallSpecializer::PrepareStaticOpInput(Value* input,
if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Inserted %s\n", conversion->ToCString());
}
InsertBefore(call, conversion, /* env = */ NULL, FlowGraph::kValue);
InsertBefore(call, conversion, /* env = */ nullptr, FlowGraph::kValue);
return new (Z) Value(conversion);
}
@@ -419,7 +420,7 @@ Definition* AotCallSpecializer::TryOptimizeMod(TemplateDartCall<0>* instr,
#if defined(TARGET_ARCH_ARM)
Definition* right_definition = new (Z) UnboxedConstantInstr(
Smi::ZoneHandle(Z, Smi::New(modulus - 1)), kUnboxedInt32);
InsertBefore(instr, right_definition, /*env=*/NULL, FlowGraph::kValue);
InsertBefore(instr, right_definition, /*env=*/nullptr, FlowGraph::kValue);
right_definition = new (Z)
IntConverterInstr(kUnboxedInt32, kUnboxedInt64,
new (Z) Value(right_definition), DeoptId::kNone);
@@ -428,7 +429,7 @@ Definition* AotCallSpecializer::TryOptimizeMod(TemplateDartCall<0>* instr,
Smi::ZoneHandle(Z, Smi::New(modulus - 1)), kUnboxedInt64);
#endif
if (modulus == 1) return right_definition;
InsertBefore(instr, right_definition, /*env=*/NULL, FlowGraph::kValue);
InsertBefore(instr, right_definition, /*env=*/nullptr, FlowGraph::kValue);
right_value = new (Z) Value(right_definition);
return new (Z)
BinaryInt64OpInstr(Token::kBIT_AND, left_value, right_value,
@@ -442,7 +443,7 @@ bool AotCallSpecializer::TryOptimizeIntegerOperation(TemplateDartCall<0>* instr,
return false;
}
Definition* replacement = NULL;
Definition* replacement = nullptr;
if (instr->ArgumentCount() == 2) {
Value* left_value = instr->ArgumentValueAt(0);
Value* right_value = instr->ArgumentValueAt(1);
@@ -592,7 +593,7 @@ bool AotCallSpecializer::TryOptimizeDoubleOperation(TemplateDartCall<0>* instr,
return false;
}
Definition* replacement = NULL;
Definition* replacement = nullptr;
if (instr->ArgumentCount() == 2) {
Value* left_value = instr->ArgumentValueAt(0);
@@ -685,7 +686,7 @@ bool AotCallSpecializer::TryOptimizeDoubleOperation(TemplateDartCall<0>* instr,
}
}
if (replacement != NULL && !replacement->ComputeCanDeoptimize()) {
if (replacement != nullptr && !replacement->ComputeCanDeoptimize()) {
if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Optimization: replacing %s with %s\n",
instr->ToCString(), replacement->ToCString());
@@ -1060,13 +1061,13 @@ void AotCallSpecializer::VisitPolymorphicInstanceCall(
bool AotCallSpecializer::TryReplaceInstanceOfWithRangeCheck(
InstanceCallInstr* call,
const AbstractType& type) {
if (precompiler_ == NULL) {
if (precompiler_ == nullptr) {
// Loading not complete, can't do CHA yet.
return false;
}
HierarchyInfo* hi = thread()->hierarchy_info();
if (hi == NULL) {
if (hi == nullptr) {
return false;
}
@@ -1080,7 +1081,7 @@ bool AotCallSpecializer::TryReplaceInstanceOfWithRangeCheck(
// left.instanceof(type) =>
// _classRangeCheck(left.cid, lower_limit, upper_limit)
LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
InsertBefore(call, left_cid, nullptr, FlowGraph::kValue);
ConstantInstr* lower_cid =
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
+10 -10
View File
@@ -386,7 +386,7 @@ void Precompiler::ReportStats() {
Precompiler::Precompiler(Thread* thread)
: thread_(thread),
zone_(NULL),
zone_(nullptr),
changed_(false),
retain_root_library_caches_(false),
function_count_(0),
@@ -426,7 +426,7 @@ Precompiler::Precompiler(Thread* thread)
api_uses_(),
error_(Error::Handle()),
get_runtime_type_is_unique_(false) {
ASSERT(Precompiler::singleton_ == NULL);
ASSERT(Precompiler::singleton_ == nullptr);
Precompiler::singleton_ = this;
if (FLAG_print_precompiler_timings) {
@@ -443,7 +443,7 @@ Precompiler::~Precompiler() {
functions_to_retain_.Release();
ASSERT(Precompiler::singleton_ == this);
Precompiler::singleton_ = NULL;
Precompiler::singleton_ = nullptr;
delete thread()->compiler_timings();
thread()->set_compiler_timings(nullptr);
@@ -673,7 +673,7 @@ void Precompiler::DoCompileAll() {
retained_reasons_writer_ = nullptr;
}
zone_ = NULL;
zone_ = nullptr;
}
intptr_t symbols_before = -1;
@@ -3555,7 +3555,7 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
precompiler_->global_object_pool_builder());
compiler::Assembler assembler(&object_pool_builder, far_branch_level);
CodeStatistics* function_stats = NULL;
CodeStatistics* function_stats = nullptr;
if (FLAG_print_instruction_stats) {
// At the moment we are leaking CodeStatistics objects for
// simplicity because this is just a development mode flag.
@@ -3760,7 +3760,7 @@ ErrorPtr Precompiler::CompileFunction(Precompiler* precompiler,
}
Obfuscator::Obfuscator(Thread* thread, const String& private_key)
: state_(NULL) {
: state_(nullptr) {
auto isolate_group = thread->isolate_group();
if (!isolate_group->obfuscate()) {
// Nothing to do.
@@ -3791,7 +3791,7 @@ Obfuscator::Obfuscator(Thread* thread, const String& private_key)
}
Obfuscator::~Obfuscator() {
if (state_ != NULL) {
if (state_ != nullptr) {
state_->SaveState();
}
}
@@ -3912,7 +3912,7 @@ static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
void Obfuscator::PreventRenaming(const char* name) {
// For constructor names Class.name skip class name (if any) and a dot.
const char* dot = strchr(name, '.');
if (dot != NULL) {
if (dot != nullptr) {
name = dot + 1;
}
@@ -4095,7 +4095,7 @@ const char** Obfuscator::SerializeMap(Thread* thread) {
Array::Handle(thread->zone(),
thread->isolate_group()->object_store()->obfuscation_map());
if (obfuscation_state.IsNull()) {
return NULL;
return nullptr;
}
const Array& renames = Array::Handle(
@@ -4114,7 +4114,7 @@ const char** Obfuscator::SerializeMap(Thread* thread) {
str ^= renames_map.GetPayload(entry, 0);
result[idx++] = StringToCString(str);
}
result[idx++] = NULL;
result[idx++] = nullptr;
renames_map.Release();
return result;
+2 -2
View File
@@ -483,7 +483,7 @@ class Obfuscator : public ValueObject {
// This method is guaranteed to return the same value for the same
// input and it always preserves leading '_' even for atomic renames.
StringPtr Rename(const String& name, bool atomic = false) {
if (state_ == NULL) {
if (state_ == nullptr) {
return name.ptr();
}
@@ -610,7 +610,7 @@ class Obfuscator : public ValueObject {
String& renamed_;
};
// Current obfuscation state or NULL if obfuscation is not enabled.
// Current obfuscation state or nullptr if obfuscation is not enabled.
ObfuscationState* state_;
};
#else
@@ -29,7 +29,7 @@ PrecompilerTracer* PrecompilerTracer::StartTracingIfRequested(
return nullptr;
}
void* file = Dart::file_open_callback()(filename, /*write=*/true);
if (file == NULL) {
if (file == nullptr) {
OS::PrintErr("warning: Failed to write precompiler trace: %s\n", filename);
return nullptr;
}
@@ -3544,7 +3544,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
JumpDistance distance,
Register instance_reg,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(instance_reg != kNoRegister);
ASSERT(instance_reg != temp_reg);
ASSERT(instance_reg != IP);
@@ -297,7 +297,7 @@ static int CountOneBits(uint64_t value, int width) {
// If it can't be encoded, the function returns false, and the operand is
// undefined.
bool Operand::IsImmLogical(uint64_t value, uint8_t width, Operand* imm_op) {
ASSERT(imm_op != NULL);
ASSERT(imm_op != nullptr);
ASSERT((width == kWRegSizeInBits) || (width == kXRegSizeInBits));
if (width == kWRegSizeInBits) {
value &= 0xffffffffUL;
@@ -2008,7 +2008,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
JumpDistance distance,
Register instance_reg,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(instance_size != 0);
ASSERT(instance_reg != temp_reg);
ASSERT(temp_reg != kNoRegister);
@@ -482,7 +482,7 @@ class Operand : public ValueObject {
// used as an operand in either instruction. The encoded operand is written
// to op.
static OperandType CanHold(int64_t imm, uint8_t sz, Operand* op) {
ASSERT(op != NULL);
ASSERT(op != nullptr);
ASSERT((sz == kXRegSizeInBits) || (sz == kWRegSizeInBits));
if (Utils::IsUint(12, imm)) {
op->encoding_ = imm << kImm12Shift;
@@ -843,7 +843,7 @@ ASSEMBLER_TEST_GENERATE(PushRegisterPair, assembler) {
}
ASSEMBLER_TEST_RUN(PushRegisterPair, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int (*PushRegisterPair)() DART_UNUSED;
EXPECT_EQ(12, EXECUTE_TEST_CODE_INT64(PushRegisterPair, test->entry()));
EXPECT_DISASSEMBLY(
@@ -870,7 +870,7 @@ ASSEMBLER_TEST_GENERATE(PushRegisterPairReversed, assembler) {
}
ASSEMBLER_TEST_RUN(PushRegisterPairReversed, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int (*PushRegisterPairReversed)() DART_UNUSED;
EXPECT_EQ(12,
EXECUTE_TEST_CODE_INT64(PushRegisterPairReversed, test->entry()));
@@ -898,7 +898,7 @@ ASSEMBLER_TEST_GENERATE(PopRegisterPair, assembler) {
}
ASSEMBLER_TEST_RUN(PopRegisterPair, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int (*PopRegisterPair)() DART_UNUSED;
EXPECT_EQ(12, EXECUTE_TEST_CODE_INT64(PopRegisterPair, test->entry()));
EXPECT_DISASSEMBLY(
@@ -925,7 +925,7 @@ ASSEMBLER_TEST_GENERATE(PopRegisterPairReversed, assembler) {
}
ASSEMBLER_TEST_RUN(PopRegisterPairReversed, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int (*PopRegisterPairReversed)() DART_UNUSED;
EXPECT_EQ(12,
EXECUTE_TEST_CODE_INT64(PopRegisterPairReversed, test->entry()));
@@ -1018,7 +1018,7 @@ ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
}
ASSEMBLER_TEST_RUN(Semaphore, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*Semaphore)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Semaphore, test->entry()));
EXPECT_DISASSEMBLY(
@@ -1051,7 +1051,7 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
}
ASSEMBLER_TEST_RUN(FailedSemaphore, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*FailedSemaphore)() DART_UNUSED;
EXPECT_EQ(41, EXECUTE_TEST_CODE_INT64(FailedSemaphore, test->entry()));
EXPECT_DISASSEMBLY(
@@ -1092,7 +1092,7 @@ ASSEMBLER_TEST_GENERATE(Semaphore32, assembler) {
}
ASSEMBLER_TEST_RUN(Semaphore32, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*Semaphore32)() DART_UNUSED;
// Lower word has been atomically switched from 40 to 42k, whereas upper word
// is unchanged at 40.
@@ -1134,7 +1134,7 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore32, assembler) {
}
ASSEMBLER_TEST_RUN(FailedSemaphore32, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*FailedSemaphore32)() DART_UNUSED;
// Lower word has had the failure code (1) added to it. Upper word is
// unchanged at 40.
@@ -3034,7 +3034,7 @@ ASSEMBLER_TEST_GENERATE(Udiv, assembler) {
}
ASSEMBLER_TEST_RUN(Udiv, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -3055,7 +3055,7 @@ ASSEMBLER_TEST_GENERATE(Sdiv, assembler) {
}
ASSEMBLER_TEST_RUN(Sdiv, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -3076,7 +3076,7 @@ ASSEMBLER_TEST_GENERATE(Udiv_zero, assembler) {
}
ASSEMBLER_TEST_RUN(Udiv_zero, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -3096,7 +3096,7 @@ ASSEMBLER_TEST_GENERATE(Sdiv_zero, assembler) {
}
ASSEMBLER_TEST_RUN(Sdiv_zero, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -3116,7 +3116,7 @@ ASSEMBLER_TEST_GENERATE(Udiv_corner, assembler) {
}
ASSEMBLER_TEST_RUN(Udiv_corner, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -3136,7 +3136,7 @@ ASSEMBLER_TEST_GENERATE(Sdiv_corner, assembler) {
}
ASSEMBLER_TEST_RUN(Sdiv_corner, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(static_cast<int64_t>(0x8000000000000000),
EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
@@ -3689,7 +3689,7 @@ ASSEMBLER_TEST_GENERATE(LoadHalfWordUnaligned, assembler) {
}
ASSEMBLER_TEST_RUN(LoadHalfWordUnaligned, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*LoadHalfWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0x89, 0xAB, 0xCD, 0xEF,
@@ -3716,7 +3716,7 @@ ASSEMBLER_TEST_GENERATE(LoadHalfWordUnsignedUnaligned, assembler) {
}
ASSEMBLER_TEST_RUN(LoadHalfWordUnsignedUnaligned, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*LoadHalfWordUnsignedUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0x89, 0xAB, 0xCD, 0xEF,
@@ -3742,7 +3742,7 @@ ASSEMBLER_TEST_GENERATE(StoreHalfWordUnaligned, assembler) {
}
ASSEMBLER_TEST_RUN(StoreHalfWordUnaligned, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*StoreHalfWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[4] = {
0, 0, 0, 0,
@@ -3775,7 +3775,7 @@ ASSEMBLER_TEST_GENERATE(LoadWordUnaligned, assembler) {
}
ASSEMBLER_TEST_RUN(LoadWordUnaligned, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int32_t (*LoadWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[8] = {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0};
@@ -3809,7 +3809,7 @@ ASSEMBLER_TEST_GENERATE(StoreWordUnaligned, assembler) {
}
ASSEMBLER_TEST_RUN(StoreWordUnaligned, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef intptr_t (*StoreWordUnaligned)(intptr_t) DART_UNUSED;
uint8_t buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -5355,7 +5355,7 @@ ASSEMBLER_TEST_GENERATE(VinswVmovrs, assembler) {
}
ASSEMBLER_TEST_RUN(VinswVmovrs, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(174, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -5392,7 +5392,7 @@ ASSEMBLER_TEST_GENERATE(VinsxVmovrd, assembler) {
}
ASSEMBLER_TEST_RUN(VinsxVmovrd, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(85, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -5427,7 +5427,7 @@ ASSEMBLER_TEST_GENERATE(Vnot, assembler) {
}
ASSEMBLER_TEST_RUN(Vnot, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(2, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
@@ -7148,7 +7148,7 @@ ASSEMBLER_TEST_GENERATE(Vrecpes, assembler) {
}
ASSEMBLER_TEST_RUN(Vrecpes, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef double (*DoubleReturn)() DART_UNUSED;
float res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(arm_recip_estimate(147.0), res, 0.0001);
@@ -7180,7 +7180,7 @@ ASSEMBLER_TEST_GENERATE(Vrecpss, assembler) {
}
ASSEMBLER_TEST_RUN(Vrecpss, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef double (*DoubleReturn)() DART_UNUSED;
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(2.0 - 10.0 * 5.0, res, 0.0001);
@@ -7314,7 +7314,7 @@ ASSEMBLER_TEST_GENERATE(Vrsqrtes, assembler) {
}
ASSEMBLER_TEST_RUN(Vrsqrtes, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef double (*DoubleReturn)() DART_UNUSED;
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(arm_reciprocal_sqrt_estimate(147.0), res, 0.0001);
@@ -7342,7 +7342,7 @@ ASSEMBLER_TEST_GENERATE(Vrsqrtss, assembler) {
}
ASSEMBLER_TEST_RUN(Vrsqrtss, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef double (*DoubleReturn)() DART_UNUSED;
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ((3.0 - 10.0 * 5.0) / 2.0, res, 0.0001);
@@ -7367,7 +7367,7 @@ ASSEMBLER_TEST_GENERATE(ReciprocalSqrt, assembler) {
}
ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef double (*DoubleReturn)() DART_UNUSED;
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(1.0 / sqrt(147000.0), res, 0.0001);
@@ -7428,7 +7428,7 @@ ASSEMBLER_TEST_GENERATE(Drop, assembler) {
}
ASSEMBLER_TEST_RUN(Drop, test) {
EXPECT(test != NULL);
EXPECT(test != nullptr);
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxPushedNumber,
EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
File diff suppressed because it is too large Load Diff
@@ -161,7 +161,7 @@ AssemblerBuffer::AssemblerBuffer()
contents_ = NewContents(kInitialBufferCapacity);
cursor_ = contents_;
limit_ = ComputeLimit(contents_, kInitialBufferCapacity);
fixup_ = NULL;
fixup_ = nullptr;
#if defined(DEBUG)
has_ensured_capacity_ = false;
fixups_processed_ = false;
@@ -176,7 +176,7 @@ AssemblerBuffer::~AssemblerBuffer() {}
void AssemblerBuffer::ProcessFixups(const MemoryRegion& region) {
AssemblerFixup* fixup = fixup_;
while (fixup != NULL) {
while (fixup != nullptr) {
fixup->Process(region, fixup->position());
fixup = fixup->previous();
}
@@ -245,7 +245,7 @@ class PatchCodeWithHandle : public AssemblerFixup {
intptr_t AssemblerBuffer::CountPointerOffsets() const {
intptr_t count = 0;
AssemblerFixup* current = fixup_;
while (current != NULL) {
while (current != nullptr) {
if (current->IsPointerOffset()) ++count;
current = current->previous_;
}
@@ -266,7 +266,7 @@ void AssemblerBuffer::EmitObject(const Object& object) {
// Shared macros are implemented here.
void AssemblerBase::Unimplemented(const char* message) {
const char* format = "Unimplemented: %s";
const intptr_t len = Utils::SNPrint(NULL, 0, format, message);
const intptr_t len = Utils::SNPrint(nullptr, 0, format, message);
char* buffer = reinterpret_cast<char*>(malloc(len + 1));
Utils::SNPrint(buffer, len + 1, format, message);
Stop(buffer);
@@ -274,7 +274,7 @@ void AssemblerBase::Unimplemented(const char* message) {
void AssemblerBase::Untested(const char* message) {
const char* format = "Untested: %s";
const intptr_t len = Utils::SNPrint(NULL, 0, format, message);
const intptr_t len = Utils::SNPrint(nullptr, 0, format, message);
char* buffer = reinterpret_cast<char*>(malloc(len + 1));
Utils::SNPrint(buffer, len + 1, format, message);
Stop(buffer);
@@ -282,7 +282,7 @@ void AssemblerBase::Untested(const char* message) {
void AssemblerBase::Unreachable(const char* message) {
const char* format = "Unreachable: %s";
const intptr_t len = Utils::SNPrint(NULL, 0, format, message);
const intptr_t len = Utils::SNPrint(nullptr, 0, format, message);
char* buffer = reinterpret_cast<char*>(malloc(len + 1));
Utils::SNPrint(buffer, len + 1, format, message);
Stop(buffer);
@@ -379,15 +379,15 @@ intptr_t ObjectPoolBuilder::AddImmediate128(simd128_value_t imm) {
intptr_t ObjectPoolBuilder::AddObject(ObjectPoolBuilderEntry entry) {
DEBUG_ASSERT((entry.type() != ObjectPoolBuilderEntry::kTaggedObject) ||
(IsNotTemporaryScopedHandle(*entry.obj_) &&
(entry.equivalence_ == NULL ||
(entry.equivalence_ == nullptr ||
IsNotTemporaryScopedHandle(*entry.equivalence_))));
if (entry.type() == ObjectPoolBuilderEntry::kTaggedObject) {
// If the owner of the object pool wrapper specified a specific zone we
// should use we'll do so.
if (zone_ != NULL) {
if (zone_ != nullptr) {
entry.obj_ = &NewZoneHandle(zone_, *entry.obj_);
if (entry.equivalence_ != NULL) {
if (entry.equivalence_ != nullptr) {
entry.equivalence_ = &NewZoneHandle(zone_, *entry.equivalence_);
}
}
@@ -2768,7 +2768,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
JumpDistance distance,
Register instance_reg,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(instance_size != 0);
ASSERT(Utils::IsAligned(instance_size,
target::ObjectAlignment::kObjectAlignment));
@@ -2803,7 +2803,7 @@ void Assembler::TryAllocateArray(intptr_t cid,
Register instance,
Register end_address,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(temp_reg != kNoRegister);
if (FLAG_inline_alloc &&
target::Heap::IsAllocatableInNewSpace(instance_size)) {
@@ -4403,7 +4403,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
JumpDistance distance,
Register instance_reg,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(instance_size != 0);
ASSERT(instance_reg != temp_reg);
ASSERT(temp_reg != kNoRegister);
@@ -2285,7 +2285,7 @@ void Assembler::TryAllocateObject(intptr_t cid,
JumpDistance distance,
Register instance_reg,
Register temp_reg) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
ASSERT(instance_size != 0);
ASSERT(Utils::IsAligned(instance_size,
target::ObjectAlignment::kObjectAlignment));
@@ -2320,7 +2320,7 @@ void Assembler::TryAllocateArray(intptr_t cid,
Register instance,
Register end_address,
Register temp) {
ASSERT(failure != NULL);
ASSERT(failure != nullptr);
if (FLAG_inline_alloc &&
target::Heap::IsAllocatableInNewSpace(instance_size)) {
// If this allocation is traced, program will jump to failure path
@@ -49,7 +49,7 @@ void DisassembleToStdout::ConsumeInstruction(char* hex_buffer,
}
}
THR_Print("%s", human_buffer);
if (object != NULL) {
if (object != nullptr) {
THR_Print(" %s", object->ToCString());
}
THR_Print("\n");
@@ -118,7 +118,7 @@ void DisassembleToMemory::Print(const char* format, ...) {
}
va_list measure_args;
va_start(measure_args, format);
intptr_t len = Utils::VSNPrint(NULL, 0, format, measure_args);
intptr_t len = Utils::VSNPrint(nullptr, 0, format, measure_args);
va_end(measure_args);
if (remaining_ < len + 100) {
*buffer_++ = '.';
@@ -149,7 +149,7 @@ void Disassembler::Disassemble(uword start,
if (comments == nullptr) {
comments = code.IsNull() ? &Code::Comments::New(0) : &code.comments();
}
ASSERT(formatter != NULL);
ASSERT(formatter != nullptr);
char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
uword pc = start;
@@ -492,7 +492,7 @@ void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
jsarr_.AddValue(hex_buffer);
jsarr_.AddValue(human_buffer);
if (object != NULL) {
if (object != nullptr) {
jsarr_.AddValue(*object);
} else {
jsarr_.AddValueNull(); // Not a reference to null.
@@ -502,7 +502,7 @@ void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
void DisassembleToJSONStream::Print(const char* format, ...) {
va_list measure_args;
va_start(measure_args, format);
intptr_t len = Utils::VSNPrint(NULL, 0, format, measure_args);
intptr_t len = Utils::VSNPrint(nullptr, 0, format, measure_args);
va_end(measure_args);
char* p = reinterpret_cast<char*>(malloc(len + 1));
@@ -1510,13 +1510,13 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
*out_instr_size = Instr::kInstrSize;
}
*object = NULL;
*object = nullptr;
// TODO(36839): Make DecodeLoadObjectFromPoolOrThread work on simarm_x64.
#if !defined(IS_SIMARM_HOST64)
if (!code.IsNull()) {
*object = &Object::Handle();
if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) {
*object = NULL;
*object = nullptr;
}
}
#endif // !defined(IS_SIMARM_HOST64)
@@ -612,7 +612,7 @@ int ARM64Decoder::FormatOption(Instr* instr, const char* format) {
case 'v': {
if (format[1] == 's') {
ASSERT(STRING_STARTS_WITH(format, "vsz"));
char const* sz_str = NULL;
char const* sz_str = nullptr;
if (instr->Bits(14, 2) == 3) {
switch (instr->Bit(22)) {
case 0:
@@ -1667,11 +1667,11 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
*out_instr_size = Instr::kInstrSize;
}
*object = NULL;
*object = nullptr;
if (!code.IsNull()) {
*object = &Object::Handle();
if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) {
*object = NULL;
*object = nullptr;
}
}
}
@@ -1792,11 +1792,11 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
*out_instr_size = instr_size;
}
*object = NULL;
*object = nullptr;
if (!code.IsNull()) {
*object = &Object::Handle();
if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) {
*object = NULL;
*object = nullptr;
}
}
}
@@ -202,7 +202,7 @@ void InstructionTable::AddJumpConditionalShort() {
for (uint8_t b = 0x70; b <= 0x7F; b++) {
InstructionDesc* id = &instructions_[b];
ASSERT(NO_INSTR == id->type); // Information not already entered
id->mnem = NULL; // Computed depending on condition code.
id->mnem = nullptr; // Computed depending on condition code.
id->type = JUMP_CONDITIONAL_SHORT_INSTR;
}
}
@@ -592,7 +592,7 @@ void DisassemblerX64::PrintDisp(int disp, const char* after) {
} else {
Print("+%#x", disp);
}
if (after != NULL) Print("%s", after);
if (after != nullptr) Print("%s", after);
}
// Returns number of bytes used by machine instruction, including *data byte.
@@ -646,8 +646,8 @@ int DisassemblerX64::F6F7Instruction(uint8_t* data) {
uint8_t modrm = *(data + 1);
int mod, regop, rm;
get_modrm(modrm, &mod, &regop, &rm);
static const char* const mnemonics[] = {"test", NULL, "not", "neg",
"mul", "imul", "div", "idiv"};
static const char* const mnemonics[] = {"test", nullptr, "not", "neg",
"mul", "imul", "div", "idiv"};
const char* mnem = mnemonics[regop];
if (mod == 3 && regop != 0) {
if (regop > 3) {
@@ -689,7 +689,7 @@ int DisassemblerX64::ShiftInstruction(uint8_t* data) {
get_modrm(*modrm, &mod, &regop, &rm);
regop &= 0x7; // The REX.R bit does not affect the operation.
int num_bytes = 1;
const char* mnem = NULL;
const char* mnem = nullptr;
switch (regop) {
case 0:
mnem = "rol";
@@ -716,7 +716,7 @@ int DisassemblerX64::ShiftInstruction(uint8_t* data) {
UnimplementedInstruction();
return num_bytes;
}
ASSERT(NULL != mnem);
ASSERT(nullptr != mnem);
Print("%s%s ", mnem, operand_size_code());
if (byte_size_operand_) {
num_bytes += PrintRightByteOperand(modrm);
@@ -801,7 +801,7 @@ void DisassemblerX64::PrintAddress(uint8_t* addr_byte_ptr) {
// Try to print as stub name.
uword addr = reinterpret_cast<uword>(addr_byte_ptr);
const char* name_of_stub = StubCode::NameOfStub(addr);
if (name_of_stub != NULL) {
if (name_of_stub != nullptr) {
Print(" [stub: %s]", name_of_stub);
}
}
@@ -1534,10 +1534,11 @@ int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) {
current += PrintOperands(idesc.mnem, idesc.op_order_, current);
} else if (0x10 <= opcode && opcode <= 0x16) {
// ...ps xmm, xmm/m128
static const char* const mnemonics[] = {
"movups", NULL, "movhlps", NULL, "unpcklps", "unpckhps", "movlhps"};
static const char* const mnemonics[] = {"movups", nullptr, "movhlps",
nullptr, "unpcklps", "unpckhps",
"movlhps"};
const char* mnemonic = mnemonics[opcode - 0x10];
if (mnemonic == NULL) {
if (mnemonic == nullptr) {
UnimplementedInstruction();
mnemonic = "???";
}
@@ -1610,7 +1611,7 @@ int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) {
// Mnemonics for two-byte opcode instructions starting with 0x0F.
// The argument is the second byte of the two-byte opcode.
// Returns NULL if the instruction is not handled here.
// Returns nullptr if the instruction is not handled here.
const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) {
if (opcode == 0x5A) {
return "cvtps2pd";
@@ -1619,11 +1620,11 @@ const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) {
}
if (0xA2 <= opcode && opcode <= 0xBF) {
static const char* const mnemonics[] = {
"cpuid", "bt", "shld", "shld", NULL, NULL,
NULL, NULL, NULL, "bts", "shrd", "shrd",
NULL, "imul", "cmpxchg", "cmpxchg", NULL, NULL,
NULL, NULL, "movzxb", "movzxw", "popcnt", NULL,
NULL, NULL, "bsf", "bsr", "movsxb", "movsxw"};
"cpuid", "bt", "shld", "shld", nullptr, nullptr,
nullptr, nullptr, nullptr, "bts", "shrd", "shrd",
nullptr, "imul", "cmpxchg", "cmpxchg", nullptr, nullptr,
nullptr, nullptr, "movzxb", "movzxw", "popcnt", nullptr,
nullptr, nullptr, "bsf", "bsr", "movsxb", "movsxw"};
return mnemonics[opcode - 0xA2];
}
switch (opcode) {
@@ -1638,7 +1639,7 @@ const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) {
case 0x31:
return "rdtsc";
default:
return NULL;
return nullptr;
}
}
@@ -1699,7 +1700,7 @@ int DisassemblerX64::InstructionDecode(uword pc) {
data++;
int mod, regop, rm;
get_modrm(*data, &mod, &regop, &rm);
const char* mnem = NULL;
const char* mnem = nullptr;
switch (regop) {
case 0:
mnem = "inc";
@@ -2013,12 +2014,12 @@ void Disassembler::DecodeInstruction(char* hex_buffer,
*out_instr_len = instruction_length;
}
*object = NULL;
*object = nullptr;
#if defined(TARGET_ARCH_X64)
if (!code.IsNull()) {
*object = &Object::Handle();
if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) {
*object = NULL;
*object = nullptr;
}
}
#else
@@ -254,8 +254,8 @@ class ObjectPoolBuilder : public ValueObject {
DirectChainedHashMap<ObjIndexPair> object_pool_index_table_;
// The zone used for allocating the handles we keep in the map and array (or
// NULL, in which case allocations happen using the zone active at the point
// of insertion).
// nullptr, in which case allocations happen using the zone active at the
// point of insertion).
Zone* zone_;
};
@@ -117,7 +117,7 @@ struct Link : public ZoneAllocated {
// a length to support adding a shorter chain's links to a longer chain.
struct Chain : public ZoneAllocated {
explicit Chain(BlockEntryInstr* block)
: first(new Link(block, NULL)), last(first), length(1) {}
: first(new Link(block, nullptr)), last(first), length(1) {}
Link* first;
Link* last;
@@ -137,7 +137,7 @@ static void Union(GrowableArray<Chain*>* chains,
Chain* source_chain,
Chain* target_chain) {
if (source_chain->length < target_chain->length) {
for (Link* link = source_chain->first; link != NULL; link = link->next) {
for (Link* link = source_chain->first; link != nullptr; link = link->next) {
(*chains)[link->block->postorder_number()] = target_chain;
}
// Link the chains.
@@ -146,7 +146,7 @@ static void Union(GrowableArray<Chain*>* chains,
target_chain->first = source_chain->first;
target_chain->length += source_chain->length;
} else {
for (Link* link = target_chain->first; link != NULL; link = link->next) {
for (Link* link = target_chain->first; link != nullptr; link = link->next) {
(*chains)[link->block->postorder_number()] = source_chain;
}
source_chain->last->next = target_chain->first;
@@ -229,7 +229,7 @@ void BlockScheduler::ReorderBlocksJIT(FlowGraph* flow_graph) {
// sort of the blocks).
for (intptr_t i = block_count - 1; i >= 0; --i) {
if (chains[i]->first->block == flow_graph->postorder()[i]) {
for (Link* link = chains[i]->first; link != NULL; link = link->next) {
for (Link* link = chains[i]->first; link != nullptr; link = link->next) {
if ((link->block != checked_entry) && (link->block != graph_entry)) {
flow_graph->CodegenBlockOrder(true)->Add(link->block);
}
+15 -15
View File
@@ -13,12 +13,12 @@ namespace dart {
// is used in the environments either at the corresponding block entry or
// at the same instruction where input use is.
static bool PhiHasSingleUse(PhiInstr* phi, Value* use) {
if ((use->next_use() != NULL) || (phi->input_use_list() != use)) {
if ((use->next_use() != nullptr) || (phi->input_use_list() != use)) {
return false;
}
BlockEntryInstr* block = phi->block();
for (Value* env_use = phi->env_use_list(); env_use != NULL;
for (Value* env_use = phi->env_use_list(); env_use != nullptr;
env_use = env_use->next_use()) {
if ((env_use->instruction() != block) &&
(env_use->instruction() != use->instruction())) {
@@ -40,7 +40,7 @@ bool BranchSimplifier::Match(JoinEntryInstr* block) {
// has no other phis and no instructions intervening between the phi and
// branch so the block can simply be eliminated.
BranchInstr* branch = block->last_instruction()->AsBranch();
ASSERT(branch != NULL);
ASSERT(branch != nullptr);
ComparisonInstr* comparison = branch->comparison();
if (comparison->InputCount() != 2) {
return false;
@@ -52,10 +52,10 @@ bool BranchSimplifier::Match(JoinEntryInstr* block) {
PhiInstr* phi = left->definition()->AsPhi();
Value* right = comparison->right();
ConstantInstr* constant =
(right == NULL) ? NULL : right->definition()->AsConstant();
return (phi != NULL) && (constant != NULL) && (phi->GetBlock() == block) &&
PhiHasSingleUse(phi, left) && (block->next() == branch) &&
(block->phis()->length() == 1);
(right == nullptr) ? nullptr : right->definition()->AsConstant();
return (phi != nullptr) && (constant != nullptr) &&
(phi->GetBlock() == block) && PhiHasSingleUse(phi, left) &&
(block->next() == branch) && (block->phis()->length() == 1);
}
JoinEntryInstr* BranchSimplifier::ToJoinEntry(Zone* zone,
@@ -122,7 +122,7 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
while (!worklist.is_empty()) {
// All blocks in the worklist are join blocks (ending with a branch).
JoinEntryInstr* block = worklist.RemoveLast()->AsJoinEntry();
ASSERT(block != NULL);
ASSERT(block != nullptr);
if (Match(block)) {
changed = true;
@@ -136,19 +136,19 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
// instance of the pattern. There is thus no need to add it to the
// worklist.
BranchInstr* branch = block->last_instruction()->AsBranch();
ASSERT(branch != NULL);
ASSERT(branch != nullptr);
JoinEntryInstr* join_true = ToJoinEntry(zone, branch->true_successor());
JoinEntryInstr* join_false = ToJoinEntry(zone, branch->false_successor());
ComparisonInstr* comparison = branch->comparison();
PhiInstr* phi = comparison->left()->definition()->AsPhi();
ConstantInstr* constant = comparison->right()->definition()->AsConstant();
ASSERT(constant != NULL);
ASSERT(constant != nullptr);
// Copy the constant and branch and push it to all the predecessors.
for (intptr_t i = 0, count = block->PredecessorCount(); i < count; ++i) {
GotoInstr* old_goto =
block->PredecessorAt(i)->last_instruction()->AsGoto();
ASSERT(old_goto != NULL);
ASSERT(old_goto != nullptr);
// Replace the goto in each predecessor with a rewritten branch,
// rewritten to use the corresponding phi input instead of the phi.
@@ -156,7 +156,7 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
Value* new_right = new (zone) Value(constant);
BranchInstr* new_branch =
CloneBranch(zone, branch, new_left, new_right);
if (branch->env() == NULL) {
if (branch->env() == nullptr) {
new_branch->InheritDeoptTarget(zone, old_goto);
} else {
// Take the environment from the branch if it has one.
@@ -172,7 +172,7 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
}
new_branch->InsertBefore(old_goto);
new_branch->set_next(NULL); // Detaching the goto from the graph.
new_branch->set_next(nullptr); // Detaching the goto from the graph.
old_goto->UnuseAllInputs();
// Update the predecessor block. We may have created another
@@ -268,7 +268,7 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
// Ba:
// v3 = IfThenElse(COMP ? v1 : v2)
//
if ((join != NULL) && (join->phis() != NULL) &&
if ((join != nullptr) && (join->phis() != nullptr) &&
(join->phis()->length() == 1) && (block->PredecessorCount() == 2)) {
BlockEntryInstr* pred1 = block->PredecessorAt(0);
BlockEntryInstr* pred2 = block->PredecessorAt(1);
@@ -305,7 +305,7 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
IfThenElseInstr* if_then_else =
new (zone) IfThenElseInstr(new_comparison, if_true->Copy(zone),
if_false->Copy(zone), DeoptId::kNone);
flow_graph->InsertBefore(branch, if_then_else, NULL,
flow_graph->InsertBefore(branch, if_then_else, nullptr,
FlowGraph::kValue);
phi->ReplaceUsesWith(if_then_else);
@@ -171,7 +171,7 @@ void CodeStatistics::Finalize() {
const intptr_t unaligned_bytes = Instructions::HeaderSize() + function_size;
alignment_bytes_ =
Utils::RoundUp(unaligned_bytes, kObjectAlignment) - unaligned_bytes;
assembler_ = NULL;
assembler_ = nullptr;
}
void CodeStatistics::AppendTo(CombinedCodeStatistics* stat) {
@@ -72,7 +72,7 @@ bool ConstantPropagator::SetValue(Definition* definition, const Object& value) {
// heap-allocated and so not necessarily pointer-equal on each iteration).
if (definition->constant_value().ptr() != value.ptr()) {
definition->constant_value() = value.ptr();
if (definition->input_use_list() != NULL) {
if (definition->input_use_list() != nullptr) {
definition_worklist_.Add(definition);
}
return true;
@@ -245,7 +245,7 @@ void ConstantPropagator::VisitBranch(BranchInstr* instr) {
// might be analyzing it because the constant value of one of its inputs
// has changed.)
if (reachable_->Contains(instr->GetBlock()->preorder_number())) {
if (instr->constant_target() != NULL) {
if (instr->constant_target() != nullptr) {
ASSERT((instr->constant_target() == instr->true_successor()) ||
(instr->constant_target() == instr->false_successor()));
SetReachable(instr->constant_target());
@@ -305,10 +305,10 @@ Definition* ConstantPropagator::UnwrapPhi(Definition* defn) {
if (defn->IsPhi()) {
JoinEntryInstr* block = defn->AsPhi()->block();
Definition* input = NULL;
Definition* input = nullptr;
for (intptr_t i = 0; i < defn->InputCount(); ++i) {
if (reachable_->Contains(block->PredecessorAt(i)->preorder_number())) {
if (input == NULL) {
if (input == nullptr) {
input = defn->InputAt(i)->definition();
} else {
return defn;
@@ -1569,8 +1569,8 @@ void ConstantPropagator::EliminateRedundantBranches() {
BlockEntryInstr* block = b.Current();
BranchInstr* branch = block->last_instruction()->AsBranch();
empty_blocks->Clear();
if ((branch != NULL) && !branch->HasUnknownSideEffects()) {
ASSERT(branch->previous() != NULL); // Not already eliminated.
if ((branch != nullptr) && !branch->HasUnknownSideEffects()) {
ASSERT(branch->previous() != nullptr); // Not already eliminated.
BlockEntryInstr* if_true =
FindFirstNonEmptySuccessor(branch->true_successor(), empty_blocks);
BlockEntryInstr* if_false =
@@ -1584,7 +1584,7 @@ void ConstantPropagator::EliminateRedundantBranches() {
graph_->CopyDeoptTarget(jump, branch);
Instruction* previous = branch->previous();
branch->set_previous(NULL);
branch->set_previous(nullptr);
previous->LinkTo(jump);
// Remove uses from branch and all the empty blocks that
@@ -1633,12 +1633,12 @@ void ConstantPropagator::Transform() {
}
JoinEntryInstr* join = block->AsJoinEntry();
if (join != NULL) {
if (join != nullptr) {
// Remove phi inputs corresponding to unreachable predecessor blocks.
// Predecessors will be recomputed (in block id order) after removing
// unreachable code so we merely have to keep the phi inputs in order.
ZoneGrowableArray<PhiInstr*>* phis = join->phis();
if ((phis != NULL) && !phis->is_empty()) {
if ((phis != nullptr) && !phis->is_empty()) {
intptr_t pred_count = join->PredecessorCount();
intptr_t live_count = 0;
for (intptr_t pred_idx = 0; pred_idx < pred_count; ++pred_idx) {
@@ -1647,7 +1647,7 @@ void ConstantPropagator::Transform() {
if (live_count < pred_idx) {
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
phi->SetInputAt(live_count, phi->InputAt(pred_idx));
}
}
@@ -1655,7 +1655,7 @@ void ConstantPropagator::Transform() {
} else {
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
phi->InputAt(pred_idx)->RemoveFromUseList();
}
}
@@ -1664,7 +1664,7 @@ void ConstantPropagator::Transform() {
intptr_t to_idx = 0;
for (intptr_t from_idx = 0; from_idx < phis->length(); ++from_idx) {
PhiInstr* phi = (*phis)[from_idx];
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
if (FLAG_remove_redundant_phis && (live_count == 1)) {
Value* input = phi->InputAt(0);
phi->ReplaceUsesWith(input->definition());
@@ -1675,7 +1675,7 @@ void ConstantPropagator::Transform() {
}
}
if (to_idx == 0) {
join->phis_ = NULL;
join->phis_ = nullptr;
} else {
phis->TruncateTo(to_idx);
}
@@ -1700,22 +1700,22 @@ void ConstantPropagator::Transform() {
// Replace branches where one target is unreachable with jumps.
BranchInstr* branch = block->last_instruction()->AsBranch();
if (branch != NULL) {
if (branch != nullptr) {
TargetEntryInstr* if_true = branch->true_successor();
TargetEntryInstr* if_false = branch->false_successor();
JoinEntryInstr* join = NULL;
Instruction* next = NULL;
JoinEntryInstr* join = nullptr;
Instruction* next = nullptr;
if (!reachable_->Contains(if_true->preorder_number())) {
ASSERT(reachable_->Contains(if_false->preorder_number()));
ASSERT(if_false->parallel_move() == NULL);
ASSERT(if_false->parallel_move() == nullptr);
join = new (Z) JoinEntryInstr(if_false->block_id(),
if_false->try_index(), DeoptId::kNone);
graph_->CopyDeoptTarget(join, if_false);
if_false->UnuseAllInputs();
next = if_false->next();
} else if (!reachable_->Contains(if_false->preorder_number())) {
ASSERT(if_true->parallel_move() == NULL);
ASSERT(if_true->parallel_move() == nullptr);
join = new (Z) JoinEntryInstr(if_true->block_id(), if_true->try_index(),
DeoptId::kNone);
graph_->CopyDeoptTarget(join, if_true);
@@ -1723,7 +1723,7 @@ void ConstantPropagator::Transform() {
next = if_true->next();
}
if (join != NULL) {
if (join != nullptr) {
// Replace the branch with a jump to the reachable successor.
// Drop the comparison, which does not have side effects as long
// as it is a strict compare (the only one we can determine is
@@ -1732,7 +1732,7 @@ void ConstantPropagator::Transform() {
graph_->CopyDeoptTarget(jump, branch);
Instruction* previous = branch->previous();
branch->set_previous(NULL);
branch->set_previous(nullptr);
previous->LinkTo(jump);
// Replace the false target entry with the new join entry. We will
+59 -56
View File
@@ -139,9 +139,9 @@ void FlowGraph::ReplaceCurrentInstruction(ForwardInstructionIterator* iterator,
Instruction* current,
Instruction* replacement) {
Definition* current_defn = current->AsDefinition();
if ((replacement != NULL) && (current_defn != NULL)) {
if ((replacement != nullptr) && (current_defn != nullptr)) {
Definition* replacement_defn = replacement->AsDefinition();
ASSERT(replacement_defn != NULL);
ASSERT(replacement_defn != nullptr);
current_defn->ReplaceUsesWith(replacement_defn);
EnsureSSATempIndex(current_defn, replacement_defn);
@@ -151,7 +151,7 @@ void FlowGraph::ReplaceCurrentInstruction(ForwardInstructionIterator* iterator,
replacement_defn->ssa_temp_index());
}
} else if (FLAG_trace_optimization) {
if (current_defn == NULL) {
if (current_defn == nullptr) {
THR_Print("Removing %s\n", current->DebugName());
} else {
ASSERT(!current_defn->HasUses());
@@ -275,8 +275,8 @@ void FlowGraph::InsertAfter(Instruction* prev,
AllocateSSAIndex(instr->AsDefinition());
}
instr->InsertAfter(prev);
ASSERT(instr->env() == NULL);
if (env != NULL) {
ASSERT(instr->env() == nullptr);
if (env != nullptr) {
env->DeepCopyTo(zone(), instr);
}
}
@@ -299,8 +299,8 @@ Instruction* FlowGraph::AppendTo(Instruction* prev,
ASSERT(instr->IsDefinition());
AllocateSSAIndex(instr->AsDefinition());
}
ASSERT(instr->env() == NULL);
if (env != NULL) {
ASSERT(instr->env() == nullptr);
if (env != nullptr) {
env->DeepCopyTo(zone(), instr);
}
return prev->AppendInstruction(instr);
@@ -351,7 +351,7 @@ void FlowGraph::DiscoverBlocks() {
parent_.Clear();
GrowableArray<BlockTraversalState> block_stack;
graph_entry_->DiscoverBlock(NULL, &preorder_, &parent_);
graph_entry_->DiscoverBlock(nullptr, &preorder_, &parent_);
block_stack.Add(BlockTraversalState(graph_entry_));
while (!block_stack.is_empty()) {
BlockTraversalState& state = block_stack.Last();
@@ -463,7 +463,7 @@ void FlowGraph::ComputeIsReceiver(PhiInstr* phi) const {
PhiInstr* phi = unmark.RemoveLast();
for (Value::Iterator it(phi->input_use_list()); !it.Done(); it.Advance()) {
PhiInstr* use = it.Current()->instruction()->AsPhi();
if ((use != NULL) && (use->is_receiver() == PhiInstr::kReceiver)) {
if ((use != nullptr) && (use->is_receiver() == PhiInstr::kReceiver)) {
use->set_is_receiver(PhiInstr::kNotReceiver);
unmark.Add(use);
}
@@ -648,7 +648,7 @@ bool FlowGraph::VerifyRedefinitions() {
for (ForwardInstructionIterator instr_it(block_it.Current());
!instr_it.Done(); instr_it.Advance()) {
RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition();
if (redefinition != NULL) {
if (redefinition != nullptr) {
Definition* original = redefinition->value()->definition();
for (Value::Iterator it(original->input_use_list()); !it.Done();
it.Advance()) {
@@ -683,10 +683,10 @@ bool LivenessAnalysis::UpdateLiveOut(const BlockEntryInstr& block) {
BitVector* live_out = live_out_[block.postorder_number()];
bool changed = false;
Instruction* last = block.last_instruction();
ASSERT(last != NULL);
ASSERT(last != nullptr);
for (intptr_t i = 0; i < last->SuccessorCount(); i++) {
BlockEntryInstr* succ = last->SuccessorAt(i);
ASSERT(succ != NULL);
ASSERT(succ != nullptr);
if (live_out->AddAll(live_in_[succ->postorder_number()])) {
changed = true;
}
@@ -861,7 +861,7 @@ void VariableLivenessAnalysis::ComputeInitialSets() {
Instruction* current = it.Current();
LoadLocalInstr* load = current->AsLoadLocal();
if (load != NULL) {
if (load != nullptr) {
const intptr_t index = flow_graph_->EnvIndex(&load->local());
if (index >= live_in->length()) continue; // Skip tmp_locals.
live_in->Add(index);
@@ -873,7 +873,7 @@ void VariableLivenessAnalysis::ComputeInitialSets() {
}
StoreLocalInstr* store = current->AsStoreLocal();
if (store != NULL) {
if (store != nullptr) {
const intptr_t index = flow_graph_->EnvIndex(&store->local());
if (index >= live_in->length()) continue; // Skip tmp_locals.
if (kill->Contains(index)) {
@@ -1012,7 +1012,7 @@ void FlowGraph::ComputeDominators(
block->ClearDominatedBlocks();
for (intptr_t i = 0, count = block->PredecessorCount(); i < count; ++i) {
BlockEntryInstr* pred = block->PredecessorAt(i);
ASSERT(pred != NULL);
ASSERT(pred != nullptr);
// Look for the semidominator by ascending the semidominator path
// starting from pred.
@@ -1210,7 +1210,7 @@ void FlowGraph::PopulateEnvironmentFromFunctionEntry(
// Check if inlining_parameters include a type argument vector parameter.
const intptr_t inlined_type_args_param =
((inlining_parameters != NULL) && function().IsGeneric()) ? 1 : 0;
((inlining_parameters != nullptr) && function().IsGeneric()) ? 1 : 0;
ASSERT(variable_count() == env->length());
ASSERT(direct_parameter_count <= env->length());
@@ -1249,7 +1249,7 @@ void FlowGraph::PopulateEnvironmentFromFunctionEntry(
// inlining arguments, type parameter, args descriptor, context, ...)
{
// Replace parameter slots with inlining definitions coming in.
if (inlining_parameters != NULL) {
if (inlining_parameters != nullptr) {
for (intptr_t i = 0; i < function().NumParameters(); ++i) {
Definition* defn = (*inlining_parameters)[inlined_type_args_param + i];
if (defn->IsConstant()) {
@@ -1268,9 +1268,9 @@ void FlowGraph::PopulateEnvironmentFromFunctionEntry(
// Replace the type arguments slot with a special parameter.
const bool reify_generic_argument = function().IsGeneric();
if (reify_generic_argument) {
ASSERT(parsed_function().function_type_arguments() != NULL);
ASSERT(parsed_function().function_type_arguments() != nullptr);
Definition* defn;
if (inlining_parameters == NULL) {
if (inlining_parameters == nullptr) {
// Note: If we are not inlining, then the prologue builder will
// take care of checking that we got the correct reified type
// arguments. This includes checking the argument descriptor in order
@@ -1476,7 +1476,7 @@ void FlowGraph::RenameRecursive(
// 2b. Handle LoadLocal/StoreLocal/MakeTemp/DropTemps/Constant specially.
// Other definitions are just pushed to the environment directly.
Definition* result = NULL;
Definition* result = nullptr;
switch (current->tag()) {
case Instruction::kLoadLocal: {
LoadLocalInstr* load = current->Cast<LoadLocalInstr>();
@@ -1488,7 +1488,7 @@ void FlowGraph::RenameRecursive(
result = (*env)[index];
PhiInstr* phi = result->AsPhi();
if ((phi != NULL) && !phi->is_alive()) {
if ((phi != nullptr) && !phi->is_alive()) {
phi->mark_alive();
live_phis->Add(phi);
}
@@ -1553,10 +1553,10 @@ void FlowGraph::RenameRecursive(
for (intptr_t j = 0; j < drop->num_temps(); j++) {
env->RemoveLast();
}
if (drop->value() != NULL) {
if (drop->value() != nullptr) {
result = drop->value()->definition();
}
ASSERT((drop->value() != NULL) || !drop->HasTemp());
ASSERT((drop->value() != nullptr) || !drop->HasTemp());
break;
}
@@ -1637,7 +1637,7 @@ void FlowGraph::RenameRecursive(
block_entry->last_instruction()->SuccessorAt(0)->AsJoinEntry();
intptr_t pred_index = successor->IndexOfPredecessor(block_entry);
ASSERT(pred_index >= 0);
if (successor->phis() != NULL) {
if (successor->phis() != nullptr) {
for (intptr_t i = 0; i < successor->phis()->length(); ++i) {
PhiInstr* phi = (*successor->phis())[i];
if (phi != nullptr) {
@@ -1668,7 +1668,7 @@ void FlowGraph::ValidatePhis() {
last_instruction->SuccessorAt(0)->IsJoinEntry()) {
JoinEntryInstr* successor =
last_instruction->SuccessorAt(0)->AsJoinEntry();
if (successor->phis() != NULL) {
if (successor->phis() != nullptr) {
for (intptr_t j = 0; j < successor->phis()->length(); ++j) {
PhiInstr* phi = (*successor->phis())[j];
if (phi == nullptr && !IsImmortalVariable(j)) {
@@ -1699,11 +1699,12 @@ void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) {
if (!graph_entry()->catch_entries().is_empty()) {
for (BlockIterator it(postorder_iterator()); !it.Done(); it.Advance()) {
JoinEntryInstr* join = it.Current()->AsJoinEntry();
if (join == NULL) continue;
if (join == nullptr) continue;
for (PhiIterator phi_it(join); !phi_it.Done(); phi_it.Advance()) {
PhiInstr* phi = phi_it.Current();
if (phi == NULL || phi->is_alive() || (phi->input_use_list() != NULL) ||
(phi->env_use_list() == NULL)) {
if (phi == nullptr || phi->is_alive() ||
(phi->input_use_list() != nullptr) ||
(phi->env_use_list() == nullptr)) {
continue;
}
for (Value::Iterator it(phi->env_use_list()); !it.Done();
@@ -1725,7 +1726,7 @@ void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) {
for (intptr_t i = 0; i < phi->InputCount(); i++) {
Value* val = phi->InputAt(i);
PhiInstr* used_phi = val->definition()->AsPhi();
if ((used_phi != NULL) && !used_phi->is_alive()) {
if ((used_phi != nullptr) && !used_phi->is_alive()) {
used_phi->mark_alive();
live_phis->Add(used_phi);
}
@@ -1734,7 +1735,7 @@ void FlowGraph::RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis) {
for (BlockIterator it(postorder_iterator()); !it.Done(); it.Advance()) {
JoinEntryInstr* join = it.Current()->AsJoinEntry();
if (join != NULL) join->RemoveDeadPhis(constant_dead());
if (join != nullptr) join->RemoveDeadPhis(constant_dead());
}
}
@@ -1910,7 +1911,7 @@ void FlowGraph::InsertConversion(Representation from,
ASSERT(from != to);
Instruction* insert_before;
PhiInstr* phi = use->instruction()->AsPhi();
if (phi != NULL) {
if (phi != nullptr) {
ASSERT(phi->is_alive());
// For phis conversions have to be inserted in the predecessor.
auto predecessor = phi->block()->PredecessorAt(use->use_index());
@@ -1926,7 +1927,7 @@ void FlowGraph::InsertConversion(Representation from,
deopt_target = insert_before;
}
Definition* converted = NULL;
Definition* converted = nullptr;
if (IsUnboxedInteger(from) && IsUnboxedInteger(to)) {
const intptr_t deopt_id = (to == kUnboxedInt32) && (deopt_target != nullptr)
? deopt_target->DeoptimizationTarget()
@@ -2244,7 +2245,7 @@ void FlowGraph::SelectRepresentations() {
for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
block_it.Advance()) {
JoinEntryInstr* join_entry = block_it.Current()->AsJoinEntry();
if (join_entry != NULL) {
if (join_entry != nullptr) {
for (PhiIterator it(join_entry); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
phi_unboxing_heuristic.Process(phi);
@@ -2276,14 +2277,14 @@ void FlowGraph::SelectRepresentations() {
if (JoinEntryInstr* join_entry = entry->AsJoinEntry()) {
for (PhiIterator it(join_entry); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
ASSERT(phi->is_alive());
InsertConversionsFor(phi);
}
}
for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
Definition* def = it.Current()->AsDefinition();
if (def != NULL) {
if (def != nullptr) {
InsertConversionsFor(def);
}
}
@@ -2337,7 +2338,7 @@ void FlowGraph::WidenSmiToInt32() {
for (ForwardInstructionIterator instr_it(block_it.Current());
!instr_it.Done(); instr_it.Advance()) {
BinarySmiOpInstr* smi_op = instr_it.Current()->AsBinarySmiOp();
if ((smi_op != NULL) && smi_op->HasSSATemp() &&
if ((smi_op != nullptr) && smi_op->HasSSATemp() &&
BenefitsFromWidening(smi_op) && CanBeWidened(smi_op)) {
candidates.Add(smi_op);
}
@@ -2427,11 +2428,11 @@ void FlowGraph::WidenSmiToInt32() {
}
// Process all uses.
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
Instruction* instr = use->instruction();
Definition* use_defn = instr->AsDefinition();
if (use_defn == NULL) {
if (use_defn == nullptr) {
// We assume that tagging before returning or pushing argument costs
// very little compared to the cost of the return/call itself.
ASSERT(!instr->IsMoveArgument());
@@ -2495,7 +2496,7 @@ void FlowGraph::WidenSmiToInt32() {
smi_op->op_kind(), smi_op->left()->CopyWithType(),
smi_op->right()->CopyWithType(), smi_op->DeoptimizationTarget());
smi_op->ReplaceWith(int32_op, NULL);
smi_op->ReplaceWith(int32_op, nullptr);
} else if (defn->IsPhi()) {
defn->AsPhi()->set_representation(kUnboxedInt32);
ASSERT(defn->Type()->IsInt());
@@ -2579,7 +2580,7 @@ bool FlowGraph::Canonicalize() {
Instruction* replacement = current->Canonicalize(this);
if (replacement != current) {
// For non-definitions Canonicalize should return either NULL or
// For non-definitions Canonicalize should return either nullptr or
// this.
if (replacement != nullptr) {
ASSERT(current->IsDefinition());
@@ -2696,7 +2697,7 @@ static bool IsDominatedUse(Instruction* dom, Value* use) {
Instruction* instr = use->instruction();
PhiInstr* phi = instr->AsPhi();
if (phi != NULL) {
if (phi != nullptr) {
return dom_block->Dominates(phi->block()->PredecessorAt(use->use_index()));
}
@@ -2705,7 +2706,8 @@ static bool IsDominatedUse(Instruction* dom, Value* use) {
// Fast path for the case of block entry.
if (dom_block == dom) return true;
for (Instruction* curr = dom->next(); curr != NULL; curr = curr->next()) {
for (Instruction* curr = dom->next(); curr != nullptr;
curr = curr->next()) {
if (curr == instr) return true;
}
@@ -2750,7 +2752,7 @@ void FlowGraph::RenameUsesDominatedByRedefinitions() {
static bool IsPositiveOrZeroSmiConst(Definition* d) {
ConstantInstr* const_instr = d->AsConstant();
if ((const_instr != NULL) && (const_instr->value().IsSmi())) {
if ((const_instr != nullptr) && (const_instr->value().IsSmi())) {
return Smi::Cast(const_instr->value()).Value() >= 0;
}
return false;
@@ -2758,10 +2760,10 @@ static bool IsPositiveOrZeroSmiConst(Definition* d) {
static BinarySmiOpInstr* AsSmiShiftLeftInstruction(Definition* d) {
BinarySmiOpInstr* instr = d->AsBinarySmiOp();
if ((instr != NULL) && (instr->op_kind() == Token::kSHL)) {
if ((instr != nullptr) && (instr->op_kind() == Token::kSHL)) {
return instr;
}
return NULL;
return nullptr;
}
void FlowGraph::OptimizeLeftShiftBitAndSmiOp(
@@ -2769,8 +2771,8 @@ void FlowGraph::OptimizeLeftShiftBitAndSmiOp(
Definition* bit_and_instr,
Definition* left_instr,
Definition* right_instr) {
ASSERT(bit_and_instr != NULL);
ASSERT((left_instr != NULL) && (right_instr != NULL));
ASSERT(bit_and_instr != nullptr);
ASSERT((left_instr != nullptr) && (right_instr != nullptr));
// Check for pattern, smi_shift_left must be single-use.
bool is_positive_or_zero = IsPositiveOrZeroSmiConst(left_instr);
@@ -2779,14 +2781,15 @@ void FlowGraph::OptimizeLeftShiftBitAndSmiOp(
}
if (!is_positive_or_zero) return;
BinarySmiOpInstr* smi_shift_left = NULL;
BinarySmiOpInstr* smi_shift_left = nullptr;
if (bit_and_instr->InputAt(0)->IsSingleUse()) {
smi_shift_left = AsSmiShiftLeftInstruction(left_instr);
}
if ((smi_shift_left == NULL) && (bit_and_instr->InputAt(1)->IsSingleUse())) {
if ((smi_shift_left == nullptr) &&
(bit_and_instr->InputAt(1)->IsSingleUse())) {
smi_shift_left = AsSmiShiftLeftInstruction(right_instr);
}
if (smi_shift_left == NULL) return;
if (smi_shift_left == nullptr) return;
// Pattern recognized.
smi_shift_left->mark_truncating();
@@ -2825,7 +2828,7 @@ void FlowGraph::TryMergeTruncDivMod(
}
for (intptr_t i = 0; i < merge_candidates->length(); i++) {
BinarySmiOpInstr* curr_instr = (*merge_candidates)[i];
if (curr_instr == NULL) {
if (curr_instr == nullptr) {
// Instruction was merged already.
continue;
}
@@ -2839,11 +2842,11 @@ void FlowGraph::TryMergeTruncDivMod(
Definition* right_def = curr_instr->right()->definition();
for (intptr_t k = i + 1; k < merge_candidates->length(); k++) {
BinarySmiOpInstr* other_binop = (*merge_candidates)[k];
// 'other_binop' can be NULL if it was already merged.
if ((other_binop != NULL) && (other_binop->op_kind() == other_kind) &&
// 'other_binop' can be nullptr if it was already merged.
if ((other_binop != nullptr) && (other_binop->op_kind() == other_kind) &&
(other_binop->left()->definition() == left_def) &&
(other_binop->right()->definition() == right_def)) {
(*merge_candidates)[k] = NULL; // Clear it.
(*merge_candidates)[k] = nullptr; // Clear it.
ASSERT(curr_instr->HasUses());
AppendExtractNthOutputForMerged(
curr_instr, TruncDivModInstr::OutputIndexOf(curr_instr->op_kind()),
@@ -2858,7 +2861,7 @@ void FlowGraph::TryMergeTruncDivMod(
TruncDivModInstr* div_mod = new (Z) TruncDivModInstr(
curr_instr->left()->CopyWithType(),
curr_instr->right()->CopyWithType(), curr_instr->deopt_id());
curr_instr->ReplaceWith(div_mod, NULL);
curr_instr->ReplaceWith(div_mod, nullptr);
other_binop->ReplaceUsesWith(div_mod);
other_binop->RemoveFromGraph();
// Only one merge possible. Because canonicalization happens later,
@@ -2877,7 +2880,7 @@ void FlowGraph::AppendExtractNthOutputForMerged(Definition* instr,
ExtractNthOutputInstr* extract =
new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid);
instr->ReplaceUsesWith(extract);
InsertAfter(instr, extract, NULL, FlowGraph::kValue);
InsertAfter(instr, extract, nullptr, FlowGraph::kValue);
}
//
+2 -1
View File
@@ -374,7 +374,8 @@ class FlowGraph : public ZoneAllocated {
// Insert a redefinition of an original definition after prev and rename all
// dominated uses of the original. If an equivalent redefinition is already
// present, nothing is inserted.
// Returns the redefinition, if a redefinition was inserted, NULL otherwise.
// Returns the redefinition, if a redefinition was inserted, nullptr
// otherwise.
RedefinitionInstr* EnsureRedefinition(Instruction* prev,
Definition* original,
CompileType compile_type);
@@ -100,7 +100,7 @@ compiler::LRState ComputeInnerLRState(const FlowGraph& flow_graph) {
// them immediately before the call instruction and right before
// register allocation.
void CompilerDeoptInfo::AllocateOutgoingArguments(Environment* env) {
if (env == NULL) return;
if (env == nullptr) return;
for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) {
if (it.CurrentLocation().IsInvalid()) {
if (auto move_arg = it.CurrentValue()->definition()->AsMoveArgument()) {
@@ -116,7 +116,7 @@ void CompilerDeoptInfo::EmitMaterializations(Environment* env,
if (it.CurrentLocation().IsInvalid()) {
MaterializeObjectInstr* mat =
it.CurrentValue()->definition()->AsMaterializeObject();
ASSERT(mat != NULL);
ASSERT(mat != nullptr);
builder->AddMaterialization(mat);
}
}
@@ -132,7 +132,7 @@ FlowGraphCompiler::FlowGraphCompiler(
const GrowableArray<TokenPosition>& inline_id_to_token_pos,
const GrowableArray<intptr_t>& caller_inline_id,
ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data,
CodeStatistics* stats /* = NULL */)
CodeStatistics* stats /* = nullptr */)
: thread_(Thread::Current()),
zone_(Thread::Current()->zone()),
assembler_(assembler),
@@ -166,7 +166,7 @@ FlowGraphCompiler::FlowGraphCompiler(
Class::ZoneHandle(isolate_group()->object_store()->int32x4_class())),
list_class_(Class::ZoneHandle(Library::Handle(Library::CoreLibrary())
.LookupClass(Symbols::List()))),
pending_deoptimization_env_(NULL),
pending_deoptimization_env_(nullptr),
deopt_id_to_ic_data_(deopt_id_to_ic_data),
edge_counters_array_(Array::ZoneHandle()) {
ASSERT(flow_graph->parsed_function().function().ptr() ==
@@ -178,7 +178,7 @@ FlowGraphCompiler::FlowGraphCompiler(
const intptr_t len = thread()->compiler_state().deopt_id();
deopt_id_to_ic_data_->EnsureLength(len, nullptr);
}
ASSERT(assembler != NULL);
ASSERT(assembler != nullptr);
ASSERT(!list_class_.IsNull());
#if defined(PRODUCT)
@@ -272,14 +272,14 @@ bool FlowGraphCompiler::ForceSlowPathForStackOverflow() const {
return true;
}
}
if (FLAG_stacktrace_filter != NULL &&
if (FLAG_stacktrace_filter != nullptr &&
strstr(parsed_function().function().ToFullyQualifiedCString(),
FLAG_stacktrace_filter) != NULL) {
FLAG_stacktrace_filter) != nullptr) {
return true;
}
if (is_optimizing() && FLAG_deoptimize_filter != NULL &&
if (is_optimizing() && FLAG_deoptimize_filter != nullptr &&
strstr(parsed_function().function().ToFullyQualifiedCString(),
FLAG_deoptimize_filter) != NULL) {
FLAG_deoptimize_filter) != nullptr) {
return true;
}
#endif // !defined(PRODUCT)
@@ -318,7 +318,7 @@ void FlowGraphCompiler::CompactBlocks() {
// This algorithm does not garbage collect blocks in place, but merely
// records forwarding label information. In this way it avoids having to
// change join and target entries.
compiler::Label* nonempty_label = NULL;
compiler::Label* nonempty_label = nullptr;
for (intptr_t i = block_order().length() - 1; i >= 1; --i) {
BlockEntryInstr* block = block_order()[i];
@@ -701,14 +701,14 @@ void FlowGraphCompiler::VisitBlocks() {
}
BeginCodeSourceRange(entry->source());
ASSERT(pending_deoptimization_env_ == NULL);
ASSERT(pending_deoptimization_env_ == nullptr);
pending_deoptimization_env_ = entry->env();
set_current_instruction(entry);
StatsBegin(entry);
entry->EmitNativeCode(this);
StatsEnd(entry);
set_current_instruction(nullptr);
pending_deoptimization_env_ = NULL;
pending_deoptimization_env_ = nullptr;
EndCodeSourceRange(entry->source());
if (skip_body_compilation()) {
@@ -739,12 +739,12 @@ void FlowGraphCompiler::VisitBlocks() {
BeginCodeSourceRange(instr->source());
EmitInstructionPrologue(instr);
ASSERT(pending_deoptimization_env_ == NULL);
ASSERT(pending_deoptimization_env_ == nullptr);
pending_deoptimization_env_ = instr->env();
DEBUG_ONLY(current_instruction_ = instr);
instr->EmitNativeCode(this);
DEBUG_ONLY(current_instruction_ = nullptr);
pending_deoptimization_env_ = NULL;
pending_deoptimization_env_ = nullptr;
if (IsPeephole(instr)) {
ASSERT(top_of_stack_ == nullptr);
top_of_stack_ = instr->AsDefinition();
@@ -771,7 +771,7 @@ void FlowGraphCompiler::VisitBlocks() {
#endif
}
set_current_block(NULL);
set_current_block(nullptr);
}
void FlowGraphCompiler::Bailout(const char* reason) {
@@ -1016,7 +1016,7 @@ void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs,
is_optimizing() ? flow_graph_.graph_entry()->spill_slot_count() : 0;
RegisterSet* registers = locs->live_registers();
ASSERT(registers != NULL);
ASSERT(registers != nullptr);
const intptr_t kFpuRegisterSpillFactor =
kFpuRegisterSize / compiler::target::kWordSize;
const bool using_shared_stub = locs->call_on_shared_slow_path();
@@ -1239,14 +1239,14 @@ compiler::Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id,
}
void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) {
ASSERT(exception_handlers_list_ != NULL);
ASSERT(exception_handlers_list_ != nullptr);
const ExceptionHandlers& handlers = ExceptionHandlers::Handle(
exception_handlers_list_->FinalizeExceptionHandlers(code.PayloadStart()));
code.set_exception_handlers(handlers);
}
void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) {
ASSERT(pc_descriptors_list_ != NULL);
ASSERT(pc_descriptors_list_ != nullptr);
const PcDescriptors& descriptors = PcDescriptors::Handle(
pc_descriptors_list_->FinalizePcDescriptors(code.PayloadStart()));
if (!is_optimizing_) descriptors.Verify(parsed_function_.function());
@@ -1286,7 +1286,7 @@ ArrayPtr FlowGraphCompiler::CreateDeoptInfo(compiler::Assembler* assembler) {
}
void FlowGraphCompiler::FinalizeStackMaps(const Code& code) {
ASSERT(compressed_stackmaps_builder_ != NULL);
ASSERT(compressed_stackmaps_builder_ != nullptr);
// Finalize the compressed stack maps and add it to the code object.
const auto& maps =
CompressedStackMaps::Handle(compressed_stackmaps_builder_->Finalize());
@@ -1858,8 +1858,8 @@ const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData(
intptr_t num_args_tested,
const AbstractType& receiver_type,
const Function& binary_smi_target) {
if ((deopt_id_to_ic_data_ != NULL) &&
((*deopt_id_to_ic_data_)[deopt_id] != NULL)) {
if ((deopt_id_to_ic_data_ != nullptr) &&
((*deopt_id_to_ic_data_)[deopt_id] != nullptr)) {
const ICData* res = (*deopt_id_to_ic_data_)[deopt_id];
ASSERT(res->deopt_id() == deopt_id);
ASSERT(res->target_name() == target_name.ptr());
@@ -1888,7 +1888,7 @@ const ICData* FlowGraphCompiler::GetOrAddInstanceCallICData(
ICData::kInstance, receiver_type);
}
if (deopt_id_to_ic_data_ != NULL) {
if (deopt_id_to_ic_data_ != nullptr) {
(*deopt_id_to_ic_data_)[deopt_id] = &ic_data;
}
ASSERT(!ic_data.is_static_call());
@@ -1901,8 +1901,8 @@ const ICData* FlowGraphCompiler::GetOrAddStaticCallICData(
const Array& arguments_descriptor,
intptr_t num_args_tested,
ICData::RebindRule rebind_rule) {
if ((deopt_id_to_ic_data_ != NULL) &&
((*deopt_id_to_ic_data_)[deopt_id] != NULL)) {
if ((deopt_id_to_ic_data_ != nullptr) &&
((*deopt_id_to_ic_data_)[deopt_id] != nullptr)) {
const ICData* res = (*deopt_id_to_ic_data_)[deopt_id];
ASSERT(res->deopt_id() == deopt_id);
ASSERT(res->target_name() == target.name());
@@ -1917,7 +1917,7 @@ const ICData* FlowGraphCompiler::GetOrAddStaticCallICData(
zone(), ICData::NewForStaticCall(parsed_function().function(), target,
arguments_descriptor, deopt_id,
num_args_tested, rebind_rule));
if (deopt_id_to_ic_data_ != NULL) {
if (deopt_id_to_ic_data_ != nullptr) {
(*deopt_id_to_ic_data_)[deopt_id] = &ic_data;
}
return &ic_data;
@@ -1996,7 +1996,7 @@ const CallTargets* FlowGraphCompiler::ResolveCallTargetsForReceiverCid(
ArgumentsDescriptor args_desc(args_desc_array);
Function& fn = Function::ZoneHandle(zone);
if (!LookupMethodFor(cid, selector, args_desc, &fn)) return NULL;
if (!LookupMethodFor(cid, selector, args_desc, &fn)) return nullptr;
CallTargets* targets = new (zone) CallTargets(zone);
targets->Add(new (zone) TargetInfo(cid, cid, &fn, /* count = */ 1,
@@ -2023,7 +2023,7 @@ bool FlowGraphCompiler::LookupMethodFor(int class_id,
if (!cls.is_finalized()) return false;
if (Array::Handle(cls.current_functions()).IsNull()) return false;
if (class_is_abstract_return != NULL) {
if (class_is_abstract_return != nullptr) {
*class_is_abstract_return = cls.is_abstract();
}
const bool allow_add = false;
@@ -2060,8 +2060,8 @@ void FlowGraphCompiler::EmitPolymorphicInstanceCall(
if (complete) {
compiler::Label ok;
EmitTestAndCall(targets, call->function_name(), args_info,
NULL, // No cid match.
&ok, // Found cid.
nullptr, // No cid match.
&ok, // Found cid.
deopt_id, source, locs, true, total_ic_calls,
call->entry_kind());
assembler()->Bind(&ok);
@@ -2155,7 +2155,7 @@ void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
UntaggedPcDescriptors::kOther, locs, function,
entry_kind);
EmitDropArguments(args_info.size_with_type_args);
if (match_found != NULL) {
if (match_found != nullptr) {
__ Jump(match_found);
}
__ Bind(&after_smi_test);
@@ -2221,7 +2221,7 @@ bool FlowGraphCompiler::GenerateSubtypeRangeCheck(Register class_id_reg,
const Class& type_class,
compiler::Label* is_subtype) {
HierarchyInfo* hi = Thread::Current()->hierarchy_info();
if (hi != NULL) {
if (hi != nullptr) {
const CidRangeVector& ranges =
hi->SubtypeRangesForClass(type_class,
/*include_abstract=*/false,
@@ -3037,7 +3037,7 @@ void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) {
FrameStatePop(instr->ArgumentCount());
Definition* defn = instr->AsDefinition();
if ((defn != NULL) && defn->HasTemp()) {
if ((defn != nullptr) && defn->HasTemp()) {
FrameStatePush(defn);
}
}
@@ -76,7 +76,7 @@ class CompilerDeoptInfo : public ZoneAllocated {
reason_(reason),
flags_(flags),
deopt_env_(deopt_env) {
ASSERT(deopt_env != NULL);
ASSERT(deopt_env != nullptr);
}
virtual ~CompilerDeoptInfo() {}
@@ -126,7 +126,7 @@ class CompilerDeoptInfoWithStub : public CompilerDeoptInfo {
const char* Name() const {
const char* kFormat = "Deopt stub for id %d, reason: %s";
const intptr_t len = Utils::SNPrint(NULL, 0, kFormat, deopt_id(),
const intptr_t len = Utils::SNPrint(nullptr, 0, kFormat, deopt_id(),
DeoptReasonToCString(reason())) +
1;
char* chars = Thread::Current()->zone()->Alloc<char>(len);
@@ -327,7 +327,7 @@ class FlowGraphCompiler : public ValueObject {
BlockInfo()
: block_label_(),
jump_label_(&block_label_),
next_nonempty_label_(NULL),
next_nonempty_label_(nullptr),
is_marked_(false) {}
// The label to jump to when control is transferred to this block. For
@@ -337,7 +337,7 @@ class FlowGraphCompiler : public ValueObject {
void set_jump_label(compiler::Label* label) { jump_label_ = label; }
// The label of the first nonempty block after this one in the block
// order, or NULL if there is no nonempty block following this one.
// order, or nullptr if there is no nonempty block following this one.
compiler::Label* next_nonempty_label() const {
return next_nonempty_label_;
}
@@ -371,7 +371,7 @@ class FlowGraphCompiler : public ValueObject {
const GrowableArray<TokenPosition>& inline_id_to_token_pos,
const GrowableArray<intptr_t>& caller_inline_id,
ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data,
CodeStatistics* stats = NULL);
CodeStatistics* stats = nullptr);
void ArchSpecificInitialization();
@@ -446,19 +446,19 @@ class FlowGraphCompiler : public ValueObject {
const GrowableArray<BlockInfo*>& block_info() const { return block_info_; }
void StatsBegin(Instruction* instr) {
if (stats_ != NULL) stats_->Begin(instr);
if (stats_ != nullptr) stats_->Begin(instr);
}
void StatsEnd(Instruction* instr) {
if (stats_ != NULL) stats_->End(instr);
if (stats_ != nullptr) stats_->End(instr);
}
void SpecialStatsBegin(intptr_t tag) {
if (stats_ != NULL) stats_->SpecialBegin(tag);
if (stats_ != nullptr) stats_->SpecialBegin(tag);
}
void SpecialStatsEnd(intptr_t tag) {
if (stats_ != NULL) stats_->SpecialEnd(tag);
if (stats_ != nullptr) stats_->SpecialEnd(tag);
}
GrowableArray<const Field*>& used_static_fields() {
@@ -628,12 +628,13 @@ class FlowGraphCompiler : public ValueObject {
// the range.
//
// Returns whether [class_id_reg] is clobbered by the check.
static bool GenerateCidRangesCheck(compiler::Assembler* assembler,
Register class_id_reg,
const CidRangeVector& cid_ranges,
compiler::Label* inside_range_lbl,
compiler::Label* outside_range_lbl = NULL,
bool fall_through_if_inside = false);
static bool GenerateCidRangesCheck(
compiler::Assembler* assembler,
Register class_id_reg,
const CidRangeVector& cid_ranges,
compiler::Label* inside_range_lbl,
compiler::Label* outside_range_lbl = nullptr,
bool fall_through_if_inside = false);
void EmitOptimizedInstanceCall(
const Code& stub,
@@ -846,7 +847,7 @@ class FlowGraphCompiler : public ValueObject {
intptr_t num_slow_path_args);
intptr_t CurrentTryIndex() const {
if (current_block_ == NULL) {
if (current_block_ == nullptr) {
return kInvalidTryIndex;
}
return current_block_->try_index();
@@ -898,7 +899,7 @@ class FlowGraphCompiler : public ValueObject {
const String& name,
const ArgumentsDescriptor& args_desc,
Function* fn_return,
bool* class_is_abstract_return = NULL);
bool* class_is_abstract_return = nullptr);
// Returns new class-id bias.
//
@@ -1097,7 +1098,7 @@ class FlowGraphCompiler : public ValueObject {
bool CanPcRelativeCall(const Code& target) const;
bool CanPcRelativeCall(const AbstractType& target) const;
// This struct contains either function or code, the other one being NULL.
// This struct contains either function or code, the other one being nullptr.
class StaticCallsStruct : public ZoneAllocated {
public:
Code::CallKind call_kind;
@@ -94,7 +94,7 @@ void FlowGraphCompiler::ExitIntrinsicMode() {
TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder,
const Array& deopt_table) {
if (deopt_env_ == NULL) {
if (deopt_env_ == nullptr) {
++builder->current_info_number_;
return TypedData::null();
}
@@ -131,7 +131,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
Environment* previous = current;
current = current->outer();
while (current != NULL) {
while (current != nullptr) {
builder->AddPp(current->function(), slot_ix++);
builder->AddPcMarker(previous->function(), slot_ix++);
builder->AddCallerFp(slot_ix++);
@@ -160,7 +160,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
}
// The previous pointer is now the outermost environment.
ASSERT(previous != NULL);
ASSERT(previous != nullptr);
// Set slots for the outermost environment.
builder->AddCallerPp(slot_ix++);
@@ -188,7 +188,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
__ bkpt(0);
}
ASSERT(deopt_env() != NULL);
ASSERT(deopt_env() != nullptr);
__ Call(compiler::Address(
THR, compiler::target::Thread::deoptimize_entry_offset()));
set_pc_offset(assembler->CodeSize());
@@ -88,7 +88,7 @@ void FlowGraphCompiler::ExitIntrinsicMode() {
TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder,
const Array& deopt_table) {
if (deopt_env_ == NULL) {
if (deopt_env_ == nullptr) {
++builder->current_info_number_;
return TypedData::null();
}
@@ -125,7 +125,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
Environment* previous = current;
current = current->outer();
while (current != NULL) {
while (current != nullptr) {
builder->AddPp(current->function(), slot_ix++);
builder->AddPcMarker(previous->function(), slot_ix++);
builder->AddCallerFp(slot_ix++);
@@ -154,7 +154,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
}
// The previous pointer is now the outermost environment.
ASSERT(previous != NULL);
ASSERT(previous != nullptr);
// Add slots for the outermost environment.
builder->AddCallerPp(slot_ix++);
@@ -182,7 +182,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
__ brk(0);
}
ASSERT(deopt_env() != NULL);
ASSERT(deopt_env() != nullptr);
__ Call(compiler::Address(THR, Thread::deoptimize_entry_offset()));
set_pc_offset(assembler->CodeSize());
#undef __
@@ -66,7 +66,7 @@ void FlowGraphCompiler::ExitIntrinsicMode() {
TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder,
const Array& deopt_table) {
if (deopt_env_ == NULL) {
if (deopt_env_ == nullptr) {
++builder->current_info_number_;
return TypedData::null();
}
@@ -105,7 +105,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
Environment* previous = current;
current = current->outer();
while (current != NULL) {
while (current != nullptr) {
// For any outer environment the deopt id is that of the call instruction
// which is recorded in the outer environment.
builder->AddReturnAddress(current->function(),
@@ -133,7 +133,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
}
// The previous pointer is now the outermost environment.
ASSERT(previous != NULL);
ASSERT(previous != nullptr);
// For the outermost environment, set caller PC.
builder->AddCallerPc(slot_ix++);
@@ -158,7 +158,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
__ int3();
}
ASSERT(deopt_env() != NULL);
ASSERT(deopt_env() != nullptr);
__ pushl(CODE_REG);
__ Call(StubCode::Deoptimize());
set_pc_offset(assembler->CodeSize());
@@ -244,7 +244,7 @@ SubtypeTestCachePtr FlowGraphCompiler::GenerateCallSubtypeTestStub(
}
// Optimize assignable type check by adding inlined tests for:
// - NULL -> return NULL.
// - null -> return null.
// - Smi -> compile time subtype check (only if dst class is not parameterized).
// - Class equality (only if class is not parameterized).
// Inputs:
@@ -75,7 +75,7 @@ void FlowGraphCompiler::ExitIntrinsicMode() {
TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder,
const Array& deopt_table) {
if (deopt_env_ == NULL) {
if (deopt_env_ == nullptr) {
++builder->current_info_number_;
return TypedData::null();
}
@@ -112,7 +112,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
Environment* previous = current;
current = current->outer();
while (current != NULL) {
while (current != nullptr) {
builder->AddPp(current->function(), slot_ix++);
builder->AddPcMarker(previous->function(), slot_ix++);
builder->AddCallerFp(slot_ix++);
@@ -141,7 +141,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
}
// The previous pointer is now the outermost environment.
ASSERT(previous != NULL);
ASSERT(previous != nullptr);
// Add slots for the outermost environment.
builder->AddCallerPp(slot_ix++);
@@ -169,7 +169,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
__ trap();
}
ASSERT(deopt_env() != NULL);
ASSERT(deopt_env() != nullptr);
__ Call(compiler::Address(THR, Thread::deoptimize_entry_offset()));
set_pc_offset(assembler->CodeSize());
#undef __
@@ -89,7 +89,7 @@ void FlowGraphCompiler::ExitIntrinsicMode() {
TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder,
const Array& deopt_table) {
if (deopt_env_ == NULL) {
if (deopt_env_ == nullptr) {
++builder->current_info_number_;
return TypedData::null();
}
@@ -126,7 +126,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
Environment* previous = current;
current = current->outer();
while (current != NULL) {
while (current != nullptr) {
builder->AddPp(current->function(), slot_ix++);
builder->AddPcMarker(previous->function(), slot_ix++);
builder->AddCallerFp(slot_ix++);
@@ -155,7 +155,7 @@ TypedDataPtr CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
current = current->outer();
}
// The previous pointer is now the outermost environment.
ASSERT(previous != NULL);
ASSERT(previous != nullptr);
// Set slots for the outermost environment.
builder->AddCallerPp(slot_ix++);
@@ -183,7 +183,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
__ int3();
}
ASSERT(deopt_env() != NULL);
ASSERT(deopt_env() != nullptr);
__ call(compiler::Address(THR, Thread::deoptimize_entry_offset()));
set_pc_offset(assembler->CodeSize());
__ int3();
File diff suppressed because it is too large Load Diff
+72 -65
View File
@@ -80,11 +80,11 @@ class Value : public ZoneAllocated {
public:
explicit Iterator(Value* head) : next_(head) { Advance(); }
Value* Current() const { return current_; }
bool Done() const { return current_ == NULL; }
bool Done() const { return current_ == nullptr; }
void Advance() {
// Pre-fetch next on advance and cache it.
current_ = next_;
if (next_ != NULL) next_ = next_->next_use();
if (next_ != nullptr) next_ = next_->next_use();
}
private:
@@ -94,11 +94,11 @@ class Value : public ZoneAllocated {
explicit Value(Definition* definition)
: definition_(definition),
previous_use_(NULL),
next_use_(NULL),
instruction_(NULL),
previous_use_(nullptr),
next_use_(nullptr),
instruction_(nullptr),
use_index_(-1),
reaching_type_(NULL) {}
reaching_type_(nullptr) {}
Definition* definition() const { return definition_; }
void set_definition(Definition* definition) {
@@ -115,7 +115,7 @@ class Value : public ZoneAllocated {
void set_next_use(Value* next) { next_use_ = next; }
bool IsSingleUse() const {
return (next_use_ == NULL) && (previous_use_ == NULL);
return (next_use_ == nullptr) && (previous_use_ == nullptr);
}
Instruction* instruction() const { return instruction_; }
@@ -274,7 +274,7 @@ class HierarchyInfo : public ThreadStackResource {
thread->set_hierarchy_info(this);
}
~HierarchyInfo() { thread()->set_hierarchy_info(NULL); }
~HierarchyInfo() { thread()->set_hierarchy_info(nullptr); }
// Returned from FindBestTAVOffset and SplitOnConsistentTypeArguments
// to denote a failure to find a compatible concrete, finalized class.
@@ -974,7 +974,7 @@ class Instruction : public ZoneAllocated {
virtual intptr_t InputCount() const = 0;
virtual Value* InputAt(intptr_t i) const = 0;
void SetInputAt(intptr_t i, Value* value) {
ASSERT(value != NULL);
ASSERT(value != nullptr);
value->set_instruction(this);
value->set_use_index(i);
RawSetInputAt(i, value);
@@ -1056,9 +1056,9 @@ class Instruction : public ZoneAllocated {
void set_next(Instruction* instr) {
ASSERT(!IsGraphEntry());
ASSERT(!IsReturn());
ASSERT(!IsBranch() || (instr == NULL));
ASSERT(!IsBranch() || (instr == nullptr));
ASSERT(!IsPhi());
ASSERT(instr == NULL || !instr->IsBlockEntry());
ASSERT(instr == nullptr || !instr->IsBlockEntry());
// TODO(fschneider): Also add Throw and ReThrow to the list of instructions
// that do not have a successor. Currently, the graph builder will continue
// to append instruction in case of a Throw inside an expression. This
@@ -1153,17 +1153,17 @@ class Instruction : public ZoneAllocated {
// Returns structure describing location constraints required
// to emit native code for this instruction.
LocationSummary* locs() {
ASSERT(locs_ != NULL);
ASSERT(locs_ != nullptr);
return locs_;
}
bool HasLocs() const { return locs_ != NULL; }
bool HasLocs() const { return locs_ != nullptr; }
virtual LocationSummary* MakeLocationSummary(Zone* zone,
bool is_optimizing) const = 0;
void InitializeLocationSummary(Zone* zone, bool optimizing) {
ASSERT(locs_ == NULL);
ASSERT(locs_ == nullptr);
locs_ = MakeLocationSummary(zone, optimizing);
}
@@ -1222,7 +1222,7 @@ class Instruction : public ZoneAllocated {
// Representation of the value produced by this computation.
virtual Representation representation() const { return kTagged; }
bool WasEliminated() const { return next() == NULL; }
bool WasEliminated() const { return next() == nullptr; }
// Returns deoptimization id that corresponds to the deoptimization target
// that input operands conversions inserted for this instruction can jump
@@ -1232,7 +1232,7 @@ class Instruction : public ZoneAllocated {
return DeoptId::kNone;
}
// Returns a replacement for the instruction or NULL if the instruction can
// Returns a replacement for the instruction or nullptr if the instruction can
// be eliminated. By default returns the this instruction which means no
// change.
virtual Instruction* Canonicalize(FlowGraph* flow_graph);
@@ -1313,7 +1313,7 @@ class Instruction : public ZoneAllocated {
bool IsDominatedBy(Instruction* dom);
void ClearEnv() { env_ = NULL; }
void ClearEnv() { env_ = nullptr; }
void Unsupported(FlowGraphCompiler* compiler);
@@ -1640,14 +1640,14 @@ class BlockEntryInstr : public TemplateInstruction<0, NoThrow> {
ParallelMoveInstr* parallel_move() const { return parallel_move_; }
bool HasParallelMove() const { return parallel_move_ != NULL; }
bool HasParallelMove() const { return parallel_move_ != nullptr; }
bool HasNonRedundantParallelMove() const {
return HasParallelMove() && !parallel_move()->IsRedundant();
}
ParallelMoveInstr* GetParallelMove() {
if (parallel_move_ == NULL) {
if (parallel_move_ == nullptr) {
parallel_move_ = new ParallelMoveInstr();
}
return parallel_move_;
@@ -1797,7 +1797,7 @@ class ForwardInstructionIterator {
current_ = current_->next();
}
bool Done() const { return current_ == NULL; }
bool Done() const { return current_ == nullptr; }
// Removes 'current_' from graph and sets 'current_' to previous instruction.
void RemoveCurrentFromGraph();
@@ -1836,7 +1836,7 @@ class BackwardInstructionIterator : public ValueObject {
public:
explicit BackwardInstructionIterator(BlockEntryInstr* block_entry)
: block_entry_(block_entry), current_(block_entry->last_instruction()) {
ASSERT(block_entry_->previous() == NULL);
ASSERT(block_entry_->previous() == nullptr);
}
void Advance() {
@@ -1901,7 +1901,7 @@ class GraphEntryInstr : public BlockEntryWithInitialDefs {
virtual intptr_t PredecessorCount() const { return 0; }
virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
UNREACHABLE();
return NULL;
return nullptr;
}
virtual intptr_t SuccessorCount() const;
virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
@@ -2061,7 +2061,9 @@ class PhiIterator : public ValueObject {
index_++;
}
bool Done() const { return (phis_ == NULL) || (index_ >= phis_->length()); }
bool Done() const {
return (phis_ == nullptr) || (index_ >= phis_->length());
}
PhiInstr* Current() const { return (*phis_)[index_]; }
@@ -2089,10 +2091,10 @@ class TargetEntryInstr : public BlockEntryInstr {
void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; }
virtual intptr_t PredecessorCount() const {
return (predecessor_ == NULL) ? 0 : 1;
return (predecessor_ == nullptr) ? 0 : 1;
}
virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
ASSERT((index == 0) && (predecessor_ != NULL));
ASSERT((index == 0) && (predecessor_ != nullptr));
return predecessor_;
}
@@ -2107,9 +2109,9 @@ class TargetEntryInstr : public BlockEntryInstr {
private:
friend class BlockEntryInstr; // Access to predecessor_ when inlining.
virtual void ClearPredecessors() { predecessor_ = NULL; }
virtual void ClearPredecessors() { predecessor_ = nullptr; }
virtual void AddPredecessor(BlockEntryInstr* predecessor) {
ASSERT(predecessor_ == NULL);
ASSERT(predecessor_ == nullptr);
predecessor_ = predecessor;
}
@@ -2281,7 +2283,7 @@ class CatchBlockEntryInstr : public BlockEntryWithInitialDefs {
deopt_id,
/*stack_depth=*/0),
graph_entry_(graph_entry),
predecessor_(NULL),
predecessor_(nullptr),
catch_handler_types_(Array::ZoneHandle(handler_types.ptr())),
catch_try_index_(catch_try_index),
exception_var_(exception_var),
@@ -2294,10 +2296,10 @@ class CatchBlockEntryInstr : public BlockEntryWithInitialDefs {
DECLARE_INSTRUCTION(CatchBlockEntry)
virtual intptr_t PredecessorCount() const {
return (predecessor_ == NULL) ? 0 : 1;
return (predecessor_ == nullptr) ? 0 : 1;
}
virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
ASSERT((index == 0) && (predecessor_ != NULL));
ASSERT((index == 0) && (predecessor_ != nullptr));
return predecessor_;
}
@@ -2327,9 +2329,9 @@ class CatchBlockEntryInstr : public BlockEntryWithInitialDefs {
private:
friend class BlockEntryInstr; // Access to predecessor_ when inlining.
virtual void ClearPredecessors() { predecessor_ = NULL; }
virtual void ClearPredecessors() { predecessor_ = nullptr; }
virtual void AddPredecessor(BlockEntryInstr* predecessor) {
ASSERT(predecessor_ == NULL);
ASSERT(predecessor_ == nullptr);
predecessor_ = predecessor;
}
@@ -2458,7 +2460,7 @@ class Definition : public Instruction {
// Compile time type of the definition, which may be requested before type
// propagation during graph building.
CompileType* Type() {
if (type_ == NULL) {
if (type_ == nullptr) {
auto type = new CompileType(ComputeType());
type->set_owner(this);
set_type(type);
@@ -2466,7 +2468,7 @@ class Definition : public Instruction {
return type_;
}
bool HasType() const { return (type_ != NULL); }
bool HasType() const { return (type_ != nullptr); }
inline bool IsInt64Definition();
@@ -2503,7 +2505,7 @@ class Definition : public Instruction {
}
bool HasUses() const {
return (input_use_list_ != NULL) || (env_use_list_ != NULL);
return (input_use_list_ != nullptr) || (env_use_list_ != nullptr);
}
bool HasOnlyUse(Value* use) const;
bool HasOnlyInputUse(Value* use) const;
@@ -2529,7 +2531,7 @@ class Definition : public Instruction {
// Replace this definition with another instruction. Use the provided result
// definition to replace uses of the original definition. If replacing during
// iteration, pass the iterator so that the instruction can be replaced
// without affecting iteration order, otherwise pass a NULL iterator.
// without affecting iteration order, otherwise pass a nullptr iterator.
void ReplaceWithResult(Instruction* replacement,
Definition* replacement_for_uses,
ForwardInstructionIterator* iterator);
@@ -2537,7 +2539,7 @@ class Definition : public Instruction {
// Replace this definition and all uses with another definition. If
// replacing during iteration, pass the iterator so that the instruction
// can be replaced without affecting iteration order, otherwise pass a
// NULL iterator.
// nullptr iterator.
void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator);
// A value in the constant propagation lattice.
@@ -3425,7 +3427,7 @@ class ReThrowInstr : public TemplateInstruction<2, Throws> {
class StopInstr : public TemplateInstruction<0, NoThrow> {
public:
explicit StopInstr(const char* message) : message_(message) {
ASSERT(message != NULL);
ASSERT(message != nullptr);
}
const char* message() const { return message_; }
@@ -3484,14 +3486,14 @@ class GotoInstr : public TemplateInstruction<0, NoThrow> {
ParallelMoveInstr* parallel_move() const { return parallel_move_; }
bool HasParallelMove() const { return parallel_move_ != NULL; }
bool HasParallelMove() const { return parallel_move_ != nullptr; }
bool HasNonRedundantParallelMove() const {
return HasParallelMove() && !parallel_move()->IsRedundant();
}
ParallelMoveInstr* GetParallelMove() {
if (parallel_move_ == NULL) {
if (parallel_move_ == nullptr) {
parallel_move_ = new ParallelMoveInstr();
}
return parallel_move_;
@@ -3708,7 +3710,7 @@ class BranchInstr : public Instruction {
public:
explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id)
: Instruction(deopt_id), comparison_(comparison) {
ASSERT(comparison->env() == NULL);
ASSERT(comparison->env() == nullptr);
for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
comparison->InputAt(i)->set_instruction(this);
}
@@ -3829,7 +3831,7 @@ class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> {
class RedefinitionInstr : public TemplateDefinition<1, NoThrow> {
public:
explicit RedefinitionInstr(Value* value) : constrained_type_(NULL) {
explicit RedefinitionInstr(Value* value) : constrained_type_(nullptr) {
SetInputAt(0, value);
}
@@ -4005,7 +4007,7 @@ class UnboxedConstantInstr : public ConstantInstr {
virtual Representation representation() const { return representation_; }
// Either NULL or the address of the unboxed constant.
// Either nullptr or the address of the unboxed constant.
uword constant_address() const { return constant_address_; }
DECLARE_INSTRUCTION(UnboxedConstant)
@@ -4013,7 +4015,8 @@ class UnboxedConstantInstr : public ConstantInstr {
private:
const Representation representation_;
uword constant_address_; // Either NULL or points to the untagged constant.
uword
constant_address_; // Either nullptr or points to the untagged constant.
DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr);
};
@@ -5136,7 +5139,7 @@ class IfThenElseInstr : public Definition {
if_true_(Smi::Cast(if_true->BoundConstant()).Value()),
if_false_(Smi::Cast(if_false->BoundConstant()).Value()) {
// Adjust uses at the comparison.
ASSERT(comparison->env() == NULL);
ASSERT(comparison->env() == nullptr);
for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
comparison->InputAt(i)->set_instruction(this);
}
@@ -5232,7 +5235,7 @@ class StaticCallInstr : public TemplateDartCall<0> {
call_count_(0),
function_(function),
rebind_rule_(rebind_rule),
result_type_(NULL),
result_type_(nullptr),
is_known_list_constructor_(false),
entry_kind_(Code::EntryKind::kNormal),
identity_(AliasIdentity::Unknown()) {
@@ -5253,11 +5256,11 @@ class StaticCallInstr : public TemplateDartCall<0> {
argument_names,
std::move(arguments),
source),
ic_data_(NULL),
ic_data_(nullptr),
call_count_(call_count),
function_(function),
rebind_rule_(rebind_rule),
result_type_(NULL),
result_type_(nullptr),
is_known_list_constructor_(false),
entry_kind_(Code::EntryKind::kNormal),
identity_(AliasIdentity::Unknown()) {
@@ -5280,7 +5283,7 @@ class StaticCallInstr : public TemplateDartCall<0> {
StaticCallInstr* new_call = new (zone) StaticCallInstr(
call->source(), target, call->type_args_len(), call->argument_names(),
std::move(args), call->deopt_id(), call_count, ICData::kNoRebind);
if (call->result_type() != NULL) {
if (call->result_type() != nullptr) {
new_call->result_type_ = call->result_type();
}
new_call->set_entry_kind(call->entry_kind());
@@ -5289,7 +5292,9 @@ class StaticCallInstr : public TemplateDartCall<0> {
// ICData for static calls carries call count.
const ICData* ic_data() const { return ic_data_; }
bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); }
bool HasICData() const {
return (ic_data() != nullptr) && !ic_data()->IsNull();
}
void set_ic_data(const ICData* value) { ic_data_ = value; }
@@ -5306,7 +5311,7 @@ class StaticCallInstr : public TemplateDartCall<0> {
const Function& function() const { return function_; }
virtual intptr_t CallCount() const {
return ic_data() == NULL ? call_count_ : ic_data()->AggregateCount();
return ic_data() == nullptr ? call_count_ : ic_data()->AggregateCount();
}
virtual bool ComputeCanDeoptimize() const {
@@ -5334,7 +5339,7 @@ class StaticCallInstr : public TemplateDartCall<0> {
CompileType* result_type() const { return result_type_; }
intptr_t result_cid() const {
if (result_type_ == NULL) {
if (result_type_ == nullptr) {
return kDynamicCid;
}
return result_type_->ToCid();
@@ -6479,7 +6484,7 @@ class OneByteStringFromCharCodeInstr
class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> {
public:
StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) {
ASSERT(str != NULL);
ASSERT(str != nullptr);
SetInputAt(0, str);
}
@@ -10681,7 +10686,7 @@ class SuspendInstr : public TemplateDefinition<2, Throws> {
class Environment : public ZoneAllocated {
public:
// Iterate the non-NULL values in the innermost level of an environment.
// Iterate the non-nullptr values in the innermost level of an environment.
class ShallowIterator : public ValueObject {
public:
explicit ShallowIterator(Environment* environment)
@@ -10706,18 +10711,18 @@ class Environment : public ZoneAllocated {
}
bool Done() const {
return (environment_ == NULL) || (index_ >= environment_->Length());
return (environment_ == nullptr) || (index_ >= environment_->Length());
}
Value* CurrentValue() const {
ASSERT(!Done());
ASSERT(environment_->values_[index_] != NULL);
ASSERT(environment_->values_[index_] != nullptr);
return environment_->values_[index_];
}
void SetCurrentValue(Value* value) {
ASSERT(!Done());
ASSERT(value != NULL);
ASSERT(value != nullptr);
environment_->values_[index_] = value;
}
@@ -10736,7 +10741,7 @@ class Environment : public ZoneAllocated {
intptr_t index_;
};
// Iterate all non-NULL values in an environment, including outer
// Iterate all non-nullptr values in an environment, including outer
// environments. Note that the iterator skips empty environments.
class DeepIterator : public ValueObject {
public:
@@ -10750,7 +10755,7 @@ class Environment : public ZoneAllocated {
SkipDone();
}
bool Done() const { return iterator_.environment() == NULL; }
bool Done() const { return iterator_.environment() == nullptr; }
Value* CurrentValue() const {
ASSERT(!Done());
@@ -10790,7 +10795,7 @@ class Environment : public ZoneAllocated {
const ParsedFunction& parsed_function);
void set_locations(Location* locations) {
ASSERT(locations_ == NULL);
ASSERT(locations_ == nullptr);
locations_ = locations;
}
@@ -10829,7 +10834,7 @@ class Environment : public ZoneAllocated {
Environment* Outermost() {
Environment* result = this;
while (result->outer() != NULL)
while (result->outer() != nullptr)
result = result->outer();
return result;
}
@@ -10849,7 +10854,7 @@ class Environment : public ZoneAllocated {
Value* ValueAtUseIndex(intptr_t index) const {
const Environment* env = this;
while (index >= env->Length()) {
ASSERT(env->outer_ != NULL);
ASSERT(env->outer_ != nullptr);
index -= env->Length();
env = env->outer_;
}
@@ -10969,7 +10974,7 @@ class InstructionVisitor : public ValueObject {
class FlowGraphVisitor : public InstructionVisitor {
public:
explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order)
: current_iterator_(NULL), block_order_(&block_order) {}
: current_iterator_(nullptr), block_order_(&block_order) {}
virtual ~FlowGraphVisitor() {}
ForwardInstructionIterator* current_iterator() const {
@@ -10996,9 +11001,11 @@ class FlowGraphVisitor : public InstructionVisitor {
#define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \
LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
UNIMPLEMENTED(); \
return NULL; \
return nullptr; \
} \
void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
void Name::EmitNativeCode(FlowGraphCompiler* compiler) { \
UNIMPLEMENTED(); \
}
template <intptr_t kExtraInputs>
StringPtr TemplateDartCall<kExtraInputs>::Selector() {
+46 -46
View File
@@ -608,7 +608,7 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// Emit comparison code. This must not overwrite the result register.
// IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
// the labels or returning an invalid condition.
BranchLabels labels = {NULL, NULL, NULL};
BranchLabels labels = {nullptr, nullptr, nullptr};
Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
ASSERT(true_condition != kInvalidCondition);
@@ -1009,18 +1009,18 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
return locs;
}
UNREACHABLE();
return NULL;
return nullptr;
}
static void LoadValueCid(FlowGraphCompiler* compiler,
Register value_cid_reg,
Register value_reg,
compiler::Label* value_is_smi = NULL) {
if (value_is_smi == NULL) {
compiler::Label* value_is_smi = nullptr) {
if (value_is_smi == nullptr) {
__ mov(value_cid_reg, compiler::Operand(kSmiCid));
}
__ tst(value_reg, compiler::Operand(kSmiTagMask));
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ LoadClassId(value_cid_reg, value_reg, NE);
} else {
__ b(value_is_smi, EQ);
@@ -1328,7 +1328,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids)
: NULL;
: nullptr;
const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
const ZoneGrowableArray<intptr_t>& data = cid_results();
@@ -1346,7 +1346,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
__ b(result ? labels.true_label : labels.false_label, EQ);
}
// No match found, deoptimize or default action.
if (deopt == NULL) {
if (deopt == nullptr) {
// If the cid is not in the list, jump to the opposite label from the cids
// that are in the list. These must be all the same (see asserts in the
// constructor).
@@ -1972,7 +1972,7 @@ static bool CanBeImmediateIndex(Value* value,
}
ConstantInstr* constant = value->definition()->AsConstant();
if ((constant == NULL) ||
if ((constant == nullptr) ||
!compiler::Assembler::IsSafeSmi(constant->value())) {
return false;
}
@@ -2312,7 +2312,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
break;
default:
UNREACHABLE();
return NULL;
return nullptr;
}
return locs;
@@ -2560,9 +2560,9 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
compiler::Label* fail = (deopt != NULL) ? deopt : &fail_label;
compiler::Label* fail = (deopt != nullptr) ? deopt : &fail_label;
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle(field().Original()));
@@ -2613,7 +2613,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ b(&ok);
}
if (deopt == NULL) {
if (deopt == nullptr) {
__ Bind(fail);
__ ldr(IP, compiler::FieldAddress(
@@ -2631,7 +2631,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
} else {
ASSERT(compiler->is_optimizing());
ASSERT(deopt != NULL);
ASSERT(deopt != nullptr);
// Field guard class has been initialized and is known.
if (value_cid == kDynamicCid) {
@@ -2699,7 +2699,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
const Register value_reg = locs()->in(0).reg();
@@ -2732,7 +2732,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ ldr(IP, compiler::Address(value_reg, offset_reg));
__ cmp(length_reg, compiler::Operand(IP));
if (deopt == NULL) {
if (deopt == nullptr) {
__ b(&ok, EQ);
__ Push(field_reg);
@@ -3254,7 +3254,7 @@ class CheckStackOverflowSlowPath
}
// pending_deoptimization_env_ is needed to generate a runtime call that
// may throw an exception.
ASSERT(compiler->pending_deoptimization_env_ == NULL);
ASSERT(compiler->pending_deoptimization_env_ == nullptr);
Environment* env =
compiler->SlowPathEnvironmentFor(instruction(), kNumSlowPathArgs);
compiler->pending_deoptimization_env_ = env;
@@ -3283,7 +3283,7 @@ class CheckStackOverflowSlowPath
instruction()->deopt_id(),
InstructionSource());
}
compiler->pending_deoptimization_env_ = NULL;
compiler->pending_deoptimization_env_ = nullptr;
if (!using_shared_stub) {
compiler->RestoreLiveRegisters(instruction()->locs());
}
@@ -3365,7 +3365,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
if (locs.in(1).IsConstant()) {
const Object& constant = locs.in(1).constant();
ASSERT(compiler::target::IsSmi(constant));
@@ -3515,7 +3515,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register left = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3526,7 +3526,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const int32_t imm = compiler::target::ToRawSmi(constant);
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, imm);
} else {
__ AddImmediateSetFlags(result, left, imm);
@@ -3535,7 +3535,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, -imm);
} else {
// Negating imm and using AddImmediateSetFlags would not detect the
@@ -3548,7 +3548,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kMUL: {
// Keep left value tagged and untag right value.
const intptr_t value = compiler::target::SmiValue(constant);
if (deopt == NULL) {
if (deopt == nullptr) {
__ LoadImmediate(IP, value);
__ mul(result, left, IP);
} else {
@@ -3681,7 +3681,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register right = locs()->in(1).reg();
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ add(result, left, compiler::Operand(right));
} else {
__ adds(result, left, compiler::Operand(right));
@@ -3690,7 +3690,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ sub(result, left, compiler::Operand(right));
} else {
__ subs(result, left, compiler::Operand(right));
@@ -3700,7 +3700,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
case Token::kMUL: {
__ SmiUntag(IP, left);
if (deopt == NULL) {
if (deopt == nullptr) {
__ mul(result, IP, right);
} else {
__ smull(result, IP, IP, right);
@@ -3889,7 +3889,7 @@ static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
ASSERT(locs.in(1).IsConstant());
const Object& constant = locs.in(1).constant();
ASSERT(compiler::target::IsSmi(constant));
@@ -3938,7 +3938,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register left = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3949,7 +3949,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const intptr_t value = compiler::target::SmiValue(constant);
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, value);
} else {
__ AddImmediateSetFlags(result, left, value);
@@ -3958,7 +3958,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, -value);
} else {
// Negating value and using AddImmediateSetFlags would not detect the
@@ -3969,7 +3969,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kMUL: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ LoadImmediate(IP, value);
__ mul(result, left, IP);
} else {
@@ -4073,7 +4073,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register right = locs()->in(1).reg();
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ add(result, left, compiler::Operand(right));
} else {
__ adds(result, left, compiler::Operand(right));
@@ -4082,7 +4082,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ sub(result, left, compiler::Operand(right));
} else {
__ subs(result, left, compiler::Operand(right));
@@ -4091,7 +4091,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kMUL: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ mul(result, left, right);
} else {
__ smull(result, IP, left, right);
@@ -4458,7 +4458,7 @@ static void LoadInt32FromMint(FlowGraphCompiler* compiler,
Register temp,
compiler::Label* deopt) {
__ LoadFieldFromOffset(result, mint, compiler::target::Mint::value_offset());
if (deopt != NULL) {
if (deopt != nullptr) {
__ LoadFieldFromOffset(
temp, mint,
compiler::target::Mint::value_offset() + compiler::target::kWordSize);
@@ -4493,8 +4493,8 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger)
: NULL;
compiler::Label* out_of_range = !is_truncating() ? deopt : NULL;
: nullptr;
compiler::Label* out_of_range = !is_truncating() ? deopt : nullptr;
ASSERT(value != out);
if (value_cid == kSmiCid) {
@@ -4504,7 +4504,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (!CanDeoptimize()) {
compiler::Label done;
__ SmiUntag(out, value, &done);
LoadInt32FromMint(compiler, value, out, kNoRegister, NULL);
LoadInt32FromMint(compiler, value, out, kNoRegister, nullptr);
__ Bind(&done);
} else {
compiler::Label done;
@@ -5217,7 +5217,7 @@ LocationSummary* SimdOpInstr::MakeLocationSummary(Zone* zone, bool opt) const {
break;
}
UNREACHABLE();
return NULL;
return nullptr;
}
void SimdOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -5463,7 +5463,7 @@ void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* Int64ToDoubleInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
UNIMPLEMENTED();
return NULL;
return nullptr;
}
void Int64ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -5538,7 +5538,7 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
UNIMPLEMENTED();
return NULL;
return nullptr;
}
void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -6615,7 +6615,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = right_pair->At(1).reg();
// Jump to a slow path if shift is larger than 63 or less than 0.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6628,7 +6628,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByRegister(compiler, op_kind(), out_lo, out_hi, left_lo,
left_hi, right_lo);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6747,7 +6747,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = right_pair->At(1).reg();
// Jump to a slow path if shift count is > 31 or negative.
ShiftUint32OpSlowPath* slow_path = NULL;
ShiftUint32OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange(kUint32ShiftCountLimit)) {
slow_path = new (Z) ShiftUint32OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6760,7 +6760,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftUint32ByRegister(compiler, op_kind(), out, left, right_lo);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -7194,14 +7194,14 @@ LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
// If a constant has more than one use, make sure it is loaded in register
// so that multiple immediate loads can be avoided.
ConstantInstr* constant = left()->definition()->AsConstant();
if ((constant != NULL) && !left()->IsSingleUse()) {
if ((constant != nullptr) && !left()->IsSingleUse()) {
locs->set_in(0, Location::RequiresRegister());
} else {
locs->set_in(0, LocationRegisterOrConstant(left()));
}
constant = right()->definition()->AsConstant();
if ((constant != NULL) && !right()->IsSingleUse()) {
if ((constant != nullptr) && !right()->IsSingleUse()) {
locs->set_in(1, Location::RequiresRegister());
} else {
// Only one of the inputs can be a constant. Choose register if the first
+33 -33
View File
@@ -552,7 +552,7 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// Emit comparison code. This must not overwrite the result register.
// IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
// the labels or returning an invalid condition.
BranchLabels labels = {NULL, NULL, NULL};
BranchLabels labels = {nullptr, nullptr, nullptr};
Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
ASSERT(true_condition != kInvalidCondition);
@@ -1094,7 +1094,7 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
return locs;
}
UNREACHABLE();
return NULL;
return nullptr;
}
static Condition TokenKindToDoubleCondition(Token::Kind kind) {
@@ -1197,7 +1197,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids)
: NULL;
: nullptr;
const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
const ZoneGrowableArray<intptr_t>& data = cid_results();
@@ -1214,7 +1214,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
__ b(result ? labels.true_label : labels.false_label, EQ);
}
// No match found, deoptimize or default action.
if (deopt == NULL) {
if (deopt == nullptr) {
// If the cid is not in the list, jump to the opposite label from the cids
// that are in the list. These must be all the same (see asserts in the
// constructor).
@@ -1256,7 +1256,7 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
}
UNREACHABLE();
return NULL;
return nullptr;
}
Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
@@ -1870,7 +1870,7 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
static bool CanBeImmediateIndex(Value* value, intptr_t cid, bool is_external) {
ConstantInstr* constant = value->definition()->AsConstant();
if ((constant == NULL) || !constant->value().IsSmi()) {
if ((constant == nullptr) || !constant->value().IsSmi()) {
return false;
}
const int64_t index = Smi::Cast(constant->value()).AsInt64Value();
@@ -2125,7 +2125,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
break;
default:
UNREACHABLE();
return NULL;
return nullptr;
}
return locs;
}
@@ -2275,12 +2275,12 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
static void LoadValueCid(FlowGraphCompiler* compiler,
Register value_cid_reg,
Register value_reg,
compiler::Label* value_is_smi = NULL) {
compiler::Label* value_is_smi = nullptr) {
compiler::Label done;
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ LoadImmediate(value_cid_reg, kSmiCid);
}
__ BranchIfSmi(value_reg, value_is_smi == NULL ? &done : value_is_smi);
__ BranchIfSmi(value_reg, value_is_smi == nullptr ? &done : value_is_smi);
__ LoadClassId(value_cid_reg, value_reg);
__ Bind(&done);
}
@@ -2356,9 +2356,9 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
compiler::Label* fail = (deopt != NULL) ? deopt : &fail_label;
compiler::Label* fail = (deopt != nullptr) ? deopt : &fail_label;
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle((field().Original())));
@@ -2413,7 +2413,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ b(&ok);
}
if (deopt == NULL) {
if (deopt == nullptr) {
__ Bind(fail);
__ LoadFieldFromOffset(TMP, field_reg, Field::guarded_cid_offset(),
@@ -2430,7 +2430,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
} else {
ASSERT(compiler->is_optimizing());
ASSERT(deopt != NULL);
ASSERT(deopt != nullptr);
// Field guard class has been initialized and is known.
if (value_cid == kDynamicCid) {
@@ -2491,7 +2491,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
const Register value_reg = locs()->in(0).reg();
@@ -2523,7 +2523,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ LoadCompressedSmi(TMP, compiler::Address(value_reg, offset_reg));
__ CompareObjectRegisters(length_reg, TMP);
if (deopt == NULL) {
if (deopt == nullptr) {
__ b(&ok, EQ);
__ PushPair(value_reg, field_reg);
@@ -2912,7 +2912,7 @@ class CheckStackOverflowSlowPath
}
// pending_deoptimization_env_ is needed to generate a runtime call that
// may throw an exception.
ASSERT(compiler->pending_deoptimization_env_ == NULL);
ASSERT(compiler->pending_deoptimization_env_ == nullptr);
Environment* env =
compiler->SlowPathEnvironmentFor(instruction(), kNumSlowPathArgs);
compiler->pending_deoptimization_env_ = env;
@@ -2954,7 +2954,7 @@ class CheckStackOverflowSlowPath
instruction()->deopt_id(),
InstructionSource());
}
compiler->pending_deoptimization_env_ = NULL;
compiler->pending_deoptimization_env_ = nullptr;
if (!using_shared_stub) {
compiler->RestoreLiveRegisters(locs);
}
@@ -3011,7 +3011,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
if (locs.in(1).IsConstant()) {
const Object& constant = locs.in(1).constant();
ASSERT(constant.IsSmi());
@@ -3149,7 +3149,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register left = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3160,7 +3160,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const int64_t imm = Smi::RawValue(Smi::Cast(constant).Value());
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, imm, compiler::kObjectBytes);
} else {
__ AddImmediateSetFlags(result, left, imm, compiler::kObjectBytes);
@@ -3169,7 +3169,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, -imm);
} else {
// Negating imm and using AddImmediateSetFlags would not detect the
@@ -3188,7 +3188,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
#else
__ smull(result, left, TMP);
#endif
if (deopt != NULL) {
if (deopt != nullptr) {
#if !defined(DART_COMPRESSED_POINTERS)
__ smulh(TMP, left, TMP);
// TMP: result bits 64..127.
@@ -3281,7 +3281,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register right = locs()->in(1).reg();
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ add(result, left, compiler::Operand(right), compiler::kObjectBytes);
} else {
__ adds(result, left, compiler::Operand(right), compiler::kObjectBytes);
@@ -3290,7 +3290,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ sub(result, left, compiler::Operand(right), compiler::kObjectBytes);
} else {
__ subs(result, left, compiler::Operand(right), compiler::kObjectBytes);
@@ -3305,7 +3305,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
#else
__ smull(result, TMP, right);
#endif
if (deopt != NULL) {
if (deopt != nullptr) {
#if !defined(DART_COMPRESSED_POINTERS)
__ smulh(TMP, TMP, right);
// TMP: result bits 64..127.
@@ -3808,7 +3808,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger)
: NULL;
: nullptr;
if (value_cid == kSmiCid) {
__ SmiUntag(out, value);
@@ -3836,7 +3836,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
// TODO(vegorov): as it is implemented right now truncating unboxing would
// leave "garbage" in the higher word.
if (!is_truncating() && (deopt != NULL)) {
if (!is_truncating() && (deopt != nullptr)) {
ASSERT(representation() == kUnboxedInt32);
__ cmp(out, compiler::Operand(out, SXTW, 0));
__ b(deopt, NE);
@@ -4358,7 +4358,7 @@ LocationSummary* SimdOpInstr::MakeLocationSummary(Zone* zone, bool opt) const {
break;
}
UNREACHABLE();
return NULL;
return nullptr;
}
void SimdOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -4711,7 +4711,7 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
UNIMPLEMENTED();
return NULL;
return nullptr;
}
void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -5763,7 +5763,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register shift = locs()->in(1).reg();
// Jump to a slow path if shift is larger than 63 or less than 0.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -5773,7 +5773,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByRegister(compiler, op_kind(), out, left, shift);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6068,7 +6068,7 @@ void IntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register out = locs()->out(0).reg();
compiler::Label* deopt =
!CanDeoptimize()
? NULL
? nullptr
: compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnboxInteger);
if (from() == kUnboxedInt32 && to() == kUnboxedUint32) {
if (CanDeoptimize()) {
+37 -37
View File
@@ -652,19 +652,19 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
return locs;
}
UNREACHABLE();
return NULL;
return nullptr;
}
static void LoadValueCid(FlowGraphCompiler* compiler,
Register value_cid_reg,
Register value_reg,
compiler::Label* value_is_smi = NULL) {
compiler::Label* value_is_smi = nullptr) {
compiler::Label done;
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ movl(value_cid_reg, compiler::Immediate(kSmiCid));
}
__ testl(value_reg, compiler::Immediate(kSmiTagMask));
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ j(ZERO, &done, compiler::Assembler::kNearJump);
} else {
__ j(ZERO, value_is_smi);
@@ -938,7 +938,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids)
: NULL;
: nullptr;
const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
const ZoneGrowableArray<intptr_t>& data = cid_results();
@@ -955,7 +955,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
__ j(EQUAL, result ? labels.true_label : labels.false_label);
}
// No match found, deoptimize or default action.
if (deopt == NULL) {
if (deopt == nullptr) {
// If the cid is not in the list, jump to the opposite label from the cids
// that are in the list. These must be all the same (see asserts in the
// constructor).
@@ -1345,7 +1345,7 @@ void CCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
static bool CanBeImmediateIndex(Value* value, intptr_t cid) {
ConstantInstr* constant = value->definition()->AsConstant();
if ((constant == NULL) ||
if ((constant == nullptr) ||
!compiler::Assembler::IsSafeSmi(constant->value())) {
return false;
}
@@ -1796,7 +1796,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
break;
default:
UNREACHABLE();
return NULL;
return nullptr;
}
return locs;
}
@@ -1994,7 +1994,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField);
}
compiler::Label* fail = (deopt != NULL) ? deopt : &fail_label;
compiler::Label* fail = (deopt != nullptr) ? deopt : &fail_label;
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle(field().Original()));
@@ -2047,7 +2047,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ jmp(&ok);
}
if (deopt == NULL) {
if (deopt == nullptr) {
__ Bind(fail);
__ cmpl(compiler::FieldAddress(field_reg, Field::guarded_cid_offset()),
@@ -2064,7 +2064,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
} else {
ASSERT(compiler->is_optimizing());
ASSERT(deopt != NULL);
ASSERT(deopt != nullptr);
ASSERT(fail == deopt);
// Field guard class has been initialized and is known.
@@ -2131,7 +2131,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
const Register value_reg = locs()->in(0).reg();
@@ -2161,7 +2161,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// why we use Address instead of FieldAddress.
__ cmpl(length_reg, compiler::Address(value_reg, offset_reg, TIMES_1, 0));
if (deopt == NULL) {
if (deopt == nullptr) {
__ j(EQUAL, &ok);
__ pushl(field_reg);
@@ -2534,7 +2534,7 @@ class CheckStackOverflowSlowPath
compiler->SaveLiveRegisters(instruction()->locs());
// pending_deoptimization_env_ is needed to generate a runtime call that
// may throw an exception.
ASSERT(compiler->pending_deoptimization_env_ == NULL);
ASSERT(compiler->pending_deoptimization_env_ == nullptr);
Environment* env = compiler->SlowPathEnvironmentFor(
instruction(), /*num_slow_path_args=*/0);
compiler->pending_deoptimization_env_ = env;
@@ -2551,7 +2551,7 @@ class CheckStackOverflowSlowPath
instruction()->deopt_id(),
InstructionSource());
}
compiler->pending_deoptimization_env_ = NULL;
compiler->pending_deoptimization_env_ = nullptr;
compiler->RestoreLiveRegisters(instruction()->locs());
__ jmp(exit_label());
}
@@ -2603,7 +2603,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
if (locs.in(1).IsConstant()) {
const Object& constant = locs.in(1).constant();
ASSERT(constant.IsSmi());
@@ -2755,7 +2755,7 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
ConstantInstr* right_constant = right()->definition()->AsConstant();
// Shift-by-1 overflow checking can use flags, otherwise we need a temp.
const bool shiftBy1 =
(right_constant != NULL) && IsSmiValue(right_constant->value(), 1);
(right_constant != nullptr) && IsSmiValue(right_constant->value(), 1);
const intptr_t kNumTemps = (can_overflow() && !shiftBy1) ? 1 : 0;
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
@@ -2772,7 +2772,7 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
ConstantInstr* constant = right()->definition()->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
summary->set_in(1, LocationRegisterOrSmiConstant(right()));
} else {
summary->set_in(1, Location::PrefersRegister());
@@ -2810,7 +2810,7 @@ static void EmitIntegerArithmetic(FlowGraphCompiler* compiler,
default:
UNREACHABLE();
}
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
}
void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -2822,7 +2822,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
Register result = locs()->out(0).reg();
ASSERT(left == result);
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3143,10 +3143,10 @@ LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone,
const intptr_t kNumInputs = 2;
if (op_kind() == Token::kTRUNCDIV) {
UNREACHABLE();
return NULL;
return nullptr;
} else if (op_kind() == Token::kMOD) {
UNREACHABLE();
return NULL;
return nullptr;
} else if ((op_kind() == Token::kSHR) || (op_kind() == Token::kUSHR)) {
const intptr_t kNumTemps = 0;
LocationSummary* summary = new (zone)
@@ -3172,7 +3172,7 @@ LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone,
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
ConstantInstr* constant = right()->definition()->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
summary->set_in(1, LocationRegisterOrSmiConstant(right()));
} else {
summary->set_in(1, Location::PrefersRegister());
@@ -3192,7 +3192,7 @@ static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
ASSERT(locs.in(1).IsConstant());
const Object& constant = locs.in(1).constant();
@@ -3223,7 +3223,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
Register result = locs()->out(0).reg();
ASSERT(left == result);
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3354,7 +3354,7 @@ void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kBIT_XOR:
case Token::kADD:
case Token::kSUB:
EmitIntegerArithmetic(compiler, op_kind(), left, right, NULL);
EmitIntegerArithmetic(compiler, op_kind(), left, right, nullptr);
return;
case Token::kMUL:
@@ -3730,7 +3730,7 @@ static void LoadInt32FromMint(FlowGraphCompiler* compiler,
Register temp,
compiler::Label* deopt) {
__ movl(result, lo);
if (deopt != NULL) {
if (deopt != nullptr) {
ASSERT(temp != result);
__ movl(temp, result);
__ sarl(temp, compiler::Immediate(31));
@@ -3748,7 +3748,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger);
}
compiler::Label* out_of_range = !is_truncating() ? deopt : NULL;
compiler::Label* out_of_range = !is_truncating() ? deopt : nullptr;
const intptr_t lo_offset = Mint::value_offset();
const intptr_t hi_offset = Mint::value_offset() + kWordSize;
@@ -3757,7 +3757,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(value == result);
__ SmiUntag(value);
} else if (value_cid == kMintCid) {
ASSERT((value != result) || (out_of_range == NULL));
ASSERT((value != result) || (out_of_range == nullptr));
LoadInt32FromMint(
compiler, result, compiler::FieldAddress(value, lo_offset),
compiler::FieldAddress(value, hi_offset), temp, out_of_range);
@@ -3773,7 +3773,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label done;
__ SmiUntagOrCheckClass(value, kMintCid, temp, &done);
__ j(NOT_EQUAL, deopt);
if (out_of_range != NULL) {
if (out_of_range != nullptr) {
Register value_temp = locs()->temp(1).reg();
__ movl(value_temp, value);
value = value_temp;
@@ -4400,7 +4400,7 @@ LocationSummary* SimdOpInstr::MakeLocationSummary(Zone* zone, bool opt) const {
break;
}
UNREACHABLE();
return NULL;
return nullptr;
}
void SimdOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -5543,7 +5543,7 @@ LocationSummary* BinaryInt64OpInstr::MakeLocationSummary(Zone* zone,
}
default:
UNREACHABLE();
return NULL;
return nullptr;
}
}
@@ -5864,7 +5864,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = locs()->in(1).AsPairLocation()->At(1).reg();
// Jump to a slow path if shift count is > 63 or negative.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -5876,7 +5876,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByECX(compiler, op_kind(), left_lo, left_hi);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -5999,7 +5999,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = locs()->in(1).AsPairLocation()->At(1).reg();
// Jump to a slow path if shift count is > 31 or negative.
ShiftUint32OpSlowPath* slow_path = NULL;
ShiftUint32OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange(kUint32ShiftCountLimit)) {
slow_path = new (Z) ShiftUint32OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6012,7 +6012,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftUint32ByECX(compiler, op_kind(), left);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6375,7 +6375,7 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// Emit comparison code. This must not overwrite the result register.
// IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
// the labels or returning an invalid condition.
BranchLabels labels = {NULL, NULL, NULL};
BranchLabels labels = {nullptr, nullptr, nullptr};
Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
ASSERT(true_condition != kInvalidCondition);
+18 -18
View File
@@ -320,7 +320,7 @@ void FlowGraphPrinter::PrintOneInstruction(Instruction* instr,
char str[4000];
BufferFormatter f(str, sizeof(str));
instr->PrintTo(&f);
if (FLAG_print_environments && (instr->env() != NULL)) {
if (FLAG_print_environments && (instr->env() != nullptr)) {
instr->env()->PrintTo(&f);
}
if (print_locations && (instr->HasLocs())) {
@@ -343,7 +343,7 @@ void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function,
const String& dst_name,
bool eliminated) {
const char* compile_type_name = "unknown";
if (value != NULL && value->reaching_type_ != NULL) {
if (value != nullptr && value->reaching_type_ != nullptr) {
compile_type_name = value->reaching_type_->ToCString();
}
THR_Print(
@@ -527,7 +527,7 @@ void Instruction::PrintTo(BaseTextBuffer* f) const {
void Instruction::PrintOperandsTo(BaseTextBuffer* f) const {
for (int i = 0; i < InputCount(); ++i) {
if (i > 0) f->AddString(", ");
if (InputAt(i) != NULL) InputAt(i)->PrintTo(f);
if (InputAt(i) != nullptr) InputAt(i)->PrintTo(f);
}
}
@@ -541,12 +541,12 @@ void Definition::PrintTo(BaseTextBuffer* f) const {
}
PrintOperandsTo(f);
f->AddString(")");
if (range_ != NULL) {
if (range_ != nullptr) {
f->AddString(" ");
range_->PrintTo(f);
}
if (type_ != NULL) {
if (type_ != nullptr) {
f->AddString(" ");
type_->PrintTo(f);
}
@@ -570,7 +570,7 @@ void CheckNullInstr::PrintOperandsTo(BaseTextBuffer* f) const {
void Definition::PrintOperandsTo(BaseTextBuffer* f) const {
for (int i = 0; i < InputCount(); ++i) {
if (i > 0) f->AddString(", ");
if (InputAt(i) != NULL) {
if (InputAt(i) != nullptr) {
InputAt(i)->PrintTo(f);
}
}
@@ -597,7 +597,7 @@ const char* Value::ToCString() const {
void Value::PrintTo(BaseTextBuffer* f) const {
PrintUse(f, *definition());
if ((reaching_type_ != NULL) && (reaching_type_ != definition()->type_)) {
if ((reaching_type_ != nullptr) && (reaching_type_ != definition()->type_)) {
f->AddString(" ");
reaching_type_->PrintTo(f);
}
@@ -606,7 +606,7 @@ void Value::PrintTo(BaseTextBuffer* f) const {
void ConstantInstr::PrintOperandsTo(BaseTextBuffer* f) const {
const char* cstr = value().ToCString();
const char* new_line = strchr(cstr, '\n');
if (new_line == NULL) {
if (new_line == nullptr) {
f->Printf("#%s", cstr);
} else {
const intptr_t pos = new_line - cstr;
@@ -636,7 +636,7 @@ void Range::PrintTo(BaseTextBuffer* f) const {
}
const char* Range::ToCString(const Range* range) {
if (range == NULL) return "[_|_, _|_]";
if (range == nullptr) return "[_|_, _|_]";
char buffer[256];
BufferFormatter f(buffer, sizeof(buffer));
@@ -677,7 +677,7 @@ void MakeTempInstr::PrintOperandsTo(BaseTextBuffer* f) const {}
void DropTempsInstr::PrintOperandsTo(BaseTextBuffer* f) const {
f->Printf("%" Pd "", num_temps());
if (value() != NULL) {
if (value() != nullptr) {
f->AddString(", ");
value()->PrintTo(f);
}
@@ -1134,10 +1134,10 @@ void JoinEntryInstr::PrintTo(BaseTextBuffer* f) const {
f->Printf("B%" Pd, predecessors_[i]->block_id());
}
f->AddString(")");
if (phis_ != NULL) {
if (phis_ != nullptr) {
f->AddString(" {");
for (intptr_t i = 0; i < phis_->length(); ++i) {
if ((*phis_)[i] == NULL) continue;
if ((*phis_)[i] == nullptr) continue;
f->AddString("\n ");
(*phis_)[i]->PrintTo(f);
}
@@ -1160,10 +1160,10 @@ void IndirectEntryInstr::PrintTo(BaseTextBuffer* f) const {
f->Printf("B%" Pd, predecessors_[i]->block_id());
}
f->AddString(")");
if (phis_ != NULL) {
if (phis_ != nullptr) {
f->AddString(" {");
for (intptr_t i = 0; i < phis_->length(); ++i) {
if ((*phis_)[i] == NULL) continue;
if ((*phis_)[i] == nullptr) continue;
f->AddString("\n ");
(*phis_)[i]->PrintTo(f);
}
@@ -1178,12 +1178,12 @@ void IndirectEntryInstr::PrintTo(BaseTextBuffer* f) const {
void PhiInstr::PrintTo(BaseTextBuffer* f) const {
f->Printf("v%" Pd " <- phi(", ssa_temp_index());
for (intptr_t i = 0; i < inputs_.length(); ++i) {
if (inputs_[i] != NULL) inputs_[i]->PrintTo(f);
if (inputs_[i] != nullptr) inputs_[i]->PrintTo(f);
if (i < inputs_.length() - 1) f->AddString(", ");
}
f->AddString(")");
f->AddString(is_alive() ? " alive" : " dead");
if (range_ != NULL) {
if (range_ != nullptr) {
f->AddString(" ");
range_->PrintTo(f);
}
@@ -1492,14 +1492,14 @@ void Environment::PrintTo(BaseTextBuffer* f) const {
} else {
values_[i]->PrintTo(f);
}
if ((locations_ != NULL) && !locations_[i].IsInvalid()) {
if ((locations_ != nullptr) && !locations_[i].IsInvalid()) {
f->AddString(" [");
locations_[i].PrintTo(f);
f->AddString("]");
}
}
f->AddString(" }");
if (outer_ != NULL) outer_->PrintTo(f);
if (outer_ != nullptr) outer_->PrintTo(f);
}
const char* Environment::ToCString() const {
+50 -50
View File
@@ -554,7 +554,7 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// Emit comparison code. This must not overwrite the result register.
// IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
// the labels or returning an invalid condition.
BranchLabels labels = {NULL, NULL, NULL};
BranchLabels labels = {nullptr, nullptr, nullptr};
Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
ASSERT(true_condition != kInvalidCondition);
@@ -1168,7 +1168,7 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
return locs;
}
UNREACHABLE();
return NULL;
return nullptr;
}
static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
@@ -1277,7 +1277,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids)
: NULL;
: nullptr;
const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
const ZoneGrowableArray<intptr_t>& data = cid_results();
@@ -1294,7 +1294,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
__ BranchIf(EQ, result ? labels.true_label : labels.false_label);
}
// No match found, deoptimize or default action.
if (deopt == NULL) {
if (deopt == nullptr) {
// If the cid is not in the list, jump to the opposite label from the cids
// that are in the list. These must be all the same (see asserts in the
// constructor).
@@ -1348,7 +1348,7 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
}
UNREACHABLE();
return NULL;
return nullptr;
}
Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
@@ -2034,7 +2034,7 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
static bool CanBeImmediateIndex(Value* value, intptr_t cid, bool is_external) {
ConstantInstr* constant = value->definition()->AsConstant();
if ((constant == NULL) || !constant->value().IsSmi()) {
if ((constant == nullptr) || !constant->value().IsSmi()) {
return false;
}
const int64_t index = Smi::Cast(constant->value()).AsInt64Value();
@@ -2383,7 +2383,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
break;
default:
UNREACHABLE();
return NULL;
return nullptr;
}
return locs;
}
@@ -2561,12 +2561,12 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
static void LoadValueCid(FlowGraphCompiler* compiler,
Register value_cid_reg,
Register value_reg,
compiler::Label* value_is_smi = NULL) {
compiler::Label* value_is_smi = nullptr) {
compiler::Label done;
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ LoadImmediate(value_cid_reg, kSmiCid);
}
__ BranchIfSmi(value_reg, value_is_smi == NULL ? &done : value_is_smi,
__ BranchIfSmi(value_reg, value_is_smi == nullptr ? &done : value_is_smi,
compiler::Assembler::kNearJump);
__ LoadClassId(value_cid_reg, value_reg);
__ Bind(&done);
@@ -2643,9 +2643,9 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
compiler::Label* fail = (deopt != NULL) ? deopt : &fail_label;
compiler::Label* fail = (deopt != nullptr) ? deopt : &fail_label;
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle((field().Original())));
@@ -2698,7 +2698,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ j(&ok, compiler::Assembler::kNearJump);
}
if (deopt == NULL) {
if (deopt == nullptr) {
__ Bind(fail);
__ LoadFieldFromOffset(TMP, field_reg, Field::guarded_cid_offset(),
@@ -2715,7 +2715,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
} else {
ASSERT(compiler->is_optimizing());
ASSERT(deopt != NULL);
ASSERT(deopt != nullptr);
// Field guard class has been initialized and is known.
if (value_cid == kDynamicCid) {
@@ -2776,7 +2776,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
const Register value_reg = locs()->in(0).reg();
@@ -2807,7 +2807,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ lx(TMP, compiler::Address(TMP, 0));
__ CompareObjectRegisters(length_reg, TMP);
if (deopt == NULL) {
if (deopt == nullptr) {
__ BranchIf(EQ, &ok, compiler::Assembler::kNearJump);
__ PushRegisterPair(value_reg, field_reg);
@@ -3193,7 +3193,7 @@ class CheckStackOverflowSlowPath
}
// pending_deoptimization_env_ is needed to generate a runtime call that
// may throw an exception.
ASSERT(compiler->pending_deoptimization_env_ == NULL);
ASSERT(compiler->pending_deoptimization_env_ == nullptr);
Environment* env =
compiler->SlowPathEnvironmentFor(instruction(), kNumSlowPathArgs);
compiler->pending_deoptimization_env_ = env;
@@ -3235,7 +3235,7 @@ class CheckStackOverflowSlowPath
instruction()->deopt_id(),
InstructionSource());
}
compiler->pending_deoptimization_env_ = NULL;
compiler->pending_deoptimization_env_ = nullptr;
if (!using_shared_stub) {
compiler->RestoreLiveRegisters(locs);
}
@@ -3291,7 +3291,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
if (locs.in(1).IsConstant()) {
const Object& constant = locs.in(1).constant();
ASSERT(constant.IsSmi());
@@ -3415,7 +3415,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register left = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3426,7 +3426,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const intx_t imm = static_cast<intx_t>(constant.ptr());
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, imm);
} else {
__ AddImmediateBranchOverflow(result, left, imm, deopt);
@@ -3434,7 +3434,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, -imm);
} else {
// Negating imm and using AddImmediateSetFlags would not detect the
@@ -3446,7 +3446,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kMUL: {
// Keep left value tagged and untag right value.
const intptr_t value = Smi::Cast(constant).Value();
if (deopt == NULL) {
if (deopt == nullptr) {
__ LoadImmediate(TMP, value);
__ mul(result, left, TMP);
} else {
@@ -3565,7 +3565,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register right = locs()->in(1).reg();
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ add(result, left, right);
} else if (RangeUtils::IsPositive(right_range())) {
ASSERT(result != left);
@@ -3581,7 +3581,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ sub(result, left, right);
} else if (RangeUtils::IsPositive(right_range())) {
ASSERT(result != left);
@@ -3599,7 +3599,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kMUL: {
const Register temp = locs()->temp(0).reg();
__ SmiUntag(temp, left);
if (deopt == NULL) {
if (deopt == nullptr) {
__ mul(result, temp, right);
} else {
__ MultiplyBranchOverflow(result, temp, right, deopt);
@@ -4228,7 +4228,7 @@ static void LoadInt32FromMint(FlowGraphCompiler* compiler,
Register result,
compiler::Label* deopt) {
__ LoadFieldFromOffset(result, mint, compiler::target::Mint::value_offset());
if (deopt != NULL) {
if (deopt != nullptr) {
__ LoadFieldFromOffset(
TMP, mint,
compiler::target::Mint::value_offset() + compiler::target::kWordSize);
@@ -4257,8 +4257,8 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger)
: NULL;
compiler::Label* out_of_range = !is_truncating() ? deopt : NULL;
: nullptr;
compiler::Label* out_of_range = !is_truncating() ? deopt : nullptr;
ASSERT(value != out);
if (value_cid == kSmiCid) {
@@ -4269,7 +4269,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label done;
__ SmiUntag(out, value);
__ BranchIfSmi(value, &done, compiler::Assembler::kNearJump);
LoadInt32FromMint(compiler, value, out, NULL);
LoadInt32FromMint(compiler, value, out, nullptr);
__ Bind(&done);
} else {
compiler::Label done;
@@ -4287,7 +4287,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger)
: NULL;
: nullptr;
if (value_cid == kSmiCid) {
__ SmiUntag(out, value);
@@ -4315,7 +4315,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
// TODO(vegorov): as it is implemented right now truncating unboxing would
// leave "garbage" in the higher word.
if (!is_truncating() && (deopt != NULL)) {
if (!is_truncating() && (deopt != nullptr)) {
ASSERT(representation() == kUnboxedInt32);
__ sextw(TMP, out);
__ bne(TMP, out, deopt);
@@ -4592,7 +4592,7 @@ LocationSummary* SimdOpInstr::MakeLocationSummary(Zone* zone, bool opt) const {
break;
}
UNREACHABLE();
return NULL;
return nullptr;
}
void SimdOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -4826,7 +4826,7 @@ LocationSummary* Int64ToDoubleInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
#if XLEN == 32
UNIMPLEMENTED();
return NULL;
return nullptr;
#else
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
@@ -4931,7 +4931,7 @@ void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
UNIMPLEMENTED();
return NULL;
return nullptr;
}
void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -6259,7 +6259,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = right_pair->At(1).reg();
// Jump to a slow path if shift is larger than 63 or less than 0.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6272,7 +6272,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByRegister(compiler, op_kind(), out_lo, out_hi, left_lo,
left_hi, right_lo);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6289,7 +6289,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register shift = locs()->in(1).reg();
// Jump to a slow path if shift is larger than 63 or less than 0.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6299,7 +6299,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByRegister(compiler, op_kind(), out, left, shift);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6475,7 +6475,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register right_hi = right_pair->At(1).reg();
// Jump to a slow path if shift count is > 31 or negative.
ShiftUint32OpSlowPath* slow_path = NULL;
ShiftUint32OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange(kUint32ShiftCountLimit)) {
slow_path = new (Z) ShiftUint32OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6488,7 +6488,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftUint32ByRegister(compiler, op_kind(), out, left, right_lo);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6719,7 +6719,7 @@ static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
ASSERT(locs.in(1).IsConstant());
const Object& constant = locs.in(1).constant();
ASSERT(compiler::target::IsSmi(constant));
@@ -6765,7 +6765,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register left = locs()->in(0).reg();
const Register result = locs()->out(0).reg();
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -6776,7 +6776,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const intptr_t value = compiler::target::SmiValue(constant);
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, value);
} else {
__ AddImmediateBranchOverflow(result, left, value, deopt);
@@ -6784,7 +6784,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ AddImmediate(result, left, -value);
} else {
// Negating value and using AddImmediateSetFlags would not detect the
@@ -6796,7 +6796,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case Token::kMUL: {
const Register right = locs()->temp(0).reg();
__ LoadImmediate(right, value);
if (deopt == NULL) {
if (deopt == nullptr) {
__ mul(result, left, right);
} else {
__ MultiplyBranchOverflow(result, left, right, deopt);
@@ -6839,7 +6839,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register right = locs()->in(1).reg();
switch (op_kind()) {
case Token::kADD: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ add(result, left, right);
} else {
__ AddBranchOverflow(result, left, right, deopt);
@@ -6847,7 +6847,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kSUB: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ sub(result, left, right);
} else {
__ SubtractBranchOverflow(result, left, right, deopt);
@@ -6855,7 +6855,7 @@ void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
}
case Token::kMUL: {
if (deopt == NULL) {
if (deopt == nullptr) {
__ mul(result, left, right);
} else {
__ MultiplyBranchOverflow(result, left, right, deopt);
@@ -7017,7 +7017,7 @@ void IntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register out = locs()->out(0).reg();
compiler::Label* deopt =
!CanDeoptimize()
? NULL
? nullptr
: compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnboxInteger);
if (from() == kUnboxedInt32 && to() == kUnboxedUint32) {
if (CanDeoptimize()) {
+43 -43
View File
@@ -532,7 +532,7 @@ void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
// Emit comparison code. This must not overwrite the result register.
// IfThenElseInstr::Supports() should prevent EmitComparisonCode from using
// the labels or returning an invalid condition.
BranchLabels labels = {NULL, NULL, NULL};
BranchLabels labels = {nullptr, nullptr, nullptr};
Condition true_condition = comparison()->EmitComparisonCode(compiler, labels);
ASSERT(true_condition != kInvalidCondition);
@@ -831,19 +831,19 @@ LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone,
return locs;
}
UNREACHABLE();
return NULL;
return nullptr;
}
static void LoadValueCid(FlowGraphCompiler* compiler,
Register value_cid_reg,
Register value_reg,
compiler::Label* value_is_smi = NULL) {
compiler::Label* value_is_smi = nullptr) {
compiler::Label done;
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ LoadImmediate(value_cid_reg, compiler::Immediate(kSmiCid));
}
__ testq(value_reg, compiler::Immediate(kSmiTagMask));
if (value_is_smi == NULL) {
if (value_is_smi == nullptr) {
__ j(ZERO, &done, compiler::Assembler::kNearJump);
} else {
__ j(ZERO, value_is_smi);
@@ -911,7 +911,7 @@ static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler,
Condition true_condition = TokenKindToIntCondition(kind);
if (left.IsConstant() || right.IsConstant()) {
// Ensure constant is on the right.
ConstantInstr* constant = NULL;
ConstantInstr* constant = nullptr;
if (left.IsConstant()) {
constant = left.constant_instruction();
Location tmp = right;
@@ -949,7 +949,7 @@ static Condition EmitInt64ComparisonOp(FlowGraphCompiler* compiler,
Condition true_condition = TokenKindToIntCondition(kind);
if (left.IsConstant() || right.IsConstant()) {
// Ensure constant is on the right.
ConstantInstr* constant = NULL;
ConstantInstr* constant = nullptr;
if (left.IsConstant()) {
constant = left.constant_instruction();
Location tmp = right;
@@ -1137,7 +1137,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids)
: NULL;
: nullptr;
const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
const ZoneGrowableArray<intptr_t>& data = cid_results();
@@ -1154,7 +1154,7 @@ Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
__ j(EQUAL, result ? labels.true_label : labels.false_label);
}
// No match found, deoptimize or default action.
if (deopt == NULL) {
if (deopt == nullptr) {
// If the cid is not in the list, jump to the opposite label from the cids
// that are in the list. These must be all the same (see asserts in the
// constructor).
@@ -1195,7 +1195,7 @@ LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone,
return summary;
}
UNREACHABLE();
return NULL;
return nullptr;
}
Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
@@ -2120,7 +2120,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone,
break;
default:
UNREACHABLE();
return NULL;
return nullptr;
}
return locs;
}
@@ -2318,12 +2318,12 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label ok, fail_label;
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (compiler->is_optimizing()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField);
}
compiler::Label* fail = (deopt != NULL) ? deopt : &fail_label;
compiler::Label* fail = (deopt != nullptr) ? deopt : &fail_label;
if (emit_full_guard) {
__ LoadObject(field_reg, Field::ZoneHandle(field().Original()));
@@ -2372,7 +2372,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ jmp(&ok);
}
if (deopt == NULL) {
if (deopt == nullptr) {
__ Bind(fail);
__ cmpl(compiler::FieldAddress(field_reg, Field::guarded_cid_offset()),
@@ -2389,7 +2389,7 @@ void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
} else {
ASSERT(compiler->is_optimizing());
ASSERT(deopt != NULL);
ASSERT(deopt != nullptr);
// Field guard class has been initialized and is known.
if (value_cid == kDynamicCid) {
@@ -2450,7 +2450,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
const Register value_reg = locs()->in(0).reg();
@@ -2482,7 +2482,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ OBJ(cmp)(length_reg,
compiler::Address(value_reg, offset_reg, TIMES_1, 0));
if (deopt == NULL) {
if (deopt == nullptr) {
__ j(EQUAL, &ok);
__ pushq(field_reg);
@@ -2533,7 +2533,7 @@ void GuardFieldTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
compiler->is_optimizing()
? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptGuardField)
: NULL;
: nullptr;
compiler::Label ok;
@@ -2959,7 +2959,7 @@ class CheckStackOverflowSlowPath
}
// pending_deoptimization_env_ is needed to generate a runtime call that
// may throw an exception.
ASSERT(compiler->pending_deoptimization_env_ == NULL);
ASSERT(compiler->pending_deoptimization_env_ == nullptr);
Environment* env =
compiler->SlowPathEnvironmentFor(instruction(), kNumSlowPathArgs);
compiler->pending_deoptimization_env_ = env;
@@ -2988,7 +2988,7 @@ class CheckStackOverflowSlowPath
instruction()->deopt_id(),
InstructionSource());
}
compiler->pending_deoptimization_env_ = NULL;
compiler->pending_deoptimization_env_ = nullptr;
if (!using_shared_stub) {
compiler->RestoreLiveRegisters(instruction()->locs());
}
@@ -3042,7 +3042,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
shift_left->CanDeoptimize()
? compiler->AddDeoptStub(shift_left->deopt_id(),
ICData::kDeoptBinarySmiOp)
: NULL;
: nullptr;
if (locs.in(1).IsConstant()) {
const Object& constant = locs.in(1).constant();
ASSERT(constant.IsSmi());
@@ -3108,7 +3108,7 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
if (!shift_left->can_overflow()) {
if (right_needs_check) {
const bool right_may_be_negative =
(right_range == NULL) || !right_range->IsPositive();
(right_range == nullptr) || !right_range->IsPositive();
if (right_may_be_negative) {
ASSERT(shift_left->CanDeoptimize());
__ CompareImmediate(right, compiler::Immediate(0),
@@ -3165,7 +3165,7 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
const intptr_t kNumInputs = 2;
ConstantInstr* right_constant = right()->definition()->AsConstant();
if ((right_constant != NULL) && (op_kind() != Token::kTRUNCDIV) &&
if ((right_constant != nullptr) && (op_kind() != Token::kTRUNCDIV) &&
(op_kind() != Token::kSHL) &&
#if defined(DART_COMPRESSED_POINTERS)
(op_kind() != Token::kUSHR) &&
@@ -3242,7 +3242,7 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
} else if (op_kind() == Token::kSHL) {
// Shift-by-1 overflow checking can use flags, otherwise we need a temp.
const bool shiftBy1 =
(right_constant != NULL) && IsSmiValue(right_constant->value(), 1);
(right_constant != nullptr) && IsSmiValue(right_constant->value(), 1);
const intptr_t kNumTemps = (can_overflow() && !shiftBy1) ? 1 : 0;
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
@@ -3259,7 +3259,7 @@ LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
ConstantInstr* constant = right()->definition()->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
summary->set_in(1, LocationRegisterOrSmiConstant(right()));
} else {
summary->set_in(1, Location::PrefersRegister());
@@ -3278,7 +3278,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
Register result = locs()->out(0).reg();
ASSERT(left == result);
compiler::Label* deopt = NULL;
compiler::Label* deopt = nullptr;
if (CanDeoptimize()) {
deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
}
@@ -3290,12 +3290,12 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
switch (op_kind()) {
case Token::kADD: {
__ AddImmediate(left, compiler::Immediate(imm), compiler::kObjectBytes);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kSUB: {
__ SubImmediate(left, compiler::Immediate(imm), compiler::kObjectBytes);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kMUL: {
@@ -3303,7 +3303,7 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const intptr_t value = Smi::Cast(constant).Value();
__ MulImmediate(left, compiler::Immediate(value),
compiler::kObjectBytes);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kTRUNCDIV: {
@@ -3399,18 +3399,18 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
switch (op_kind()) {
case Token::kADD: {
__ OBJ(add)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kSUB: {
__ OBJ(sub)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kMUL: {
__ SmiUntag(left);
__ OBJ(imul)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kBIT_AND: {
@@ -3440,18 +3440,18 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
switch (op_kind()) {
case Token::kADD: {
__ OBJ(add)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kSUB: {
__ OBJ(sub)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kMUL: {
__ SmiUntag(left);
__ OBJ(imul)(left, right);
if (deopt != NULL) __ j(OVERFLOW, deopt);
if (deopt != nullptr) __ j(OVERFLOW, deopt);
break;
}
case Token::kBIT_AND: {
@@ -3925,7 +3925,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label* deopt =
CanDeoptimize()
? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger)
: NULL;
: nullptr;
ASSERT(value == locs()->out(0).reg());
if (value_cid == kSmiCid) {
@@ -3985,7 +3985,7 @@ void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
// TODO(vegorov): as it is implemented right now truncating unboxing would
// leave "garbage" in the higher word.
if (!is_truncating() && (deopt != NULL)) {
if (!is_truncating() && (deopt != nullptr)) {
ASSERT(representation() == kUnboxedInt32);
Register temp = locs()->temp(0).reg();
__ movsxd(temp, value);
@@ -4635,7 +4635,7 @@ LocationSummary* SimdOpInstr::MakeLocationSummary(Zone* zone, bool opt) const {
break;
}
UNREACHABLE();
return NULL;
return nullptr;
}
void SimdOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
@@ -5361,7 +5361,7 @@ void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ cmpq(RDX, compiler::Immediate(0));
__ j(GREATER_EQUAL, &all_done, compiler::Assembler::kNearJump);
// Result is negative, adjust it.
if ((divisor_range() == NULL) || divisor_range()->Overlaps(-1, 1)) {
if ((divisor_range() == nullptr) || divisor_range()->Overlaps(-1, 1)) {
compiler::Label subtract;
__ cmpq(right, compiler::Immediate(0));
__ j(LESS, &subtract, compiler::Assembler::kNearJump);
@@ -6209,7 +6209,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(locs()->in(1).reg() == RCX);
// Jump to a slow path if shift count is > 63 or negative.
ShiftInt64OpSlowPath* slow_path = NULL;
ShiftInt64OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange()) {
slow_path = new (Z) ShiftInt64OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6220,7 +6220,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftInt64ByRCX(compiler, op_kind(), left);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
@@ -6325,7 +6325,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
ASSERT(locs()->in(1).reg() == RCX);
// Jump to a slow path if shift count is > 31 or negative.
ShiftUint32OpSlowPath* slow_path = NULL;
ShiftUint32OpSlowPath* slow_path = nullptr;
if (!IsShiftCountInRange(kUint32ShiftCountLimit)) {
slow_path = new (Z) ShiftUint32OpSlowPath(this);
compiler->AddSlowPathCode(slow_path);
@@ -6336,7 +6336,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
EmitShiftUint32ByRCX(compiler, op_kind(), left);
if (slow_path != NULL) {
if (slow_path != nullptr) {
__ Bind(slow_path->exit_label());
}
}
+77 -70
View File
@@ -33,7 +33,7 @@ DEFINE_FLAG(int,
12,
"How many times we allow deoptimization before we stop inlining.");
DEFINE_FLAG(bool, trace_inlining, false, "Trace inlining");
DEFINE_FLAG(charp, inlining_filter, NULL, "Inline only in named function");
DEFINE_FLAG(charp, inlining_filter, nullptr, "Inline only in named function");
// Flags for inlining heuristics.
DEFINE_FLAG(int,
@@ -112,7 +112,7 @@ static bool IsSmiValue(Value* val, intptr_t* int_val) {
// Test if a call is recursive by looking in the deoptimization environment.
static bool IsCallRecursive(const Function& function, Definition* call) {
Environment* env = call->env();
while (env != NULL) {
while (env != nullptr) {
if (function.ptr() == env->function().ptr()) {
return true;
}
@@ -402,7 +402,7 @@ class CallSites : public ValueObject {
for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
it.Advance()) {
Instruction* current = it.Current();
Definition* call = NULL;
Definition* call = nullptr;
if (current->IsPolymorphicInstanceCall()) {
PolymorphicInstanceCallInstr* instance_call =
current->AsPolymorphicInstanceCall();
@@ -415,7 +415,7 @@ class CallSites : public ValueObject {
} else if (current->IsClosureCall()) {
// TODO(srdjan): Add data for closure calls.
}
if (call != NULL) {
if (call != nullptr) {
inlined_info->Add(
InlinedInfo(caller, &target, depth + 1, call, "Too deep"));
}
@@ -563,7 +563,7 @@ class CallSites : public ValueObject {
intptr_t depth,
GrowableArray<InlinedInfo>* inlined_info) {
COMPILER_TIMINGS_TIMER_SCOPE(graph->thread(), FindCallSites);
ASSERT(graph != NULL);
ASSERT(graph != nullptr);
if (depth > inlining_depth_threshold_) {
if (FLAG_print_inlining_tree) {
RecordAllNotInlinedFunction(graph, depth, inlined_info);
@@ -737,9 +737,9 @@ struct InlinedCallData {
arguments_descriptor(arguments_descriptor),
first_arg_index(first_arg_index),
arguments(arguments),
callee_graph(NULL),
parameter_stubs(NULL),
exit_collector(NULL),
callee_graph(nullptr),
parameter_stubs(nullptr),
exit_collector(nullptr),
caller(caller) {}
Definition* call;
@@ -864,7 +864,7 @@ static void ReplaceParameterStubs(Zone* zone,
const bool is_polymorphic = call_data->call->IsPolymorphicInstanceCall();
const bool no_checks =
IsAThisCallThroughAnUncheckedEntryPoint(call_data->call);
ASSERT(is_polymorphic == (target_info != NULL));
ASSERT(is_polymorphic == (target_info != nullptr));
FlowGraph* callee_graph = call_data->callee_graph;
auto callee_entry = callee_graph->graph_entry()->normal_entry();
const Function& callee = callee_graph->function();
@@ -1031,8 +1031,8 @@ class CallSiteInliner : public ValueObject {
inlining_depth_(1),
inlining_recursion_depth_(0),
inlining_depth_threshold_(threshold),
collected_call_sites_(NULL),
inlining_call_sites_(NULL),
collected_call_sites_(nullptr),
inlining_call_sites_(nullptr),
function_cache_(),
inlined_info_() {}
@@ -1102,7 +1102,7 @@ class CallSiteInliner : public ValueObject {
GrowableArray<CallSites::CallInfo<InstanceCallInstr>> calls;
CallSites sites1(inlining_depth_threshold_, &calls);
CallSites sites2(inlining_depth_threshold_, &calls);
CallSites* call_sites_temp = NULL;
CallSites* call_sites_temp = nullptr;
collected_call_sites_ = &sites1;
inlining_call_sites_ = &sites2;
// Collect initial call sites.
@@ -1141,8 +1141,8 @@ class CallSiteInliner : public ValueObject {
}
}
collected_call_sites_ = NULL;
inlining_call_sites_ = NULL;
collected_call_sites_ = nullptr;
inlining_call_sites_ = nullptr;
}
bool inlined() const { return inlined_; }
@@ -1157,7 +1157,7 @@ class CallSiteInliner : public ValueObject {
Value* argument,
FlowGraph* graph) {
ConstantInstr* constant = argument->definition()->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
return graph->GetConstant(constant->value());
} else {
ParameterInstr* param =
@@ -1362,7 +1362,7 @@ class CallSiteInliner : public ValueObject {
// Closure functions only have one entry point.
}
kernel::FlowGraphBuilder builder(
parsed_function, ic_data_array, /* not building var desc */ NULL,
parsed_function, ic_data_array, /* not building var desc */ nullptr,
exit_collector,
/* optimized = */ true, Compiler::kNoOSRDeoptId,
caller_graph_->max_block_id() + 1,
@@ -1635,7 +1635,7 @@ class CallSiteInliner : public ValueObject {
TRACE_INLINING(THR_Print(
" with reason %s, code size %" Pd ", call sites: %" Pd "\n",
decision.reason, instruction_count, call_site_count));
PRINT_INLINING_TREE(NULL, &call_data->caller, &function, call);
PRINT_INLINING_TREE(nullptr, &call_data->caller, &function, call);
return true;
} else {
error = thread()->StealStickyError();
@@ -1696,7 +1696,7 @@ class CallSiteInliner : public ValueObject {
// Print those that were inlined.
for (intptr_t i = 0; i < inlined_info_.length(); i++) {
const InlinedInfo& info = inlined_info_[i];
if (info.bailout_reason != NULL) {
if (info.bailout_reason != nullptr) {
continue;
}
if ((info.inlined_depth == depth) &&
@@ -1715,7 +1715,7 @@ class CallSiteInliner : public ValueObject {
// Print those that were not inlined.
for (intptr_t i = 0; i < inlined_info_.length(); i++) {
const InlinedInfo& info = inlined_info_[i];
if (info.bailout_reason == NULL) {
if (info.bailout_reason == nullptr) {
continue;
}
if ((info.inlined_depth == depth) &&
@@ -1739,7 +1739,7 @@ class CallSiteInliner : public ValueObject {
// Plug result in the caller graph.
InlineExitCollector* exit_collector = call_data->exit_collector;
exit_collector->PrepareGraphs(callee_graph);
ReplaceParameterStubs(zone(), caller_graph_, call_data, NULL);
ReplaceParameterStubs(zone(), caller_graph_, call_data, nullptr);
exit_collector->ReplaceCall(callee_function_entry);
ASSERT(!call_data->call->HasMoveArguments());
@@ -1777,7 +1777,7 @@ class CallSiteInliner : public ValueObject {
StaticCallInstr* call = call_info[call_idx].call;
if (FlowGraphInliner::TryReplaceStaticCallWithInline(
inliner_->flow_graph(), NULL, call,
inliner_->flow_graph(), nullptr, call,
inliner_->speculative_policy_)) {
inlined = true;
continue;
@@ -1930,7 +1930,7 @@ class CallSiteInliner : public ValueObject {
const Instance& object =
parsed_function.DefaultParameterValueAt(i - fixed_param_count);
ConstantInstr* constant = callee_graph->GetConstant(object);
arguments->Add(NULL);
arguments->Add(nullptr);
param_stubs->Add(constant);
}
return true;
@@ -1948,7 +1948,7 @@ class CallSiteInliner : public ValueObject {
for (intptr_t i = 0; i < param_count - fixed_param_count; ++i) {
const Instance& object = parsed_function.DefaultParameterValueAt(i);
ConstantInstr* constant = callee_graph->GetConstant(object);
arguments->Add(NULL);
arguments->Add(nullptr);
param_stubs->Add(constant);
}
return true;
@@ -1972,7 +1972,7 @@ class CallSiteInliner : public ValueObject {
for (intptr_t i = fixed_param_count; i < param_count; ++i) {
String& param_name = String::Handle(function.ParameterNameAt(i));
// Search for and add the named argument.
Value* arg = NULL;
Value* arg = nullptr;
for (intptr_t j = 0; j < named_args.length(); ++j) {
if (param_name.Equals(*named_args[j].name)) {
arg = named_args[j].value;
@@ -1982,7 +1982,7 @@ class CallSiteInliner : public ValueObject {
}
arguments->Add(arg);
// Create a stub for the argument or use the parameter's default value.
if (arg != NULL) {
if (arg != nullptr) {
param_stubs->Add(CreateParameterStub(i, arg, callee_graph));
} else {
const Instance& object =
@@ -2276,7 +2276,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// already constructed a join and set its dominator. Add a jump to
// the join.
JoinEntryInstr* join = callee_entry->AsJoinEntry();
ASSERT(join->dominator() != NULL);
ASSERT(join->dominator() != nullptr);
GotoInstr* goto_join = new GotoInstr(join, DeoptId::kNone);
goto_join->InheritDeoptTarget(zone(), join);
cursor->LinkTo(goto_join);
@@ -2286,7 +2286,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// shared inlined body) because this is the last inlined entry.
UNREACHABLE();
}
cursor = NULL;
cursor = nullptr;
} else {
// For all variants except the last, use a branch on the loaded class
// id.
@@ -2296,7 +2296,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
const Smi& cid = Smi::ZoneHandle(Smi::New(variant.cid_start));
ConstantInstr* cid_constant = owner_->caller_graph()->GetConstant(cid);
BranchInstr* branch;
BranchInstr* upper_limit_branch = NULL;
BranchInstr* upper_limit_branch = nullptr;
BlockEntryInstr* cid_test_entry_block = current_block;
if (test_is_range) {
// Double branch for testing a range of Cids.
@@ -2343,7 +2343,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// cases (unshared, shared first predecessor, and shared subsequent
// predecessors).
BlockEntryInstr* callee_entry = inlined_entries_[i];
TargetEntryInstr* true_target = NULL;
TargetEntryInstr* true_target = nullptr;
if (callee_entry->IsGraphEntry()) {
// Unshared.
auto graph_entry = callee_entry->AsGraphEntry();
@@ -2371,8 +2371,8 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// already constructed a join. We need a fresh target that jumps to
// the join.
JoinEntryInstr* join = callee_entry->AsJoinEntry();
ASSERT(join != NULL);
ASSERT(join->dominator() != NULL);
ASSERT(join != nullptr);
ASSERT(join->dominator() != nullptr);
true_target =
new TargetEntryInstr(AllocateBlockId(), try_idx, DeoptId::kNone);
true_target->InheritDeoptTarget(zone(), join);
@@ -2700,8 +2700,9 @@ int FlowGraphInliner::Inline() {
&call_site_count);
const Function& top = flow_graph_->function();
if ((FLAG_inlining_filter != NULL) &&
(strstr(top.ToFullyQualifiedCString(), FLAG_inlining_filter) == NULL)) {
if ((FLAG_inlining_filter != nullptr) &&
(strstr(top.ToFullyQualifiedCString(), FLAG_inlining_filter) ==
nullptr)) {
return 0;
}
@@ -2782,7 +2783,7 @@ static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph,
LoadFieldInstr* length = new (Z) LoadFieldInstr(
new (Z) Value(*array), Slot::GetLengthFieldForArrayCid(array_cid),
call->source());
*cursor = flow_graph->AppendTo(*cursor, length, NULL, FlowGraph::kValue);
*cursor = flow_graph->AppendTo(*cursor, length, nullptr, FlowGraph::kValue);
*index = flow_graph->CreateCheckBound(length, *index, call->deopt_id());
*cursor =
flow_graph->AppendTo(*cursor, *index, call->env(), FlowGraph::kValue);
@@ -2792,14 +2793,16 @@ static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph,
LoadFieldInstr* elements = new (Z)
LoadFieldInstr(new (Z) Value(*array), Slot::GrowableObjectArray_data(),
call->source());
*cursor = flow_graph->AppendTo(*cursor, elements, NULL, FlowGraph::kValue);
*cursor =
flow_graph->AppendTo(*cursor, elements, nullptr, FlowGraph::kValue);
// Load from the data from backing store which is a fixed-length array.
*array = elements;
array_cid = kArrayCid;
} else if (IsExternalTypedDataClassId(array_cid)) {
LoadUntaggedInstr* elements = new (Z) LoadUntaggedInstr(
new (Z) Value(*array), compiler::target::PointerBase::data_offset());
*cursor = flow_graph->AppendTo(*cursor, elements, NULL, FlowGraph::kValue);
*cursor =
flow_graph->AppendTo(*cursor, elements, nullptr, FlowGraph::kValue);
*array = elements;
}
return array_cid;
@@ -2849,9 +2852,9 @@ static bool InlineGetIndexed(FlowGraph* flow_graph,
ResultType(call));
*last = load;
cursor = flow_graph->AppendTo(cursor, load,
deopt_id != DeoptId::kNone ? call->env() : NULL,
FlowGraph::kValue);
cursor = flow_graph->AppendTo(
cursor, load, deopt_id != DeoptId::kNone ? call->env() : nullptr,
FlowGraph::kValue);
const bool value_needs_boxing =
array_cid == kTypedDataInt8ArrayCid ||
@@ -2865,7 +2868,7 @@ static bool InlineGetIndexed(FlowGraph* flow_graph,
if (array_cid == kTypedDataFloat32ArrayCid) {
*last = new (Z) FloatToDoubleInstr(new (Z) Value(load), deopt_id);
flow_graph->AppendTo(cursor, *last,
deopt_id != DeoptId::kNone ? call->env() : NULL,
deopt_id != DeoptId::kNone ? call->env() : nullptr,
FlowGraph::kValue);
} else if (value_needs_boxing) {
*last = BoxInstr::Create(kUnboxedIntPtr, new Value(load));
@@ -2920,7 +2923,7 @@ static bool InlineSetIndexed(FlowGraph* flow_graph,
// the index is not a smi.
const AbstractType& value_type =
AbstractType::ZoneHandle(Z, target.ParameterTypeAt(2));
Definition* type_args = NULL;
Definition* type_args = nullptr;
switch (array_cid) {
case kArrayCid:
case kGrowableObjectArrayCid: {
@@ -2930,7 +2933,7 @@ static bool InlineSetIndexed(FlowGraph* flow_graph,
Slot::GetTypeArgumentsSlotFor(flow_graph->thread(),
instantiator_class),
call->source());
cursor = flow_graph->AppendTo(cursor, load_type_args, NULL,
cursor = flow_graph->AppendTo(cursor, load_type_args, nullptr,
FlowGraph::kValue);
type_args = load_type_args;
break;
@@ -3020,7 +3023,7 @@ static bool InlineSetIndexed(FlowGraph* flow_graph,
array_cid == kExternalTypedDataUint8ArrayCid ||
array_cid == kExternalTypedDataUint8ClampedArrayCid;
if (value_check != NULL) {
if (value_check != nullptr) {
// No store barrier needed because checked value is a smi, an unboxed mint,
// an unboxed double, an unboxed Float32x4, or unboxed Int32x4.
needs_store_barrier = kNoStoreBarrier;
@@ -3034,7 +3037,7 @@ static bool InlineSetIndexed(FlowGraph* flow_graph,
stored_value = new (Z)
DoubleToFloatInstr(new (Z) Value(stored_value), call->deopt_id());
cursor =
flow_graph->AppendTo(cursor, stored_value, NULL, FlowGraph::kValue);
flow_graph->AppendTo(cursor, stored_value, nullptr, FlowGraph::kValue);
} else if (value_needs_unboxing) {
Representation representation = kNoRepresentation;
switch (array_cid) {
@@ -3195,7 +3198,8 @@ static void PrepareInlineByteArrayBaseOp(FlowGraph* flow_graph,
// Internal or External typed data: load untagged.
auto elements = new (Z) LoadUntaggedInstr(
new (Z) Value(*array), compiler::target::PointerBase::data_offset());
*cursor = flow_graph->AppendTo(*cursor, elements, NULL, FlowGraph::kValue);
*cursor =
flow_graph->AppendTo(*cursor, elements, nullptr, FlowGraph::kValue);
*array = elements;
} else {
// Internal typed data: no action.
@@ -3487,7 +3491,7 @@ static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph,
Instruction* cursor) {
LoadFieldInstr* length = new (Z) LoadFieldInstr(
new (Z) Value(str), Slot::GetLengthFieldForArrayCid(cid), str->source());
cursor = flow_graph->AppendTo(cursor, length, NULL, FlowGraph::kValue);
cursor = flow_graph->AppendTo(cursor, length, nullptr, FlowGraph::kValue);
// Bounds check.
index = flow_graph->CreateCheckBound(length, index, call->deopt_id());
@@ -3498,19 +3502,20 @@ static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph,
str = new LoadUntaggedInstr(
new Value(str),
compiler::target::ExternalOneByteString::external_data_offset());
cursor = flow_graph->AppendTo(cursor, str, NULL, FlowGraph::kValue);
cursor = flow_graph->AppendTo(cursor, str, nullptr, FlowGraph::kValue);
} else if (cid == kExternalTwoByteStringCid) {
str = new LoadUntaggedInstr(
new Value(str),
compiler::target::ExternalTwoByteString::external_data_offset());
cursor = flow_graph->AppendTo(cursor, str, NULL, FlowGraph::kValue);
cursor = flow_graph->AppendTo(cursor, str, nullptr, FlowGraph::kValue);
}
LoadIndexedInstr* load_indexed = new (Z) LoadIndexedInstr(
new (Z) Value(str), new (Z) Value(index), /*index_unboxed=*/false,
compiler::target::Instance::ElementSizeFor(cid), cid, kAlignedAccess,
DeoptId::kNone, call->source());
cursor = flow_graph->AppendTo(cursor, load_indexed, NULL, FlowGraph::kValue);
cursor =
flow_graph->AppendTo(cursor, load_indexed, nullptr, FlowGraph::kValue);
auto box = BoxInstr::Create(kUnboxedIntPtr, new Value(load_indexed));
cursor = flow_graph->AppendTo(cursor, box, nullptr, FlowGraph::kValue);
@@ -3543,7 +3548,7 @@ static bool InlineStringBaseCharAt(FlowGraph* flow_graph,
OneByteStringFromCharCodeInstr* char_at = new (Z)
OneByteStringFromCharCodeInstr(new (Z) Value((*last)->AsDefinition()));
flow_graph->AppendTo(*last, char_at, NULL, FlowGraph::kValue);
flow_graph->AppendTo(*last, char_at, nullptr, FlowGraph::kValue);
*last = char_at;
*result = char_at->AsDefinition();
@@ -3648,19 +3653,19 @@ bool FlowGraphInliner::TryReplaceInstanceCallWithInline(
}
// Finally insert the sequence other definition in place of this one in the
// graph.
if (entry->next() != NULL) {
if (entry->next() != nullptr) {
call->previous()->LinkTo(entry->next());
}
entry->UnuseAllInputs(); // Entry block is not in the graph.
if (last != NULL) {
if (last != nullptr) {
ASSERT(call->GetBlock() == last->GetBlock());
last->LinkTo(call);
}
// Remove through the iterator.
ASSERT(iterator->Current() == call);
iterator->RemoveCurrentFromGraph();
call->set_previous(NULL);
call->set_next(NULL);
call->set_previous(nullptr);
call->set_next(nullptr);
return true;
}
return false;
@@ -3702,7 +3707,7 @@ bool FlowGraphInliner::TryReplaceStaticCallWithInline(
call->previous()->LinkTo(entry->next());
}
entry->UnuseAllInputs(); // Entry block is not in the graph.
if (last != NULL) {
if (last != nullptr) {
BlockEntryInstr* link = call->GetBlock();
BlockEntryInstr* exit = last->GetBlock();
if (link != exit) {
@@ -3730,7 +3735,7 @@ bool FlowGraphInliner::TryReplaceStaticCallWithInline(
}
}
// Remove through the iterator.
if (iterator != NULL) {
if (iterator != nullptr) {
ASSERT(iterator->Current() == call);
iterator->RemoveCurrentFromGraph();
} else {
@@ -3860,9 +3865,9 @@ static bool InlineSimdOp(FlowGraph* flow_graph,
// env_use_list()), so InheritDeoptTarget should be done only after decided
// to inline.
(*entry)->InheritDeoptTarget(Z, call);
flow_graph->AppendTo(cursor, *last,
call->deopt_id() != DeoptId::kNone ? call->env() : NULL,
FlowGraph::kValue);
flow_graph->AppendTo(
cursor, *last, call->deopt_id() != DeoptId::kNone ? call->env() : nullptr,
FlowGraph::kValue);
*result = (*last)->AsDefinition();
return true;
}
@@ -4025,8 +4030,8 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
case MethodRecognizer::kObjectArraySetIndexedUnchecked:
case MethodRecognizer::kGrowableArraySetIndexedUnchecked:
return InlineSetIndexed(flow_graph, kind, target, call, receiver, source,
/* value_check = */ NULL, exactness, graph_entry,
entry, last, result);
/* value_check = */ nullptr, exactness,
graph_entry, entry, last, result);
case MethodRecognizer::kInt8ArraySetIndexed:
case MethodRecognizer::kUint8ArraySetIndexed:
case MethodRecognizer::kUint8ClampedArraySetIndexed:
@@ -4035,7 +4040,8 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
case MethodRecognizer::kInt16ArraySetIndexed:
case MethodRecognizer::kUint16ArraySetIndexed: {
// Optimistically assume Smi.
if (ic_data != NULL && ic_data->HasDeoptReason(ICData::kDeoptCheckSmi)) {
if (ic_data != nullptr &&
ic_data->HasDeoptReason(ICData::kDeoptCheckSmi)) {
// Optimistic assumption failed at least once.
return false;
}
@@ -4049,14 +4055,14 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
// Value check not needed for Int32 and Uint32 arrays because they
// implicitly contain unboxing instructions which check for right type.
return InlineSetIndexed(flow_graph, kind, target, call, receiver, source,
/* value_check = */ NULL, exactness, graph_entry,
entry, last, result);
/* value_check = */ nullptr, exactness,
graph_entry, entry, last, result);
}
case MethodRecognizer::kInt64ArraySetIndexed:
case MethodRecognizer::kUint64ArraySetIndexed:
return InlineSetIndexed(flow_graph, kind, target, call, receiver, source,
/* value_check = */ NULL, exactness, graph_entry,
entry, last, result);
/* value_check = */ nullptr, exactness,
graph_entry, entry, last, result);
case MethodRecognizer::kFloat32ArraySetIndexed:
case MethodRecognizer::kFloat64ArraySetIndexed: {
if (!CanUnboxDouble()) {
@@ -4340,8 +4346,9 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
call->GetBlock()->try_index(), DeoptId::kNone);
(*entry)->InheritDeoptTarget(Z, call);
ASSERT(!call->HasUses());
*last = NULL; // Empty body.
*result = NULL; // Since no uses of original call, result will be unused.
*last = nullptr; // Empty body.
*result =
nullptr; // Since no uses of original call, result will be unused.
return true;
}
@@ -4359,7 +4366,7 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
call->deopt_id());
flow_graph->AppendTo(
*entry, *last,
call->deopt_id() != DeoptId::kNone ? call->env() : NULL,
call->deopt_id() != DeoptId::kNone ? call->env() : nullptr,
FlowGraph::kValue);
*result = (*last)->AsDefinition();
return true;
@@ -4401,7 +4408,7 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(
new (Z) RedefinitionInstr(new (Z) Value(ctype));
flow_graph->AppendTo(
*entry, redef,
call->deopt_id() != DeoptId::kNone ? call->env() : NULL,
call->deopt_id() != DeoptId::kNone ? call->env() : nullptr,
FlowGraph::kValue);
*last = *result = redef;
return true;
+120 -118
View File
@@ -109,7 +109,7 @@ FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph,
cpu_spill_slot_count_(0),
intrinsic_mode_(intrinsic_mode) {
for (intptr_t i = 0; i < vreg_count_; i++) {
live_ranges_.Add(NULL);
live_ranges_.Add(nullptr);
}
for (intptr_t i = 0; i < vreg_count_; i++) {
value_representations_.Add(kNoRepresentation);
@@ -150,7 +150,7 @@ static void DeepLiveness(MaterializeObjectInstr* mat, BitVector* live_in) {
if (!mat->InputAt(i)->BindsToConstant()) {
Definition* defn = mat->InputAt(i)->definition();
MaterializeObjectInstr* inner_mat = defn->AsMaterializeObject();
if (inner_mat != NULL) {
if (inner_mat != nullptr) {
DeepLiveness(inner_mat, live_in);
} else {
intptr_t idx = defn->vreg(0);
@@ -182,7 +182,7 @@ void SSALivenessAnalysis::ComputeInitialSets() {
// Handle definitions.
Definition* current_def = current->AsDefinition();
if ((current_def != NULL) && current_def->HasSSATemp()) {
if ((current_def != nullptr) && current_def->HasSSATemp()) {
kill->Add(current_def->vreg(0));
live_in->Remove(current_def->vreg(0));
if (current_def->HasPairRepresentation()) {
@@ -207,7 +207,7 @@ void SSALivenessAnalysis::ComputeInitialSets() {
// Add non-argument uses from the deoptimization environment (pushed
// arguments are not allocated by the register allocator).
if (current->env() != NULL) {
if (current->env() != nullptr) {
for (Environment::DeepIterator env_it(current->env()); !env_it.Done();
env_it.Advance()) {
Definition* defn = env_it.CurrentValue()->definition();
@@ -230,7 +230,7 @@ void SSALivenessAnalysis::ComputeInitialSets() {
JoinEntryInstr* join = block->AsJoinEntry();
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
kill->Add(phi->vreg(0));
live_in->Remove(phi->vreg(0));
if (phi->HasPairRepresentation()) {
@@ -279,10 +279,10 @@ void SSALivenessAnalysis::ComputeInitialSets() {
}
UsePosition* LiveRange::AddUse(intptr_t pos, Location* location_slot) {
ASSERT(location_slot != NULL);
ASSERT(location_slot != nullptr);
ASSERT((first_use_interval_->start_ <= pos) &&
(pos <= first_use_interval_->end_));
if (uses_ != NULL) {
if (uses_ != nullptr) {
if ((uses_->pos() == pos) && (uses_->location_slot() == location_slot)) {
return uses_;
} else if (uses_->pos() < pos) {
@@ -291,13 +291,13 @@ UsePosition* LiveRange::AddUse(intptr_t pos, Location* location_slot) {
// add uses both at position P-1 and *then* P which will make
// uses_ unsorted unless we account for it here.
UsePosition* insert_after = uses_;
while ((insert_after->next() != NULL) &&
while ((insert_after->next() != nullptr) &&
(insert_after->next()->pos() < pos)) {
insert_after = insert_after->next();
}
UsePosition* insert_before = insert_after->next();
while (insert_before != NULL && (insert_before->pos() == pos)) {
while (insert_before != nullptr && (insert_before->pos() == pos)) {
if (insert_before->location_slot() == location_slot) {
return insert_before;
}
@@ -328,11 +328,11 @@ void LiveRange::AddSafepoint(intptr_t pos, LocationSummary* locs) {
SafepointPosition* safepoint =
new SafepointPosition(ToInstructionEnd(pos), locs);
if (first_safepoint_ == NULL) {
ASSERT(last_safepoint_ == NULL);
if (first_safepoint_ == nullptr) {
ASSERT(last_safepoint_ == nullptr);
first_safepoint_ = last_safepoint_ = safepoint;
} else {
ASSERT(last_safepoint_ != NULL);
ASSERT(last_safepoint_ != nullptr);
// We assume that safepoints list is sorted by position and that
// safepoints are added in this order.
ASSERT(last_safepoint_->pos() < pos);
@@ -344,7 +344,7 @@ void LiveRange::AddSafepoint(intptr_t pos, LocationSummary* locs) {
void LiveRange::AddHintedUse(intptr_t pos,
Location* location_slot,
Location* hint) {
ASSERT(hint != NULL);
ASSERT(hint != nullptr);
AddUse(pos, location_slot)->set_hint(hint);
}
@@ -354,7 +354,7 @@ void LiveRange::AddUseInterval(intptr_t start, intptr_t end) {
// Live ranges are being build by visiting instructions in post-order.
// This implies that use intervals will be prepended in a monotonically
// decreasing order.
if (first_use_interval() != NULL) {
if (first_use_interval() != nullptr) {
// If the first use interval and the use interval we are adding
// touch then we can just extend the first interval to cover their
// union.
@@ -378,8 +378,8 @@ void LiveRange::AddUseInterval(intptr_t start, intptr_t end) {
}
first_use_interval_ = new UseInterval(start, end, first_use_interval_);
if (last_use_interval_ == NULL) {
ASSERT(first_use_interval_->next() == NULL);
if (last_use_interval_ == nullptr) {
ASSERT(first_use_interval_->next() == nullptr);
last_use_interval_ = first_use_interval_;
}
}
@@ -392,9 +392,9 @@ void LiveRange::DefineAt(intptr_t pos) {
// expand the first use interval to cover the block from the start
// to the last use in the block and then we shrink it if we encounter
// definition of the value inside the same block.
if (first_use_interval_ == NULL) {
if (first_use_interval_ == nullptr) {
// Definition without a use.
first_use_interval_ = new UseInterval(pos, pos + 1, NULL);
first_use_interval_ = new UseInterval(pos, pos + 1, nullptr);
last_use_interval_ = first_use_interval_;
} else {
// Shrink the first use interval. It was optimistically expanded to
@@ -405,7 +405,7 @@ void LiveRange::DefineAt(intptr_t pos) {
}
LiveRange* FlowGraphAllocator::GetLiveRange(intptr_t vreg) {
if (live_ranges_[vreg] == NULL) {
if (live_ranges_[vreg] == nullptr) {
Representation rep = value_representations_[vreg];
ASSERT(rep != kNoRepresentation);
live_ranges_[vreg] = new LiveRange(vreg, rep);
@@ -432,7 +432,7 @@ void FlowGraphAllocator::BlockRegisterLocation(Location loc,
return;
}
if (blocking_ranges[loc.register_code()] == NULL) {
if (blocking_ranges[loc.register_code()] == nullptr) {
Representation ignored = kNoRepresentation;
LiveRange* range = new LiveRange(kNoVirtualRegister, ignored);
blocking_ranges[loc.register_code()] = range;
@@ -481,7 +481,7 @@ void FlowGraphAllocator::BlockFpuRegisters(intptr_t fpu_registers,
}
void LiveRange::Print() {
if (first_use_interval() == NULL) {
if (first_use_interval() == nullptr) {
return;
}
@@ -494,7 +494,7 @@ void LiveRange::Print() {
THR_Print("\n");
SafepointPosition* safepoint = first_safepoint();
while (safepoint != NULL) {
while (safepoint != nullptr) {
THR_Print(" Safepoint [%" Pd "]: ", safepoint->pos());
safepoint->locs()->stack_bitmap().Print();
THR_Print("\n");
@@ -502,13 +502,13 @@ void LiveRange::Print() {
}
UsePosition* use_pos = uses_;
for (UseInterval* interval = first_use_interval_; interval != NULL;
for (UseInterval* interval = first_use_interval_; interval != nullptr;
interval = interval->next()) {
THR_Print(" use interval [%" Pd ", %" Pd ")\n", interval->start(),
interval->end());
while ((use_pos != NULL) && (use_pos->pos() <= interval->end())) {
while ((use_pos != nullptr) && (use_pos->pos() <= interval->end())) {
THR_Print(" use at %" Pd "", use_pos->pos());
if (use_pos->location_slot() != NULL) {
if (use_pos->location_slot() != nullptr) {
THR_Print(" as ");
use_pos->location_slot()->Print();
}
@@ -517,7 +517,7 @@ void LiveRange::Print() {
}
}
if (next_sibling() != NULL) {
if (next_sibling() != nullptr) {
next_sibling()->Print();
}
}
@@ -530,7 +530,7 @@ void FlowGraphAllocator::PrintLiveRanges() {
#endif
for (intptr_t i = 0; i < live_ranges_.length(); i++) {
if (live_ranges_[i] != NULL) {
if (live_ranges_[i] != nullptr) {
live_ranges_[i]->Print();
}
}
@@ -541,7 +541,7 @@ void FlowGraphAllocator::PrintLiveRanges() {
static bool HasOnlyUnconstrainedUsesInLoop(LiveRange* range,
intptr_t boundary) {
UsePosition* use = range->first_use();
while ((use != NULL) && (use->pos() < boundary)) {
while ((use != nullptr) && (use->pos() < boundary)) {
if (!use->location_slot()->Equals(Location::Any())) {
return false;
}
@@ -553,7 +553,7 @@ static bool HasOnlyUnconstrainedUsesInLoop(LiveRange* range,
// Returns true if all uses of the given range have Any allocation policy.
static bool HasOnlyUnconstrainedUses(LiveRange* range) {
UsePosition* use = range->first_use();
while (use != NULL) {
while (use != nullptr) {
if (!use->location_slot()->Equals(Location::Any())) {
return false;
}
@@ -565,7 +565,7 @@ static bool HasOnlyUnconstrainedUses(LiveRange* range) {
void FlowGraphAllocator::BuildLiveRanges() {
const intptr_t block_count = postorder_.length();
ASSERT(postorder_.Last()->IsGraphEntry());
BitVector* current_interference_set = NULL;
BitVector* current_interference_set = nullptr;
Zone* zone = flow_graph_.zone();
for (intptr_t i = 0; i < (block_count - 1); i++) {
BlockEntryInstr* block = postorder_[i];
@@ -793,7 +793,7 @@ void FlowGraphAllocator::ProcessInitialDefinition(
}
} else {
ConstantInstr* constant = defn->AsConstant();
ASSERT(constant != NULL);
ASSERT(constant != nullptr);
const intptr_t pair_index = second_location_for_definition ? 1 : 0;
range->set_assigned_location(Location::Constant(constant, pair_index));
range->set_spill_slot(Location::Constant(constant, pair_index));
@@ -802,7 +802,7 @@ void FlowGraphAllocator::ProcessInitialDefinition(
range->finger()->Initialize(range);
UsePosition* use =
range->finger()->FirstRegisterBeneficialUse(block->start_pos());
if (use != NULL) {
if (use != nullptr) {
LiveRange* tail = SplitBetween(range, block->start_pos(), use->pos());
CompleteRange(tail, defn->RegisterKindForResult());
}
@@ -875,7 +875,7 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
Instruction* last = block->last_instruction();
GotoInstr* goto_instr = last->AsGoto();
if (goto_instr == NULL) return last;
if (goto_instr == nullptr) return last;
// If we have a parallel move here then the successor block must be a
// join with phis. The phi inputs contribute uses to each predecessor
@@ -888,7 +888,7 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
const intptr_t pos = GetLifetimePosition(goto_instr);
JoinEntryInstr* join = goto_instr->successor();
ASSERT(join != NULL);
ASSERT(join != nullptr);
// Search for the index of the current block in the predecessors of
// the join.
@@ -902,7 +902,7 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
MoveOperands* move = parallel_move->MoveOperandsAt(move_index++);
ConstantInstr* constant = val->definition()->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
move->set_src(Location::Constant(constant, /*pair_index*/ 0));
if (val->definition()->HasPairRepresentation()) {
move = parallel_move->MoveOperandsAt(move_index++);
@@ -918,7 +918,7 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
//
intptr_t vreg = val->definition()->vreg(0);
LiveRange* range = GetLiveRange(vreg);
if (interfere_at_backedge != NULL) interfere_at_backedge->Add(vreg);
if (interfere_at_backedge != nullptr) interfere_at_backedge->Add(vreg);
range->AddUseInterval(block->start_pos(), pos);
range->AddHintedUse(pos, move->src_slot(),
@@ -929,7 +929,7 @@ Instruction* FlowGraphAllocator::ConnectOutgoingPhiMoves(
move = parallel_move->MoveOperandsAt(move_index++);
vreg = val->definition()->vreg(1);
range = GetLiveRange(vreg);
if (interfere_at_backedge != NULL) {
if (interfere_at_backedge != nullptr) {
interfere_at_backedge->Add(vreg);
}
range->AddUseInterval(block->start_pos(), pos);
@@ -955,7 +955,7 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(JoinEntryInstr* join) {
intptr_t move_idx = 0;
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL);
ASSERT(phi != nullptr);
const intptr_t vreg = phi->vreg(0);
ASSERT(vreg >= 0);
const bool is_pair_phi = phi->HasPairRepresentation();
@@ -978,7 +978,7 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(JoinEntryInstr* join) {
for (intptr_t pred_idx = 0; pred_idx < phi->InputCount(); pred_idx++) {
BlockEntryInstr* pred = join->PredecessorAt(pred_idx);
GotoInstr* goto_instr = pred->last_instruction()->AsGoto();
ASSERT((goto_instr != NULL) && (goto_instr->HasParallelMove()));
ASSERT((goto_instr != nullptr) && (goto_instr->HasParallelMove()));
MoveOperands* move =
goto_instr->parallel_move()->MoveOperandsAt(move_idx);
move->set_dest(Location::PrefersRegister());
@@ -1008,9 +1008,9 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(JoinEntryInstr* join) {
void FlowGraphAllocator::ProcessEnvironmentUses(BlockEntryInstr* block,
Instruction* current) {
ASSERT(current->env() != NULL);
ASSERT(current->env() != nullptr);
Environment* env = current->env();
while (env != NULL) {
while (env != nullptr) {
// Any value mentioned in the deoptimization environment should survive
// until the end of instruction but it does not need to be in the register.
// Expected shape of live range:
@@ -1112,7 +1112,7 @@ void FlowGraphAllocator::ProcessMaterializationUses(
MaterializeObjectInstr* mat) {
// Materialization can occur several times in the same environment.
// Check if we already processed this one.
if (mat->locations() != NULL) {
if (mat->locations() != nullptr) {
return; // Already processed.
}
@@ -1124,7 +1124,7 @@ void FlowGraphAllocator::ProcessMaterializationUses(
Definition* def = mat->InputAt(i)->definition();
ConstantInstr* constant = def->AsConstant();
if (constant != NULL) {
if (constant != nullptr) {
locations[i] = Location::Constant(constant);
continue;
}
@@ -1163,10 +1163,10 @@ void FlowGraphAllocator::ProcessOneInput(BlockEntryInstr* block,
Value* input,
intptr_t vreg,
RegisterSet* live_registers) {
ASSERT(in_ref != NULL);
ASSERT(in_ref != nullptr);
ASSERT(!in_ref->IsPairLocation());
ASSERT(input != NULL);
ASSERT(block != NULL);
ASSERT(input != nullptr);
ASSERT(block != nullptr);
LiveRange* range = GetLiveRange(vreg);
if (in_ref->IsMachineRegister()) {
// Input is expected in a fixed register. Expected shape of
@@ -1176,7 +1176,7 @@ void FlowGraphAllocator::ProcessOneInput(BlockEntryInstr* block,
// value --*
// register [-----)
//
if (live_registers != NULL) {
if (live_registers != nullptr) {
live_registers->Add(*in_ref, range->representation());
}
MoveOperands* move = AddMoveAt(pos - 1, *in_ref, Location::Any());
@@ -1232,10 +1232,10 @@ void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block,
Definition* input,
intptr_t input_vreg,
BitVector* interference_set) {
ASSERT(out != NULL);
ASSERT(out != nullptr);
ASSERT(!out->IsPairLocation());
ASSERT(def != NULL);
ASSERT(block != NULL);
ASSERT(def != nullptr);
ASSERT(block != nullptr);
LiveRange* range =
vreg >= 0 ? GetLiveRange(vreg) : MakeLiveRangeForTemporary();
@@ -1260,7 +1260,7 @@ void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block,
UsePosition* use = range->first_use();
// If the value has no uses we don't need to allocate it.
if (use == NULL) return;
if (use == nullptr) return;
// Connect fixed output to all inputs that immediately follow to avoid
// allocating an intermediary register.
@@ -1285,8 +1285,8 @@ void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block,
MoveOperands* move = AddMoveAt(pos + 1, Location::Any(), *out);
range->AddHintedUse(pos + 1, move->dest_slot(), out);
} else if (output_same_as_first_input) {
ASSERT(in_ref != NULL);
ASSERT(input != NULL);
ASSERT(in_ref != nullptr);
ASSERT(input != nullptr);
// Output register will contain a value of the first input at instruction's
// start. Expected shape of live ranges:
//
@@ -1313,7 +1313,7 @@ void FlowGraphAllocator::ProcessOneOutput(BlockEntryInstr* block,
range->AddUse(pos, move->dest_slot());
range->AddUse(pos, in_ref);
if ((interference_set != NULL) && (range->vreg() >= 0) &&
if ((interference_set != nullptr) && (range->vreg() >= 0) &&
interference_set->Contains(range->vreg())) {
interference_set->Add(input->vreg(0));
}
@@ -1345,12 +1345,13 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
LocationSummary* locs = current->locs();
Definition* def = current->AsDefinition();
if ((def != NULL) && (def->AsConstant() != NULL)) {
if ((def != nullptr) && (def->AsConstant() != nullptr)) {
ASSERT(!def->HasPairRepresentation());
LiveRange* range = (def->vreg(0) != -1) ? GetLiveRange(def->vreg(0)) : NULL;
LiveRange* range =
(def->vreg(0) != -1) ? GetLiveRange(def->vreg(0)) : nullptr;
// Drop definitions of constants that have no uses.
if ((range == NULL) || (range->first_use() == NULL)) {
if ((range == nullptr) || (range->first_use() == nullptr)) {
locs->set_out(0, Location::NoLocation());
return;
}
@@ -1406,7 +1407,7 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
Location::RequiresRegister()));
}
// Add uses from the deoptimization environment.
if (current->env() != NULL) ProcessEnvironmentUses(block, current);
if (current->env() != nullptr) ProcessEnvironmentUses(block, current);
// Process inputs.
// Skip the first input if output is specified with kSameAsFirstInput policy,
@@ -1418,7 +1419,7 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
// the location is the first register or second register.
Value* input = current->InputAt(j);
Location* in_ref = locs->in_slot(j);
RegisterSet* live_registers = NULL;
RegisterSet* live_registers = nullptr;
if (locs->HasCallOnSlowPath()) {
live_registers = locs->live_registers();
}
@@ -1526,7 +1527,7 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
safepoints_.Add(current);
}
if (def == NULL) {
if (def == nullptr) {
ASSERT(locs->out(0).IsInvalid());
return;
}
@@ -1562,11 +1563,11 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
// Each element of the pair is assigned it's own virtual register number
// and is allocated its own LiveRange.
ProcessOneOutput(block, pos, pair->SlotAt(0), def, def->vreg(0),
false, // output is not mapped to first input.
NULL, NULL, -1, // First input not needed.
false, // output is not mapped to first input.
nullptr, nullptr, -1, // First input not needed.
interference_set);
ProcessOneOutput(block, pos, pair->SlotAt(1), def, def->vreg(1), false,
NULL, NULL, -1, interference_set);
nullptr, nullptr, -1, interference_set);
}
} else {
if (output_same_as_first_input) {
@@ -1582,8 +1583,8 @@ void FlowGraphAllocator::ProcessOneInstruction(BlockEntryInstr* block,
interference_set);
} else {
ProcessOneOutput(block, pos, out, def, def->vreg(0),
false, // output is not mapped to first input.
NULL, NULL, -1, // First input not needed.
false, // output is not mapped to first input.
nullptr, nullptr, -1, // First input not needed.
interference_set);
}
}
@@ -1594,7 +1595,7 @@ static ParallelMoveInstr* CreateParallelMoveBefore(Instruction* instr,
ASSERT(pos > 0);
Instruction* prev = instr->previous();
ParallelMoveInstr* move = prev->AsParallelMove();
if ((move == NULL) ||
if ((move == nullptr) ||
(FlowGraphAllocator::GetLifetimePosition(move) != pos)) {
move = new ParallelMoveInstr();
prev->LinkTo(move);
@@ -1654,7 +1655,7 @@ void FlowGraphAllocator::NumberInstructions() {
// For join entry predecessors create phi resolution moves if
// necessary. They will be populated by the register allocator.
JoinEntryInstr* join = block->AsJoinEntry();
if (join != NULL) {
if (join != nullptr) {
intptr_t move_count = 0;
for (PhiIterator it(join); !it.Done(); it.Advance()) {
move_count += it.Current()->HasPairRepresentation() ? 2 : 1;
@@ -1707,16 +1708,16 @@ void AllocationFinger::Initialize(LiveRange* range) {
bool AllocationFinger::Advance(const intptr_t start) {
UseInterval* a = first_pending_use_interval_;
while (a != NULL && a->end() <= start)
while (a != nullptr && a->end() <= start)
a = a->next();
first_pending_use_interval_ = a;
return (first_pending_use_interval_ == NULL);
return (first_pending_use_interval_ == nullptr);
}
Location AllocationFinger::FirstHint() {
UsePosition* use = first_hinted_use_;
while (use != NULL) {
while (use != nullptr) {
if (use->HasHint()) return use->hint();
use = use->next();
}
@@ -1725,7 +1726,7 @@ Location AllocationFinger::FirstHint() {
}
static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) {
while ((use != NULL) && (use->pos() < after)) {
while ((use != nullptr) && (use->pos() < after)) {
use = use->next();
}
return use;
@@ -1733,7 +1734,7 @@ static UsePosition* FirstUseAfter(UsePosition* use, intptr_t after) {
UsePosition* AllocationFinger::FirstRegisterUse(intptr_t after) {
for (UsePosition* use = FirstUseAfter(first_register_use_, after);
use != NULL; use = use->next()) {
use != nullptr; use = use->next()) {
Location* loc = use->location_slot();
if (loc->IsUnallocated() &&
((loc->policy() == Location::kRequiresRegister) ||
@@ -1742,19 +1743,19 @@ UsePosition* AllocationFinger::FirstRegisterUse(intptr_t after) {
return use;
}
}
return NULL;
return nullptr;
}
UsePosition* AllocationFinger::FirstRegisterBeneficialUse(intptr_t after) {
for (UsePosition* use = FirstUseAfter(first_register_beneficial_use_, after);
use != NULL; use = use->next()) {
use != nullptr; use = use->next()) {
Location* loc = use->location_slot();
if (loc->IsUnallocated() && loc->IsRegisterBeneficial()) {
first_register_beneficial_use_ = use;
return use;
}
}
return NULL;
return nullptr;
}
UsePosition* AllocationFinger::FirstInterferingUse(intptr_t after) {
@@ -1767,14 +1768,14 @@ UsePosition* AllocationFinger::FirstInterferingUse(intptr_t after) {
}
void AllocationFinger::UpdateAfterSplit(intptr_t first_use_after_split_pos) {
if ((first_register_use_ != NULL) &&
if ((first_register_use_ != nullptr) &&
(first_register_use_->pos() >= first_use_after_split_pos)) {
first_register_use_ = NULL;
first_register_use_ = nullptr;
}
if ((first_register_beneficial_use_ != NULL) &&
if ((first_register_beneficial_use_ != nullptr) &&
(first_register_beneficial_use_->pos() >= first_use_after_split_pos)) {
first_register_beneficial_use_ = NULL;
first_register_beneficial_use_ = nullptr;
}
}
@@ -1788,7 +1789,7 @@ intptr_t UseInterval::Intersect(UseInterval* other) {
}
static intptr_t FirstIntersection(UseInterval* a, UseInterval* u) {
while (a != NULL && u != NULL) {
while (a != nullptr && u != nullptr) {
const intptr_t pos = a->Intersect(u);
if (pos != kIllegalPosition) return pos;
@@ -1806,24 +1807,24 @@ template <typename PositionType>
PositionType* SplitListOfPositions(PositionType** head,
intptr_t split_pos,
bool split_at_start) {
PositionType* last_before_split = NULL;
PositionType* last_before_split = nullptr;
PositionType* pos = *head;
if (split_at_start) {
while ((pos != NULL) && (pos->pos() < split_pos)) {
while ((pos != nullptr) && (pos->pos() < split_pos)) {
last_before_split = pos;
pos = pos->next();
}
} else {
while ((pos != NULL) && (pos->pos() <= split_pos)) {
while ((pos != nullptr) && (pos->pos() <= split_pos)) {
last_before_split = pos;
pos = pos->next();
}
}
if (last_before_split == NULL) {
*head = NULL;
if (last_before_split == nullptr) {
*head = nullptr;
} else {
last_before_split->set_next(NULL);
last_before_split->set_next(nullptr);
}
return pos;
@@ -1833,7 +1834,7 @@ LiveRange* LiveRange::SplitAt(intptr_t split_pos) {
if (Start() == split_pos) return this;
UseInterval* interval = finger_.first_pending_use_interval();
if (interval == NULL) {
if (interval == nullptr) {
finger_.Initialize(this);
interval = finger_.first_pending_use_interval();
}
@@ -1844,7 +1845,7 @@ LiveRange* LiveRange::SplitAt(intptr_t split_pos) {
// end. We need to start over to find the previous interval.
if (split_pos <= interval->start()) interval = first_use_interval_;
UseInterval* last_before_split = NULL;
UseInterval* last_before_split = nullptr;
while (interval->end() <= split_pos) {
last_before_split = interval;
interval = interval->next();
@@ -1861,7 +1862,7 @@ LiveRange* LiveRange::SplitAt(intptr_t split_pos) {
last_before_split = interval;
}
ASSERT(last_before_split != NULL);
ASSERT(last_before_split != nullptr);
ASSERT(last_before_split->next() == first_after_split);
ASSERT(last_before_split->end() <= split_pos);
ASSERT(split_pos <= first_after_split->start());
@@ -1883,9 +1884,9 @@ LiveRange* LiveRange::SplitAt(intptr_t split_pos) {
next_sibling_->Start(), next_sibling_->End()));
last_use_interval_ = last_before_split;
last_use_interval_->next_ = NULL;
last_use_interval_->next_ = nullptr;
if (first_use_after_split != NULL) {
if (first_use_after_split != nullptr) {
finger_.UpdateAfterSplit(first_use_after_split->pos());
}
@@ -2005,7 +2006,7 @@ void FlowGraphAllocator::AllocateSpillSlotFor(LiveRange* range) {
// Compute range start and end.
LiveRange* last_sibling = range;
while (last_sibling->next_sibling() != NULL) {
while (last_sibling->next_sibling() != nullptr) {
last_sibling = last_sibling->next_sibling();
}
@@ -2110,9 +2111,9 @@ void FlowGraphAllocator::MarkAsObjectAtSafepoints(LiveRange* range) {
spill_slot.stack_index());
}
ASSERT(stack_index >= 0);
while (range != NULL) {
while (range != nullptr) {
for (SafepointPosition* safepoint = range->first_safepoint();
safepoint != NULL; safepoint = safepoint->next()) {
safepoint != nullptr; safepoint = safepoint->next()) {
// Mark the stack slot as having an object.
safepoint->locs()->SetStackBit(stack_index);
}
@@ -2173,7 +2174,7 @@ intptr_t FlowGraphAllocator::FirstIntersectionWithAllocated(
intptr_t intersection = kMaxPosition;
for (intptr_t i = 0; i < registers_[reg]->length(); i++) {
LiveRange* allocated = (*registers_[reg])[i];
if (allocated == NULL) continue;
if (allocated == nullptr) continue;
UseInterval* allocated_head =
allocated->finger()->first_pending_use_interval();
@@ -2187,7 +2188,7 @@ intptr_t FlowGraphAllocator::FirstIntersectionWithAllocated(
}
void ReachingDefs::AddPhi(PhiInstr* phi) {
if (phi->reaching_defs() == NULL) {
if (phi->reaching_defs() == nullptr) {
Zone* zone = flow_graph_.zone();
phi->set_reaching_defs(new (zone) BitVector(zone, flow_graph_.max_vreg()));
@@ -2217,7 +2218,7 @@ void ReachingDefs::Compute() {
// Add all phis that affect this phi to the list.
for (intptr_t i = 0; i < phi->InputCount(); i++) {
PhiInstr* input_phi = phi->InputAt(i)->definition()->AsPhi();
if (input_phi != NULL) {
if (input_phi != nullptr) {
AddPhi(input_phi);
}
}
@@ -2231,7 +2232,7 @@ void ReachingDefs::Compute() {
PhiInstr* phi = phis_[i];
for (intptr_t i = 0; i < phi->InputCount(); i++) {
PhiInstr* input_phi = phi->InputAt(i)->definition()->AsPhi();
if (input_phi != NULL) {
if (input_phi != nullptr) {
if (phi->reaching_defs()->AddAll(input_phi->reaching_defs())) {
changed = true;
}
@@ -2244,7 +2245,7 @@ void ReachingDefs::Compute() {
}
BitVector* ReachingDefs::Get(PhiInstr* phi) {
if (phi->reaching_defs() == NULL) {
if (phi->reaching_defs() == nullptr) {
ASSERT(phis_.is_empty());
AddPhi(phi);
Compute();
@@ -2373,7 +2374,7 @@ bool FlowGraphAllocator::AllocateFreeRegister(LiveRange* unallocated) {
// If unallocated represents a constant value and does not have
// any uses then avoid using a register for it.
if (unallocated->first_use() == NULL) {
if (unallocated->first_use() == nullptr) {
if (unallocated->vreg() >= 0) {
LiveRange* parent = GetLiveRange(unallocated->vreg());
if (parent->spill_slot().IsConstant()) {
@@ -2448,7 +2449,7 @@ void FlowGraphAllocator::AllocateAnyRegister(LiveRange* unallocated) {
// loop.
UsePosition* register_use =
unallocated->finger()->FirstRegisterUse(unallocated->Start());
if ((register_use == NULL) &&
if ((register_use == nullptr) &&
!(unallocated->is_loop_phi() && HasCheapEvictionCandidate(unallocated))) {
Spill(unallocated);
return;
@@ -2467,7 +2468,7 @@ void FlowGraphAllocator::AllocateAnyRegister(LiveRange* unallocated) {
}
const intptr_t register_use_pos =
(register_use != NULL) ? register_use->pos() : unallocated->Start();
(register_use != nullptr) ? register_use->pos() : unallocated->Start();
if (free_until < register_use_pos) {
// Can't acquire free register. Spill until we really need one.
ASSERT(unallocated->Start() < ToInstructionStart(register_use_pos));
@@ -2515,14 +2516,14 @@ bool FlowGraphAllocator::UpdateFreeUntil(intptr_t reg,
}
UsePosition* use = allocated->finger()->FirstInterferingUse(start);
if ((use != NULL) && ((ToInstructionStart(use->pos()) - start) <= 1)) {
if ((use != nullptr) && ((ToInstructionStart(use->pos()) - start) <= 1)) {
// This register is blocked by interval that is used
// as register in the current instruction and can't
// be spilled.
return false;
}
const intptr_t use_pos = (use != NULL) ? use->pos() : allocated->End();
const intptr_t use_pos = (use != nullptr) ? use->pos() : allocated->End();
if (use_pos < free_until) free_until = use_pos;
} else {
@@ -2551,7 +2552,7 @@ void FlowGraphAllocator::RemoveEvicted(intptr_t reg, intptr_t first_evicted) {
intptr_t from = first_evicted + 1;
while (from < registers_[reg]->length()) {
LiveRange* allocated = (*registers_[reg])[from++];
if (allocated != NULL) (*registers_[reg])[to++] = allocated;
if (allocated != nullptr) (*registers_[reg])[to++] = allocated;
}
registers_[reg]->TruncateTo(to);
}
@@ -2568,7 +2569,7 @@ void FlowGraphAllocator::AssignNonFreeRegister(LiveRange* unallocated,
ASSERT(allocated->End() <= unallocated->Start());
ConvertAllUses(allocated);
}
(*registers_[reg])[i] = NULL;
(*registers_[reg])[i] = nullptr;
first_evicted = i;
}
}
@@ -2590,7 +2591,7 @@ bool FlowGraphAllocator::EvictIntersection(LiveRange* allocated,
const intptr_t spill_position = first_unallocated->start();
UsePosition* use = allocated->finger()->FirstInterferingUse(spill_position);
if (use == NULL) {
if (use == nullptr) {
// No register uses after this point.
SpillAfter(allocated, spill_position);
} else {
@@ -2613,7 +2614,7 @@ MoveOperands* FlowGraphAllocator::AddMoveAt(intptr_t pos,
// in it so we should not attempt to add parallel moves to it.
ASSERT(pos >= kNormalEntryPos);
ParallelMoveInstr* parallel_move = NULL;
ParallelMoveInstr* parallel_move = nullptr;
Instruction* instr = InstructionAt(pos);
if (auto entry = instr->AsFunctionEntry()) {
// Parallel moves added to the FunctionEntry will be added after the block
@@ -2630,7 +2631,7 @@ MoveOperands* FlowGraphAllocator::AddMoveAt(intptr_t pos,
void FlowGraphAllocator::ConvertUseTo(UsePosition* use, Location loc) {
ASSERT(!loc.IsPairLocation());
ASSERT(use->location_slot() != NULL);
ASSERT(use->location_slot() != nullptr);
Location* slot = use->location_slot();
ASSERT(slot->IsUnallocated());
TRACE_ALLOC(THR_Print(" use at %" Pd " converted to ", use->pos()));
@@ -2651,7 +2652,8 @@ void FlowGraphAllocator::ConvertAllUses(LiveRange* range) {
TRACE_ALLOC(loc.Print());
TRACE_ALLOC(THR_Print(":\n"));
for (UsePosition* use = range->first_use(); use != NULL; use = use->next()) {
for (UsePosition* use = range->first_use(); use != nullptr;
use = use->next()) {
ConvertUseTo(use, loc);
}
@@ -2659,7 +2661,7 @@ void FlowGraphAllocator::ConvertAllUses(LiveRange* range) {
// code.
if (loc.IsMachineRegister()) {
for (SafepointPosition* safepoint = range->first_safepoint();
safepoint != NULL; safepoint = safepoint->next()) {
safepoint != nullptr; safepoint = safepoint->next()) {
if (!safepoint->locs()->always_calls()) {
ASSERT(safepoint->locs()->can_call());
safepoint->locs()->live_registers()->Add(loc, range->representation());
@@ -2678,7 +2680,7 @@ void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) {
LiveRange* range = (*registers_[reg])[i];
if (range->finger()->Advance(start)) {
ConvertAllUses(range);
(*registers_[reg])[i] = NULL;
(*registers_[reg])[i] = nullptr;
first_evicted = i;
}
}
@@ -2690,7 +2692,7 @@ void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) {
bool LiveRange::Contains(intptr_t pos) const {
if (!CanCover(pos)) return false;
for (UseInterval* interval = first_use_interval_; interval != NULL;
for (UseInterval* interval = first_use_interval_; interval != nullptr;
interval = interval->next()) {
if (interval->Contains(pos)) {
return true;
@@ -2799,7 +2801,7 @@ void FlowGraphAllocator::PrepareForAllocation(
ASSERT(registers_[reg]->is_empty());
LiveRange* range = blocking_ranges[reg];
if (range != NULL) {
if (range != nullptr) {
range->finger()->Initialize(range);
registers_[reg]->Add(range);
}
@@ -2883,7 +2885,7 @@ void FlowGraphAllocator::ResolveControlFlow() {
// inside basic blocks.
for (intptr_t vreg = 0; vreg < live_ranges_.length(); vreg++) {
LiveRange* range = live_ranges_[vreg];
if (range == NULL) continue;
if (range == nullptr) continue;
while (range->next_sibling() != nullptr) {
LiveRange* sibling = range->next_sibling();
@@ -3103,7 +3105,7 @@ void FlowGraphAllocator::CollectRepresentations() {
} else if (auto join = block->AsJoinEntry()) {
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
ASSERT(phi != NULL && phi->vreg(0) >= 0);
ASSERT(phi != nullptr && phi->vreg(0) >= 0);
value_representations_[phi->vreg(0)] =
RepresentationForRange(phi->representation());
if (phi->HasPairRepresentation()) {
@@ -3117,7 +3119,7 @@ void FlowGraphAllocator::CollectRepresentations() {
for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
instr_it.Advance()) {
Definition* def = instr_it.Current()->AsDefinition();
if ((def != NULL) && (def->vreg(0) >= 0)) {
if ((def != nullptr) && (def->vreg(0) >= 0)) {
const intptr_t vreg = def->vreg(0);
value_representations_[vreg] =
RepresentationForRange(def->representation());
@@ -3385,7 +3387,7 @@ void FlowGraphAllocator::AllocateRegisters() {
AllocateUnallocatedRanges();
GraphEntryInstr* entry = block_order_[0]->AsGraphEntry();
ASSERT(entry != NULL);
ASSERT(entry != nullptr);
intptr_t double_spill_slot_count = spill_slots_.length() * kDoubleSpillFactor;
entry->set_spill_slot_count(cpu_spill_slot_count_ + double_spill_slot_count +
flow_graph_.max_argument_slot_count());
+15 -15
View File
@@ -387,8 +387,8 @@ class FlowGraphAllocator : public ValueObject {
class UsePosition : public ZoneAllocated {
public:
UsePosition(intptr_t pos, UsePosition* next, Location* location_slot)
: pos_(pos), location_slot_(location_slot), hint_(NULL), next_(next) {
ASSERT(location_slot != NULL);
: pos_(pos), location_slot_(location_slot), hint_(nullptr), next_(next) {
ASSERT(location_slot != nullptr);
}
Location* location_slot() const { return location_slot_; }
@@ -403,7 +403,7 @@ class UsePosition : public ZoneAllocated {
void set_hint(Location* hint) { hint_ = hint; }
bool HasHint() const { return (hint_ != NULL) && !hint_->IsUnallocated(); }
bool HasHint() const { return (hint_ != nullptr) && !hint_->IsUnallocated(); }
void set_next(UsePosition* next) { next_ = next; }
UsePosition* next() const { return next_; }
@@ -460,10 +460,10 @@ class UseInterval : public ZoneAllocated {
class AllocationFinger : public ValueObject {
public:
AllocationFinger()
: first_pending_use_interval_(NULL),
first_register_use_(NULL),
first_register_beneficial_use_(NULL),
first_hinted_use_(NULL) {}
: first_pending_use_interval_(nullptr),
first_register_use_(nullptr),
first_register_beneficial_use_(nullptr),
first_hinted_use_(nullptr) {}
void Initialize(LiveRange* range);
void UpdateAfterSplit(intptr_t first_use_after_split_pos);
@@ -490,7 +490,7 @@ class AllocationFinger : public ValueObject {
class SafepointPosition : public ZoneAllocated {
public:
SafepointPosition(intptr_t pos, LocationSummary* locs)
: pos_(pos), locs_(locs), next_(NULL) {}
: pos_(pos), locs_(locs), next_(nullptr) {}
void set_next(SafepointPosition* next) { next_ = next; }
SafepointPosition* next() const { return next_; }
@@ -514,12 +514,12 @@ class LiveRange : public ZoneAllocated {
representation_(rep),
assigned_location_(),
spill_slot_(),
uses_(NULL),
first_use_interval_(NULL),
last_use_interval_(NULL),
first_safepoint_(NULL),
last_safepoint_(NULL),
next_sibling_(NULL),
uses_(nullptr),
first_use_interval_(nullptr),
last_use_interval_(nullptr),
first_safepoint_(nullptr),
last_safepoint_(nullptr),
next_sibling_(nullptr),
has_only_any_uses_in_loops_(0),
is_loop_phi_(false),
finger_() {}
@@ -603,7 +603,7 @@ class LiveRange : public ZoneAllocated {
first_use_interval_(first_use_interval),
last_use_interval_(last_use_interval),
first_safepoint_(first_safepoint),
last_safepoint_(NULL),
last_safepoint_(nullptr),
next_sibling_(next_sibling),
has_only_any_uses_in_loops_(0),
is_loop_phi_(false),
+8 -5
View File
@@ -149,7 +149,7 @@ LocationSummary::LocationSummary(Zone* zone,
: num_inputs_(input_count),
num_temps_(temp_count),
output_location_(), // out(0)->IsInvalid() unless later set.
stack_bitmap_(NULL),
stack_bitmap_(nullptr),
contains_call_(contains_call),
live_registers_() {
#if defined(DEBUG)
@@ -229,7 +229,8 @@ Location Location::Component(intptr_t i) const {
Location LocationRegisterOrConstant(Value* value) {
ConstantInstr* constant = value->definition()->AsConstant();
return ((constant != NULL) && compiler::Assembler::IsSafe(constant->value()))
return ((constant != nullptr) &&
compiler::Assembler::IsSafe(constant->value()))
? Location::Constant(constant)
: Location::RequiresRegister();
}
@@ -271,7 +272,8 @@ Location LocationWritableRegisterOrSmiConstant(Value* value,
Location LocationFixedRegisterOrConstant(Value* value, Register reg) {
ASSERT(((1 << reg) & kDartAvailableCpuRegs) != 0);
ConstantInstr* constant = value->definition()->AsConstant();
return ((constant != NULL) && compiler::Assembler::IsSafe(constant->value()))
return ((constant != nullptr) &&
compiler::Assembler::IsSafe(constant->value()))
? Location::Constant(constant)
: Location::RegisterLocation(reg);
}
@@ -279,7 +281,7 @@ Location LocationFixedRegisterOrConstant(Value* value, Register reg) {
Location LocationFixedRegisterOrSmiConstant(Value* value, Register reg) {
ASSERT(((1 << reg) & kDartAvailableCpuRegs) != 0);
ConstantInstr* constant = value->definition()->AsConstant();
return ((constant != NULL) &&
return ((constant != nullptr) &&
compiler::Assembler::IsSafeSmi(constant->value()))
? Location::Constant(constant)
: Location::RegisterLocation(reg);
@@ -287,7 +289,8 @@ Location LocationFixedRegisterOrSmiConstant(Value* value, Register reg) {
Location LocationAnyOrConstant(Value* value) {
ConstantInstr* constant = value->definition()->AsConstant();
return ((constant != NULL) && compiler::Assembler::IsSafe(constant->value()))
return ((constant != nullptr) &&
compiler::Assembler::IsSafe(constant->value()))
? Location::Constant(constant)
: Location::Any();
}
+1 -1
View File
@@ -863,7 +863,7 @@ class LocationSummary : public ZoneAllocated {
private:
BitmapBuilder& EnsureStackBitmap() {
if (stack_bitmap_ == NULL) {
if (stack_bitmap_ == nullptr) {
stack_bitmap_ = new BitmapBuilder();
}
return *stack_bitmap_;
@@ -70,7 +70,7 @@ class MockInstruction : public ZoneAllocated {
virtual ~MockInstruction() {}
LocationSummary* locs() {
if (locs_ == NULL) {
if (locs_ == nullptr) {
locs_ = MakeLocationSummary(Thread::Current()->zone(), false);
}
return locs_;
@@ -90,7 +90,9 @@ class MockInstruction : public ZoneAllocated {
public: \
LocationSummary* MakeLocationSummary(Zone* zone, bool opt) const; \
void EmitNativeCode(FlowGraphCompiler* compiler); \
virtual intptr_t InputCount() const { return Arity; } \
virtual intptr_t InputCount() const { \
return Arity; \
} \
}; \
TEST_CASE(LocationsHelpers_##Name) { \
const Location expected_out = ExpectedOut; \
@@ -107,7 +109,7 @@ class MockInstruction : public ZoneAllocated {
ValidateSummary(locs, expected_out, expected_inputs, expected_temps); \
FillSummary(locs, allocated_out, allocated_inputs, allocated_temps); \
\
instr->EmitNativeCode(NULL); \
instr->EmitNativeCode(nullptr); \
} \
DEFINE_BACKEND(Name, Signature)
+103 -102
View File
@@ -76,7 +76,7 @@ void RangeAnalysis::CollectValues() {
!block_it.Done(); block_it.Advance()) {
BlockEntryInstr* block = block_it.Current();
JoinEntryInstr* join = block->AsJoinEntry();
if (join != NULL) {
if (join != nullptr) {
for (PhiIterator phi_it(join); !phi_it.Done(); phi_it.Advance()) {
PhiInstr* current = phi_it.Current();
if (current->Type()->IsInt()) {
@@ -89,7 +89,7 @@ void RangeAnalysis::CollectValues() {
instr_it.Advance()) {
Instruction* current = instr_it.Current();
Definition* defn = current->AsDefinition();
if (defn != NULL) {
if (defn != nullptr) {
if (defn->HasSSATemp() && IsIntegerDefinition(defn)) {
values_.Add(defn);
if (defn->IsBinaryInt64Op()) {
@@ -133,7 +133,7 @@ Range* RangeAnalysis::ConstraintSmiRange(Token::Kind op, Definition* boundary) {
RangeBoundary::MaxSmi());
default:
UNREACHABLE();
return NULL;
return nullptr;
}
}
@@ -142,22 +142,22 @@ ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use,
Range* constraint_range,
Instruction* after) {
// No need to constrain constants.
if (defn->IsConstant()) return NULL;
if (defn->IsConstant()) return nullptr;
// Check if the value is already constrained to avoid inserting duplicated
// constraints.
ConstraintInstr* constraint = after->next()->AsConstraint();
while (constraint != NULL) {
while (constraint != nullptr) {
if ((constraint->value()->definition() == defn) &&
constraint->constraint()->Equals(constraint_range)) {
return NULL;
return nullptr;
}
constraint = constraint->next()->AsConstraint();
}
constraint = new (Z) ConstraintInstr(use->CopyWithType(), constraint_range);
flow_graph_->InsertAfter(after, constraint, NULL, FlowGraph::kValue);
flow_graph_->InsertAfter(after, constraint, nullptr, FlowGraph::kValue);
FlowGraph::RenameDominatedUses(defn, constraint, constraint);
constraints_.Add(constraint);
return constraint;
@@ -166,7 +166,7 @@ ConstraintInstr* RangeAnalysis::InsertConstraintFor(Value* use,
bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) {
BranchInstr* branch = use->instruction()->AsBranch();
RelationalOpInstr* rel_op = branch->comparison()->AsRelationalOp();
if ((rel_op != NULL) && (rel_op->operation_cid() == kSmiCid)) {
if ((rel_op != nullptr) && (rel_op->operation_cid() == kSmiCid)) {
// Found comparison of two smis. Constrain defn at true and false
// successors using the other operand as a boundary.
Definition* boundary;
@@ -186,7 +186,7 @@ bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) {
ConstraintInstr* true_constraint =
InsertConstraintFor(use, defn, ConstraintSmiRange(op_kind, boundary),
branch->true_successor());
if (true_constraint != NULL) {
if (true_constraint != nullptr) {
true_constraint->set_target(branch->true_successor());
}
@@ -195,7 +195,7 @@ bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) {
use, defn,
ConstraintSmiRange(Token::NegateComparison(op_kind), boundary),
branch->false_successor());
if (false_constraint != NULL) {
if (false_constraint != nullptr) {
false_constraint->set_target(branch->false_successor());
}
@@ -206,7 +206,7 @@ bool RangeAnalysis::ConstrainValueAfterBranch(Value* use, Definition* defn) {
}
void RangeAnalysis::InsertConstraintsFor(Definition* defn) {
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
if (auto branch = use->instruction()->AsBranch()) {
if (ConstrainValueAfterBranch(use, defn)) {
@@ -226,7 +226,7 @@ void RangeAnalysis::ConstrainValueAfterCheckBound(Value* use,
Definition* defn) {
const intptr_t use_index = use->use_index();
Range* constraint_range = NULL;
Range* constraint_range = nullptr;
if (use_index == CheckBoundBase::kIndexPos) {
Definition* length = check->length()->definition();
constraint_range = new (Z) Range(RangeBoundary::FromConstant(0),
@@ -254,7 +254,7 @@ const Range* RangeAnalysis::GetSmiRange(Value* value) const {
Definition* defn = value->definition();
const Range* range = defn->range();
if ((range == NULL) && (defn->Type()->ToCid() != kSmiCid)) {
if ((range == nullptr) && (defn->Type()->ToCid() != kSmiCid)) {
// Type propagator determined that reaching type for this use is Smi.
// However the definition itself is not a smi-definition and
// thus it will never have range assigned to it. Just return the widest
@@ -263,7 +263,7 @@ const Range* RangeAnalysis::GetSmiRange(Value* value) const {
// (e.g. results of loads or function call) can be used only after they
// pass through UnboxInt64Instr which is considered as mint-definition
// and will have a range assigned to it.
// Note: that we can't return NULL here because it is used as lattice's
// Note: that we can't return nullptr here because it is used as lattice's
// bottom element to indicate that the range was not computed *yet*.
return &smi_range_;
}
@@ -275,12 +275,12 @@ const Range* RangeAnalysis::GetIntRange(Value* value) const {
Definition* defn = value->definition();
const Range* range = defn->range();
if ((range == NULL) && !defn->Type()->IsInt()) {
if ((range == nullptr) && !defn->Type()->IsInt()) {
// Type propagator determined that reaching type for this use is int.
// However the definition itself is not a int-definition and
// thus it will never have range assigned to it. Just return the widest
// range possible for this value.
// Note: that we can't return NULL here because it is used as lattice's
// Note: that we can't return nullptr here because it is used as lattice's
// bottom element to indicate that the range was not computed *yet*.
return &int64_range_;
}
@@ -482,7 +482,7 @@ void RangeAnalysis::CollectDefinitions(BitVector* set) {
BlockEntryInstr* block = block_it.Current();
JoinEntryInstr* join = block->AsJoinEntry();
if (join != NULL) {
if (join != nullptr) {
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
if (set->Contains(phi->ssa_temp_index())) {
@@ -493,7 +493,7 @@ void RangeAnalysis::CollectDefinitions(BitVector* set) {
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
Definition* defn = it.Current()->AsDefinition();
if ((defn != NULL) && defn->HasSSATemp() &&
if ((defn != nullptr) && defn->HasSSATemp() &&
set->Contains(defn->ssa_temp_index())) {
definitions_.Add(defn);
}
@@ -623,7 +623,7 @@ class Scheduler {
// Given the floating instruction attempt to schedule it into one of the
// loop preheaders that dominates given post_dominator instruction.
// Some of the instruction inputs can potentially be unscheduled as well.
// Returns NULL is the scheduling fails (e.g. inputs are not invariant for
// Returns nullptr is the scheduling fails (e.g. inputs are not invariant for
// any loop containing post_dominator).
// Resulting schedule should be equivalent to one obtained by inserting
// instructions right before post_dominator and running CSE and LICM passes.
@@ -656,8 +656,8 @@ class Scheduler {
if (!defn->HasSSATemp()) {
Definition* scheduled = Emit(defn, sink);
if (scheduled == NULL) {
return NULL;
if (scheduled == nullptr) {
return nullptr;
}
instruction->InputAt(i)->set_definition(scheduled);
} else if (defn->IsConstraint()) {
@@ -669,7 +669,7 @@ class Scheduler {
// If the instruction is still in the graph (it could have been
// un-scheduled by a rollback action) and it dominates the sink - use it.
Instruction* emitted = map_.LookupValue(instruction);
if (emitted != NULL && !emitted->WasEliminated() &&
if (emitted != nullptr && !emitted->WasEliminated() &&
sink->IsDominatedBy(emitted)) {
return emitted;
}
@@ -680,7 +680,7 @@ class Scheduler {
BlockEntryInstr* header = loop_headers_[i];
BlockEntryInstr* pre_header = pre_headers_[i];
if (pre_header == NULL) {
if (pre_header == nullptr) {
continue;
}
@@ -705,7 +705,7 @@ class Scheduler {
}
}
return NULL;
return nullptr;
}
void EmitTo(BlockEntryInstr* block, Instruction* instr) {
@@ -757,7 +757,7 @@ class BoundsCheckGeneralizer {
// Re-associate subexpressions inside upper_bound to collect all constants
// together. This will expose more redundancies when we are going to emit
// upper bound through scheduler.
if (!Simplify(&upper_bound, NULL)) {
if (!Simplify(&upper_bound, nullptr)) {
if (FLAG_support_il_printer && FLAG_trace_range_analysis) {
THR_Print("Failed to simplify upper bound for %s index\n",
check->ToCString());
@@ -842,7 +842,7 @@ class BoundsCheckGeneralizer {
DeoptId::kNone);
precondition->mark_generalized();
precondition = scheduler_.Emit(precondition, check);
if (precondition == NULL) {
if (precondition == nullptr) {
if (FLAG_trace_range_analysis) {
THR_Print(" => failed to insert positivity constraint\n");
}
@@ -864,7 +864,7 @@ class BoundsCheckGeneralizer {
}
new_check = scheduler_.Emit(new_check, check);
if (new_check != NULL) {
if (new_check != nullptr) {
if (FLAG_trace_range_analysis) {
THR_Print(" => generalized check was hoisted into B%" Pd "\n",
new_check->GetBlock()->block_id());
@@ -880,7 +880,7 @@ class BoundsCheckGeneralizer {
static void RemoveGeneralizedCheck(CheckArrayBoundInstr* check) {
BinarySmiOpInstr* binary_op = check->index()->definition()->AsBinarySmiOp();
if (binary_op != NULL) {
if (binary_op != nullptr) {
binary_op->set_can_overflow(false);
}
check->ReplaceUsesWith(check->index()->definition());
@@ -1114,31 +1114,31 @@ class BoundsCheckGeneralizer {
return false; // Abort.
}
if (constant != NULL) {
if (constant != nullptr) {
*constant = c;
}
if ((left == NULL) && (right == NULL)) {
if (constant != NULL) {
*defn = NULL;
if ((left == nullptr) && (right == nullptr)) {
if (constant != nullptr) {
*defn = nullptr;
} else {
*defn = flow_graph_->GetConstant(Smi::Handle(Smi::New(c)));
}
return true;
}
if (left == NULL) {
if ((constant != NULL) || (c == 0)) {
if (left == nullptr) {
if ((constant != nullptr) || (c == 0)) {
*defn = right;
return true;
} else {
left = right;
right = NULL;
right = nullptr;
}
}
if (right == NULL) {
if ((constant != NULL) || (c == 0)) {
if (right == nullptr) {
if ((constant != nullptr) || (c == 0)) {
*defn = left;
return true;
} else {
@@ -1159,25 +1159,25 @@ class BoundsCheckGeneralizer {
return false; // Abort.
}
if (constant != NULL) {
if (constant != nullptr) {
*constant = c;
}
if ((left == NULL) && (right == NULL)) {
if (constant != NULL) {
*defn = NULL;
if ((left == nullptr) && (right == nullptr)) {
if (constant != nullptr) {
*defn = nullptr;
} else {
*defn = flow_graph_->GetConstant(Smi::Handle(Smi::New(c)));
}
return true;
}
if (left == NULL) {
if (left == nullptr) {
left = flow_graph_->GetConstant(Object::smi_zero());
}
if (right == NULL) {
if ((constant != NULL) || (c == 0)) {
if (right == nullptr) {
if ((constant != nullptr) || (c == 0)) {
*defn = left;
return true;
} else {
@@ -1186,7 +1186,7 @@ class BoundsCheckGeneralizer {
}
}
} else if (binary_op->op_kind() == Token::kMUL) {
if (!Simplify(&left, NULL) || !Simplify(&right, NULL)) {
if (!Simplify(&left, nullptr) || !Simplify(&right, nullptr)) {
return false;
}
} else {
@@ -1194,8 +1194,8 @@ class BoundsCheckGeneralizer {
return true;
}
ASSERT(left != NULL);
ASSERT(right != NULL);
ASSERT(left != nullptr);
ASSERT(right != nullptr);
const bool left_changed = (left != binary_op->left()->definition());
const bool right_changed = (right != binary_op->right()->definition());
@@ -1210,13 +1210,13 @@ class BoundsCheckGeneralizer {
}
}
if ((c != 0) && (constant == NULL)) {
if ((c != 0) && (constant == nullptr)) {
*defn = MakeBinaryOp(Token::kADD, *defn, c);
}
} else if ((*defn)->IsConstant()) {
ConstantInstr* constant_defn = (*defn)->AsConstant();
if ((constant != NULL) && constant_defn->IsSmi()) {
*defn = NULL;
if ((constant != nullptr) && constant_defn->IsSmi()) {
*defn = nullptr;
*constant = Smi::Cast(constant_defn->value()).Value();
}
}
@@ -1266,10 +1266,11 @@ class BoundsCheckGeneralizer {
// instruction.
static Definition* FindInnermostConstraint(Definition* defn,
Instruction* post_dominator) {
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
ConstraintInstr* constraint = use->instruction()->AsConstraint();
if ((constraint != NULL) && post_dominator->IsDominatedBy(constraint)) {
if ((constraint != nullptr) &&
post_dominator->IsDominatedBy(constraint)) {
return FindInnermostConstraint(constraint, post_dominator);
}
}
@@ -1284,10 +1285,10 @@ class BoundsCheckGeneralizer {
static Definition* ApplyConstraints(
Definition* defn,
Instruction* post_dominator,
GrowableArray<ConstraintInstr*>* constraints = NULL) {
GrowableArray<ConstraintInstr*>* constraints = nullptr) {
if (defn->HasSSATemp()) {
defn = FindInnermostConstraint(defn, post_dominator);
if (constraints != NULL) {
if (constraints != nullptr) {
for (intptr_t i = 0; i < constraints->length(); i++) {
ConstraintInstr* constraint = (*constraints)[i];
if (constraint->value()->definition() == defn) {
@@ -1310,7 +1311,7 @@ class BoundsCheckGeneralizer {
static void PrettyPrintIndexBoundRecursively(BaseTextBuffer* f,
Definition* index_bound) {
BinarySmiOpInstr* binary_op = index_bound->AsBinarySmiOp();
if (binary_op != NULL) {
if (binary_op != nullptr) {
f->AddString("(");
PrettyPrintIndexBoundRecursively(f, binary_op->left()->definition());
f->Printf(" %s ", Token::Str(binary_op->op_kind()));
@@ -1365,7 +1366,7 @@ void RangeAnalysis::MarkUnreachableBlocks() {
for (intptr_t i = 0; i < constraints_.length(); i++) {
if (Range::IsUnknown(constraints_[i]->range())) {
TargetEntryInstr* target = constraints_[i]->target();
if (target == NULL) {
if (target == nullptr) {
// TODO(vegorov): replace Constraint with an unconditional
// deoptimization and kill all dominated dead code.
continue;
@@ -1419,7 +1420,7 @@ static void NarrowBinaryInt64Op(BinaryInt64OpInstr* int64_op) {
int64_op->right()->CopyWithType(), int64_op->DeoptimizationTarget());
int32_op->set_range(*int64_op->range());
int32_op->set_can_overflow(false);
int64_op->ReplaceWith(int32_op, NULL);
int64_op->ReplaceWith(int32_op, nullptr);
}
}
@@ -1436,7 +1437,7 @@ static void NarrowShiftInt64Op(ShiftIntegerOpInstr* int64_op) {
int64_op->right()->CopyWithType(), int64_op->DeoptimizationTarget());
int32_op->set_range(*int64_op->range());
int32_op->set_can_overflow(false);
int64_op->ReplaceWith(int32_op, NULL);
int64_op->ReplaceWith(int32_op, nullptr);
}
}
@@ -1452,7 +1453,7 @@ void RangeAnalysis::NarrowMintToInt32() {
IntegerInstructionSelector::IntegerInstructionSelector(FlowGraph* flow_graph)
: flow_graph_(flow_graph) {
ASSERT(flow_graph_ != NULL);
ASSERT(flow_graph_ != nullptr);
zone_ = flow_graph_->zone();
selected_uint32_defs_ =
new (zone_) BitVector(zone_, flow_graph_->current_ssa_temp_index());
@@ -1498,7 +1499,7 @@ void IntegerInstructionSelector::FindPotentialUint32Definitions() {
instr_it.Advance()) {
Instruction* current = instr_it.Current();
Definition* defn = current->AsDefinition();
if ((defn != NULL) && defn->HasSSATemp()) {
if ((defn != nullptr) && defn->HasSSATemp()) {
if (IsPotentialUint32Definition(defn)) {
if (FLAG_support_il_printer && FLAG_trace_integer_ir_selection) {
THR_Print("Adding %s\n", current->ToCString());
@@ -1520,7 +1521,7 @@ bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) {
return false;
}
Range* range = op->range();
if ((range == NULL) ||
if ((range == nullptr) ||
!range->IsWithin(0, static_cast<int64_t>(kMaxUint32))) {
return false;
}
@@ -1531,7 +1532,7 @@ bool IntegerInstructionSelector::IsUint32NarrowingDefinition(Definition* def) {
}
void IntegerInstructionSelector::FindUint32NarrowingDefinitions() {
ASSERT(selected_uint32_defs_ != NULL);
ASSERT(selected_uint32_defs_ != nullptr);
if (FLAG_trace_integer_ir_selection) {
THR_Print("++++ Selecting Uint32 definitions:\n");
THR_Print("++++ Initial set:\n");
@@ -1551,7 +1552,7 @@ bool IntegerInstructionSelector::AllUsesAreUint32Narrowing(Value* list_head) {
for (Value::Iterator it(list_head); !it.Done(); it.Advance()) {
Value* use = it.Current();
Definition* defn = use->instruction()->AsDefinition();
if ((defn == NULL) || !defn->HasSSATemp() ||
if ((defn == nullptr) || !defn->HasSSATemp() ||
!selected_uint32_defs_->Contains(defn->ssa_temp_index())) {
return false;
}
@@ -1579,9 +1580,9 @@ bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) {
ShiftIntegerOpInstr* op = def->AsShiftIntegerOp();
if ((op->op_kind() == Token::kSHR) || (op->op_kind() == Token::kUSHR)) {
Definition* shift_input = op->left()->definition();
ASSERT(shift_input != NULL);
ASSERT(shift_input != nullptr);
Range* range = shift_input->range();
if ((range == NULL) ||
if ((range == nullptr) ||
!range->IsWithin(0, static_cast<int64_t>(kMaxUint32))) {
return false;
}
@@ -1596,7 +1597,7 @@ bool IntegerInstructionSelector::CanBecomeUint32(Definition* def) {
}
void IntegerInstructionSelector::Propagate() {
ASSERT(selected_uint32_defs_ != NULL);
ASSERT(selected_uint32_defs_ != nullptr);
bool changed = true;
intptr_t iteration = 0;
while (changed) {
@@ -1663,7 +1664,7 @@ Definition* IntegerInstructionSelector::ConstructReplacementFor(
return new (Z) UnaryUint32OpInstr(op_kind, value, deopt_id);
}
UNREACHABLE();
return NULL;
return nullptr;
}
void IntegerInstructionSelector::ReplaceInstructions() {
@@ -1677,7 +1678,7 @@ void IntegerInstructionSelector::ReplaceInstructions() {
continue;
}
Definition* replacement = ConstructReplacementFor(defn);
ASSERT(replacement != NULL);
ASSERT(replacement != nullptr);
if (!Range::IsUnknown(defn->range())) {
if (defn->range()->IsPositive()) {
replacement->set_range(*defn->range());
@@ -1690,7 +1691,7 @@ void IntegerInstructionSelector::ReplaceInstructions() {
THR_Print("Replacing %s with %s\n", defn->ToCString(),
replacement->ToCString());
}
defn->ReplaceWith(replacement, NULL);
defn->ReplaceWith(replacement, nullptr);
}
}
@@ -1894,7 +1895,7 @@ static bool CanonicalizeMaxBoundary(RangeBoundary* a) {
if (!a->IsSymbol()) return false;
Range* range = a->symbol()->range();
if ((range == NULL) || !range->max().IsSymbol()) return false;
if ((range == nullptr) || !range->max().IsSymbol()) return false;
if (Utils::WillAddOverflow(range->max().offset(), a->offset())) {
*a = RangeBoundary::PositiveInfinity();
@@ -1919,7 +1920,7 @@ static bool CanonicalizeMinBoundary(RangeBoundary* a) {
if (!a->IsSymbol()) return false;
Range* range = a->symbol()->range();
if ((range == NULL) || !range->min().IsSymbol()) return false;
if ((range == nullptr) || !range->min().IsSymbol()) return false;
if (Utils::WillAddOverflow(range->min().offset(), a->offset())) {
*a = RangeBoundary::NegativeInfinity();
@@ -2137,10 +2138,10 @@ void Range::Shl(const Range* left,
const Range* right,
RangeBoundary* result_min,
RangeBoundary* result_max) {
ASSERT(left != NULL);
ASSERT(right != NULL);
ASSERT(result_min != NULL);
ASSERT(result_max != NULL);
ASSERT(left != nullptr);
ASSERT(right != nullptr);
ASSERT(result_min != nullptr);
ASSERT(result_max != nullptr);
RangeBoundary left_max = Range::ConstantMax(left);
RangeBoundary left_min = Range::ConstantMin(left);
// A negative shift count always deoptimizes (and throws), so the minimum
@@ -2254,10 +2255,10 @@ void Range::And(const Range* left_range,
const Range* right_range,
RangeBoundary* result_min,
RangeBoundary* result_max) {
ASSERT(left_range != NULL);
ASSERT(right_range != NULL);
ASSERT(result_min != NULL);
ASSERT(result_max != NULL);
ASSERT(left_range != nullptr);
ASSERT(right_range != nullptr);
ASSERT(result_min != nullptr);
ASSERT(result_max != nullptr);
if (Range::ConstantMin(right_range).ConstantValue() >= 0) {
*result_min = RangeBoundary::FromConstant(0);
@@ -2302,10 +2303,10 @@ void Range::Add(const Range* left_range,
RangeBoundary* result_min,
RangeBoundary* result_max,
Definition* left_defn) {
ASSERT(left_range != NULL);
ASSERT(right_range != NULL);
ASSERT(result_min != NULL);
ASSERT(result_max != NULL);
ASSERT(left_range != nullptr);
ASSERT(right_range != nullptr);
ASSERT(result_min != nullptr);
ASSERT(result_max != nullptr);
RangeBoundary left_min = Definition::IsArrayLength(left_defn)
? RangeBoundary::FromDefinition(left_defn)
@@ -2332,10 +2333,10 @@ void Range::Sub(const Range* left_range,
RangeBoundary* result_min,
RangeBoundary* result_max,
Definition* left_defn) {
ASSERT(left_range != NULL);
ASSERT(right_range != NULL);
ASSERT(result_min != NULL);
ASSERT(result_max != NULL);
ASSERT(left_range != nullptr);
ASSERT(right_range != nullptr);
ASSERT(result_min != nullptr);
ASSERT(result_max != nullptr);
RangeBoundary left_min = Definition::IsArrayLength(left_defn)
? RangeBoundary::FromDefinition(left_defn)
@@ -2361,10 +2362,10 @@ void Range::Mul(const Range* left_range,
const Range* right_range,
RangeBoundary* result_min,
RangeBoundary* result_max) {
ASSERT(left_range != NULL);
ASSERT(right_range != NULL);
ASSERT(result_min != NULL);
ASSERT(result_max != NULL);
ASSERT(left_range != nullptr);
ASSERT(right_range != nullptr);
ASSERT(result_min != nullptr);
ASSERT(result_max != nullptr);
const int64_t left_max = ConstantAbsMax(left_range);
const int64_t right_max = ConstantAbsMax(right_range);
@@ -2461,7 +2462,7 @@ bool Range::OnlyNegativeOrZero(const Range& a, const Range& b) {
// Return the maximum absolute value included in range.
int64_t Range::ConstantAbsMax(const Range* range) {
if (range == NULL) {
if (range == nullptr) {
return RangeBoundary::kMax;
}
const int64_t abs_min =
@@ -2473,7 +2474,7 @@ int64_t Range::ConstantAbsMax(const Range* range) {
// Return the minimum absolute value included in range.
int64_t Range::ConstantAbsMin(const Range* range) {
if (range == NULL) {
if (range == nullptr) {
return 0;
}
const int64_t abs_min =
@@ -2488,8 +2489,8 @@ void Range::BinaryOp(const Token::Kind op,
const Range* right_range,
Definition* left_defn,
Range* result) {
ASSERT(left_range != NULL);
ASSERT(right_range != NULL);
ASSERT(left_range != nullptr);
ASSERT(right_range != nullptr);
// Both left and right ranges are finite.
ASSERT(left_range->IsFinite());
@@ -2557,7 +2558,7 @@ void Range::BinaryOp(const Token::Kind op,
}
void Definition::set_range(const Range& range) {
if (range_ == NULL) {
if (range_ == nullptr) {
range_ = new Range();
}
*range_ = range;
@@ -2679,7 +2680,7 @@ static const Range* GetInputRange(RangeAnalysis* analysis,
return analysis->GetIntRange(input);
default:
UNREACHABLE();
return NULL;
return nullptr;
}
}
@@ -2982,15 +2983,15 @@ void BinaryIntegerOpInstr::InferRangeHelper(const Range* left_range,
static void CacheRange(Range** slot,
const Range* range,
RangeBoundary::RangeSize size) {
if (range != NULL) {
if (*slot == NULL) {
if (range != nullptr) {
if (*slot == nullptr) {
*slot = new Range();
}
**slot = *range;
// Eliminate any symbolic dependencies from the range information.
(*slot)->ClampToConstant(size);
} else if (*slot != NULL) {
} else if (*slot != nullptr) {
**slot = Range(); // Clear cached range information.
}
}
@@ -3051,7 +3052,7 @@ void UnboxInt32Instr::InferRange(RangeAnalysis* analysis, Range* range) {
}
void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) {
const Range* value_range = NULL;
const Range* value_range = nullptr;
if (value()->Type()->ToCid() == kSmiCid) {
value_range = analysis->GetSmiRange(value());
@@ -3075,7 +3076,7 @@ void UnboxUint32Instr::InferRange(RangeAnalysis* analysis, Range* range) {
void UnboxInt64Instr::InferRange(RangeAnalysis* analysis, Range* range) {
const Range* value_range = value()->definition()->range();
if (value_range != NULL) {
if (value_range != nullptr) {
*range = *value_range;
} else if (!value()->definition()->IsInt64Definition() &&
(value()->definition()->Type()->ToCid() != kSmiCid)) {
+4 -4
View File
@@ -336,7 +336,7 @@ class Range : public ZoneAllocated {
}
static bool IsUnknown(const Range* other) {
if (other == NULL) {
if (other == nullptr) {
return true;
}
return other->min().IsUnknown();
@@ -352,7 +352,7 @@ class Range : public ZoneAllocated {
bool Equals(const Range* other) {
ASSERT(min_.IsUnknown() == max_.IsUnknown());
if (other == NULL) {
if (other == nullptr) {
return min_.IsUnknown();
}
return min_.Equals(other->min_) && max_.Equals(other->max_);
@@ -397,7 +397,7 @@ class Range : public ZoneAllocated {
static RangeBoundary ConstantMin(const Range* range,
RangeBoundary::RangeSize size) {
if (range == NULL) {
if (range == nullptr) {
return RangeBoundary::MinConstant(size);
}
return range->min().LowerBound().Clamp(size);
@@ -405,7 +405,7 @@ class Range : public ZoneAllocated {
static RangeBoundary ConstantMax(const Range* range,
RangeBoundary::RangeSize size) {
if (range == NULL) {
if (range == nullptr) {
return RangeBoundary::MaxConstant(size);
}
return range->max().UpperBound().Clamp(size);
@@ -270,7 +270,7 @@ TEST_CASE(RangeBinaryOp) {
{
Range result;
Range::BinaryOp(Token::kADD, range_a, range_b, NULL, &result);
Range::BinaryOp(Token::kADD, range_a, range_b, nullptr, &result);
ASSERT(!Range::IsUnknown(&result));
EXPECT(!result.min().IsNegativeInfinity());
EXPECT(!result.max().IsPositiveInfinity());
@@ -288,7 +288,7 @@ TEST_CASE(RangeBinaryOp) {
{
Range result;
Range::BinaryOp(Token::kADD, range_c, range_d, NULL, &result);
Range::BinaryOp(Token::kADD, range_c, range_d, nullptr, &result);
ASSERT(!Range::IsUnknown(&result));
EXPECT(result.min().ConstantValue() == 5);
EXPECT(result.max().ConstantValue() == 15);
@@ -301,7 +301,7 @@ TEST_CASE(RangeBinaryOp) {
RangeBoundary::FromConstant(0xf));
{
Range result;
Range::BinaryOp(Token::kBIT_AND, range_e, range_f, NULL, &result);
Range::BinaryOp(Token::kBIT_AND, range_e, range_f, nullptr, &result);
ASSERT(!Range::IsUnknown(&result));
EXPECT(result.min().ConstantValue() == 0x0);
EXPECT(result.max().ConstantValue() == 0xf);
@@ -320,7 +320,7 @@ TEST_CASE(RangeAdd) {
EXPECT(left_range->max().ConstantValue() == l_max); \
EXPECT(right_range->min().ConstantValue() == r_min); \
EXPECT(right_range->max().ConstantValue() == r_max); \
Range::Add(left_range, right_range, &min, &max, NULL); \
Range::Add(left_range, right_range, &min, &max, nullptr); \
EXPECT(min.Equals(result_min)); \
if (FLAG_support_il_printer && !min.Equals(result_min)) { \
OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
@@ -400,7 +400,7 @@ TEST_CASE(RangeSub) {
EXPECT(left_range->max().ConstantValue() == l_max); \
EXPECT(right_range->min().ConstantValue() == r_min); \
EXPECT(right_range->max().ConstantValue() == r_max); \
Range::Sub(left_range, right_range, &min, &max, NULL); \
Range::Sub(left_range, right_range, &min, &max, nullptr); \
EXPECT(min.Equals(result_min)); \
if (FLAG_support_il_printer && !min.Equals(result_min)) { \
OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
@@ -312,7 +312,8 @@ class Place : public ValueObject {
// Create object representing *[*] alias.
static Place* CreateAnyInstanceAnyIndexAlias(Zone* zone, intptr_t id) {
return Wrap(
zone, Place(EncodeFlags(kIndexed, kNoRepresentation, kNoSize), NULL, 0),
zone,
Place(EncodeFlags(kIndexed, kNoRepresentation, kNoSize), nullptr, 0),
id);
}
@@ -332,10 +333,10 @@ class Place : public ValueObject {
// if any.
//
Place ToAlias() const {
return Place(
RepresentationBits::update(kNoRepresentation, flags_),
(DependsOnInstance() && IsAllocation(instance())) ? instance() : NULL,
(kind() == kIndexed) ? 0 : raw_selector_);
return Place(RepresentationBits::update(kNoRepresentation, flags_),
(DependsOnInstance() && IsAllocation(instance())) ? instance()
: nullptr,
(kind() == kIndexed) ? 0 : raw_selector_);
}
bool DependsOnInstance() const {
@@ -358,7 +359,7 @@ class Place : public ValueObject {
// wild-card dependent alias *.f, *.@offs, *[C] or *[*] respectively.
Place CopyWithoutInstance() const {
ASSERT(DependsOnInstance());
return Place(flags_, NULL, raw_selector_);
return Place(flags_, nullptr, raw_selector_);
}
// Given alias X[C] or *[C] return X[*] and *[*] respectively.
@@ -442,7 +443,7 @@ class Place : public ValueObject {
}
static const char* DefinitionName(Definition* def) {
if (def == NULL) {
if (def == nullptr) {
return "*";
} else {
return Thread::Current()->zone()->PrintToString("v%" Pd,
@@ -511,9 +512,9 @@ class Place : public ValueObject {
static Place* Wrap(Zone* zone, const Place& place, intptr_t id);
static bool IsAllocation(Definition* defn) {
return (defn != NULL) && (defn->IsAllocation() ||
(defn->IsStaticCall() &&
defn->AsStaticCall()->IsRecognizedFactory()));
return (defn != nullptr) && (defn->IsAllocation() ||
(defn->IsStaticCall() &&
defn->AsStaticCall()->IsRecognizedFactory()));
}
private:
@@ -545,7 +546,7 @@ class Place : public ValueObject {
void SetIndex(Definition* index, intptr_t scale, intptr_t class_id) {
ConstantInstr* index_constant = index->AsConstant();
if ((index_constant != NULL) && index_constant->value().IsSmi()) {
if ((index_constant != nullptr) && index_constant->value().IsSmi()) {
const intptr_t index_value = Smi::Cast(index_constant->value()).Value();
const ElementSize size = ElementSizeFor(class_id);
const bool is_typed_access = (size != kNoSize);
@@ -725,7 +726,7 @@ class PhiPlaceMoves : public ZoneAllocated {
MovesList GetOutgoingMoves(BlockEntryInstr* block) const {
const intptr_t block_num = block->preorder_number();
return (block_num < moves_.length()) ? moves_[block_num] : NULL;
return (block_num < moves_.length()) ? moves_[block_num] : nullptr;
}
private:
@@ -761,11 +762,11 @@ class AliasedSet : public ZoneAllocated {
intptr_t LookupAliasId(const Place& alias) {
const Place* result = aliases_map_.LookupValue(&alias);
return (result != NULL) ? result->id() : static_cast<intptr_t>(kNoAlias);
return (result != nullptr) ? result->id() : static_cast<intptr_t>(kNoAlias);
}
BitVector* GetKilledSet(intptr_t alias) {
return (alias < killed_.length()) ? killed_[alias] : NULL;
return (alias < killed_.length()) ? killed_[alias] : nullptr;
}
intptr_t max_place_id() const { return places().length(); }
@@ -846,7 +847,7 @@ class AliasedSet : public ZoneAllocated {
->Add(place->id());
}
if (alias->instance() == NULL) {
if (alias->instance() == nullptr) {
EnsureSet(&representatives_, kUnknownInstanceConstantIndexedAlias)
->Add(place->id());
}
@@ -884,7 +885,7 @@ class AliasedSet : public ZoneAllocated {
BitVector* kill = GetKilledSet(alias->id());
THR_Print("%s: ", alias->ToCString());
if (kill != NULL) {
if (kill != nullptr) {
PrintSet(kill);
}
THR_Print("\n");
@@ -899,7 +900,7 @@ class AliasedSet : public ZoneAllocated {
const Place* CanonicalizeAlias(const Place& alias) {
const Place* canonical = aliases_map_.LookupValue(&alias);
if (canonical == NULL) {
if (canonical == nullptr) {
canonical = Place::Wrap(zone_, alias,
kAnyInstanceAnyIndexAlias + aliases_.length());
InsertAlias(canonical);
@@ -909,16 +910,17 @@ class AliasedSet : public ZoneAllocated {
}
BitVector* GetRepresentativesSet(intptr_t alias) {
return (alias < representatives_.length()) ? representatives_[alias] : NULL;
return (alias < representatives_.length()) ? representatives_[alias]
: nullptr;
}
BitVector* EnsureSet(GrowableArray<BitVector*>* sets, intptr_t alias) {
while (sets->length() <= alias) {
sets->Add(NULL);
sets->Add(nullptr);
}
BitVector* set = (*sets)[alias];
if (set == NULL) {
if (set == nullptr) {
(*sets)[alias] = set = new (zone_) BitVector(zone_, max_place_id());
}
return set;
@@ -930,7 +932,7 @@ class AliasedSet : public ZoneAllocated {
void AddAllRepresentatives(intptr_t to, intptr_t from) {
BitVector* from_set = GetRepresentativesSet(from);
if (from_set != NULL) {
if (from_set != nullptr) {
EnsureSet(&killed_, to)->AddAll(from_set);
}
}
@@ -960,7 +962,7 @@ class AliasedSet : public ZoneAllocated {
void ComputeKillSet(const Place* alias) {
switch (alias->kind()) {
case Place::kIndexed: // Either *[*] or X[*] alias.
if (alias->instance() == NULL) {
if (alias->instance() == nullptr) {
// *[*] aliases with X[*], X[C], *[C].
AddAllRepresentatives(alias, kAnyConstantIndexedAlias);
AddAllRepresentatives(alias, kAnyAllocationIndexedAlias);
@@ -975,7 +977,7 @@ class AliasedSet : public ZoneAllocated {
case Place::kConstantIndexed: // Either X[C] or *[C] alias.
if (alias->element_size() != Place::kNoSize) {
const bool has_aliased_instance =
(alias->instance() != NULL) && CanBeAliased(alias->instance());
(alias->instance() != nullptr) && CanBeAliased(alias->instance());
// If this is a TypedData access then X[C|S] aliases larger elements
// covering this one X[RoundDown(C, S')|S'] for all S' > S and
@@ -1034,7 +1036,7 @@ class AliasedSet : public ZoneAllocated {
}
}
if (alias->instance() == NULL) {
if (alias->instance() == nullptr) {
// *[C] aliases with X[C], X[*], *[*].
AddAllRepresentatives(alias, kAnyAllocationIndexedAlias);
CrossAlias(alias, kAnyInstanceAnyIndexAlias);
@@ -1082,7 +1084,7 @@ class AliasedSet : public ZoneAllocated {
bool HasLoadsFromPlace(Definition* defn, const Place* place) {
ASSERT(place->kind() == Place::kInstanceField);
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
Instruction* instr = use->instruction();
if (UseIsARedefinition(use) &&
@@ -1111,7 +1113,7 @@ class AliasedSet : public ZoneAllocated {
// Check if any use of the definition can create an alias.
// Can add more objects into aliasing_worklist_.
bool AnyUseCreatesAlias(Definition* defn) {
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
Instruction* instr = use->instruction();
if (instr->HasUnknownSideEffects() || instr->IsLoadUntagged() ||
@@ -1188,7 +1190,7 @@ class AliasedSet : public ZoneAllocated {
}
}
// Find all stores into this object.
for (Value* use = defn->input_use_list(); use != NULL;
for (Value* use = defn->input_use_list(); use != nullptr;
use = use->next_use()) {
auto instr = use->instruction();
if (UseIsARedefinition(use)) {
@@ -1275,22 +1277,22 @@ static Definition* GetStoredValue(Instruction* instr) {
}
StoreFieldInstr* store_instance_field = instr->AsStoreField();
if (store_instance_field != NULL) {
if (store_instance_field != nullptr) {
return store_instance_field->value()->definition();
}
StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField();
if (store_static_field != NULL) {
if (store_static_field != nullptr) {
return store_static_field->value()->definition();
}
UNREACHABLE(); // Should only be called for supported store instructions.
return NULL;
return nullptr;
}
static bool IsPhiDependentPlace(Place* place) {
return (place->kind() == Place::kInstanceField) &&
(place->instance() != NULL) && place->instance()->IsPhi();
(place->instance() != nullptr) && place->instance()->IsPhi();
}
// For each place that depends on a phi ensure that equivalent places
@@ -1319,7 +1321,7 @@ static PhiPlaceMoves* ComputePhiMoves(PointerSet<Place>* map,
input_place.set_instance(phi->InputAt(j)->definition());
Place* result = map->LookupValue(&input_place);
if (result == NULL) {
if (result == nullptr) {
result = Place::Wrap(zone, input_place, places->length());
map->Insert(result);
places->Add(result);
@@ -1375,7 +1377,7 @@ static AliasedSet* NumberPlaces(FlowGraph* graph,
}
Place* result = map->LookupValue(&place);
if (result == NULL) {
if (result == nullptr) {
result = Place::Wrap(zone, place, places->length());
map->Insert(result);
places->Add(result);
@@ -1391,10 +1393,10 @@ static AliasedSet* NumberPlaces(FlowGraph* graph,
}
if ((mode == kOptimizeLoads) && !has_loads) {
return NULL;
return nullptr;
}
if ((mode == kOptimizeStores) && !has_stores) {
return NULL;
return nullptr;
}
PhiPlaceMoves* phi_moves = ComputePhiMoves(map, places);
@@ -1412,7 +1414,7 @@ static bool IsLoadEliminationCandidate(Instruction* instr) {
static bool IsLoopInvariantLoad(ZoneGrowableArray<BitVector*>* sets,
intptr_t loop_header_index,
Instruction* instr) {
return IsLoadEliminationCandidate(instr) && (sets != NULL) &&
return IsLoadEliminationCandidate(instr) && (sets != nullptr) &&
HasPlaceId(instr) &&
(*sets)[loop_header_index]->Contains(GetPlaceId(instr));
}
@@ -1431,7 +1433,7 @@ void LICM::Hoist(ForwardInstructionIterator* it,
}
// Move the instruction out of the loop.
current->RemoveEnvironment();
if (it != NULL) {
if (it != nullptr) {
it->RemoveCurrentFromGraph();
} else {
current->RemoveFromGraph();
@@ -1476,18 +1478,18 @@ void LICM::TrySpecializeSmiPhi(PhiInstr* phi,
return;
}
CheckSmiInstr* check = NULL;
for (Value* use = phi->input_use_list(); (use != NULL) && (check == NULL);
use = use->next_use()) {
CheckSmiInstr* check = nullptr;
for (Value* use = phi->input_use_list();
(use != nullptr) && (check == nullptr); use = use->next_use()) {
check = use->instruction()->AsCheckSmi();
}
if (check == NULL) {
if (check == nullptr) {
return;
}
// Host CheckSmi instruction and make this phi smi one.
Hoist(NULL, pre_header, check);
Hoist(nullptr, pre_header, check);
// Replace value we are checking with phi's input.
check->value()->BindTo(phi->InputAt(non_smi_input)->definition());
@@ -1512,7 +1514,7 @@ void LICM::OptimisticallySpecializeSmiPhis() {
JoinEntryInstr* header = loop_headers[i]->AsJoinEntry();
// Skip loop that don't have a pre-header block.
BlockEntryInstr* pre_header = header->ImmediateDominator();
if (pre_header == NULL) continue;
if (pre_header == nullptr) continue;
for (PhiIterator it(header); !it.Done(); it.Advance()) {
TrySpecializeSmiPhi(it.Current(), header, pre_header);
@@ -1754,17 +1756,17 @@ class LoadOptimizer : public ValueObject {
phis_(5),
worklist_(5),
congruency_worklist_(6),
in_worklist_(NULL),
in_worklist_(nullptr),
forwarded_(false) {
const intptr_t num_blocks = graph_->preorder().length();
for (intptr_t i = 0; i < num_blocks; i++) {
out_.Add(NULL);
out_.Add(nullptr);
gen_.Add(new (Z) BitVector(Z, aliased_set_->max_place_id()));
kill_.Add(new (Z) BitVector(Z, aliased_set_->max_place_id()));
in_.Add(new (Z) BitVector(Z, aliased_set_->max_place_id()));
exposed_values_.Add(NULL);
out_values_.Add(NULL);
exposed_values_.Add(nullptr);
out_values_.Add(nullptr);
}
}
@@ -1783,7 +1785,7 @@ class LoadOptimizer : public ValueObject {
PointerSet<Place> map;
AliasedSet* aliased_set = NumberPlaces(graph, &map, kOptimizeLoads);
if ((aliased_set != NULL) && !aliased_set->IsEmpty()) {
if ((aliased_set != nullptr) && !aliased_set->IsEmpty()) {
// If any loads were forwarded return true from Optimize to run load
// forwarding again. This will allow to forward chains of loads.
// This is especially important for context variables as they are built
@@ -2060,8 +2062,8 @@ class LoadOptimizer : public ValueObject {
BitVector* kill = kill_[preorder_number];
BitVector* gen = gen_[preorder_number];
ZoneGrowableArray<Definition*>* exposed_values = NULL;
ZoneGrowableArray<Definition*>* out_values = NULL;
ZoneGrowableArray<Definition*>* exposed_values = nullptr;
ZoneGrowableArray<Definition*>* out_values = nullptr;
for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
instr_it.Advance()) {
@@ -2070,7 +2072,7 @@ class LoadOptimizer : public ValueObject {
bool is_load = false, is_store = false;
Place place(instr, &is_load, &is_store);
BitVector* killed = NULL;
BitVector* killed = nullptr;
if (is_store) {
const intptr_t alias_id =
aliased_set_->LookupAliasId(place.ToAlias());
@@ -2146,7 +2148,7 @@ class LoadOptimizer : public ValueObject {
// Check if this load needs renumbering because of the intrablock
// load forwarding.
const Place* canonical = aliased_set_->LookupCanonical(&place);
if ((canonical != NULL) &&
if ((canonical != nullptr) &&
(canonical->id() != GetPlaceId(instr->AsDefinition()))) {
SetPlaceId(instr->AsDefinition(), canonical->id());
}
@@ -2162,7 +2164,7 @@ class LoadOptimizer : public ValueObject {
}
Definition* defn = instr->AsDefinition();
if (defn == NULL) {
if (defn == nullptr) {
continue;
}
@@ -2172,7 +2174,7 @@ class LoadOptimizer : public ValueObject {
// any values from it.
continue;
}
for (Value* use = alloc->input_use_list(); use != NULL;
for (Value* use = alloc->input_use_list(); use != nullptr;
use = use->next_use()) {
if (use->use_index() != 0) {
// Not a potential immediate load or store, since they take the
@@ -2256,7 +2258,8 @@ class LoadOptimizer : public ValueObject {
const intptr_t place_id = GetPlaceId(defn);
if (gen->Contains(place_id)) {
// This is a locally redundant load.
ASSERT((out_values != NULL) && ((*out_values)[place_id] != NULL));
ASSERT((out_values != nullptr) &&
((*out_values)[place_id] != nullptr));
Definition* replacement = (*out_values)[place_id];
if (CanForwardLoadTo(defn, replacement)) {
@@ -2275,7 +2278,7 @@ class LoadOptimizer : public ValueObject {
// This is an exposed load: it is the first representative of a
// given expression id and it is not killed on the path from
// the block entry.
if (exposed_values == NULL) {
if (exposed_values == nullptr) {
static const intptr_t kMaxExposedValuesInitialSize = 5;
exposed_values = new (Z) ZoneGrowableArray<Definition*>(
Utils::Minimum(kMaxExposedValuesInitialSize,
@@ -2287,7 +2290,7 @@ class LoadOptimizer : public ValueObject {
gen->Add(place_id);
if (out_values == NULL) out_values = CreateBlockOutValues();
if (out_values == nullptr) out_values = CreateBlockOutValues();
(*out_values)[place_id] = defn;
}
@@ -2355,10 +2358,10 @@ class LoadOptimizer : public ValueObject {
for (intptr_t i = 0; i < block->PredecessorCount(); i++) {
BlockEntryInstr* pred = block->PredecessorAt(i);
BitVector* pred_out = out_[pred->preorder_number()];
if (pred_out == NULL) continue;
if (pred_out == nullptr) continue;
PhiPlaceMoves::MovesList phi_moves =
aliased_set_->phi_moves()->GetOutgoingMoves(pred);
if (phi_moves != NULL) {
if (phi_moves != nullptr) {
// If there are phi moves, perform intersection with
// a copy of pred_out where the phi moves are applied.
temp_out->CopyFrom(pred_out);
@@ -2369,15 +2372,15 @@ class LoadOptimizer : public ValueObject {
}
}
if (!temp->Equals(*block_in) || (block_out == NULL)) {
if (!temp->Equals(*block_in) || (block_out == nullptr)) {
// If IN set has changed propagate the change to OUT set.
block_in->CopyFrom(temp);
temp->RemoveAll(block_kill);
temp->AddAll(block_gen);
if ((block_out == NULL) || !block_out->Equals(*temp)) {
if (block_out == NULL) {
if ((block_out == nullptr) || !block_out->Equals(*temp)) {
if (block_out == nullptr) {
block_out = out_[preorder_number] =
new (Z) BitVector(Z, aliased_set_->max_place_id());
}
@@ -2393,13 +2396,13 @@ class LoadOptimizer : public ValueObject {
// through the graph. Generate phis on back edges where eager merge is
// impossible.
// No replacement is done at this point and thus any out_value[place_id] is
// changed at most once: from NULL to an actual value.
// changed at most once: from nullptr to an actual value.
// When merging incoming loads we might need to create a phi.
// These phis are not inserted at the graph immediately because some of them
// might become redundant after load forwarding is done.
void ComputeOutValues() {
GrowableArray<PhiInstr*> pending_phis(5);
ZoneGrowableArray<Definition*>* temp_forwarded_values = NULL;
ZoneGrowableArray<Definition*>* temp_forwarded_values = nullptr;
for (BlockIterator block_it = graph_->reverse_postorder_iterator();
!block_it.Done(); block_it.Advance()) {
@@ -2418,16 +2421,17 @@ class LoadOptimizer : public ValueObject {
it.Advance()) {
const intptr_t place_id = it.Current();
if (block_out_values == NULL) {
if (block_out_values == nullptr) {
out_values_[preorder_number] = block_out_values =
CreateBlockOutValues();
}
if ((*block_out_values)[place_id] == NULL) {
if ((*block_out_values)[place_id] == nullptr) {
ASSERT(block->PredecessorCount() > 0);
Definition* in_value =
can_merge_eagerly ? MergeIncomingValues(block, place_id) : NULL;
if ((in_value == NULL) &&
Definition* in_value = can_merge_eagerly
? MergeIncomingValues(block, place_id)
: nullptr;
if ((in_value == nullptr) &&
(in_[preorder_number]->Contains(place_id))) {
PhiInstr* phi = new (Z)
PhiInstr(block->AsJoinEntry(), block->PredecessorCount());
@@ -2443,8 +2447,8 @@ class LoadOptimizer : public ValueObject {
// of values to ensure that cyclic moves are performed correctly.
PhiPlaceMoves::MovesList phi_moves =
aliased_set_->phi_moves()->GetOutgoingMoves(block);
if ((phi_moves != NULL) && (block_out_values != NULL)) {
if (temp_forwarded_values == NULL) {
if ((phi_moves != nullptr) && (block_out_values != nullptr)) {
if (temp_forwarded_values == nullptr) {
temp_forwarded_values = CreateBlockOutValues();
}
@@ -2508,8 +2512,8 @@ class LoadOptimizer : public ValueObject {
for (intptr_t i = 0; i < loop_headers.length(); i++) {
BlockEntryInstr* header = loop_headers[i];
BlockEntryInstr* pre_header = header->ImmediateDominator();
if (pre_header == NULL) {
invariant_loads->Add(NULL);
if (pre_header == nullptr) {
invariant_loads->Add(nullptr);
continue;
}
@@ -2547,14 +2551,15 @@ class LoadOptimizer : public ValueObject {
// First check if the same value is coming in from all predecessors.
static Definition* const kDifferentValuesMarker =
reinterpret_cast<Definition*>(-1);
Definition* incoming = NULL;
Definition* incoming = nullptr;
for (intptr_t i = 0; i < block->PredecessorCount(); i++) {
BlockEntryInstr* pred = block->PredecessorAt(i);
ZoneGrowableArray<Definition*>* pred_out_values =
out_values_[pred->preorder_number()];
if ((pred_out_values == NULL) || ((*pred_out_values)[place_id] == NULL)) {
return NULL;
} else if (incoming == NULL) {
if ((pred_out_values == nullptr) ||
((*pred_out_values)[place_id] == nullptr)) {
return nullptr;
} else if (incoming == nullptr) {
incoming = (*pred_out_values)[place_id];
} else if (incoming != (*pred_out_values)[place_id]) {
incoming = kDifferentValuesMarker;
@@ -2562,7 +2567,7 @@ class LoadOptimizer : public ValueObject {
}
if (incoming != kDifferentValuesMarker) {
ASSERT(incoming != NULL);
ASSERT(incoming != nullptr);
return incoming;
}
@@ -2582,7 +2587,7 @@ class LoadOptimizer : public ValueObject {
BlockEntryInstr* pred = block->PredecessorAt(i);
ZoneGrowableArray<Definition*>* pred_out_values =
out_values_[pred->preorder_number()];
ASSERT((*pred_out_values)[place_id] != NULL);
ASSERT((*pred_out_values)[place_id] != nullptr);
// Sets of outgoing values are not linked into use lists so
// they might contain values that were replaced and removed
@@ -2614,7 +2619,7 @@ class LoadOptimizer : public ValueObject {
ZoneGrowableArray<Definition*>* loads =
exposed_values_[block->preorder_number()];
if (loads == NULL) continue; // No exposed loads.
if (loads == nullptr) continue; // No exposed loads.
BitVector* in = in_[block->preorder_number()];
@@ -2623,7 +2628,7 @@ class LoadOptimizer : public ValueObject {
if (!in->Contains(GetPlaceId(load))) continue; // No incoming value.
Definition* replacement = MergeIncomingValues(block, GetPlaceId(load));
ASSERT(replacement != NULL);
ASSERT(replacement != nullptr);
// Sets of outgoing values are not linked into use lists so
// they might contain values that were replace and removed
@@ -2656,10 +2661,10 @@ class LoadOptimizer : public ValueObject {
// they are not marked alive.
// TODO(vegorov): move this into a separate phase over all phis.
bool EliminateRedundantPhi(PhiInstr* phi) {
Definition* value = NULL; // Possible value of this phi.
Definition* value = nullptr; // Possible value of this phi.
worklist_.Clear();
if (in_worklist_ == NULL) {
if (in_worklist_ == nullptr) {
in_worklist_ = new (Z) BitVector(Z, graph_->current_ssa_temp_index());
} else {
in_worklist_->Clear();
@@ -2676,7 +2681,7 @@ class LoadOptimizer : public ValueObject {
if (input == phi) continue;
PhiInstr* phi_input = input->AsPhi();
if ((phi_input != NULL) && !phi_input->is_alive()) {
if ((phi_input != nullptr) && !phi_input->is_alive()) {
if (!in_worklist_->Contains(phi_input->ssa_temp_index())) {
worklist_.Add(phi_input);
in_worklist_->Add(phi_input->ssa_temp_index());
@@ -2684,7 +2689,7 @@ class LoadOptimizer : public ValueObject {
continue;
}
if (value == NULL) {
if (value == nullptr) {
value = input;
} else if (value != input) {
return false; // This phi is not redundant.
@@ -2694,7 +2699,7 @@ class LoadOptimizer : public ValueObject {
// All phis in the worklist are redundant and have the same computed
// value on all code paths.
ASSERT(value != NULL);
ASSERT(value != nullptr);
for (intptr_t i = 0; i < worklist_.length(); i++) {
worklist_[i]->ReplaceUsesWith(value);
}
@@ -2761,7 +2766,7 @@ class LoadOptimizer : public ValueObject {
BlockEntryInstr* other_block = other->GetBlock();
if (dom_block == other_block) {
for (Instruction* current = dom->next(); current != NULL;
for (Instruction* current = dom->next(); current != nullptr;
current = current->next()) {
if (current == other) {
return true;
@@ -2780,7 +2785,7 @@ class LoadOptimizer : public ValueObject {
ASSERT(phi->block() == replacement->block());
congruency_worklist_.Clear();
if (in_worklist_ == NULL) {
if (in_worklist_ == nullptr) {
in_worklist_ = new (Z) BitVector(Z, graph_->current_ssa_temp_index());
} else {
in_worklist_->Clear();
@@ -2869,7 +2874,7 @@ class LoadOptimizer : public ValueObject {
PhiInstr* phi = phis_[i];
if (!phi->HasUses() || EliminateRedundantPhi(phi)) {
phi->UnuseAllInputs();
phis_[i] = NULL;
phis_[i] = nullptr;
}
}
@@ -2877,7 +2882,7 @@ class LoadOptimizer : public ValueObject {
// graph.
for (intptr_t i = 0; i < phis_.length(); i++) {
PhiInstr* phi = phis_[i];
if ((phi != NULL) && (!phi->HasUses() || !EmitPhi(phi))) {
if ((phi != nullptr) && (!phi->HasUses() || !EmitPhi(phi))) {
phi->UnuseAllInputs();
}
}
@@ -2887,7 +2892,7 @@ class LoadOptimizer : public ValueObject {
ZoneGrowableArray<Definition*>* out =
new (Z) ZoneGrowableArray<Definition*>(aliased_set_->max_place_id());
for (intptr_t i = 0; i < aliased_set_->max_place_id(); i++) {
out->Add(NULL);
out->Add(nullptr);
}
return out;
}
@@ -2951,7 +2956,7 @@ bool DominatorBasedCSE::OptimizeRecursive(FlowGraph* graph,
if (current->AllowsCSE()) {
Instruction* replacement = map->Lookup(current);
if (replacement != NULL) {
if (replacement != nullptr) {
// Replace current with lookup result.
ASSERT(replacement->AllowsCSE());
graph->ReplaceCurrentInstruction(&it, current, replacement);
@@ -2994,7 +2999,7 @@ class StoreOptimizer : public LivenessAnalysis {
exposed_stores_(graph_->postorder().length()) {
const intptr_t num_blocks = graph_->postorder().length();
for (intptr_t i = 0; i < num_blocks; i++) {
exposed_stores_.Add(NULL);
exposed_stores_.Add(nullptr);
}
}
@@ -3009,7 +3014,7 @@ class StoreOptimizer : public LivenessAnalysis {
PointerSet<Place> map;
AliasedSet* aliased_set = NumberPlaces(graph, &map, kOptimizeStores);
if ((aliased_set != NULL) && !aliased_set->IsEmpty()) {
if ((aliased_set != nullptr) && !aliased_set->IsEmpty()) {
StoreOptimizer store_optimizer(graph, aliased_set, &map);
store_optimizer.Optimize();
}
@@ -3083,7 +3088,7 @@ class StoreOptimizer : public LivenessAnalysis {
BitVector* live_in = live_in_[postorder_number];
BitVector* live_out = live_out_[postorder_number];
ZoneGrowableArray<Instruction*>* exposed_stores = NULL;
ZoneGrowableArray<Instruction*>* exposed_stores = nullptr;
// Iterate backwards starting at the last instruction.
for (BackwardInstructionIterator instr_it(block); !instr_it.Done();
@@ -3113,7 +3118,7 @@ class StoreOptimizer : public LivenessAnalysis {
} else if (!live_in->Contains(GetPlaceId(instr))) {
// Mark this store as down-ward exposed: They are the only
// candidates for the global store elimination.
if (exposed_stores == NULL) {
if (exposed_stores == nullptr) {
const intptr_t kMaxExposedStoresInitialSize = 5;
exposed_stores = new (zone) ZoneGrowableArray<Instruction*>(
Utils::Minimum(kMaxExposedStoresInitialSize,
@@ -3177,7 +3182,7 @@ class StoreOptimizer : public LivenessAnalysis {
// Handle loads.
Definition* defn = instr->AsDefinition();
if ((defn != NULL) && IsLoadEliminationCandidate(defn)) {
if ((defn != nullptr) && IsLoadEliminationCandidate(defn)) {
const intptr_t alias = aliased_set_->LookupAliasId(place.ToAlias());
live_in->AddAll(aliased_set_->GetKilledSet(alias));
continue;
@@ -3202,7 +3207,7 @@ class StoreOptimizer : public LivenessAnalysis {
ZoneGrowableArray<Instruction*>* exposed_stores =
exposed_stores_[postorder_number];
if (exposed_stores == NULL) continue; // No exposed stores.
if (exposed_stores == nullptr) continue; // No exposed stores.
// Iterate over candidate stores.
for (intptr_t i = 0; i < exposed_stores->length(); ++i) {
@@ -3357,7 +3362,7 @@ static bool IsSafeUse(Value* use, SafeUseCheck check_type) {
// instructions that write into fields of the allocated object.
static bool IsAllocationSinkingCandidate(Definition* alloc,
SafeUseCheck check_type) {
for (Value* use = alloc->input_use_list(); use != NULL;
for (Value* use = alloc->input_use_list(); use != nullptr;
use = use->next_use()) {
if (!IsSafeUse(use, check_type)) {
if (FLAG_support_il_printer && FLAG_trace_optimization) {
@@ -3443,7 +3448,8 @@ void AllocationSinking::EliminateAllocation(Definition* alloc) {
// There should be no environment uses. The pass replaced them with
// MaterializeObject instructions.
#ifdef DEBUG
for (Value* use = alloc->env_use_list(); use != NULL; use = use->next_use()) {
for (Value* use = alloc->env_use_list(); use != nullptr;
use = use->next_use()) {
ASSERT(use->instruction()->IsMaterializeObject());
}
#endif
@@ -3515,7 +3521,7 @@ void AllocationSinking::NormalizeMaterializations() {
Definition* alloc = candidates_[i];
Value* next_use;
for (Value* use = alloc->input_use_list(); use != NULL; use = next_use) {
for (Value* use = alloc->input_use_list(); use != nullptr; use = next_use) {
next_use = use->next_use();
if (use->instruction()->IsMaterializeObject()) {
use->BindTo(MaterializationFor(alloc, use->instruction()));
@@ -3589,7 +3595,7 @@ void AllocationSinking::DiscoverFailedCandidates() {
}
#ifdef DEBUG
for (Value* use = alloc->env_use_list(); use != NULL;
for (Value* use = alloc->env_use_list(); use != nullptr;
use = use->next_use()) {
ASSERT(use->instruction()->IsMaterializeObject());
}
@@ -3599,8 +3605,8 @@ void AllocationSinking::DiscoverFailedCandidates() {
// loads first and detach materializations from allocation's environment
// use list: we will reconstruct it when we start removing
// materializations.
alloc->set_env_use_list(NULL);
for (Value* use = alloc->input_use_list(); use != NULL;
alloc->set_env_use_list(nullptr);
for (Value* use = alloc->input_use_list(); use != nullptr;
use = use->next_use()) {
if (use->instruction()->IsLoadField() ||
use->instruction()->IsLoadIndexed()) {
@@ -3766,13 +3772,13 @@ MaterializeObjectInstr* AllocationSinking::MaterializationFor(
}
for (MaterializeObjectInstr* mat = exit->previous()->AsMaterializeObject();
mat != NULL; mat = mat->previous()->AsMaterializeObject()) {
mat != nullptr; mat = mat->previous()->AsMaterializeObject()) {
if (mat->allocation() == alloc) {
return mat;
}
}
return NULL;
return nullptr;
}
// Insert MaterializeObject instruction for the given allocation before
@@ -3892,7 +3898,8 @@ void AddInstruction(GrowableArray<T*>* list, T* value) {
// dematerialized and that are referenced by deopt environments that
// don't contain this allocation explicitly.
void AllocationSinking::ExitsCollector::Collect(Definition* alloc) {
for (Value* use = alloc->env_use_list(); use != NULL; use = use->next_use()) {
for (Value* use = alloc->env_use_list(); use != nullptr;
use = use->next_use()) {
if (use->instruction()->IsMaterializeObject()) {
AddInstruction(&exits_, ExitForMaterialization(
use->instruction()->AsMaterializeObject()));
@@ -3905,10 +3912,10 @@ void AllocationSinking::ExitsCollector::Collect(Definition* alloc) {
// candidate and put it on worklist so that we conservatively collect all
// exits for that candidate as well because they potentially might see
// this object.
for (Value* use = alloc->input_use_list(); use != NULL;
for (Value* use = alloc->input_use_list(); use != nullptr;
use = use->next_use()) {
Definition* obj = StoreDestination(use);
if ((obj != NULL) && (obj != alloc)) {
if ((obj != nullptr) && (obj != alloc)) {
AddInstruction(&worklist_, obj);
}
}
@@ -3934,7 +3941,7 @@ void AllocationSinking::InsertMaterializations(Definition* alloc) {
// Collect all fields and array elements that are written for this instance.
auto slots = new (Z) ZoneGrowableArray<const Slot*>(5);
for (Value* use = alloc->input_use_list(); use != NULL;
for (Value* use = alloc->input_use_list(); use != nullptr;
use = use->next_use()) {
if (StoreDestination(use) == alloc) {
// Allocation instructions cannot be used in as inputs to themselves.
@@ -4270,7 +4277,7 @@ void TryCatchAnalyzer::Optimize() {
// The following representation is used:
// ParameterInstr => unknown
// ConstantInstr => known constant
// NULL => non-constant
// nullptr => non-constant
GrowableArray<Definition*>* idefs = catch_entry->initial_definitions();
GrowableArray<Definition*> cdefs(idefs->length());
cdefs.AddArray(*idefs);
@@ -4326,7 +4333,7 @@ void TryCatchAnalyzer::Optimize() {
// Returns true iff this definition is used in a non-phi instruction.
static bool HasRealUse(Definition* def) {
// Environment uses are real (non-phi) uses.
if (def->env_use_list() != NULL) return true;
if (def->env_use_list() != nullptr) return true;
for (Value::Iterator it(def->input_use_list()); !it.Done(); it.Advance()) {
if (!it.Current()->instruction()->IsPhi()) return true;
@@ -4339,7 +4346,7 @@ void DeadCodeElimination::EliminateDeadPhis(FlowGraph* flow_graph) {
for (BlockIterator b = flow_graph->postorder_iterator(); !b.Done();
b.Advance()) {
JoinEntryInstr* join = b.Current()->AsJoinEntry();
if (join != NULL) {
if (join != nullptr) {
for (PhiIterator it(join); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
// Phis that have uses and phis inside try blocks are
@@ -4359,7 +4366,7 @@ void DeadCodeElimination::EliminateDeadPhis(FlowGraph* flow_graph) {
for (intptr_t i = 0; i < phi->InputCount(); i++) {
Value* val = phi->InputAt(i);
PhiInstr* used_phi = val->definition()->AsPhi();
if ((used_phi != NULL) && !used_phi->is_alive()) {
if ((used_phi != nullptr) && !used_phi->is_alive()) {
used_phi->mark_alive();
live_phis.Add(used_phi);
}
@@ -4512,7 +4519,7 @@ static bool IsMarkedWithNoInterrupts(const Function& function) {
void CheckStackOverflowElimination::EliminateStackOverflow(FlowGraph* graph) {
const bool should_remove_all = IsMarkedWithNoInterrupts(graph->function());
CheckStackOverflowInstr* first_stack_overflow_instr = NULL;
CheckStackOverflowInstr* first_stack_overflow_instr = nullptr;
for (BlockIterator block_it = graph->reverse_postorder_iterator();
!block_it.Done(); block_it.Advance()) {
BlockEntryInstr* entry = block_it.Current();
@@ -4526,7 +4533,7 @@ void CheckStackOverflowElimination::EliminateStackOverflow(FlowGraph* graph) {
continue;
}
if (first_stack_overflow_instr == NULL) {
if (first_stack_overflow_instr == nullptr) {
first_stack_overflow_instr = instr;
ASSERT(!first_stack_overflow_instr->in_loop());
}
@@ -4543,7 +4550,7 @@ void CheckStackOverflowElimination::EliminateStackOverflow(FlowGraph* graph) {
}
}
if (first_stack_overflow_instr != NULL) {
if (first_stack_overflow_instr != nullptr) {
first_stack_overflow_instr->RemoveFromGraph();
}
}
+33 -33
View File
@@ -32,7 +32,7 @@ static void TraceStrongModeType(const Instruction* instr,
CompileType* compileType) {
if (FLAG_trace_strong_mode_types) {
const AbstractType* type = compileType->ToAbstractType();
if ((type != NULL) && !type->IsDynamicType()) {
if ((type != nullptr) && !type->IsDynamicType()) {
TraceStrongModeType(instr, *type);
}
}
@@ -49,21 +49,21 @@ FlowGraphTypePropagator::FlowGraphTypePropagator(FlowGraph* flow_graph)
: FlowGraphVisitor(flow_graph->reverse_postorder()),
flow_graph_(flow_graph),
is_aot_(CompilerState::Current().is_aot()),
visited_blocks_(new (flow_graph->zone())
visited_blocks_(new(flow_graph->zone())
BitVector(flow_graph->zone(),
flow_graph->reverse_postorder().length())),
types_(flow_graph->current_ssa_temp_index()),
in_worklist_(NULL),
asserts_(NULL),
collected_asserts_(NULL) {
in_worklist_(nullptr),
asserts_(nullptr),
collected_asserts_(nullptr) {
for (intptr_t i = 0; i < flow_graph->current_ssa_temp_index(); i++) {
types_.Add(NULL);
types_.Add(nullptr);
}
asserts_ = new ZoneGrowableArray<AssertAssignableInstr*>(
flow_graph->current_ssa_temp_index());
for (intptr_t i = 0; i < flow_graph->current_ssa_temp_index(); i++) {
asserts_->Add(NULL);
asserts_->Add(nullptr);
}
collected_asserts_ = new ZoneGrowableArray<intptr_t>(10);
@@ -104,7 +104,7 @@ void FlowGraphTypePropagator::Propagate() {
Instruction* instr = it.Current()->instruction();
Definition* use_defn = instr->AsDefinition();
if (use_defn != NULL) {
if (use_defn != nullptr) {
AddToWorklist(use_defn);
}
}
@@ -143,7 +143,7 @@ void FlowGraphTypePropagator::PropagateRecursive(BlockEntryInstr* block) {
}
GotoInstr* goto_instr = block->last_instruction()->AsGoto();
if (goto_instr != NULL) {
if (goto_instr != nullptr) {
JoinEntryInstr* join = goto_instr->successor();
intptr_t pred_index = join->IndexOfPredecessor(block);
ASSERT(pred_index >= 0);
@@ -170,9 +170,9 @@ CompileType* FlowGraphTypePropagator::TypeOf(Definition* def) {
const intptr_t index = def->ssa_temp_index();
CompileType* type = types_[index];
if (type == NULL) {
if (type == nullptr) {
type = types_[index] = def->Type();
ASSERT(type != NULL);
ASSERT(type != nullptr);
}
return type;
}
@@ -271,7 +271,7 @@ void FlowGraphTypePropagator::VisitCheckClass(CheckClassInstr* check) {
void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) {
LoadClassIdInstr* load_cid =
check->value()->definition()->OriginalDefinition()->AsLoadClassId();
if (load_cid != NULL && check->cids().IsSingleCid()) {
if (load_cid != nullptr && check->cids().IsSingleCid()) {
SetCid(load_cid->object()->definition(), check->cids().cid_start);
}
}
@@ -385,7 +385,7 @@ void FlowGraphTypePropagator::VisitAssertSubtype(AssertSubtypeInstr* instr) {}
void FlowGraphTypePropagator::VisitBranch(BranchInstr* instr) {
StrictCompareInstr* comparison = instr->comparison()->AsStrictCompare();
if (comparison == NULL) return;
if (comparison == nullptr) return;
bool negated = comparison->kind() == Token::kNE_STRICT;
LoadClassIdInstr* load_cid =
comparison->InputAt(0)->definition()->AsLoadClassId();
@@ -394,15 +394,15 @@ void FlowGraphTypePropagator::VisitBranch(BranchInstr* instr) {
InstanceOfInstr* instance_of =
comparison->InputAt(0)->definition()->AsInstanceOf();
bool is_simple_instance_of =
(call != NULL) && call->MatchesCoreName(Symbols::_simpleInstanceOf());
if (load_cid != NULL && comparison->InputAt(1)->BindsToConstant()) {
(call != nullptr) && call->MatchesCoreName(Symbols::_simpleInstanceOf());
if (load_cid != nullptr && comparison->InputAt(1)->BindsToConstant()) {
intptr_t cid = Smi::Cast(comparison->InputAt(1)->BoundConstant()).Value();
BlockEntryInstr* true_successor =
negated ? instr->false_successor() : instr->true_successor();
EnsureMoreAccurateRedefinition(true_successor,
load_cid->object()->definition(),
CompileType::FromCid(cid));
} else if ((is_simple_instance_of || (instance_of != NULL)) &&
} else if ((is_simple_instance_of || (instance_of != nullptr)) &&
comparison->InputAt(1)->BindsToConstant() &&
comparison->InputAt(1)->BoundConstant().IsBool()) {
if (comparison->InputAt(1)->BoundConstant().ptr() == Bool::False().ptr()) {
@@ -410,8 +410,8 @@ void FlowGraphTypePropagator::VisitBranch(BranchInstr* instr) {
}
BlockEntryInstr* true_successor =
negated ? instr->false_successor() : instr->true_successor();
const AbstractType* type = NULL;
Definition* left = NULL;
const AbstractType* type = nullptr;
Definition* left = nullptr;
if (is_simple_instance_of) {
ASSERT(call->ArgumentAt(1)->IsConstant());
const Object& type_obj = call->ArgumentAt(1)->AsConstant()->value();
@@ -507,9 +507,9 @@ void FlowGraphTypePropagator::StrengthenAsserts(BlockEntryInstr* block) {
// If this is the first type assertion checking given value record it.
AssertAssignableInstr* assert = instr->AsAssertAssignable();
if (assert != NULL) {
if (assert != nullptr) {
Definition* defn = assert->value()->definition()->OriginalDefinition();
if ((*asserts_)[defn->ssa_temp_index()] == NULL) {
if ((*asserts_)[defn->ssa_temp_index()] == nullptr) {
(*asserts_)[defn->ssa_temp_index()] = assert;
collected_asserts_->Add(defn->ssa_temp_index());
}
@@ -517,7 +517,7 @@ void FlowGraphTypePropagator::StrengthenAsserts(BlockEntryInstr* block) {
}
for (intptr_t i = 0; i < collected_asserts_->length(); i++) {
(*asserts_)[(*collected_asserts_)[i]] = NULL;
(*asserts_)[(*collected_asserts_)[i]] = nullptr;
}
collected_asserts_->TruncateTo(0);
@@ -532,12 +532,12 @@ void FlowGraphTypePropagator::StrengthenAssertWith(Instruction* check) {
Definition* defn = check->InputAt(0)->definition()->OriginalDefinition();
AssertAssignableInstr* assert = (*asserts_)[defn->ssa_temp_index()];
if ((assert == NULL) || (assert == kStrengthenedAssertMarker)) {
if ((assert == nullptr) || (assert == kStrengthenedAssertMarker)) {
return;
}
ASSERT(assert->env() != NULL);
ASSERT(assert->env() != nullptr);
Instruction* check_clone = NULL;
Instruction* check_clone = nullptr;
if (check->IsCheckSmi()) {
check_clone = new CheckSmiInstr(assert->value()->Copy(zone()),
assert->deopt_id(), check->source());
@@ -547,7 +547,7 @@ void FlowGraphTypePropagator::StrengthenAssertWith(Instruction* check) {
new CheckClassInstr(assert->value()->Copy(zone()), assert->deopt_id(),
check->AsCheckClass()->cids(), check->source());
}
ASSERT(check_clone != NULL);
ASSERT(check_clone != nullptr);
check_clone->InsertBefore(assert);
assert->env()->DeepCopyTo(zone(), check_clone);
@@ -746,11 +746,11 @@ intptr_t CompileType::ToCid() {
if (cid_ == kIllegalCid) {
// Make sure to initialize cid_ for Null type to consistently return
// kNullCid.
if ((type_ != NULL) && type_->IsNullType()) {
if ((type_ != nullptr) && type_->IsNullType()) {
cid_ = kNullCid;
}
// Same for sentinel.
if ((type_ != NULL) && type_->IsSentinelType()) {
if ((type_ != nullptr) && type_->IsSentinelType()) {
cid_ = kSentinelCid;
}
}
@@ -765,7 +765,7 @@ intptr_t CompileType::ToCid() {
intptr_t CompileType::ToNullableCid() {
if (cid_ == kIllegalCid) {
if (type_ == NULL) {
if (type_ == nullptr) {
// Type propagation is turned off or has not yet run.
return kDynamicCid;
} else if (type_->IsVoidType()) {
@@ -808,7 +808,7 @@ bool CompileType::IsNull() {
}
const AbstractType* CompileType::ToAbstractType() {
if (type_ == NULL) {
if (type_ == nullptr) {
// Type propagation has not run. Return dynamic-type.
if (cid_ == kIllegalCid) {
return &Object::dynamic_type();
@@ -990,7 +990,7 @@ void CompileType::PrintTo(BaseTextBuffer* f) const {
const Class& cls =
Class::Handle(IsolateGroup::Current()->class_table()->At(cid_));
type_name = String::Handle(cls.ScrubbedName()).ToCString();
} else if (type_ != NULL) {
} else if (type_ != nullptr) {
type_name = type_->IsDynamicType()
? "*"
: String::Handle(type_->ScrubbedName()).ToCString();
@@ -1010,7 +1010,7 @@ const char* CompileType::ToCString() const {
}
CompileType* Value::Type() {
if (reaching_type_ == NULL) {
if (reaching_type_ == nullptr) {
reaching_type_ = definition()->Type();
}
return reaching_type_;
@@ -1060,7 +1060,7 @@ bool PhiInstr::RecomputeType() {
}
CompileType RedefinitionInstr::ComputeType() const {
if (constrained_type_ != NULL) {
if (constrained_type_ != nullptr) {
// Check if the type associated with this redefinition is more specific
// than the type of its input. If yes, return it. Otherwise, fall back
// to the input's type.
@@ -1144,7 +1144,7 @@ CompileType ParameterInstr::ComputeType() const {
// However there are parameters that are known to match their declared type:
// for example receiver.
GraphEntryInstr* graph_entry = block_->AsGraphEntry();
if (graph_entry == NULL) {
if (graph_entry == nullptr) {
if (auto function_entry = block_->AsFunctionEntry()) {
graph_entry = function_entry->graph_entry();
} else if (auto osr_entry = block_->AsOsrEntry()) {
+19 -19
View File
@@ -66,7 +66,7 @@ void CallSpecializer::ApplyICData() {
// Attempts to convert an instance call (IC call) using propagated class-ids,
// e.g., receiver class id, guarded-cid, or by guessing cid-s.
void CallSpecializer::ApplyClassIds() {
ASSERT(current_iterator_ == NULL);
ASSERT(current_iterator_ == nullptr);
for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator();
!block_it.Done(); block_it.Advance()) {
thread()->CheckForSafepoint();
@@ -89,7 +89,7 @@ void CallSpecializer::ApplyClassIds() {
SpecializePolymorphicInstanceCall(instr->AsPolymorphicInstanceCall());
}
}
current_iterator_ = NULL;
current_iterator_ = nullptr;
}
}
@@ -192,7 +192,7 @@ void CallSpecializer::SpecializePolymorphicInstanceCall(
FlowGraphCompiler::ResolveCallTargetsForReceiverCid(
receiver_cid, String::Handle(zone(), ic_data.target_name()),
Array::Handle(zone(), ic_data.arguments_descriptor()));
if (targets == NULL) {
if (targets == nullptr) {
// No specialization.
return;
}
@@ -302,8 +302,8 @@ bool CallSpecializer::TryStringLengthOneEquality(InstanceCallInstr* call,
// or results of string-from-char-code.
Definition* left = call->ArgumentAt(0);
Definition* right = call->ArgumentAt(1);
Value* left_val = NULL;
Definition* to_remove_left = NULL;
Value* left_val = nullptr;
Definition* to_remove_left = nullptr;
if (IsLengthOneString(right)) {
// Swap, since we know that both arguments are strings
Definition* temp = left;
@@ -331,8 +331,8 @@ bool CallSpecializer::TryStringLengthOneEquality(InstanceCallInstr* call,
UNREACHABLE();
}
Definition* to_remove_right = NULL;
Value* right_val = NULL;
Definition* to_remove_right = nullptr;
Value* right_val = nullptr;
if (right->IsOneByteStringFromCharCode()) {
// Skip string-from-char-code, and use its input as right value.
OneByteStringFromCharCodeInstr* right_instr =
@@ -356,13 +356,13 @@ bool CallSpecializer::TryStringLengthOneEquality(InstanceCallInstr* call,
ReplaceCall(call, comp);
// Remove dead instructions.
if ((to_remove_left != NULL) &&
(to_remove_left->input_use_list() == NULL)) {
if ((to_remove_left != nullptr) &&
(to_remove_left->input_use_list() == nullptr)) {
to_remove_left->ReplaceUsesWith(flow_graph()->constant_null());
to_remove_left->RemoveFromGraph();
}
if ((to_remove_right != NULL) &&
(to_remove_right->input_use_list() == NULL)) {
if ((to_remove_right != nullptr) &&
(to_remove_right->input_use_list() == nullptr)) {
to_remove_right->ReplaceUsesWith(flow_graph()->constant_null());
to_remove_right->RemoveFromGraph();
}
@@ -432,8 +432,8 @@ bool CallSpecializer::TryReplaceWithEqualityOp(InstanceCallInstr* call,
// be hoisted out of this function.
ConstantInstr* right_const = right->AsConstant();
ConstantInstr* left_const = left->AsConstant();
if ((right_const != NULL && right_const->value().IsNull()) ||
(left_const != NULL && left_const->value().IsNull())) {
if ((right_const != nullptr && right_const->value().IsNull()) ||
(left_const != nullptr && left_const->value().IsNull())) {
StrictCompareInstr* comp = new (Z)
StrictCompareInstr(call->source(), Token::kEQ_STRICT,
new (Z) Value(left), new (Z) Value(right),
@@ -696,7 +696,7 @@ bool CallSpecializer::TryReplaceWithUnaryOp(InstanceCallInstr* call,
ASSERT(call->type_args_len() == 0);
ASSERT(call->ArgumentCount() == 1);
Definition* input = call->ArgumentAt(0);
Definition* unary_op = NULL;
Definition* unary_op = nullptr;
if (call->Targets().ReceiverIs(kSmiCid)) {
InsertBefore(call,
new (Z) CheckSmiInstr(new (Z) Value(input), call->deopt_id(),
@@ -716,7 +716,7 @@ bool CallSpecializer::TryReplaceWithUnaryOp(InstanceCallInstr* call,
} else {
return false;
}
ASSERT(unary_op != NULL);
ASSERT(unary_op != nullptr);
ReplaceCall(call, unary_op);
return true;
}
@@ -1005,7 +1005,7 @@ bool CallSpecializer::TryInlineInstanceMethod(InstanceCallInstr* call) {
ASSERT(call->HasICData());
const ICData& ic_data = *call->ic_data();
Definition* input = call->ArgumentAt(0);
Definition* d2i_instr = NULL;
Definition* d2i_instr = nullptr;
if (ic_data.HasDeoptReason(ICData::kDeoptDoubleToSmi)) {
// Do not repeatedly deoptimize because result didn't fit into Smi.
d2i_instr = new (Z) DoubleToIntegerInstr(
@@ -1203,8 +1203,8 @@ bool CallSpecializer::TryOptimizeInstanceOfUsingStaticTypes(
void CallSpecializer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
ASSERT(Token::IsTypeTestOperator(call->token_kind()));
Definition* left = call->ArgumentAt(0);
Definition* instantiator_type_args = NULL;
Definition* function_type_args = NULL;
Definition* instantiator_type_args = nullptr;
Definition* function_type_args = nullptr;
AbstractType& type = AbstractType::ZoneHandle(Z);
ASSERT(call->type_args_len() == 0);
if (call->ArgumentCount() == 2) {
@@ -1226,7 +1226,7 @@ void CallSpecializer::ReplaceWithInstanceOf(InstanceCallInstr* call) {
intptr_t type_cid;
if (TypeCheckAsClassEquality(type, &type_cid)) {
LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
InsertBefore(call, left_cid, nullptr, FlowGraph::kValue);
ConstantInstr* cid =
flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid)));
+1 -1
View File
@@ -30,7 +30,7 @@ TEST_CASE(ClassHierarchyAnalysis) {
" bar() { }"
"}\n";
TestCase::LoadTestScript(kScriptChars, NULL);
TestCase::LoadTestScript(kScriptChars, nullptr);
TransitionNativeToVM transition(thread);
EXPECT(ClassFinalizer::ProcessPendingClasses());
+7 -7
View File
@@ -57,8 +57,8 @@ CompilerPassState::CompilerPassState(
: thread(thread),
precompiler(precompiler),
inlining_depth(0),
sinking(NULL),
call_specializer(NULL),
sinking(nullptr),
call_specializer(nullptr),
speculative_policy(speculative_policy),
reorder_blocks(false),
sticky_flags(0),
@@ -74,7 +74,7 @@ CompilerPassState::CompilerPassState(
// larger than the length of |inline_id_to_token_pos| by one.
}
CompilerPass* CompilerPass::passes_[CompilerPass::kNumPasses] = {NULL};
CompilerPass* CompilerPass::passes_[CompilerPass::kNumPasses] = {nullptr};
uint8_t CompilerPass::flags_[CompilerPass::kNumPasses] = {0};
DEFINE_OPTION_HANDLER(CompilerPass::ParseFiltersFromFlag,
@@ -124,14 +124,14 @@ uint8_t* CompilerPass::ParseFiltersFromPragma(const char* filter) {
}
void CompilerPass::ParseFilters(const char* filter, uint8_t* pass_flags) {
if (filter == NULL || *filter == 0) {
if (filter == nullptr || *filter == 0) {
return;
}
if (strcmp(filter, "help") == 0) {
OS::PrintErr("%s", kCompilerPassesUsage);
for (intptr_t i = 0; i < kNumPasses; i++) {
if (passes_[i] != NULL) {
if (passes_[i] != nullptr) {
OS::PrintErr(" %s\n", passes_[i]->name());
}
}
@@ -190,7 +190,7 @@ void CompilerPass::ParseOneFilter(const char* start,
if (length != 0) {
char* pass_name = Utils::StrNDup(start, length);
CompilerPass* pass = FindPassByName(pass_name);
if (pass != NULL) {
if (pass != nullptr) {
pass_flags[pass->id()] |= flags;
} else {
OS::PrintErr("Unknown compiler pass: %s\n", pass_name);
@@ -536,7 +536,7 @@ COMPILER_PASS(AllocationSinking_Sink, {
});
COMPILER_PASS(AllocationSinking_DetachMaterializations, {
if (state->sinking != NULL) {
if (state->sinking != nullptr) {
// Remove all MaterializeObject instructions inserted by allocation
// sinking from the flow graph and let them float on the side
// referenced only from environments. Register allocator will consider
+4 -4
View File
@@ -71,7 +71,7 @@ struct CompilerPassState {
CompilerPassState(Thread* thread,
FlowGraph* flow_graph,
SpeculativeInliningPolicy* speculative_policy,
Precompiler* precompiler = NULL);
Precompiler* precompiler = nullptr);
FlowGraph* flow_graph() const { return flow_graph_; }
@@ -117,7 +117,7 @@ class CompilerPass {
#undef ADD_ONE
CompilerPass(Id id, const char* name) : id_(id), name_(name) {
ASSERT(passes_[id] == NULL);
ASSERT(passes_[id] == nullptr);
passes_[id] = this;
// By default print the final flow-graph after the register allocation.
@@ -192,11 +192,11 @@ class CompilerPass {
private:
static CompilerPass* FindPassByName(const char* name) {
for (intptr_t i = 0; i < kNumPasses; i++) {
if ((passes_[i] != NULL) && (strcmp(passes_[i]->name_, name) == 0)) {
if ((passes_[i] != nullptr) && (strcmp(passes_[i]->name_, name) == 0)) {
return passes_[i];
}
}
return NULL;
return nullptr;
}
void PrintGraph(CompilerPassState* state, Flag mask, intptr_t round) const;
@@ -46,9 +46,9 @@ Fragment& Fragment::operator+=(const Fragment& other) {
}
Fragment& Fragment::operator<<=(Instruction* next) {
if (entry == NULL) {
if (entry == nullptr) {
entry = current = next;
} else if (current != NULL) {
} else if (current != nullptr) {
current->LinkTo(next);
current = next;
}
@@ -56,7 +56,7 @@ Fragment& Fragment::operator<<=(Instruction* next) {
}
void Fragment::Prepend(Instruction* start) {
if (entry == NULL) {
if (entry == nullptr) {
entry = current = start;
} else {
start->LinkTo(entry);
@@ -65,8 +65,8 @@ void Fragment::Prepend(Instruction* start) {
}
Fragment Fragment::closed() {
ASSERT(entry != NULL);
return Fragment(entry, NULL);
ASSERT(entry != nullptr);
return Fragment(entry, nullptr);
}
Fragment operator+(const Fragment& first, const Fragment& second) {
@@ -713,7 +713,7 @@ Fragment BaseFlowGraphBuilder::DropTemporary(LocalVariable** temp) {
void BaseFlowGraphBuilder::SetTempIndex(Definition* definition) {
definition->set_temp_index(
stack_ == NULL ? 0 : stack_->definition()->temp_index() + 1);
stack_ == nullptr ? 0 : stack_->definition()->temp_index() + 1);
}
void BaseFlowGraphBuilder::Push(Definition* definition) {
@@ -732,25 +732,25 @@ Definition* BaseFlowGraphBuilder::Peek(intptr_t depth) {
}
Value* BaseFlowGraphBuilder::Pop() {
ASSERT(stack_ != NULL);
ASSERT(stack_ != nullptr);
Value* value = stack_;
stack_ = value->next_use();
if (stack_ != NULL) stack_->set_previous_use(NULL);
if (stack_ != nullptr) stack_->set_previous_use(nullptr);
value->set_next_use(NULL);
value->set_previous_use(NULL);
value->set_next_use(nullptr);
value->set_previous_use(nullptr);
value->definition()->ClearSSATempIndex();
return value;
}
Fragment BaseFlowGraphBuilder::Drop() {
ASSERT(stack_ != NULL);
ASSERT(stack_ != nullptr);
Fragment instructions;
Definition* definition = stack_->definition();
// The SSA renaming implementation doesn't like [LoadLocal]s without a
// tempindex.
if (definition->HasSSATemp() || definition->IsLoadLocal()) {
instructions <<= new (Z) DropTempsInstr(1, NULL);
instructions <<= new (Z) DropTempsInstr(1, nullptr);
} else {
definition->ClearTempIndex();
}
@@ -112,7 +112,7 @@ class TestFragment {
//
// kNone:
//
// There is no unchecked entrypoint: the unchecked entry is set to NULL in
// There is no unchecked entrypoint: the unchecked entry is set to nullptr in
// the 'GraphEntryInstr'.
//
// kSeparate:
@@ -153,7 +153,7 @@ class BaseFlowGraphBuilder {
last_used_block_id_(last_used_block_id),
current_try_index_(kInvalidTryIndex),
next_used_try_index_(0),
stack_(NULL),
stack_(nullptr),
exit_collector_(exit_collector),
inlining_unchecked_entry_(inlining_unchecked_entry),
saved_args_desc_array_(
@@ -315,7 +315,7 @@ class BaseFlowGraphBuilder {
intptr_t GetNextDeoptId() {
intptr_t deopt_id = thread_->compiler_state().GetNextDeoptId();
if (context_level_array_ != NULL) {
if (context_level_array_ != nullptr) {
intptr_t level = context_depth_;
context_level_array_->Add(deopt_id);
context_level_array_->Add(level);
@@ -50,7 +50,7 @@ void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) {
callee_graph->current_ssa_temp_index());
// Attach the outer environment on each instruction in the callee graph.
ASSERT(call_->env() != NULL);
ASSERT(call_->env() != nullptr);
ASSERT(call_->deopt_id() != DeoptId::kNone);
auto zone = callee_graph->zone();
@@ -92,7 +92,7 @@ void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) {
}
void InlineExitCollector::AddExit(ReturnInstr* exit) {
Data data = {NULL, exit};
Data data = {nullptr, exit};
exits_.Add(data);
}
@@ -113,7 +113,7 @@ void InlineExitCollector::RemoveUnreachableExits(FlowGraph* callee_graph) {
int j = 0;
for (int i = 0; i < exits_.length(); ++i) {
BlockEntryInstr* block = exits_[i].exit_return->GetBlock();
if ((block != NULL) && (0 <= block->postorder_number()) &&
if ((block != nullptr) && (0 <= block->postorder_number()) &&
(block->postorder_number() < postorder.length()) &&
(postorder[block->postorder_number()] == block)) {
if (i != j) {
@@ -145,7 +145,7 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block,
ReturnAt(0)->UnuseAllInputs();
*exit_block = ExitBlockAt(0);
*last_instruction = LastInstructionAt(0);
return call_->HasUses() ? ValueAt(0)->definition() : NULL;
return call_->HasUses() ? ValueAt(0)->definition() : nullptr;
} else {
ASSERT(num_exits > 1);
// Create a join of the returns.
@@ -180,7 +180,7 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block,
// Collect the block's dominators.
block_dominators.Clear();
BlockEntryInstr* dominator = ExitBlockAt(i)->dominator();
while (dominator != NULL) {
while (dominator != nullptr) {
block_dominators.Add(dominator);
dominator = dominator->dominator();
}
@@ -233,20 +233,20 @@ Definition* InlineExitCollector::JoinReturns(BlockEntryInstr** exit_block,
for (intptr_t i = 0; i < num_exits; ++i) {
ReturnAt(i)->UnuseAllInputs();
}
join->InheritDeoptTargetAfter(caller_graph_, call_, NULL);
return NULL;
join->InheritDeoptTargetAfter(caller_graph_, call_, nullptr);
return nullptr;
}
}
}
void InlineExitCollector::ReplaceCall(BlockEntryInstr* callee_entry) {
ASSERT(call_->previous() != NULL);
ASSERT(call_->next() != NULL);
ASSERT(call_->previous() != nullptr);
ASSERT(call_->next() != nullptr);
BlockEntryInstr* call_block = call_->GetBlock();
// Insert the callee graph into the caller graph.
BlockEntryInstr* callee_exit = NULL;
Instruction* callee_last_instruction = NULL;
BlockEntryInstr* callee_exit = nullptr;
Instruction* callee_last_instruction = nullptr;
if (exits_.length() == 0) {
// Handle the case when there are no normal return exits from the callee
@@ -258,7 +258,7 @@ void InlineExitCollector::ReplaceCall(BlockEntryInstr* callee_entry) {
TargetEntryInstr* false_block = new (Z) TargetEntryInstr(
caller_graph_->allocate_block_id(), call_block->try_index(),
CompilerState::Current().GetNextDeoptId());
false_block->InheritDeoptTargetAfter(caller_graph_, call_, NULL);
false_block->InheritDeoptTargetAfter(caller_graph_, call_, nullptr);
false_block->LinkTo(call_->next());
call_block->ReplaceAsPredecessorWith(false_block);
@@ -302,7 +302,7 @@ void InlineExitCollector::ReplaceCall(BlockEntryInstr* callee_entry) {
} else {
Definition* callee_result = JoinReturns(
&callee_exit, &callee_last_instruction, call_block->try_index());
if (callee_result != NULL) {
if (callee_result != nullptr) {
call_->ReplaceUsesWith(callee_result);
}
if (callee_last_instruction == callee_entry) {
@@ -53,7 +53,7 @@ class InlineExitCollector : public ZoneAllocated {
};
BlockEntryInstr* ExitBlockAt(intptr_t i) const {
ASSERT(exits_[i].exit_block != NULL);
ASSERT(exits_[i].exit_block != nullptr);
return exits_[i].exit_block;
}
+17 -17
View File
@@ -86,13 +86,13 @@ FlowGraphBuilder::FlowGraphBuilder(
catch_depth_(0),
for_in_depth_(0),
block_expression_depth_(0),
graph_entry_(NULL),
scopes_(NULL),
breakable_block_(NULL),
switch_block_(NULL),
try_catch_block_(NULL),
try_finally_block_(NULL),
catch_block_(NULL),
graph_entry_(nullptr),
scopes_(nullptr),
breakable_block_(nullptr),
switch_block_(nullptr),
try_catch_block_(nullptr),
try_finally_block_(nullptr),
catch_block_(nullptr),
prepend_type_arguments_(Function::ZoneHandle(zone_)),
throw_new_null_assertion_(Function::ZoneHandle(zone_)) {
const Script& script =
@@ -192,7 +192,7 @@ Fragment FlowGraphBuilder::LoadFunctionTypeArguments() {
const Function& function = parsed_function_->function();
if (function.IsGeneric() || function.HasGenericParent()) {
ASSERT(parsed_function_->function_type_arguments() != NULL);
ASSERT(parsed_function_->function_type_arguments() != nullptr);
instructions += LoadLocal(parsed_function_->function_type_arguments());
} else {
instructions += NullConstant();
@@ -369,7 +369,7 @@ Fragment FlowGraphBuilder::InstanceCall(
InstructionSource(position), name, kind, std::move(arguments),
type_args_len, argument_names, checked_argument_count, ic_data_array_,
GetNextDeoptId(), interface_target, tearoff_interface_target);
if ((result_type != NULL) && !result_type->IsTrivial()) {
if ((result_type != nullptr) && !result_type->IsTrivial()) {
call->SetResultType(Z, result_type->ToCompileType(Z));
}
if (use_unchecked_entry) {
@@ -621,11 +621,11 @@ void FlowGraphBuilder::SetResultTypeForStaticCall(
intptr_t argument_count,
const InferredTypeMetadata* result_type) {
if (call->InitResultType(Z)) {
ASSERT((result_type == NULL) || (result_type->cid == kDynamicCid) ||
ASSERT((result_type == nullptr) || (result_type->cid == kDynamicCid) ||
(result_type->cid == call->result_cid()));
return;
}
if ((result_type != NULL) && !result_type->IsTrivial()) {
if ((result_type != nullptr) && !result_type->IsTrivial()) {
call->SetResultType(Z, result_type->ToCompileType(Z));
}
}
@@ -776,7 +776,7 @@ Fragment FlowGraphBuilder::ThrowNoSuchMethodError(const Function& target,
LocalVariable* FlowGraphBuilder::LookupVariable(intptr_t kernel_offset) {
LocalVariable* local = scopes_->locals.Lookup(kernel_offset);
ASSERT(local != NULL);
ASSERT(local != nullptr);
ASSERT(local->kernel_offset() == kernel_offset);
return local;
}
@@ -1747,7 +1747,7 @@ static const LocalScope* MakeImplicitClosureScope(Zone* Z, const Class& klass) {
receiver_variable->set_is_captured();
// receiver_variable->set_is_final();
LocalScope* scope = new (Z) LocalScope(NULL, 0, 0);
LocalScope* scope = new (Z) LocalScope(nullptr, 0, 0);
scope->set_context_level(0);
scope->AddVariable(receiver_variable);
scope->AddContextVariable(receiver_variable);
@@ -2027,7 +2027,7 @@ void FlowGraphBuilder::BuildArgumentTypeChecks(
}
const AbstractType* target_type = &param->type();
if (forwarding_target != NULL) {
if (forwarding_target != nullptr) {
// We add 1 to the parameter index to account for the receiver.
target_type =
&AbstractType::ZoneHandle(Z, forwarding_target->ParameterTypeAt(i));
@@ -2176,7 +2176,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfNoSuchMethodDispatcher(
LocalVariable* array = MakeTemporary();
if (receiver_index > 0) {
LocalVariable* type_args = parsed_function_->function_type_arguments();
ASSERT(type_args != NULL);
ASSERT(type_args != nullptr);
body += LoadLocal(array);
body += IntConstant(0);
body += LoadLocal(type_args);
@@ -3733,7 +3733,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfImplicitClosureFunction(
TranslateInstantiatedTypeArguments(instantiated_type_arguments);
} else {
type_args_len = function.NumTypeParameters();
ASSERT(parsed_function_->function_type_arguments() != NULL);
ASSERT(parsed_function_->function_type_arguments() != nullptr);
closure += LoadLocal(parsed_function_->function_type_arguments());
}
} else if (target.IsFactory()) {
@@ -3779,7 +3779,7 @@ FlowGraph* FlowGraphBuilder::BuildGraphOfImplicitClosureFunction(
closure += StaticCall(TokenPosition::kNoSource, target, argument_count,
argument_names, ICData::kNoRebind,
/* result_type = */ NULL, type_args_len);
/* result_type = */ nullptr, type_args_len);
if (target.IsGenerativeConstructor()) {
// Drop result of constructor invocation, leave receiver
+14 -14
View File
@@ -214,7 +214,7 @@ class FlowGraphBuilder : public BaseFlowGraphBuilder {
intptr_t argument_count,
const Array& argument_names,
ICData::RebindRule rebind_rule,
const InferredTypeMetadata* result_type = NULL,
const InferredTypeMetadata* result_type = nullptr,
intptr_t type_args_len = 0,
bool use_unchecked_entry = false);
Fragment StringInterpolateSingle(TokenPosition position);
@@ -720,7 +720,7 @@ class SwitchBlock {
context_depth_(builder->context_depth_),
try_index_(builder->CurrentTryIndex()) {
builder_->switch_block_ = this;
if (outer_ != NULL) {
if (outer_ != nullptr) {
depth_ = outer_->depth_ + outer_->case_count_;
} else {
depth_ = 0;
@@ -729,14 +729,14 @@ class SwitchBlock {
~SwitchBlock() { builder_->switch_block_ = outer_; }
bool HadJumper(intptr_t case_num) {
return destinations_.Lookup(case_num) != NULL;
return destinations_.Lookup(case_num) != nullptr;
}
// Get destination via absolute target number (i.e. the correct destination
// is not necessarily in this block).
JoinEntryInstr* Destination(intptr_t target_index,
TryFinallyBlock** outer_finally = NULL,
intptr_t* context_depth = NULL) {
TryFinallyBlock** outer_finally = nullptr,
intptr_t* context_depth = nullptr) {
// Verify consistency of program state.
ASSERT(builder_->switch_block_ == this);
// Find corresponding destination.
@@ -747,7 +747,7 @@ class SwitchBlock {
}
// Set the outer finally block.
if (outer_finally != NULL) {
if (outer_finally != nullptr) {
*outer_finally = block->outer_finally_;
*context_depth = block->context_depth_;
}
@@ -759,10 +759,10 @@ class SwitchBlock {
// Get destination via relative target number (i.e. relative to this block,
// 0 is first case in this block etc).
JoinEntryInstr* DestinationDirect(intptr_t case_num,
TryFinallyBlock** outer_finally = NULL,
intptr_t* context_depth = NULL) {
TryFinallyBlock** outer_finally = nullptr,
intptr_t* context_depth = nullptr) {
// Set the outer finally block.
if (outer_finally != NULL) {
if (outer_finally != nullptr) {
*outer_finally = outer_finally_;
*context_depth = context_depth_;
}
@@ -774,7 +774,7 @@ class SwitchBlock {
private:
JoinEntryInstr* EnsureDestination(intptr_t case_num) {
JoinEntryInstr* cached_inst = destinations_.Lookup(case_num);
if (cached_inst == NULL) {
if (cached_inst == nullptr) {
JoinEntryInstr* inst = builder_->BuildJoinEntry(try_index_);
destinations_.Insert(case_num, inst);
return inst;
@@ -862,11 +862,11 @@ class BreakableBlock {
explicit BreakableBlock(FlowGraphBuilder* builder)
: builder_(builder),
outer_(builder->breakable_block_),
destination_(NULL),
destination_(nullptr),
outer_finally_(builder->try_finally_block_),
context_depth_(builder->context_depth_),
try_index_(builder->CurrentTryIndex()) {
if (builder_->breakable_block_ == NULL) {
if (builder_->breakable_block_ == nullptr) {
index_ = 0;
} else {
index_ = builder_->breakable_block_->index_ + 1;
@@ -875,7 +875,7 @@ class BreakableBlock {
}
~BreakableBlock() { builder_->breakable_block_ = outer_; }
bool HadJumper() { return destination_ != NULL; }
bool HadJumper() { return destination_ != nullptr; }
JoinEntryInstr* destination() { return destination_; }
@@ -897,7 +897,7 @@ class BreakableBlock {
private:
JoinEntryInstr* EnsureDestination() {
if (destination_ == NULL) {
if (destination_ == nullptr) {
destination_ = builder_->BuildJoinEntry(try_index_);
}
return destination_;
@@ -3008,7 +3008,7 @@ ExternalTypedDataPtr KernelReaderHelper::GetConstantCoverageFor(
}
intptr_t ActiveClass::MemberTypeParameterCount(Zone* zone) {
ASSERT(member != NULL);
ASSERT(member != nullptr);
if (member->IsFactory()) {
return klass->NumTypeParameters();
} else if (member->IsMethodExtractor()) {
@@ -3067,7 +3067,7 @@ ActiveTypeParametersScope::ActiveTypeParametersScope(
const TypeArguments* old_params = active_class->local_type_parameters;
const intptr_t old_param_count =
old_params == NULL ? 0 : old_params->Length();
old_params == nullptr ? 0 : old_params->Length();
const TypeArguments& extended_params = TypeArguments::Handle(
Z, TypeArguments::New(old_param_count + num_new_params));
@@ -3115,7 +3115,7 @@ TypeTranslator::TypeTranslator(KernelReaderHelper* helper,
constant_reader_(constant_reader),
translation_helper_(helper->translation_helper_),
active_class_(active_class),
type_parameter_scope_(NULL),
type_parameter_scope_(nullptr),
inferred_type_metadata_helper_(helper_, constant_reader_),
unboxing_info_metadata_helper_(helper_),
zone_(translation_helper_.zone()),
@@ -3240,7 +3240,7 @@ void TypeTranslator::BuildInterfaceType(bool simple) {
void TypeTranslator::BuildFunctionType(bool simple) {
const intptr_t num_enclosing_type_arguments =
active_class_->enclosing != NULL
active_class_->enclosing != nullptr
? active_class_->enclosing->NumTypeArguments()
: 0;
Nullability nullability = helper_->ReadNullability();
@@ -3468,7 +3468,7 @@ void TypeTranslator::BuildTypeParameterType() {
}
}
}
if (active_class_->local_type_parameters != NULL) {
if (active_class_->local_type_parameters != nullptr) {
if (parameter_index < active_class_->local_type_parameters->Length()) {
const auto& type_param = TypeParameter::CheckedHandle(
Z, active_class_->local_type_parameters->TypeAt(parameter_index));
@@ -3485,7 +3485,7 @@ void TypeTranslator::BuildTypeParameterType() {
parameter_index -= active_class_->local_type_parameters->Length();
}
if (type_parameter_scope_ != NULL &&
if (type_parameter_scope_ != nullptr &&
parameter_index < type_parameter_scope_->outer_parameter_count() +
type_parameter_scope_->parameter_count()) {
result_ = Type::DynamicType();
@@ -1262,7 +1262,7 @@ class KernelReaderHelper {
void ReadUntilFunctionNode();
Tag PeekTag(uint8_t* payload = NULL);
Tag PeekTag(uint8_t* payload = nullptr);
protected:
const Script& script() const { return script_; }
@@ -1324,7 +1324,7 @@ class KernelReaderHelper {
void SkipLibraryCombinator();
void SkipLibraryDependency();
TokenPosition ReadPosition();
Tag ReadTag(uint8_t* payload = NULL);
Tag ReadTag(uint8_t* payload = nullptr);
uint8_t ReadFlags() { return reader_.ReadFlags(); }
Nullability ReadNullability();
Variance ReadVariance();
@@ -1384,15 +1384,15 @@ class KernelReaderHelper {
class ActiveClass {
public:
ActiveClass()
: klass(NULL),
member(NULL),
enclosing(NULL),
local_type_parameters(NULL) {}
: klass(nullptr),
member(nullptr),
enclosing(nullptr),
local_type_parameters(nullptr) {}
bool HasMember() { return member != NULL; }
bool HasMember() { return member != nullptr; }
bool MemberIsProcedure() {
ASSERT(member != NULL);
ASSERT(member != nullptr);
UntaggedFunction::Kind function_kind = member->kind();
return function_kind == UntaggedFunction::kRegularFunction ||
function_kind == UntaggedFunction::kGetterFunction ||
@@ -1403,7 +1403,7 @@ class ActiveClass {
}
bool MemberIsFactoryProcedure() {
ASSERT(member != NULL);
ASSERT(member != nullptr);
return member->IsFactory();
}
@@ -1416,7 +1416,7 @@ class ActiveClass {
intptr_t MemberTypeParameterCount(Zone* zone);
intptr_t ClassNumTypeArguments() {
ASSERT(klass != NULL);
ASSERT(klass != nullptr);
return klass->NumTypeArguments();
}
@@ -1431,7 +1431,7 @@ class ActiveClass {
}
const char* ToCString() {
return member != NULL ? member->ToCString() : klass->ToCString();
return member != nullptr ? member->ToCString() : klass->ToCString();
}
// The current enclosing class (or the library top-level class).
@@ -1587,7 +1587,7 @@ class TypeTranslator {
outer_(translator->type_parameter_scope_),
translator_(translator) {
outer_parameter_count_ = 0;
if (outer_ != NULL) {
if (outer_ != nullptr) {
outer_parameter_count_ =
outer_->outer_parameter_count_ + outer_->parameter_count_;
}
@@ -177,7 +177,7 @@ Fragment PrologueBuilder::BuildParameterHandling() {
// Copy optional parameters down.
if (num_opt_pos_params > 0) {
JoinEntryInstr* next_missing = NULL;
JoinEntryInstr* next_missing = nullptr;
for (intptr_t opt_param = 1; param < num_params; ++param, ++opt_param) {
const intptr_t param_index = param - (function_.IsFactory() ? 1 : 0);
update_param_offset(function_, param_index);
@@ -199,7 +199,7 @@ Fragment PrologueBuilder::BuildParameterHandling() {
good += Drop();
Fragment not_good(missing);
if (next_missing != NULL) {
if (next_missing != nullptr) {
not_good += Goto(next_missing);
not_good.current = next_missing;
}
+17 -17
View File
@@ -17,12 +17,12 @@ namespace kernel {
#define IG IsolateGroup::Current()
ScopeBuilder::ScopeBuilder(ParsedFunction* parsed_function)
: result_(NULL),
: result_(nullptr),
parsed_function_(parsed_function),
translation_helper_(Thread::Current()),
zone_(translation_helper_.zone()),
current_function_scope_(NULL),
scope_(NULL),
current_function_scope_(nullptr),
scope_(nullptr),
depth_(0),
name_index_(0),
needs_expr_temp_(false),
@@ -45,9 +45,9 @@ ScopeBuilder::ScopeBuilder(ParsedFunction* parsed_function)
}
ScopeBuildingResult* ScopeBuilder::BuildScopes() {
if (result_ != NULL) return result_;
if (result_ != nullptr) return result_;
ASSERT(scope_ == NULL && depth_.loop_ == 0 && depth_.function_ == 0);
ASSERT(scope_ == nullptr && depth_.loop_ == 0 && depth_.function_ == 0);
result_ = new (Z) ScopeBuildingResult();
const Function& function = parsed_function_->function();
@@ -65,7 +65,7 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() {
ActiveTypeParametersScope active_type_params(&active_class_, function,
&signature, Z);
LocalScope* enclosing_scope = NULL;
LocalScope* enclosing_scope = nullptr;
if (function.IsImplicitClosureFunction() && !function.is_static()) {
// Create artificial enclosing scope for the tear-off that contains
// captured receiver value. This ensure that AssertAssignable will correctly
@@ -77,7 +77,7 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() {
Symbols::This(), klass_type);
parsed_function_->set_receiver_var(receiver_variable);
receiver_variable->set_is_captured();
enclosing_scope = new (Z) LocalScope(NULL, 0, 0);
enclosing_scope = new (Z) LocalScope(nullptr, 0, 0);
enclosing_scope->set_context_level(0);
enclosing_scope->AddVariable(receiver_variable);
enclosing_scope->AddContextVariable(receiver_variable);
@@ -1186,7 +1186,7 @@ void ScopeBuilder::VisitStatement() {
return;
case kReturnStatement: {
if ((depth_.function_ == 0) && (depth_.finally_ > 0) &&
(result_->finally_return_variable == NULL)) {
(result_->finally_return_variable == nullptr)) {
const String& name = Symbols::TryFinallyReturnValue();
LocalVariable* variable =
MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
@@ -1712,7 +1712,7 @@ LocalVariable* ScopeBuilder::MakeVariable(
const String& name,
const AbstractType& type,
intptr_t kernel_offset,
const InferredTypeMetadata* param_type_md /* = NULL */) {
const InferredTypeMetadata* param_type_md /* = nullptr */) {
CompileType* param_type = nullptr;
const Object* param_value = nullptr;
if (param_type_md != nullptr && !param_type_md->IsTrivial()) {
@@ -1729,7 +1729,7 @@ void ScopeBuilder::AddExceptionVariable(
GrowableArray<LocalVariable*>* variables,
const char* prefix,
intptr_t nesting_depth) {
LocalVariable* v = NULL;
LocalVariable* v = nullptr;
// No need to create variables for try/catch-statements inside
// nested functions.
@@ -1738,7 +1738,7 @@ void ScopeBuilder::AddExceptionVariable(
// If variable was not lifted by the transformer introduce a new
// one into the current function scope.
if (v == NULL) {
if (v == nullptr) {
v = MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
GenerateName(prefix, nesting_depth - 1),
AbstractType::dynamic_type());
@@ -1813,7 +1813,7 @@ void ScopeBuilder::AddIteratorVariable() {
}
void ScopeBuilder::AddSwitchVariable() {
if ((depth_.function_ == 0) && (result_->switch_variable == NULL)) {
if ((depth_.function_ == 0) && (result_->switch_variable == nullptr)) {
LocalVariable* variable =
MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
Symbols::SwitchExpr(), AbstractType::dynamic_type());
@@ -1843,7 +1843,7 @@ LocalVariable* ScopeBuilder::LookupVariable(
// case that we are compiling a nested function and the variable is
// declared in an outer scope. In that case, look it up in the scope by
// name and add it to the variable map to simplify later lookup.
ASSERT(current_function_scope_->parent() != NULL);
ASSERT(current_function_scope_->parent() != nullptr);
StringIndex var_name = GetNameFromVariableDeclaration(
declaration_binary_offset - helper_.data_program_offset_,
parsed_function_->function());
@@ -1918,17 +1918,17 @@ void ScopeBuilder::HandleLoadReceiver() {
void ScopeBuilder::HandleSpecialLoad(LocalVariable** variable,
const String& symbol,
intptr_t kernel_offset) {
if (current_function_scope_->parent() != NULL) {
if (current_function_scope_->parent() != nullptr) {
// We are building the scope tree of a closure function and saw [node]. We
// lazily populate the variable using the parent function scope.
if (*variable == NULL) {
if (*variable == nullptr) {
*variable = current_function_scope_->parent()->LookupVariable(
symbol, kernel_offset, true);
ASSERT(*variable != NULL);
ASSERT(*variable != nullptr);
}
}
if ((current_function_scope_->parent() != NULL) ||
if ((current_function_scope_->parent() != nullptr) ||
(scope_->function_level() > 0)) {
// Every scope we use the [variable] from needs to be notified of the usage
// in order to ensure that preserving the context scope on that particular
+13 -13
View File
@@ -104,7 +104,7 @@ class ScopeBuilder {
const String& name,
const AbstractType& type,
intptr_t kernel_offset = LocalVariable::kNoKernelOffset,
const InferredTypeMetadata* param_type_md = NULL);
const InferredTypeMetadata* param_type_md = nullptr);
void AddExceptionVariable(GrowableArray<LocalVariable*>* variables,
const char* prefix,
@@ -187,12 +187,12 @@ struct FunctionScope {
class ScopeBuildingResult : public ZoneAllocated {
public:
ScopeBuildingResult()
: type_arguments_variable(NULL),
switch_variable(NULL),
finally_return_variable(NULL),
setter_value(NULL),
yield_jump_variable(NULL),
yield_context_variable(NULL),
: type_arguments_variable(nullptr),
switch_variable(nullptr),
finally_return_variable(nullptr),
setter_value(nullptr),
yield_jump_variable(nullptr),
yield_context_variable(nullptr),
raw_variable_counter_(0) {}
bool IsClosureWithEmptyContext(intptr_t function_node_offset) {
@@ -208,24 +208,24 @@ class ScopeBuildingResult : public ZoneAllocated {
IntMap<LocalScope*> scopes;
GrowableArray<FunctionScope> function_scopes;
// Only non-NULL for factory constructor functions.
// Only non-nullptr for factory constructor functions.
LocalVariable* type_arguments_variable;
// Non-NULL when the function contains a switch statement.
// Non-nullptr when the function contains a switch statement.
LocalVariable* switch_variable;
// Non-NULL when the function contains a return inside a finally block.
// Non-nullptr when the function contains a return inside a finally block.
LocalVariable* finally_return_variable;
// Non-NULL when the function is a setter.
// Non-nullptr when the function is a setter.
LocalVariable* setter_value;
// Non-NULL if the function contains yield statement.
// Non-nullptr if the function contains yield statement.
// TODO(27590) actual variable is called :await_jump_var, we should rename
// it to reflect the fact that it is used for both await and yield.
LocalVariable* yield_jump_variable;
// Non-NULL if the function contains yield statement.
// Non-nullptr if the function contains yield statement.
// TODO(27590) actual variable is called :await_ctx_var, we should rename
// it to reflect the fact that it is used for both await and yield.
LocalVariable* yield_context_variable;
+35 -31
View File
@@ -53,7 +53,10 @@ DEFINE_FLAG(
max_deoptimization_counter_threshold,
16,
"How many times we allow deoptimization before we disallow optimization.");
DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function");
DEFINE_FLAG(charp,
optimization_filter,
nullptr,
"Optimize only named function");
DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph.");
DEFINE_FLAG(bool,
print_flow_graph_optimized,
@@ -130,10 +133,11 @@ FlowGraph* DartCompilationPipeline::BuildFlowGraph(
intptr_t osr_id,
bool optimized) {
kernel::FlowGraphBuilder builder(parsed_function, ic_data_array,
/* not building var desc */ NULL,
/* not inlining */ NULL, optimized, osr_id);
/* not building var desc */ nullptr,
/* not inlining */ nullptr, optimized,
osr_id);
FlowGraph* graph = builder.BuildGraph();
ASSERT(graph != NULL);
ASSERT(graph != nullptr);
return graph;
}
@@ -256,7 +260,7 @@ bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
function.SetUsageCounter(INT32_MIN);
return false;
}
if (FLAG_optimization_filter != NULL) {
if (FLAG_optimization_filter != nullptr) {
// FLAG_optimization_filter is a comma-separated list of strings that are
// matched against the fully-qualified function name.
char* save_ptr; // Needed for strtok_r.
@@ -266,12 +270,12 @@ bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
strncpy(filter, FLAG_optimization_filter, len); // strtok modifies arg 1.
char* token = strtok_r(filter, ",", &save_ptr);
bool found = false;
while (token != NULL) {
if (strstr(function_name, token) != NULL) {
while (token != nullptr) {
if (strstr(function_name, token) != nullptr) {
found = true;
break;
}
token = strtok_r(NULL, ",", &save_ptr);
token = strtok_r(nullptr, ",", &save_ptr);
}
delete[] filter;
if (!found) {
@@ -522,7 +526,7 @@ CodePtr CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
if (FLAG_print_ic_data_map) {
for (intptr_t i = 0; i < ic_data_array->length(); i++) {
if ((*ic_data_array)[i] != NULL) {
if ((*ic_data_array)[i] != nullptr) {
THR_Print("%" Pd " ", i);
FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]);
}
@@ -923,7 +927,7 @@ void Compiler::ComputeLocalVarDescriptors(const Code& code) {
kernel::FlowGraphBuilder builder(
parsed_function, ic_data_array, context_level_array,
/* not inlining */ NULL, false, Compiler::kNoOSRDeoptId);
/* not inlining */ nullptr, false, Compiler::kNoOSRDeoptId);
builder.BuildGraph();
auto& var_descs = LocalVarDescriptors::Handle(zone);
@@ -968,9 +972,9 @@ void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
}
#if !defined(PRODUCT)
TimelineStream* stream = Timeline::GetCompilerStream();
ASSERT(stream != NULL);
ASSERT(stream != nullptr);
TimelineEvent* event = stream->StartEvent();
if (event != NULL) {
if (event != nullptr) {
event->Instant("AbortBackgroundCompilation");
event->SetNumArguments(1);
event->CopyArgument(0, "reason", msg);
@@ -986,10 +990,10 @@ void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
class QueueElement {
public:
explicit QueueElement(const Function& function)
: next_(NULL), function_(function.ptr()) {}
: next_(nullptr), function_(function.ptr()) {}
virtual ~QueueElement() {
next_ = NULL;
next_ = nullptr;
function_ = Function::null();
}
@@ -1014,39 +1018,39 @@ class QueueElement {
// It implements a FIFO queue, using Peek, Add, Remove operations.
class BackgroundCompilationQueue {
public:
BackgroundCompilationQueue() : first_(NULL), last_(NULL) {}
BackgroundCompilationQueue() : first_(nullptr), last_(nullptr) {}
virtual ~BackgroundCompilationQueue() { Clear(); }
void VisitObjectPointers(ObjectPointerVisitor* visitor) {
ASSERT(visitor != NULL);
ASSERT(visitor != nullptr);
QueueElement* p = first_;
while (p != NULL) {
while (p != nullptr) {
visitor->VisitPointer(p->function_untag());
p = p->next();
}
}
bool IsEmpty() const { return first_ == NULL; }
bool IsEmpty() const { return first_ == nullptr; }
void Add(QueueElement* value) {
ASSERT(value != NULL);
ASSERT(value->next() == NULL);
if (first_ == NULL) {
ASSERT(value != nullptr);
ASSERT(value->next() == nullptr);
if (first_ == nullptr) {
first_ = value;
ASSERT(last_ == NULL);
ASSERT(last_ == nullptr);
} else {
ASSERT(last_ != NULL);
ASSERT(last_ != nullptr);
last_->set_next(value);
}
last_ = value;
ASSERT(first_ != NULL && last_ != NULL);
ASSERT(first_ != nullptr && last_ != nullptr);
}
QueueElement* Peek() const { return first_; }
FunctionPtr PeekFunction() const {
QueueElement* e = Peek();
if (e == NULL) {
if (e == nullptr) {
return Function::null();
} else {
return e->Function();
@@ -1054,18 +1058,18 @@ class BackgroundCompilationQueue {
}
QueueElement* Remove() {
ASSERT(first_ != NULL);
ASSERT(first_ != nullptr);
QueueElement* result = first_;
first_ = first_->next();
if (first_ == NULL) {
last_ = NULL;
if (first_ == nullptr) {
last_ = nullptr;
}
return result;
}
bool ContainsObj(const Object& obj) const {
QueueElement* p = first_;
while (p != NULL) {
while (p != nullptr) {
if (p->function() == obj.ptr()) {
return true;
}
@@ -1079,7 +1083,7 @@ class BackgroundCompilationQueue {
QueueElement* e = Remove();
delete e;
}
ASSERT((first_ == NULL) && (last_ == NULL));
ASSERT((first_ == nullptr) && (last_ == nullptr));
}
private:
@@ -1251,7 +1255,7 @@ void BackgroundCompiler::Disable() {
CompilationPipeline* CompilationPipeline::New(Zone* zone,
const Function& function) {
UNREACHABLE();
return NULL;
return nullptr;
}
DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
+1 -1
View File
@@ -54,7 +54,7 @@ class DartCompilationPipeline : public CompilationPipeline {
class IrregexpCompilationPipeline : public CompilationPipeline {
public:
IrregexpCompilationPipeline() : backtrack_goto_(NULL) {}
IrregexpCompilationPipeline() : backtrack_goto_(nullptr) {}
void ParseFunction(ParsedFunction* parsed_function) override;
@@ -163,7 +163,7 @@ void JitCallSpecializer::VisitInstanceCall(InstanceCallInstr* instr) {
// Replace generic context allocation or cloning with a sequence of inlined
// allocation and explicit initializing stores.
// If context_value is not NULL then newly allocated context is a populated
// If context_value is not nullptr then newly allocated context is a populated
// with values copied from it, otherwise it is initialized with null.
void JitCallSpecializer::LowerContextAllocation(
Definition* alloc,
@@ -179,11 +179,11 @@ void JitCallSpecializer::LowerContextAllocation(
Instruction* cursor = replacement;
Value* initial_value;
if (context_value != NULL) {
if (context_value != nullptr) {
LoadFieldInstr* load =
new (Z) LoadFieldInstr(context_value->CopyWithType(Z),
Slot::Context_parent(), alloc->source());
flow_graph()->InsertAfter(cursor, load, NULL, FlowGraph::kValue);
flow_graph()->InsertAfter(cursor, load, nullptr, FlowGraph::kValue);
cursor = load;
initial_value = new (Z) Value(load);
} else {
+1 -1
View File
@@ -369,7 +369,7 @@ static const struct {
const uint32_t finger_print;
const char* const name;
} factory_recognizer_list[] = {RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY){
Symbols::kIllegal, -1, 0, NULL}};
Symbols::kIllegal, -1, 0, nullptr}};
#undef RECOGNIZE_FACTORY