File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2266,13 +2266,13 @@ jerry_exec_snapshot (const void *snapshot_p, /**< snapshot */
22662266 if (header_p -> is_run_global )
22672267 {
22682268 ret_val = vm_run_global (bytecode_p );
2269+ ecma_bytecode_deref (bytecode_p );
22692270 }
22702271 else
22712272 {
22722273 ret_val = vm_run_eval (bytecode_p , false);
22732274 }
22742275
2275- ecma_bytecode_deref (bytecode_p );
22762276 return ret_val ;
22772277#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
22782278 JERRY_UNUSED (snapshot_p );
Original file line number Diff line number Diff line change @@ -725,8 +725,7 @@ main (void)
725725 jerry_cleanup ();
726726
727727 // Dump / execute snapshot
728- // FIXME: support save/load snapshot for optimized parser
729- if (false)
728+ if (true)
730729 {
731730 static uint8_t global_mode_snapshot_buffer [1024 ];
732731 static uint8_t eval_mode_snapshot_buffer [1024 ];
@@ -760,8 +759,13 @@ main (void)
760759 false);
761760
762761 JERRY_ASSERT (!jerry_value_has_error_flag (res ));
763- JERRY_ASSERT (jerry_value_is_undefined (res ));
762+ JERRY_ASSERT (jerry_value_is_string (res ));
763+ sz = jerry_get_string_size (res );
764+ JERRY_ASSERT (sz == 20 );
765+ sz = jerry_string_to_char_buffer (res , (jerry_char_t * ) buffer , sz );
766+ JERRY_ASSERT (sz == 20 );
764767 jerry_release_value (res );
768+ JERRY_ASSERT (!strncmp (buffer , "string from snapshot" , (size_t ) sz ));
765769
766770 res = jerry_exec_snapshot (eval_mode_snapshot_buffer ,
767771 eval_mode_snapshot_size ,
You can’t perform that action at this time.
0 commit comments