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

Unified Diff: src/code-stubs.cc

Issue 2380953002: [stubs] Generalize loop handling in CodeStubAssembler and improve common loop performance (Closed)
Patch Set: Working version Created 4 years, 2 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-stub-assembler.cc ('k') | no next file » | 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 6f8251a70073e086d88f7fef48cac808d45d8969..6a71ca0c8c493848599e452a615127dbbe807747 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -5135,9 +5135,7 @@ void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const {
compiler::Node* FastNewFunctionContextStub::Generate(
CodeStubAssembler* assembler, compiler::Node* function,
compiler::Node* slots, compiler::Node* context) {
- typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
- typedef CodeStubAssembler::Variable Variable;
Node* min_context_slots =
assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS);
@@ -5176,24 +5174,12 @@ compiler::Node* FastNewFunctionContextStub::Generate(
// Initialize the rest of the slots to undefined.
Node* undefined = assembler->UndefinedConstant();
- Variable var_slot_index(assembler, MachineRepresentation::kWord32);
- var_slot_index.Bind(min_context_slots);
- Label loop(assembler, &var_slot_index), after_loop(assembler);
- assembler->Goto(&loop);
-
- assembler->Bind(&loop);
- {
- Node* slot_index = var_slot_index.value();
- assembler->GotoUnless(assembler->Int32LessThan(slot_index, length),
- &after_loop);
- assembler->StoreFixedArrayElement(function_context, slot_index, undefined,
- SKIP_WRITE_BARRIER);
- Node* one = assembler->Int32Constant(1);
- Node* next_index = assembler->Int32Add(slot_index, one);
- var_slot_index.Bind(next_index);
- assembler->Goto(&loop);
- }
- assembler->Bind(&after_loop);
+ assembler->BuildFastFixedArrayForEach(
+ function_context, FAST_ELEMENTS, min_context_slots, length,
+ [undefined](CodeStubAssembler* assembler, Node* context, Node* offset) {
+ assembler->StoreNoWriteBarrier(MachineType::PointerRepresentation(),
+ context, offset, undefined);
+ });
return function_context;
}
« no previous file with comments | « src/code-stub-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698