本文整理汇总了Python中frame.Frame.spill_all方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.spill_all方法的具体用法?Python Frame.spill_all怎么用?Python Frame.spill_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frame.Frame
的用法示例。
在下文中一共展示了Frame.spill_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from frame import Frame [as 别名]
# 或者: from frame.Frame import spill_all [as 别名]
#.........这里部分代码省略.........
if isinstance(value, int):
self.frame.push_int(value)
else:
self.frame.push_double(value)
def op_string(self, node):
value = node.value
str = new_string(value)
self.frame.push_string(addressof(str))
def op_true(self, node):
self.frame.push_bool(True)
def op_false(self, node):
self.frame.push_bool(False)
def op_null(self, node):
self.frame.push_null()
def op_array_init(self, nodes):
for node in nodes:
if node: # could be hole
self.compile_node(node)
@function(c_int, c_int)
def array_init(length):
array = ObjectFactory.createArray(length)
return array.pointer
size = len(nodes)
self.frame.spill_all()
self.assembler.push(size)
self.assembler.mov(self.frame.scratch, array_init)
self.assembler.call(self.frame.scratch)
self.assembler.add(esp, 4)
self.assembler.push(eax) #fixme
reg = self.frame.alloc_reg()
self.assembler.mov(reg, eax.addr + 8) # elements
i = size - 1
for node in nodes:
if node:
element = self.frame.peek(-(size - i))
self.box(element, self.frame.scratch)
self.assembler.mov(reg.addr + i * 4, self.frame.scratch)
else:
self.assembler.mov(reg.addr + i * 4, undefined_value) # todo: needs special value
i = i - 1
for node in nodes:
if node:
self.frame.pop()
self.assembler.pop(self.frame.scratch)
self.assembler.mov(reg, self.frame.scratch)
self.frame.push('object', reg)
def op_object_init(self, nodes):
@function(c_int)
def object_init():
obj = ObjectFactory.createPlain(0, len(nodes) + 2)