Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: src/code-stub-assembler.cc

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 2d8e55ca29a75ece438945adf38799dc1633f0f5..d3b4d99352cd8df190e906b3c9b23f9ba7916109 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -38,9 +38,7 @@ void CodeStubAssembler::Assert(Node* condition) {
#endif
}
-Node* CodeStubAssembler::NoContextConstant() {
- return SmiConstant(Smi::FromInt(0));
-}
+Node* CodeStubAssembler::NoContextConstant() { return SmiConstant(Smi::kZero); }
#define HEAP_CONSTANT_ACCESSOR(rootName, name) \
Node* CodeStubAssembler::name##Constant() { \
@@ -614,7 +612,7 @@ Node* CodeStubAssembler::AllocateRawUnaligned(Node* size_in_bytes,
Bind(&runtime_call);
// AllocateInTargetSpace does not use the context.
- Node* context = SmiConstant(Smi::FromInt(0));
+ Node* context = SmiConstant(Smi::kZero);
Node* runtime_result;
if (flags & kPretenured) {
@@ -1677,8 +1675,7 @@ void CodeStubAssembler::CopyStringCharacters(compiler::Node* from_string,
// Nothing to do for zero characters.
- GotoIf(SmiLessThanOrEqual(character_count, SmiConstant(Smi::FromInt(0))),
- &out);
+ GotoIf(SmiLessThanOrEqual(character_count, SmiConstant(Smi::kZero)), &out);
// Calculate offsets into the strings.
@@ -2734,7 +2731,7 @@ Node* CodeStubAssembler::SubString(Node* context, Node* string, Node* from,
GotoIf(SmiAbove(substr_length, string_length), &runtime);
// Equal length - check if {from, to} == {0, str.length}.
- GotoIf(SmiAbove(from, SmiConstant(Smi::FromInt(0))), &runtime);
+ GotoIf(SmiAbove(from, SmiConstant(Smi::kZero)), &runtime);
// Return the original string (substr_length == string_length).
@@ -3055,7 +3052,7 @@ Node* CodeStubAssembler::ToInteger(Node* context, Node* input,
}
Bind(&return_zero);
- var_arg.Bind(SmiConstant(Smi::FromInt(0)));
+ var_arg.Bind(SmiConstant(Smi::kZero));
Goto(&out);
}
@@ -5647,7 +5644,7 @@ void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache,
// For all objects but the receiver, check that the cache is empty.
current_map.Bind(LoadMap(current_js_object.value()));
Node* enum_length = EnumLength(current_map.value());
- Node* zero_constant = SmiConstant(Smi::FromInt(0));
+ Node* zero_constant = SmiConstant(Smi::kZero);
BranchIf(WordEqual(enum_length, zero_constant), &loop, use_runtime);
}
}
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698