Commit 3674d6f6 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Fix constructor callback of the new bindings generator

Produces make_check_constructor_call in both cases that
constructors are overloaded and that not overloaded.

Bug: 839389
Change-Id: Ic3a90285a826dbf057b60ddd29a51e0780c6212e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117847Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752830}
parent 3afb6044
...@@ -1501,11 +1501,13 @@ def make_overload_dispatcher_function_def(cg_context, function_name): ...@@ -1501,11 +1501,13 @@ def make_overload_dispatcher_function_def(cg_context, function_name):
body = func_def.body body = func_def.body
if cg_context.operation_group: if cg_context.operation_group:
body.append(make_operation_entry(cg_context))
body.append(EmptyNode())
body.append(make_cooperative_scheduling_safepoint(cg_context)) body.append(make_cooperative_scheduling_safepoint(cg_context))
body.append(EmptyNode()) body.append(EmptyNode())
if cg_context.constructor_group: if cg_context.constructor_group:
body.append(make_check_constructor_call(cg_context)) body.append(make_constructor_entry(cg_context))
body.append(EmptyNode()) body.append(EmptyNode())
body.append(make_overload_dispatcher(cg_context)) body.append(make_overload_dispatcher(cg_context))
...@@ -1513,6 +1515,17 @@ def make_overload_dispatcher_function_def(cg_context, function_name): ...@@ -1513,6 +1515,17 @@ def make_overload_dispatcher_function_def(cg_context, function_name):
return func_def return func_def
def make_constructor_entry(cg_context):
assert isinstance(cg_context, CodeGenContext)
return SequenceNode([
make_runtime_call_timer_scope(cg_context),
make_bindings_trace_event(cg_context),
EmptyNode(),
make_check_constructor_call(cg_context),
])
def make_constructor_function_def(cg_context, function_name): def make_constructor_function_def(cg_context, function_name):
assert isinstance(cg_context, CodeGenContext) assert isinstance(cg_context, CodeGenContext)
assert isinstance(function_name, str) assert isinstance(function_name, str)
...@@ -1522,9 +1535,11 @@ def make_constructor_function_def(cg_context, function_name): ...@@ -1522,9 +1535,11 @@ def make_constructor_function_def(cg_context, function_name):
func_def = _make_empty_callback_def(cg_context, function_name) func_def = _make_empty_callback_def(cg_context, function_name)
body = func_def.body body = func_def.body
if len(cg_context.constructor_group) == 1:
body.append(make_constructor_entry(cg_context))
body.append(EmptyNode())
body.extend([ body.extend([
make_runtime_call_timer_scope(cg_context),
make_bindings_trace_event(cg_context),
make_report_deprecate_as(cg_context), make_report_deprecate_as(cg_context),
make_report_measure_as(cg_context), make_report_measure_as(cg_context),
make_log_activity(cg_context), make_log_activity(cg_context),
...@@ -1606,6 +1621,15 @@ def make_exposed_construct_callback_def(cg_context, function_name): ...@@ -1606,6 +1621,15 @@ def make_exposed_construct_callback_def(cg_context, function_name):
return func_def return func_def
def make_operation_entry(cg_context):
assert isinstance(cg_context, CodeGenContext)
return SequenceNode([
make_runtime_call_timer_scope(cg_context),
make_bindings_trace_event(cg_context),
])
def make_operation_function_def(cg_context, function_name): def make_operation_function_def(cg_context, function_name):
assert isinstance(cg_context, CodeGenContext) assert isinstance(cg_context, CodeGenContext)
assert isinstance(function_name, str) assert isinstance(function_name, str)
...@@ -1613,9 +1637,11 @@ def make_operation_function_def(cg_context, function_name): ...@@ -1613,9 +1637,11 @@ def make_operation_function_def(cg_context, function_name):
func_def = _make_empty_callback_def(cg_context, function_name) func_def = _make_empty_callback_def(cg_context, function_name)
body = func_def.body body = func_def.body
if not cg_context.operation_group or len(cg_context.operation_group) == 1:
body.append(make_operation_entry(cg_context))
body.append(EmptyNode())
body.extend([ body.extend([
make_runtime_call_timer_scope(cg_context),
make_bindings_trace_event(cg_context),
make_report_deprecate_as(cg_context), make_report_deprecate_as(cg_context),
make_report_measure_as(cg_context), make_report_measure_as(cg_context),
make_log_activity(cg_context), make_log_activity(cg_context),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment