Commit 76355c88 authored by Damien George's avatar Damien George

py/vm: Make small optimisation of BUILD_SLICE opcode.

No need to call DECODE_UINT since the value will always be either 2 or 3.
parent 57a7d5be
......@@ -817,17 +817,14 @@ unwind_jump:;
#if MICROPY_PY_BUILTINS_SLICE
ENTRY(MP_BC_BUILD_SLICE): {
MARK_EXC_IP_SELECTIVE();
DECODE_UINT;
if (unum == 2) {
mp_obj_t stop = POP();
mp_obj_t start = TOP();
SET_TOP(mp_obj_new_slice(start, stop, mp_const_none));
} else {
mp_obj_t step = POP();
mp_obj_t stop = POP();
mp_obj_t start = TOP();
SET_TOP(mp_obj_new_slice(start, stop, step));
mp_obj_t step = mp_const_none;
if (*ip++ == 3) {
// 3-argument slice includes step
step = POP();
}
mp_obj_t stop = POP();
mp_obj_t start = TOP();
SET_TOP(mp_obj_new_slice(start, stop, step));
DISPATCH();
}
#endif
......
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