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 */
2266
2266
if (header_p -> is_run_global )
2267
2267
{
2268
2268
ret_val = vm_run_global (bytecode_p );
2269
+ ecma_bytecode_deref (bytecode_p );
2269
2270
}
2270
2271
else
2271
2272
{
2272
2273
ret_val = vm_run_eval (bytecode_p , false);
2273
2274
}
2274
2275
2275
- ecma_bytecode_deref (bytecode_p );
2276
2276
return ret_val ;
2277
2277
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
2278
2278
JERRY_UNUSED (snapshot_p );
Original file line number Diff line number Diff line change @@ -725,8 +725,7 @@ main (void)
725
725
jerry_cleanup ();
726
726
727
727
// Dump / execute snapshot
728
- // FIXME: support save/load snapshot for optimized parser
729
- if (false)
728
+ if (true)
730
729
{
731
730
static uint8_t global_mode_snapshot_buffer [1024 ];
732
731
static uint8_t eval_mode_snapshot_buffer [1024 ];
@@ -760,8 +759,13 @@ main (void)
760
759
false);
761
760
762
761
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 );
764
767
jerry_release_value (res );
768
+ JERRY_ASSERT (!strncmp (buffer , "string from snapshot" , (size_t ) sz ));
765
769
766
770
res = jerry_exec_snapshot (eval_mode_snapshot_buffer ,
767
771
eval_mode_snapshot_size ,
You can’t perform that action at this time.
0 commit comments