diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 8db5282356d..4f42e46d816 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1001,29 +1001,14 @@ JSScript::NewScript(JSContext *cx, uint32_t length, uint32_t nsrcnotes, uint32_t size += length * sizeof(jsbytecode) + nsrcnotes * sizeof(jssrcnote); - uint8_t *data = NULL; -#if JS_SCRIPT_INLINE_DATA_LIMIT - if (size <= JS_SCRIPT_INLINE_DATA_LIMIT) { - /* - * Check that if inlineData is big enough to store const values, we - * can do that without any special alignment requirements given that - * the script as a GC thing is always aligned on Cell::CellSize. - */ - JS_STATIC_ASSERT(Cell::CellSize % sizeof(Value) == 0); - JS_STATIC_ASSERT(JS_SCRIPT_INLINE_DATA_LIMIT < sizeof(Value) || - offsetof(JSScript, inlineData) % sizeof(Value) == 0); - } else -#endif - { - /* - * We assume that calloc aligns on sizeof(Value) if the size we ask to - * allocate divides sizeof(Value). - */ - JS_STATIC_ASSERT(sizeof(Value) == sizeof(double)); - data = static_cast(cx->calloc_(JS_ROUNDUP(size, sizeof(Value)))); - if (!data) - return NULL; - } + /* + * We assume that calloc aligns on sizeof(Value) if the size we ask to + * allocate divides sizeof(Value). + */ + JS_STATIC_ASSERT(sizeof(Value) == sizeof(double)); + uint8_t *data = static_cast(cx->calloc_(JS_ROUNDUP(size, sizeof(Value)))); + if (!data) + return NULL; JSScript *script = js_NewGCScript(cx); if (!script) { @@ -1034,10 +1019,6 @@ JSScript::NewScript(JSContext *cx, uint32_t length, uint32_t nsrcnotes, uint32_t PodZero(script); #ifdef JS_CRASH_DIAGNOSTICS script->cookie1[0] = script->cookie2[0] = JS_SCRIPT_COOKIE; -#endif -#if JS_SCRIPT_INLINE_DATA_LIMIT - if (!data) - data = script->inlineData; #endif script->data = data; script->length = length; @@ -1325,11 +1306,6 @@ JSScript::NewScriptFromEmitter(JSContext *cx, BytecodeEmitter *bce) size_t JSScript::computedSizeOfData() { -#if JS_SCRIPT_INLINE_DATA_LIMIT - if (data == inlineData) - return 0; -#endif - uint8_t *dataEnd = code + length * sizeof(jsbytecode) + numNotes() * sizeof(jssrcnote); JS_ASSERT(dataEnd >= data); return dataEnd - data; @@ -1338,11 +1314,6 @@ JSScript::computedSizeOfData() size_t JSScript::sizeOfData(JSMallocSizeOfFun mallocSizeOf) { -#if JS_SCRIPT_INLINE_DATA_LIMIT - if (data == inlineData) - return 0; -#endif - return mallocSizeOf(data); } @@ -1436,13 +1407,8 @@ JSScript::finalize(JSContext *cx, bool background) cx->free_(debug); } -#if JS_SCRIPT_INLINE_DATA_LIMIT - if (data != inlineData) -#endif - { - JS_POISON(data, 0xdb, computedSizeOfData()); - cx->free_(data); - } + JS_POISON(data, 0xdb, computedSizeOfData()); + cx->free_(data); } namespace js { diff --git a/js/src/jsscript.h b/js/src/jsscript.h index a1db414c403..deccce65b90 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -452,16 +452,6 @@ struct JSScript : public js::gc::Cell uint16_t nClosedArgs; /* number of args which are closed over. */ uint16_t nClosedVars; /* number of vars which are closed over. */ - /* - * To ensure sizeof(JSScript) % gc::Cell::CellSize == 0 on we must pad - * the script with 4 bytes. We use them to store tiny scripts like empty - * scripts. - */ -#if JS_BITS_PER_WORD == 64 -#define JS_SCRIPT_INLINE_DATA_LIMIT 4 - uint8_t inlineData[JS_SCRIPT_INLINE_DATA_LIMIT]; -#endif - const char *filename; /* source filename or null */ JSAtom **atoms; /* maps immediate index to literal struct */ private: