Loading js/src/jsbool.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -186,13 +186,6 @@ js_BooleanToString(JSContext *cx, JSBool b) return cx->runtime->atomState.booleanAtoms[b ? 1 : 0]; } /* This function implements E-262-3 section 9.8, toString. */ bool js::BooleanToStringBuffer(JSContext *cx, JSBool b, StringBuffer &sb) { return b ? sb.append("true") : sb.append("false"); } namespace js { bool Loading js/src/jsbool.h +0 −3 Original line number Diff line number Diff line Loading @@ -54,9 +54,6 @@ js_BooleanToString(JSContext *cx, JSBool b); namespace js { extern bool BooleanToStringBuffer(JSContext *cx, JSBool b, StringBuffer &sb); inline bool BooleanGetPrimitiveValue(JSContext *cx, JSObject &obj, Value *vp); Loading js/src/jsstr.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -3265,26 +3265,6 @@ js::ToStringSlow(JSContext *cx, const Value &arg) return str; } /* This function implements E-262-3 section 9.8, toString. */ bool js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb) { Value v = arg; if (!ToPrimitive(cx, JSTYPE_STRING, &v)) return false; if (v.isString()) return sb.append(v.toString()); if (v.isNumber()) return NumberValueToStringBuffer(cx, v, sb); if (v.isBoolean()) return BooleanToStringBuffer(cx, v.toBoolean(), sb); if (v.isNull()) return sb.append(cx->runtime->atomState.nullAtom); JS_ASSERT(v.isUndefined()); return sb.append(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]); } JS_FRIEND_API(JSString *) js_ValueToSource(JSContext *cx, const Value &v) { Loading js/src/vm/StringBuffer-inl.h +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ StringBuffer::appendN(const jschar c, size_t n) return cb.appendN(c, n); } /* ES5 9.8 ToString, appending the result to the string buffer. */ extern bool ValueToStringBufferSlow(JSContext *cx, const Value &v, StringBuffer &sb); Loading @@ -79,6 +80,13 @@ ValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb) return ValueToStringBufferSlow(cx, v, sb); } /* ES5 9.8 ToString for booleans, appending the result to the string buffer. */ inline bool BooleanToStringBuffer(JSContext *cx, bool b, StringBuffer &sb) { return b ? sb.append("true") : sb.append("false"); } } /* namespace js */ #endif /* StringBuffer_inl_h__ */ js/src/vm/StringBuffer.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #include "vm/StringBuffer.h" #include "jsobjinlines.h" #include "vm/String-inl.h" #include "vm/StringBuffer-inl.h" Loading Loading @@ -45,8 +47,7 @@ StringBuffer::finishString() return cx->runtime->atomState.emptyAtom; size_t length = cb.length(); if (!checkLength(length)) return NULL; JS_ASSERT(checkLength(length)); JS_STATIC_ASSERT(JSShortString::MAX_SHORT_LENGTH < CharBuffer::InlineLength); if (JSShortString::lengthFits(length)) Loading Loading @@ -78,3 +79,22 @@ StringBuffer::finishAtom() cb.clear(); return atom; } bool js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb) { Value v = arg; if (!ToPrimitive(cx, JSTYPE_STRING, &v)) return false; if (v.isString()) return sb.append(v.toString()); if (v.isNumber()) return NumberValueToStringBuffer(cx, v, sb); if (v.isBoolean()) return BooleanToStringBuffer(cx, v.toBoolean(), sb); if (v.isNull()) return sb.append(cx->runtime->atomState.nullAtom); JS_ASSERT(v.isUndefined()); return sb.append(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]); } Loading
js/src/jsbool.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -186,13 +186,6 @@ js_BooleanToString(JSContext *cx, JSBool b) return cx->runtime->atomState.booleanAtoms[b ? 1 : 0]; } /* This function implements E-262-3 section 9.8, toString. */ bool js::BooleanToStringBuffer(JSContext *cx, JSBool b, StringBuffer &sb) { return b ? sb.append("true") : sb.append("false"); } namespace js { bool Loading
js/src/jsbool.h +0 −3 Original line number Diff line number Diff line Loading @@ -54,9 +54,6 @@ js_BooleanToString(JSContext *cx, JSBool b); namespace js { extern bool BooleanToStringBuffer(JSContext *cx, JSBool b, StringBuffer &sb); inline bool BooleanGetPrimitiveValue(JSContext *cx, JSObject &obj, Value *vp); Loading
js/src/jsstr.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -3265,26 +3265,6 @@ js::ToStringSlow(JSContext *cx, const Value &arg) return str; } /* This function implements E-262-3 section 9.8, toString. */ bool js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb) { Value v = arg; if (!ToPrimitive(cx, JSTYPE_STRING, &v)) return false; if (v.isString()) return sb.append(v.toString()); if (v.isNumber()) return NumberValueToStringBuffer(cx, v, sb); if (v.isBoolean()) return BooleanToStringBuffer(cx, v.toBoolean(), sb); if (v.isNull()) return sb.append(cx->runtime->atomState.nullAtom); JS_ASSERT(v.isUndefined()); return sb.append(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]); } JS_FRIEND_API(JSString *) js_ValueToSource(JSContext *cx, const Value &v) { Loading
js/src/vm/StringBuffer-inl.h +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ StringBuffer::appendN(const jschar c, size_t n) return cb.appendN(c, n); } /* ES5 9.8 ToString, appending the result to the string buffer. */ extern bool ValueToStringBufferSlow(JSContext *cx, const Value &v, StringBuffer &sb); Loading @@ -79,6 +80,13 @@ ValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb) return ValueToStringBufferSlow(cx, v, sb); } /* ES5 9.8 ToString for booleans, appending the result to the string buffer. */ inline bool BooleanToStringBuffer(JSContext *cx, bool b, StringBuffer &sb) { return b ? sb.append("true") : sb.append("false"); } } /* namespace js */ #endif /* StringBuffer_inl_h__ */
js/src/vm/StringBuffer.cpp +22 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #include "vm/StringBuffer.h" #include "jsobjinlines.h" #include "vm/String-inl.h" #include "vm/StringBuffer-inl.h" Loading Loading @@ -45,8 +47,7 @@ StringBuffer::finishString() return cx->runtime->atomState.emptyAtom; size_t length = cb.length(); if (!checkLength(length)) return NULL; JS_ASSERT(checkLength(length)); JS_STATIC_ASSERT(JSShortString::MAX_SHORT_LENGTH < CharBuffer::InlineLength); if (JSShortString::lengthFits(length)) Loading Loading @@ -78,3 +79,22 @@ StringBuffer::finishAtom() cb.clear(); return atom; } bool js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb) { Value v = arg; if (!ToPrimitive(cx, JSTYPE_STRING, &v)) return false; if (v.isString()) return sb.append(v.toString()); if (v.isNumber()) return NumberValueToStringBuffer(cx, v, sb); if (v.isBoolean()) return BooleanToStringBuffer(cx, v.toBoolean(), sb); if (v.isNull()) return sb.append(cx->runtime->atomState.nullAtom); JS_ASSERT(v.isUndefined()); return sb.append(cx->runtime->atomState.typeAtoms[JSTYPE_VOID]); }