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

Unified Diff: src/builtins/builtins-global.cc

Issue 2498073002: [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: one more attempt Created 4 years, 1 month 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/builtins-generator.cc ('k') | src/builtins/builtins-handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-global.cc
diff --git a/src/builtins/builtins-global.cc b/src/builtins/builtins-global.cc
index 1fa0967aa9cdddb3d5fee6d00ce979b93a18518b..c65b3b6428a079897ccfc9bd0ab3886bc191d761 100644
--- a/src/builtins/builtins-global.cc
+++ b/src/builtins/builtins-global.cc
@@ -101,111 +101,112 @@ BUILTIN(GlobalEval) {
}
// ES6 section 18.2.2 isFinite ( number )
-void Builtins::Generate_GlobalIsFinite(CodeStubAssembler* assembler) {
+void Builtins::Generate_GlobalIsFinite(compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
+ CodeStubAssembler assembler(state);
- Node* context = assembler->Parameter(4);
+ Node* context = assembler.Parameter(4);
- Label return_true(assembler), return_false(assembler);
+ Label return_true(&assembler), return_false(&assembler);
// We might need to loop once for ToNumber conversion.
- Variable var_num(assembler, MachineRepresentation::kTagged);
- Label loop(assembler, &var_num);
- var_num.Bind(assembler->Parameter(1));
- assembler->Goto(&loop);
- assembler->Bind(&loop);
+ Variable var_num(&assembler, MachineRepresentation::kTagged);
+ Label loop(&assembler, &var_num);
+ var_num.Bind(assembler.Parameter(1));
+ assembler.Goto(&loop);
+ assembler.Bind(&loop);
{
// Load the current {num} value.
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
- assembler->GotoIf(assembler->TaggedIsSmi(num), &return_true);
+ assembler.GotoIf(assembler.TaggedIsSmi(num), &return_true);
// Check if {num} is a HeapNumber.
- Label if_numisheapnumber(assembler),
- if_numisnotheapnumber(assembler, Label::kDeferred);
- assembler->Branch(assembler->WordEqual(assembler->LoadMap(num),
- assembler->HeapNumberMapConstant()),
- &if_numisheapnumber, &if_numisnotheapnumber);
+ Label if_numisheapnumber(&assembler),
+ if_numisnotheapnumber(&assembler, Label::kDeferred);
+ assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
+ assembler.HeapNumberMapConstant()),
+ &if_numisheapnumber, &if_numisnotheapnumber);
- assembler->Bind(&if_numisheapnumber);
+ assembler.Bind(&if_numisheapnumber);
{
// Check if {num} contains a finite, non-NaN value.
- Node* num_value = assembler->LoadHeapNumberValue(num);
- assembler->BranchIfFloat64IsNaN(
- assembler->Float64Sub(num_value, num_value), &return_false,
- &return_true);
+ Node* num_value = assembler.LoadHeapNumberValue(num);
+ assembler.BranchIfFloat64IsNaN(assembler.Float64Sub(num_value, num_value),
+ &return_false, &return_true);
}
- assembler->Bind(&if_numisnotheapnumber);
+ assembler.Bind(&if_numisnotheapnumber);
{
// Need to convert {num} to a Number first.
- Callable callable = CodeFactory::NonNumberToNumber(assembler->isolate());
- var_num.Bind(assembler->CallStub(callable, context, num));
- assembler->Goto(&loop);
+ Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate());
+ var_num.Bind(assembler.CallStub(callable, context, num));
+ assembler.Goto(&loop);
}
}
- assembler->Bind(&return_true);
- assembler->Return(assembler->BooleanConstant(true));
+ assembler.Bind(&return_true);
+ assembler.Return(assembler.BooleanConstant(true));
- assembler->Bind(&return_false);
- assembler->Return(assembler->BooleanConstant(false));
+ assembler.Bind(&return_false);
+ assembler.Return(assembler.BooleanConstant(false));
}
// ES6 section 18.2.3 isNaN ( number )
-void Builtins::Generate_GlobalIsNaN(CodeStubAssembler* assembler) {
+void Builtins::Generate_GlobalIsNaN(compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
+ CodeStubAssembler assembler(state);
- Node* context = assembler->Parameter(4);
+ Node* context = assembler.Parameter(4);
- Label return_true(assembler), return_false(assembler);
+ Label return_true(&assembler), return_false(&assembler);
// We might need to loop once for ToNumber conversion.
- Variable var_num(assembler, MachineRepresentation::kTagged);
- Label loop(assembler, &var_num);
- var_num.Bind(assembler->Parameter(1));
- assembler->Goto(&loop);
- assembler->Bind(&loop);
+ Variable var_num(&assembler, MachineRepresentation::kTagged);
+ Label loop(&assembler, &var_num);
+ var_num.Bind(assembler.Parameter(1));
+ assembler.Goto(&loop);
+ assembler.Bind(&loop);
{
// Load the current {num} value.
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
- assembler->GotoIf(assembler->TaggedIsSmi(num), &return_false);
+ assembler.GotoIf(assembler.TaggedIsSmi(num), &return_false);
// Check if {num} is a HeapNumber.
- Label if_numisheapnumber(assembler),
- if_numisnotheapnumber(assembler, Label::kDeferred);
- assembler->Branch(assembler->WordEqual(assembler->LoadMap(num),
- assembler->HeapNumberMapConstant()),
- &if_numisheapnumber, &if_numisnotheapnumber);
+ Label if_numisheapnumber(&assembler),
+ if_numisnotheapnumber(&assembler, Label::kDeferred);
+ assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
+ assembler.HeapNumberMapConstant()),
+ &if_numisheapnumber, &if_numisnotheapnumber);
- assembler->Bind(&if_numisheapnumber);
+ assembler.Bind(&if_numisheapnumber);
{
// Check if {num} contains a NaN.
- Node* num_value = assembler->LoadHeapNumberValue(num);
- assembler->BranchIfFloat64IsNaN(num_value, &return_true, &return_false);
+ Node* num_value = assembler.LoadHeapNumberValue(num);
+ assembler.BranchIfFloat64IsNaN(num_value, &return_true, &return_false);
}
- assembler->Bind(&if_numisnotheapnumber);
+ assembler.Bind(&if_numisnotheapnumber);
{
// Need to convert {num} to a Number first.
- Callable callable = CodeFactory::NonNumberToNumber(assembler->isolate());
- var_num.Bind(assembler->CallStub(callable, context, num));
- assembler->Goto(&loop);
+ Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate());
+ var_num.Bind(assembler.CallStub(callable, context, num));
+ assembler.Goto(&loop);
}
}
- assembler->Bind(&return_true);
- assembler->Return(assembler->BooleanConstant(true));
+ assembler.Bind(&return_true);
+ assembler.Return(assembler.BooleanConstant(true));
- assembler->Bind(&return_false);
- assembler->Return(assembler->BooleanConstant(false));
+ assembler.Bind(&return_false);
+ assembler.Return(assembler.BooleanConstant(false));
}
} // namespace internal
« no previous file with comments | « src/builtins/builtins-generator.cc ('k') | src/builtins/builtins-handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698