mirror of
https://github.com/godotengine/godot.git
synced 2025-10-21 08:53:35 +00:00
GDScript: Optimize non-constant for
-range
This commit is contained in:
parent
3b963ab8b6
commit
a13fbc6e3e
10 changed files with 267 additions and 119 deletions
|
@ -553,7 +553,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
case OPCODE_CONSTRUCT_ARRAY: {
|
||||
int instr_var_args = _code_ptr[++ip];
|
||||
int argc = _code_ptr[ip + 1 + instr_var_args];
|
||||
text += " make_array ";
|
||||
text += "make_array ";
|
||||
text += DADDR(1 + argc);
|
||||
text += " = [";
|
||||
|
||||
|
@ -585,7 +585,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
type_name = Variant::get_type_name(builtin_type);
|
||||
}
|
||||
|
||||
text += " make_typed_array (";
|
||||
text += "make_typed_array (";
|
||||
text += type_name;
|
||||
text += ") ";
|
||||
|
||||
|
@ -1181,9 +1181,25 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
incr += 5;
|
||||
} break;
|
||||
DISASSEMBLE_ITERATE_TYPES(DISASSEMBLE_ITERATE_BEGIN);
|
||||
case OPCODE_ITERATE_BEGIN_RANGE: {
|
||||
text += "for-init ";
|
||||
text += DADDR(5);
|
||||
text += " in range from ";
|
||||
text += DADDR(2);
|
||||
text += " to ";
|
||||
text += DADDR(3);
|
||||
text += " step ";
|
||||
text += DADDR(4);
|
||||
text += " counter ";
|
||||
text += DADDR(1);
|
||||
text += " end ";
|
||||
text += itos(_code_ptr[ip + 6]);
|
||||
|
||||
incr += 7;
|
||||
} break;
|
||||
case OPCODE_ITERATE: {
|
||||
text += "for-loop ";
|
||||
text += DADDR(2);
|
||||
text += DADDR(3);
|
||||
text += " in ";
|
||||
text += DADDR(2);
|
||||
text += " counter ";
|
||||
|
@ -1194,6 +1210,20 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
incr += 5;
|
||||
} break;
|
||||
DISASSEMBLE_ITERATE_TYPES(DISASSEMBLE_ITERATE);
|
||||
case OPCODE_ITERATE_RANGE: {
|
||||
text += "for-loop ";
|
||||
text += DADDR(4);
|
||||
text += " in range to ";
|
||||
text += DADDR(2);
|
||||
text += " step ";
|
||||
text += DADDR(3);
|
||||
text += " counter ";
|
||||
text += DADDR(1);
|
||||
text += " end ";
|
||||
text += itos(_code_ptr[ip + 5]);
|
||||
|
||||
incr += 6;
|
||||
} break;
|
||||
case OPCODE_STORE_GLOBAL: {
|
||||
text += "store global ";
|
||||
text += DADDR(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue