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

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

Issue 2502293002: Reland of [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: fix 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-handler.cc ('k') | src/builtins/builtins-iterator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-internal.cc
diff --git a/src/builtins/builtins-internal.cc b/src/builtins/builtins-internal.cc
index bec6ff36450223c02fc312f1f51fd7c75bafae7a..560180c7f357cdd8d479df4909d5e1280b448fdb 100644
--- a/src/builtins/builtins-internal.cc
+++ b/src/builtins/builtins-internal.cc
@@ -54,86 +54,90 @@ void Builtins::Generate_StackCheck(MacroAssembler* masm) {
// TurboFan support builtins.
void Builtins::Generate_CopyFastSmiOrObjectElements(
- CodeStubAssembler* assembler) {
+ compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CopyFastSmiOrObjectElementsDescriptor Descriptor;
+ CodeStubAssembler assembler(state);
- Node* object = assembler->Parameter(Descriptor::kObject);
+ Node* object = assembler.Parameter(Descriptor::kObject);
// Load the {object}s elements.
- Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset);
+ Node* source = assembler.LoadObjectField(object, JSObject::kElementsOffset);
- CodeStubAssembler::ParameterMode mode = assembler->OptimalParameterMode();
- Node* length = assembler->UntagParameter(
- assembler->LoadFixedArrayBaseLength(source), mode);
+ CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode();
+ Node* length = assembler.UntagParameter(
+ assembler.LoadFixedArrayBaseLength(source), mode);
// Check if we can allocate in new space.
ElementsKind kind = FAST_ELEMENTS;
int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind);
- Label if_newspace(assembler), if_oldspace(assembler);
- assembler->Branch(
- assembler->UintPtrLessThan(
- length, assembler->IntPtrOrSmiConstant(max_elements, mode)),
+ Label if_newspace(&assembler), if_oldspace(&assembler);
+ assembler.Branch(
+ assembler.UintPtrLessThan(
+ length, assembler.IntPtrOrSmiConstant(max_elements, mode)),
&if_newspace, &if_oldspace);
- assembler->Bind(&if_newspace);
+ assembler.Bind(&if_newspace);
{
- Node* target = assembler->AllocateFixedArray(kind, length, mode);
- assembler->CopyFixedArrayElements(kind, source, target, length,
- SKIP_WRITE_BARRIER, mode);
- assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
- assembler->Return(target);
+ Node* target = assembler.AllocateFixedArray(kind, length, mode);
+ assembler.CopyFixedArrayElements(kind, source, target, length,
+ SKIP_WRITE_BARRIER, mode);
+ assembler.StoreObjectField(object, JSObject::kElementsOffset, target);
+ assembler.Return(target);
}
- assembler->Bind(&if_oldspace);
+ assembler.Bind(&if_oldspace);
{
- Node* target = assembler->AllocateFixedArray(
- kind, length, mode, CodeStubAssembler::kPretenured);
- assembler->CopyFixedArrayElements(kind, source, target, length,
- UPDATE_WRITE_BARRIER, mode);
- assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
- assembler->Return(target);
+ Node* target = assembler.AllocateFixedArray(kind, length, mode,
+ CodeStubAssembler::kPretenured);
+ assembler.CopyFixedArrayElements(kind, source, target, length,
+ UPDATE_WRITE_BARRIER, mode);
+ assembler.StoreObjectField(object, JSObject::kElementsOffset, target);
+ assembler.Return(target);
}
}
-void Builtins::Generate_GrowFastDoubleElements(CodeStubAssembler* assembler) {
+void Builtins::Generate_GrowFastDoubleElements(
+ compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef GrowArrayElementsDescriptor Descriptor;
+ CodeStubAssembler assembler(state);
- Node* object = assembler->Parameter(Descriptor::kObject);
- Node* key = assembler->Parameter(Descriptor::kKey);
- Node* context = assembler->Parameter(Descriptor::kContext);
+ Node* object = assembler.Parameter(Descriptor::kObject);
+ Node* key = assembler.Parameter(Descriptor::kKey);
+ Node* context = assembler.Parameter(Descriptor::kContext);
- Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
- Node* elements = assembler->LoadElements(object);
- elements = assembler->TryGrowElementsCapacity(
+ Label runtime(&assembler, CodeStubAssembler::Label::kDeferred);
+ Node* elements = assembler.LoadElements(object);
+ elements = assembler.TryGrowElementsCapacity(
object, elements, FAST_DOUBLE_ELEMENTS, key, &runtime);
- assembler->Return(elements);
+ assembler.Return(elements);
- assembler->Bind(&runtime);
- assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
+ assembler.Bind(&runtime);
+ assembler.TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
}
void Builtins::Generate_GrowFastSmiOrObjectElements(
- CodeStubAssembler* assembler) {
+ compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef GrowArrayElementsDescriptor Descriptor;
+ CodeStubAssembler assembler(state);
- Node* object = assembler->Parameter(Descriptor::kObject);
- Node* key = assembler->Parameter(Descriptor::kKey);
- Node* context = assembler->Parameter(Descriptor::kContext);
+ Node* object = assembler.Parameter(Descriptor::kObject);
+ Node* key = assembler.Parameter(Descriptor::kKey);
+ Node* context = assembler.Parameter(Descriptor::kContext);
- Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
- Node* elements = assembler->LoadElements(object);
- elements = assembler->TryGrowElementsCapacity(object, elements, FAST_ELEMENTS,
- key, &runtime);
- assembler->Return(elements);
+ Label runtime(&assembler, CodeStubAssembler::Label::kDeferred);
+ Node* elements = assembler.LoadElements(object);
+ elements = assembler.TryGrowElementsCapacity(object, elements, FAST_ELEMENTS,
+ key, &runtime);
+ assembler.Return(elements);
- assembler->Bind(&runtime);
- assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
+ assembler.Bind(&runtime);
+ assembler.TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
}
} // namespace internal
« no previous file with comments | « src/builtins/builtins-handler.cc ('k') | src/builtins/builtins-iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698