Browse Source

make room for more hobject bits in heaphdr; bit allocation is now tight and 4 bits are available for hobject

pull/2/head
Sami Vaarala 11 years ago
parent
commit
e6b92392a7
  1. 8
      src/duk_heaphdr.h
  2. 8
      src/duk_hobject.h

8
src/duk_heaphdr.h

@ -44,12 +44,12 @@ struct duk_heaphdr_string {
#endif #endif
}; };
#define DUK_HEAPHDR_FLAGS_TYPE_MASK 0x0000000fUL #define DUK_HEAPHDR_FLAGS_TYPE_MASK 0x00000003UL
#define DUK_HEAPHDR_FLAGS_FLAG_MASK (~DUK_HEAPHDR_FLAGS_TYPE_MASK) #define DUK_HEAPHDR_FLAGS_FLAG_MASK (~DUK_HEAPHDR_FLAGS_TYPE_MASK)
/* 4 bits for heap type */ /* 2 bits for heap type */
#define DUK_HEAPHDR_FLAGS_HEAP_START 4 /* 6 heap flags */ #define DUK_HEAPHDR_FLAGS_HEAP_START 2 /* 4 heap flags */
#define DUK_HEAPHDR_FLAGS_USER_START 10 /* 22 user flags */ #define DUK_HEAPHDR_FLAGS_USER_START 6 /* 26 user flags */
#define DUK_HEAPHDR_HEAP_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_HEAP_START + (n)) #define DUK_HEAPHDR_HEAP_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_HEAP_START + (n))
#define DUK_HEAPHDR_USER_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_USER_START + (n)) #define DUK_HEAPHDR_USER_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_USER_START + (n))

8
src/duk_hobject.h

@ -32,7 +32,7 @@
#ifndef DUK_HOBJECT_H_INCLUDED #ifndef DUK_HOBJECT_H_INCLUDED
#define DUK_HOBJECT_H_INCLUDED #define DUK_HOBJECT_H_INCLUDED
/* there are currently 22 flag bits available */ /* there are currently 26 flag bits available */
#define DUK_HOBJECT_FLAG_EXTENSIBLE DUK_HEAPHDR_USER_FLAG(0) /* object is extensible */ #define DUK_HOBJECT_FLAG_EXTENSIBLE DUK_HEAPHDR_USER_FLAG(0) /* object is extensible */
#define DUK_HOBJECT_FLAG_CONSTRUCTABLE DUK_HEAPHDR_USER_FLAG(1) /* object is constructable */ #define DUK_HOBJECT_FLAG_CONSTRUCTABLE DUK_HEAPHDR_USER_FLAG(1) /* object is constructable */
#define DUK_HOBJECT_FLAG_BOUND DUK_HEAPHDR_USER_FLAG(2) /* object established using Function.prototype.bind() */ #define DUK_HOBJECT_FLAG_BOUND DUK_HEAPHDR_USER_FLAG(2) /* object established using Function.prototype.bind() */
@ -49,8 +49,12 @@
#define DUK_HOBJECT_FLAG_SPECIAL_STRINGOBJ DUK_HEAPHDR_USER_FLAG(14) /* 'String' object, array index special behavior */ #define DUK_HOBJECT_FLAG_SPECIAL_STRINGOBJ DUK_HEAPHDR_USER_FLAG(14) /* 'String' object, array index special behavior */
#define DUK_HOBJECT_FLAG_SPECIAL_ARGUMENTS DUK_HEAPHDR_USER_FLAG(15) /* 'Arguments' object and has arguments special behavior (non-strict callee) */ #define DUK_HOBJECT_FLAG_SPECIAL_ARGUMENTS DUK_HEAPHDR_USER_FLAG(15) /* 'Arguments' object and has arguments special behavior (non-strict callee) */
#define DUK_HOBJECT_FLAG_SPECIAL_DUKFUNC DUK_HEAPHDR_USER_FLAG(16) /* Duktape/C (nativefunction) object, special 'length' */ #define DUK_HOBJECT_FLAG_SPECIAL_DUKFUNC DUK_HEAPHDR_USER_FLAG(16) /* Duktape/C (nativefunction) object, special 'length' */
/* bit 17 unused */
/* bit 18 unused */
/* bit 19 unused */
/* bit 20 unused */
#define DUK_HOBJECT_FLAG_CLASS_BASE DUK_HEAPHDR_USER_FLAG_NUMBER(17) #define DUK_HOBJECT_FLAG_CLASS_BASE DUK_HEAPHDR_USER_FLAG_NUMBER(21)
#define DUK_HOBJECT_FLAG_CLASS_BITS 5 #define DUK_HOBJECT_FLAG_CLASS_BITS 5
#define DUK_HOBJECT_GET_CLASS_NUMBER(h) \ #define DUK_HOBJECT_GET_CLASS_NUMBER(h) \

Loading…
Cancel
Save