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

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

Issue 2227493002: [turbofan] Add initial support for growing stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comments. Created 4 years, 4 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/builtins.h ('k') | src/code-factory.h » ('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 03728764c6ace49613316280896869472f48fbe1..12ab4a94963c0e1926688e6f2887ab8d86b61ace 100644
--- a/src/builtins/builtins-internal.cc
+++ b/src/builtins/builtins-internal.cc
@@ -51,15 +51,19 @@ void Builtins::Generate_StackCheck(MacroAssembler* masm) {
}
// -----------------------------------------------------------------------------
-// FixedArray helpers.
+// TurboFan support builtins.
-void Builtins::Generate_CopyFixedArray(CodeStubAssembler* assembler) {
+void Builtins::Generate_CopyFastSmiOrObjectElements(
+ CodeStubAssembler* assembler) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
- typedef CopyFixedArrayDescriptor Descriptor;
+ typedef CopyFastSmiOrObjectElementsDescriptor Descriptor;
- Node* source = assembler->Parameter(Descriptor::kSource);
+ Node* object = assembler->Parameter(Descriptor::kObject);
+
+ // Load the {object}s elements.
+ Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset);
// Load the {source} length.
Node* source_length_tagged =
@@ -122,7 +126,11 @@ void Builtins::Generate_CopyFixedArray(CodeStubAssembler* assembler) {
}
assembler->Bind(&done_loop);
- assembler->Return(target);
+ {
+ // Update the {object}s element to {target}.
+ assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
+ assembler->Return(target);
+ }
}
assembler->Bind(&if_oldspace);
@@ -173,9 +181,54 @@ void Builtins::Generate_CopyFixedArray(CodeStubAssembler* assembler) {
}
assembler->Bind(&done_loop);
- assembler->Return(target);
+ {
+ // Update the {object}s element to {target}.
+ assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
+ assembler->Return(target);
+ }
}
}
+void Builtins::Generate_GrowFastDoubleElements(CodeStubAssembler* assembler) {
+ typedef CodeStubAssembler::Label Label;
+ typedef compiler::Node Node;
+ typedef GrowArrayElementsDescriptor Descriptor;
+
+ 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->CheckAndGrowElementsCapacity(
+ context, elements, FAST_DOUBLE_ELEMENTS, key, &runtime);
+ assembler->StoreObjectField(object, JSObject::kElementsOffset, elements);
+ assembler->Return(elements);
+
+ assembler->Bind(&runtime);
+ assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
+}
+
+void Builtins::Generate_GrowFastSmiOrObjectElements(
+ CodeStubAssembler* assembler) {
+ typedef CodeStubAssembler::Label Label;
+ typedef compiler::Node Node;
+ typedef GrowArrayElementsDescriptor Descriptor;
+
+ 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->CheckAndGrowElementsCapacity(
+ context, elements, FAST_ELEMENTS, key, &runtime);
+ assembler->StoreObjectField(object, JSObject::kElementsOffset, elements);
+ assembler->Return(elements);
+
+ assembler->Bind(&runtime);
+ assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698