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

Unified Diff: src/code-stubs.cc

Issue 2206333003: [stubs] Convert GrowElementsStub to TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 503f5dda0923f3836ab788c11af3afce864ccbf7..14e98beb675af2440b02b66d1ecd5181818bdade 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -4220,14 +4220,6 @@ void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
descriptor->SetMissHandler(Runtime::kStringAdd);
}
-
-void GrowArrayElementsStub::InitializeDescriptor(
- CodeStubDescriptor* descriptor) {
- descriptor->Initialize(
- Runtime::FunctionForId(Runtime::kGrowArrayElements)->entry);
-}
-
-
namespace {
compiler::Node* GenerateHasProperty(
@@ -4997,12 +4989,42 @@ void InternalArraySingleArgumentConstructorStub::GenerateAssembly(
DONT_TRACK_ALLOCATION_SITE);
}
+void GrowArrayElementsStub::GenerateAssembly(
+ CodeStubAssembler* assembler) const {
+ typedef compiler::Node Node;
+ CodeStubAssembler::Label runtime(assembler,
+ CodeStubAssembler::Label::kDeferred);
+
+ Node* object = assembler->Parameter(Descriptor::kObject);
+ Node* key = assembler->Parameter(Descriptor::kKey);
+ Node* context = assembler->Parameter(Descriptor::kContext);
+ ElementsKind kind = elements_kind();
+
+ Node* elements = assembler->LoadElements(object);
+ Node* new_elements = assembler->CheckAndGrowElementsCapacity(
+ context, elements, kind, key, &runtime);
+ assembler->StoreObjectField(object, JSObject::kElementsOffset, new_elements);
+ assembler->Return(new_elements);
+
+ assembler->Bind(&runtime);
+ // TODO(danno): Make this a tail call when the stub is only used from TurboFan
+ // code. This musn't be a tail call for now, since the caller site in lithium
+ // creates a safepoint. This safepoint musn't have a different number of
+ // arguments on the stack in the case that a GC happens from the slow-case
+ // allocation path (zero, since all the stubs inputs are in registers) and
+ // when the call happens (it would be two in the tail call case due to the
+ // tail call pushing the arguments on the stack for the runtime call). By not
+ // tail-calling, the runtime call case also has zero arguments on the stack
+ // for the stub frame.
+ assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context,
+ object, key));
+}
+
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
: PlatformCodeStub(isolate) {
minor_key_ = ArgumentCountBits::encode(ANY);
}
-
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate,
int argument_count)
: PlatformCodeStub(isolate) {
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698