|
@@ -32,6 +32,13 @@ class AnalysisState(object):
|
|
|
# We want to create the following definition:
|
|
|
#
|
|
|
# !entry_point():
|
|
|
+ # static if self.jit.source_maps_enabled:
|
|
|
+ # $function_name = literal <function map>
|
|
|
+ # $source_map_name = literal <source map name>
|
|
|
+ # $origin_name = literal jit_runtime.FAST_JIT_ORIGIN_NAME
|
|
|
+ # $_ = direct-call ('macro-positional', void) register_debug_info(
|
|
|
+ # function_name=$functionsource_map=$source_map_name)
|
|
|
+ #
|
|
|
# $jit_locals = alloc-root-node
|
|
|
# $_ = declare-local var(...)
|
|
|
# $param_1 = resolve-local var(...)
|
|
@@ -41,6 +48,22 @@ class AnalysisState(object):
|
|
|
#
|
|
|
# We also want to store '$jit_locals' in an attribute, so we can
|
|
|
# use it to shield locals from the GC.
|
|
|
+ if self.jit.source_maps_enabled:
|
|
|
+ function_name = self.current_block.append_definition(
|
|
|
+ cfg_ir.Literal(self.function_name))
|
|
|
+ source_map_name = self.current_block.append_definition(
|
|
|
+ cfg_ir.Literal(self.jit.get_source_map_name(self.function_name)))
|
|
|
+ origin_name = self.current_block.append_definition(
|
|
|
+ cfg_ir.Literal(jit_runtime.FAST_JIT_ORIGIN_NAME))
|
|
|
+ self.current_block.append_definition(
|
|
|
+ cfg_ir.DirectFunctionCall(
|
|
|
+ cfg_ir.REGISTER_DEBUG_INFO_MACRO_NAME,
|
|
|
+ [('function_name', function_name),
|
|
|
+ ('source_map', source_map_name),
|
|
|
+ ('origin_name', origin_name)],
|
|
|
+ calling_convention=cfg_ir.MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
|
+ has_value=False))
|
|
|
+
|
|
|
self.root_node = self.current_block.append_definition(cfg_ir.AllocateRootNode())
|
|
|
for node_id, name in param_dict.items():
|
|
|
variable = bytecode_ir.VariableNode(node_id, name)
|
|
@@ -67,6 +90,9 @@ class AnalysisState(object):
|
|
|
# Analyze the instruction.
|
|
|
result = self.instruction_analyzers[instruction_type](self, instruction)
|
|
|
|
|
|
+ if self.jit.source_maps_enabled:
|
|
|
+ result.debug_information = instruction.debug_information
|
|
|
+
|
|
|
# Check if the instruction has a 'next' instruction. If so, analyze it!
|
|
|
if instruction.next_instruction is not None:
|
|
|
next_result = self.analyze(instruction.next_instruction)
|