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

Unified Diff: src/builtins/builtins-object-gen.cc

Issue 2861983002: [ignition] Optimize JSGenerator creation (Closed)
Patch Set: rebase Created 3 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/builtins/builtins-definitions.h ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-object-gen.cc
diff --git a/src/builtins/builtins-object-gen.cc b/src/builtins/builtins-object-gen.cc
index b919d18f1b42c2ac519cf20290270dec0f379959..cdf9d9026630b36d3e50452b6f2b09c1cbecbc6f 100644
--- a/src/builtins/builtins-object-gen.cc
+++ b/src/builtins/builtins-object-gen.cc
@@ -412,5 +412,51 @@ TF_BUILTIN(GetSuperConstructor, ObjectBuiltinsAssembler) {
Return(GetSuperConstructor(object, context));
}
+TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
+ Node* closure = Parameter(Descriptor::kClosure);
+ Node* receiver = Parameter(Descriptor::kReceiver);
+ Node* context = Parameter(Descriptor::kContext);
+
+ // Get the initial map from the function, jumping to the runtime if we don't
+ // have one.
+ Node* maybe_map =
+ LoadObjectField(closure, JSFunction::kPrototypeOrInitialMapOffset);
+ Label runtime(this);
+ GotoIf(DoesntHaveInstanceType(maybe_map, MAP_TYPE), &runtime);
+
+ Node* shared =
+ LoadObjectField(closure, JSFunction::kSharedFunctionInfoOffset);
+ Node* bytecode_array =
+ LoadObjectField(shared, SharedFunctionInfo::kFunctionDataOffset);
+ Node* frame_size = ChangeInt32ToIntPtr(LoadObjectField(
+ bytecode_array, BytecodeArray::kFrameSizeOffset, MachineType::Int32()));
+ Node* size = WordSar(frame_size, IntPtrConstant(kPointerSizeLog2));
+ Node* register_file = AllocateFixedArray(FAST_HOLEY_ELEMENTS, size);
+ FillFixedArrayWithValue(FAST_HOLEY_ELEMENTS, register_file, IntPtrConstant(0),
+ size, Heap::kUndefinedValueRootIndex);
+
+ Node* const result = AllocateJSObjectFromMap(maybe_map);
+
+ StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kFunctionOffset,
+ closure);
+ StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kContextOffset,
+ context);
+ StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kReceiverOffset,
+ receiver);
+ StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kRegisterFileOffset,
+ register_file);
+ Node* executing = SmiConstant(JSGeneratorObject::kGeneratorExecuting);
+ StoreObjectFieldNoWriteBarrier(result, JSGeneratorObject::kContinuationOffset,
+ executing);
+ HandleSlackTracking(context, result, maybe_map, JSGeneratorObject::kSize);
+ Return(result);
+
+ BIND(&runtime);
+ {
+ Return(CallRuntime(Runtime::kCreateJSGeneratorObject, context, closure,
+ receiver));
+ }
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/builtins/builtins-definitions.h ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698