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

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

Issue 1987183002: [stubs] Convert Internal/ArraySingleArgumentsConstructor to a TurboFan stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 4 years, 7 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/arm64/interface-descriptors-arm64.cc ('k') | src/code-stubs.h » ('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 e45e66d40069f63bf06c1ee365b9f3bc47253de5..53f52b504d6eef27da6d564f5dfee2e5e32071c6 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -726,8 +726,49 @@ Node* CodeStubAssembler::AllocateJSArray(ElementsKind kind, Node* array_map,
}
}
} else {
- // TODO(danno): Add a loop for initialization
- UNIMPLEMENTED();
+ Variable current(this, MachineRepresentation::kTagged);
+ Label test(this);
+ Label decrement(this, &current);
+ Label done(this);
+ Node* limit = IntPtrAdd(elements, IntPtrConstant(first_element_offset));
+ current.Bind(
+ IntPtrAdd(limit, ElementOffsetFromIndex(capacity_node, kind, mode, 0)));
+
+ Branch(WordEqual(current.value(), limit), &done, &decrement);
+
+ Bind(&decrement);
+ current.Bind(IntPtrSub(
+ current.value(),
+ Int32Constant(IsFastDoubleElementsKind(kind) ? kDoubleSize
+ : kPointerSize)));
+ if (is_double) {
+ // Don't use doubles to store the hole double, since manipulating the
+ // signaling NaN used for the hole in C++, e.g. with bit_cast, will
+ // change its value on ia32 (the x87 stack is used to return values
+ // and stores to the stack silently clear the signalling bit).
+ //
+ // TODO(danno): When we have a Float32/Float64 wrapper class that
+ // preserves double bits during manipulation, remove this code/change
+ // this to an indexed Float64 store.
+ if (Is64()) {
+ StoreNoWriteBarrier(MachineRepresentation::kWord64, current.value(),
+ double_hole);
+ } else {
+ StoreNoWriteBarrier(MachineRepresentation::kWord32, current.value(),
+ double_hole);
+ StoreNoWriteBarrier(
+ MachineRepresentation::kWord32,
+ IntPtrAdd(current.value(), Int32Constant(kPointerSize)),
+ double_hole);
+ }
+ } else {
+ StoreNoWriteBarrier(MachineRepresentation::kTagged, current.value(),
+ hole);
+ }
+ Node* compare = WordNotEqual(current.value(), limit);
+ Branch(compare, &decrement, &done);
+
+ Bind(&done);
}
return array;
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698