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