@@ -3972,10 +3972,8 @@ DUK_INTERNAL duk_hobject *duk_push_object_helper(duk_context *ctx, duk_uint_t ho
39723972
39733973 DUK__CHECK_SPACE ();
39743974
3975- h = duk_hobject_alloc (thr -> heap , hobject_flags_and_class );
3976- if (DUK_UNLIKELY (h == NULL )) {
3977- DUK_ERROR_ALLOC_FAILED (thr );
3978- }
3975+ h = duk_hobject_alloc (thr , hobject_flags_and_class );
3976+ DUK_ASSERT (h != NULL );
39793977
39803978 DUK_DDD (DUK_DDDPRINT ("created object with flags: 0x%08lx" , (unsigned long ) h -> hdr .h_flags ));
39813979
@@ -4033,10 +4031,8 @@ DUK_EXTERNAL duk_idx_t duk_push_array(duk_context *ctx) {
40334031 DUK_HOBJECT_FLAG_EXOTIC_ARRAY |
40344032 DUK_HOBJECT_CLASS_AS_FLAGS (DUK_HOBJECT_CLASS_ARRAY );
40354033
4036- obj = duk_harray_alloc (thr -> heap , flags );
4037- if (DUK_UNLIKELY (obj == NULL )) {
4038- DUK_ERROR_ALLOC_FAILED (thr );
4039- }
4034+ obj = duk_harray_alloc (thr , flags );
4035+ DUK_ASSERT (obj != NULL );
40404036
40414037 /* XXX: since prototype is NULL, could save a check */
40424038 DUK_HOBJECT_SET_PROTOTYPE_UPDREF (thr , (duk_hobject * ) obj , thr -> builtins [DUK_BIDX_ARRAY_PROTOTYPE ]);
@@ -4092,13 +4088,11 @@ DUK_EXTERNAL duk_idx_t duk_push_thread_raw(duk_context *ctx, duk_uint_t flags) {
40924088
40934089 DUK__CHECK_SPACE ();
40944090
4095- obj = duk_hthread_alloc (thr -> heap ,
4091+ obj = duk_hthread_alloc (thr ,
40964092 DUK_HOBJECT_FLAG_EXTENSIBLE |
40974093 DUK_HOBJECT_FLAG_THREAD |
40984094 DUK_HOBJECT_CLASS_AS_FLAGS (DUK_HOBJECT_CLASS_THREAD ));
4099- if (DUK_UNLIKELY (obj == NULL )) {
4100- DUK_ERROR_ALLOC_FAILED (thr );
4101- }
4095+ DUK_ASSERT (obj != NULL );
41024096 obj -> state = DUK_HTHREAD_STATE_INACTIVE ;
41034097#if defined(DUK_USE_ROM_STRINGS )
41044098 /* Nothing to initialize, strs[] is in ROM. */
@@ -4157,7 +4151,7 @@ DUK_INTERNAL duk_hcompfunc *duk_push_hcompfunc(duk_context *ctx) {
41574151 * DUK_HOBJECT_FLAG_CONSRUCTABLE flag cleared here.
41584152 */
41594153
4160- obj = duk_hcompfunc_alloc (thr -> heap ,
4154+ obj = duk_hcompfunc_alloc (thr ,
41614155 DUK_HOBJECT_FLAG_EXTENSIBLE |
41624156 DUK_HOBJECT_FLAG_COMPFUNC |
41634157 DUK_HOBJECT_CLASS_AS_FLAGS (DUK_HOBJECT_CLASS_FUNCTION ));
@@ -4199,10 +4193,8 @@ DUK_LOCAL duk_idx_t duk__push_c_function_raw(duk_context *ctx, duk_c_function fu
41994193 goto api_error ;
42004194 }
42014195
4202- obj = duk_hnatfunc_alloc (thr -> heap , flags );
4203- if (DUK_UNLIKELY (obj == NULL )) {
4204- DUK_ERROR_ALLOC_FAILED (thr );
4205- }
4196+ obj = duk_hnatfunc_alloc (thr , flags );
4197+ DUK_ASSERT (obj != NULL );
42064198
42074199 obj -> func = func ;
42084200 obj -> nargs = func_nargs ;
@@ -4319,10 +4311,8 @@ DUK_INTERNAL duk_hbufobj *duk_push_bufobj_raw(duk_context *ctx, duk_uint_t hobje
43194311
43204312 DUK__CHECK_SPACE ();
43214313
4322- obj = duk_hbufobj_alloc (thr -> heap , hobject_flags_and_class );
4323- if (DUK_UNLIKELY (obj == NULL )) {
4324- DUK_ERROR_ALLOC_FAILED (thr );
4325- }
4314+ obj = duk_hbufobj_alloc (thr , hobject_flags_and_class );
4315+ DUK_ASSERT (obj != NULL );
43264316
43274317 DUK_HOBJECT_SET_PROTOTYPE_UPDREF (thr , (duk_hobject * ) obj , thr -> builtins [prototype_bidx ]);
43284318 DUK_ASSERT_HBUFOBJ_VALID (obj );
0 commit comments