Bug 1032956 - Self-hosted functions in {Object,Function}.{,prototype.}* are broken and fail on an assert. r=jwalden

--HG--
extra : rebase_source : 050efcbf6e69314cabd5a9910981684d92fa4836
This commit is contained in:
Nathan Braswell 2014-07-07 11:48:48 -07:00
parent dba111cd34
commit 8bb25a9efd
3 changed files with 19 additions and 1 deletions

View File

@ -277,7 +277,7 @@ js::ObjectToSource(JSContext *cx, HandleObject obj)
if (gsop[j]) {
if (!buf.append(gsop[j]) || !buf.append(' '))
return nullptr;
}
}
if (JSID_IS_SYMBOL(id) && !buf.append('['))
return nullptr;
if (!buf.append(idstr))
@ -1226,3 +1226,13 @@ const JSFunctionSpec js::object_static_methods[] = {
JS_FN("isSealed", obj_isSealed, 1,0),
JS_FS_END
};
/*
* For Object, self-hosted functions have to be done at a different
* time, after the intrinsic holder has been set, so we put them
* in a different array.
*/
const JSFunctionSpec js::object_static_selfhosted_methods[] = {
JS_FS_END
};

View File

@ -16,6 +16,7 @@ namespace js {
extern const JSFunctionSpec object_methods[];
extern const JSPropertySpec object_properties[];
extern const JSFunctionSpec object_static_methods[];
extern const JSFunctionSpec object_static_selfhosted_methods[];
// Object constructor native. Exposed only so the JIT can know its address.
bool

View File

@ -168,6 +168,13 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro
return false;
}
/*
* Define self-hosted functions after setting the intrinsics holder
* (which is needed to define self-hosted functions)
*/
if (!JS_DefineFunctions(cx, ctor, object_static_selfhosted_methods))
return false;
/*
* The global object should have |Object.prototype| as its [[Prototype]].
* Eventually we'd like to have standard classes be there from the start,