Commit 63953140 authored by titzer's avatar titzer Committed by Commit bot

[wasm] s/NULL/nullptr/g

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1571713002

Cr-Commit-Position: refs/heads/master@{#33173}
parent fc5c7e04
......@@ -40,7 +40,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
is_set_op_(false),
marking_exported(false),
builder_(new (zone) WasmModuleBuilder(zone)),
current_function_builder_(NULL),
current_function_builder_(nullptr),
literal_(literal),
isolate_(isolate),
zone_(zone),
......@@ -58,13 +58,13 @@ class AsmWasmBuilderImpl : public AstVisitor {
void VisitFunctionDeclaration(FunctionDeclaration* decl) {
DCHECK(!in_function_);
DCHECK(current_function_builder_ == NULL);
DCHECK(current_function_builder_ == nullptr);
uint16_t index = LookupOrInsertFunction(decl->proxy()->var());
current_function_builder_ = builder_->FunctionAt(index);
in_function_ = true;
RECURSE(Visit(decl->fun()));
in_function_ = false;
current_function_builder_ = NULL;
current_function_builder_ = nullptr;
local_variables_.Clear();
}
......@@ -84,7 +84,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
if (stmt->statements()->length() == 1) {
ExpressionStatement* expr =
stmt->statements()->at(0)->AsExpressionStatement();
if (expr != NULL) {
if (expr != nullptr) {
if (expr->expression()->IsAssignment()) {
RECURSE(VisitExpressionStatement(expr));
return;
......@@ -244,13 +244,13 @@ class AsmWasmBuilderImpl : public AstVisitor {
void VisitForStatement(ForStatement* stmt) {
DCHECK(in_function_);
if (stmt->init() != NULL) {
if (stmt->init() != nullptr) {
block_size_++;
RECURSE(Visit(stmt->init()));
}
BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprLoop, true);
block_size_ = 0;
if (stmt->cond() != NULL) {
if (stmt->cond() != nullptr) {
block_size_++;
current_function_builder_->Emit(kExprIf);
current_function_builder_->Emit(kExprBoolNot);
......@@ -258,11 +258,11 @@ class AsmWasmBuilderImpl : public AstVisitor {
current_function_builder_->EmitWithU8(kExprBr, 1);
current_function_builder_->Emit(kExprNop);
}
if (stmt->body() != NULL) {
if (stmt->body() != nullptr) {
block_size_++;
RECURSE(Visit(stmt->body()));
}
if (stmt->next() != NULL) {
if (stmt->next() != nullptr) {
block_size_++;
RECURSE(Visit(stmt->next()));
}
......@@ -413,7 +413,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
void UnLoadInitFunction() {
in_function_ = false;
current_function_builder_ = NULL;
current_function_builder_ = nullptr;
}
void VisitAssignment(Assignment* expr) {
......@@ -427,11 +427,11 @@ class AsmWasmBuilderImpl : public AstVisitor {
LoadInitFunction();
}
BinaryOperation* value_op = expr->value()->AsBinaryOperation();
if (value_op != NULL && MatchBinaryOperation(value_op) == kAsIs) {
if (value_op != nullptr && MatchBinaryOperation(value_op) == kAsIs) {
VariableProxy* target_var = expr->target()->AsVariableProxy();
VariableProxy* effective_value_var = GetLeft(value_op)->AsVariableProxy();
// TODO(aseemgarg): simplify block_size_ or replace with a kNop
if (target_var != NULL && effective_value_var != NULL &&
if (target_var != nullptr && effective_value_var != nullptr &&
target_var->var() == effective_value_var->var()) {
block_size_--;
return;
......@@ -557,7 +557,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
bool MatchIntBinaryOperation(BinaryOperation* expr, Token::Value op,
int32_t val) {
DCHECK(expr->right() != NULL);
DCHECK(expr->right() != nullptr);
if (expr->op() == op && expr->right()->IsLiteral() &&
TypeOf(expr) == kAstI32) {
Literal* right = expr->right()->AsLiteral();
......@@ -571,7 +571,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
bool MatchDoubleBinaryOperation(BinaryOperation* expr, Token::Value op,
double val) {
DCHECK(expr->right() != NULL);
DCHECK(expr->right() != nullptr);
if (expr->op() == op && expr->right()->IsLiteral() &&
TypeOf(expr) == kAstF64) {
Literal* right = expr->right()->AsLiteral();
......@@ -610,7 +610,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
DCHECK(TypeOf(expr->left()) == kAstI32);
DCHECK(TypeOf(expr->right()) == kAstI32);
BinaryOperation* op = expr->left()->AsBinaryOperation();
if (op != NULL) {
if (op != nullptr) {
if (MatchIntBinaryOperation(op, Token::BIT_XOR, 0xffffffff)) {
DCHECK(TypeOf(op->right()) == kAstI32);
if (TypeOf(op->left()) != kAstI32) {
......@@ -899,10 +899,10 @@ class AsmWasmBuilderImpl : public AstVisitor {
};
uint16_t LookupOrInsertLocal(Variable* v, LocalType type) {
DCHECK(current_function_builder_ != NULL);
DCHECK(current_function_builder_ != nullptr);
ZoneHashMap::Entry* entry =
local_variables_.Lookup(v, ComputePointerHash(v));
if (entry == NULL) {
if (entry == nullptr) {
uint16_t index;
if (v->IsParameter()) {
index = current_function_builder_->AddParam(type);
......@@ -921,7 +921,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
uint16_t LookupOrInsertGlobal(Variable* v, LocalType type) {
ZoneHashMap::Entry* entry =
global_variables_.Lookup(v, ComputePointerHash(v));
if (entry == NULL) {
if (entry == nullptr) {
uint16_t index =
builder_->AddGlobal(WasmOpcodes::MachineTypeFor(type), 0);
IndexContainer* container = new (zone()) IndexContainer();
......@@ -934,9 +934,9 @@ class AsmWasmBuilderImpl : public AstVisitor {
}
uint16_t LookupOrInsertFunction(Variable* v) {
DCHECK(builder_ != NULL);
DCHECK(builder_ != nullptr);
ZoneHashMap::Entry* entry = functions_.Lookup(v, ComputePointerHash(v));
if (entry == NULL) {
if (entry == nullptr) {
uint16_t index = builder_->AddFunction(v->raw_name()->raw_data(),
v->raw_name()->length());
IndexContainer* container = new (zone()) IndexContainer();
......
......@@ -101,7 +101,7 @@ void WasmFunctionBuilder::ReturnType(LocalType type) { return_type_ = type; }
void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size) {
EmitCode(code, code_size, NULL, 0);
EmitCode(code, code_size, nullptr, 0);
}
......
......@@ -125,7 +125,8 @@ class WasmModuleWriter : public ZoneObject {
class WasmModuleBuilder : public ZoneObject {
public:
explicit WasmModuleBuilder(Zone* zone);
uint16_t AddFunction(const unsigned char* name = NULL, int name_length = 0);
uint16_t AddFunction(const unsigned char* name = nullptr,
int name_length = 0);
uint32_t AddGlobal(MachineType type, bool exported);
WasmFunctionBuilder* FunctionAt(size_t index);
void AddDataSegment(WasmDataSegmentEncoder* data);
......
......@@ -139,7 +139,7 @@ v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(i::ParseInfo* info) {
v8::internal::AsmTyper typer(info->isolate(), info->zone(), *(info->script()),
info->literal());
if (!typer.Validate()) {
return NULL;
return nullptr;
}
auto module = v8::internal::wasm::AsmWasmBuilder(
......@@ -170,7 +170,7 @@ void AsmCompileRun(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::ParseInfo info(&zone, script);
auto module = TranslateAsmModule(&info);
if (module == NULL) {
if (module == nullptr) {
thrower.Error("Asm.js validation failed");
return;
}
......@@ -203,7 +203,7 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::ParseInfo info(&zone, script);
auto module = TranslateAsmModule(&info);
if (module == NULL) {
if (module == nullptr) {
thrower.Error("Asm.js validation failed");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment