mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1241581 - Put back null filename checks (r=bbouvier)
--HG-- extra : commitid : 3ClobxFytHx extra : rebase_source : 54a3f34e5e3f74c62d3372fdadf713f6779f0261
This commit is contained in:
parent
529f9ab751
commit
2d69d996c4
@ -401,16 +401,22 @@ CodeRange::CodeRange(uint32_t nameIndex, uint32_t lineNumber, FuncOffsets offset
|
||||
end_ = offsets.end;
|
||||
}
|
||||
|
||||
static size_t
|
||||
NullableStringLength(const char* chars)
|
||||
{
|
||||
return chars ? strlen(chars) : 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
CacheableChars::serializedSize() const
|
||||
{
|
||||
return sizeof(uint32_t) + strlen(get());
|
||||
return sizeof(uint32_t) + NullableStringLength(get());
|
||||
}
|
||||
|
||||
uint8_t*
|
||||
CacheableChars::serialize(uint8_t* cursor) const
|
||||
{
|
||||
uint32_t length = strlen(get());
|
||||
uint32_t length = NullableStringLength(get());
|
||||
cursor = WriteBytes(cursor, &length, sizeof(uint32_t));
|
||||
cursor = WriteBytes(cursor, get(), length);
|
||||
return cursor;
|
||||
@ -433,7 +439,7 @@ CacheableChars::deserialize(ExclusiveContext* cx, const uint8_t* cursor)
|
||||
bool
|
||||
CacheableChars::clone(JSContext* cx, CacheableChars* out) const
|
||||
{
|
||||
uint32_t length = strlen(get());
|
||||
uint32_t length = NullableStringLength(get());
|
||||
|
||||
UniqueChars chars(cx->pod_calloc<char>(length + 1));
|
||||
if (!chars)
|
||||
|
@ -1,10 +1,16 @@
|
||||
// |jit-test| test-also-noasmjs
|
||||
load(libdir + "asm.js");
|
||||
|
||||
setCachingEnabled(true);
|
||||
|
||||
var code = asmCompile(USE_ASM + "function g() { return 42 } return g");
|
||||
assertEq(asmLink(code)(), 42);
|
||||
assertEq(asmLink(code)(), 42);
|
||||
|
||||
var code = evaluate("(function() { " + USE_ASM + " function g() { return 43 } return g})", {fileName: null});
|
||||
assertEq(asmLink(code)(), 43);
|
||||
assertEq(asmLink(code)(), 43);
|
||||
|
||||
var code = asmCompile('glob', 'ffis', 'buf', USE_ASM + 'var i32=new glob.Int32Array(buf); function g() { return i32[0]|0 } return g');
|
||||
var i32_1 = new Int32Array(BUF_MIN/4);
|
||||
i32_1[0] = 42;
|
||||
|
Loading…
Reference in New Issue
Block a user