Back out changeset 23f47084749f (bug 1221747) for SM shell build assertions and jittest hangs

This commit is contained in:
Phil Ringnalda 2015-11-06 08:08:50 -08:00
parent 8b09e3bc14
commit 5294a0ca8d
5 changed files with 25 additions and 39 deletions

View File

@ -1,8 +0,0 @@
// |jit-test| --dump-bytecode
if (!('oomTest' in this))
quit();
function f() {
eval("(function() {})()");
}
oomTest(f);

View File

@ -3849,7 +3849,7 @@ struct ScriptCountBlockState
public:
ScriptCountBlockState(IonBlockCounts* block, MacroAssembler* masm)
: block(*block), masm(*masm), printer(GetJitContext()->cx, false)
: block(*block), masm(*masm), printer(GetJitContext()->cx)
{
}
@ -3883,8 +3883,7 @@ struct ScriptCountBlockState
{
masm.setPrinter(nullptr);
if (!printer.hadOutOfMemory())
block.setCode(printer.string());
block.setCode(printer.string());
}
};

View File

@ -669,7 +669,7 @@ struct IonBlockCounts
}
void setCode(const char* code) {
char* ncode = js_pod_malloc<char>(strlen(code) + 1);
char* ncode = (char*) js_malloc(strlen(code) + 1);
if (ncode) {
strcpy(ncode, code);
code_ = ncode;
@ -715,12 +715,9 @@ struct IonScriptCounts
}
bool init(size_t numBlocks) {
blocks_ = js_pod_calloc<IonBlockCounts>(numBlocks);
if (!blocks_)
return false;
numBlocks_ = numBlocks;
return true;
blocks_ = js_pod_calloc<IonBlockCounts>(numBlocks);
return blocks_ != nullptr;
}
size_t numBlocks() const {

View File

@ -19,22 +19,22 @@
namespace js {
GenericPrinter::GenericPrinter()
: hadOOM_(false)
: reportedOOM_(false)
{
}
void
GenericPrinter::reportOutOfMemory()
{
if (hadOOM_)
if (reportedOOM_)
return;
hadOOM_ = true;
reportedOOM_ = true;
}
bool
GenericPrinter::hadOutOfMemory() const
{
return hadOOM_;
return reportedOOM_;
}
int
@ -88,12 +88,11 @@ Sprinter::realloc_(size_t newSize)
return true;
}
Sprinter::Sprinter(ExclusiveContext* cx, bool shouldReportOOM)
Sprinter::Sprinter(ExclusiveContext* cx)
: context(cx),
#ifdef DEBUG
initialized(false),
#endif
shouldReportOOM(shouldReportOOM),
base(nullptr), size(0), offset(0)
{ }
@ -255,11 +254,11 @@ Sprinter::getOffset() const
void
Sprinter::reportOutOfMemory()
{
if (hadOOM_)
if (reportedOOM_)
return;
if (context && shouldReportOOM)
if (context)
ReportOutOfMemory(context);
hadOOM_ = true;
reportedOOM_ = true;
}
ptrdiff_t
@ -510,7 +509,7 @@ LSprinter::clear()
head_ = nullptr;
tail_ = nullptr;
unused_ = 0;
hadOOM_ = false;
reportedOOM_ = false;
}
int
@ -598,15 +597,15 @@ LSprinter::vprintf(const char* fmt, va_list ap)
void
LSprinter::reportOutOfMemory()
{
if (hadOOM_)
if (reportedOOM_)
return;
hadOOM_ = true;
reportedOOM_ = true;
}
bool
LSprinter::hadOutOfMemory() const
{
return hadOOM_;
return reportedOOM_;
}
} // namespace js

View File

@ -26,7 +26,7 @@ class LifoAlloc;
class GenericPrinter
{
protected:
bool hadOOM_; // whether reportOutOfMemory() has been called.
bool reportedOOM_; // record reported OOM.
GenericPrinter();
@ -66,22 +66,21 @@ class Sprinter final : public GenericPrinter
}
};
ExclusiveContext* context; // context executing the decompiler
ExclusiveContext* context; // context executing the decompiler
private:
static const size_t DefaultSize;
static const size_t DefaultSize;
#ifdef DEBUG
bool initialized; // true if this is initialized, use for debug builds
bool initialized; // true if this is initialized, use for debug builds
#endif
bool shouldReportOOM; // whether to report OOM to the context
char* base; // malloc'd buffer address
size_t size; // size of buffer allocated at base
ptrdiff_t offset; // offset of next free char in buffer
char* base; // malloc'd buffer address
size_t size; // size of buffer allocated at base
ptrdiff_t offset; // offset of next free char in buffer
bool realloc_(size_t newSize);
public:
explicit Sprinter(ExclusiveContext* cx, bool shouldReportOOM = true);
explicit Sprinter(ExclusiveContext* cx);
~Sprinter();
// Initialize this sprinter, returns false on error.