Bug 1141329, prelude - Make ObjectOpResult pointer-sized to fix amazingly bogus code and assertions in IonCaches, introduced by rev 0712a3d4b79c. r=efaust.

--HG--
extra : rebase_source : 1d82219b61105088cf27154c6200e647091a36e0
This commit is contained in:
Jason Orendorff 2015-03-10 12:22:30 -05:00
Родитель a9a1c904c3
Коммит eedeed1e47
2 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -80,14 +80,26 @@ class AutoIdVector;
class ObjectOpResult class ObjectOpResult
{ {
private: private:
uint32_t code_; /*
* code_ is either one of the special codes OkCode or Uninitialized, or
* an error code. For now the error codes are private to the JS engine;
* they're defined in js/src/js.msg.
*
* code_ is uintptr_t (rather than uint32_t) for the convenience of the
* JITs, which would otherwise have to deal with either padding or stack
* alignment on 64-bit platforms.
*/
uintptr_t code_;
public: public:
enum { OkCode = 0, Uninitialized = 0xffffffff }; enum SpecialCodes : uintptr_t {
OkCode = 0,
Uninitialized = uintptr_t(-1)
};
ObjectOpResult() : code_(Uninitialized) {} ObjectOpResult() : code_(Uninitialized) {}
/* Return true if fail() was not called. */ /* Return true if succeed() was called. */
bool ok() const { bool ok() const {
MOZ_ASSERT(code_ != Uninitialized); MOZ_ASSERT(code_ != Uninitialized);
return code_ == OkCode; return code_ == OkCode;
@ -129,7 +141,7 @@ class ObjectOpResult
uint32_t failureCode() const { uint32_t failureCode() const {
MOZ_ASSERT(!ok()); MOZ_ASSERT(!ok());
return code_; return uint32_t(code_);
} }
/* /*

Просмотреть файл

@ -1464,11 +1464,11 @@ GetPropertyIC::tryAttachTypedArrayLength(JSContext *cx, HandleScript outerScript
} }
static void static void
PushObjectOpResult(MacroAssembler &masm, uint32_t value = ObjectOpResult::Uninitialized) PushObjectOpResult(MacroAssembler &masm)
{ {
static_assert(sizeof(ObjectOpResult) == sizeof(int32_t), static_assert(sizeof(ObjectOpResult) == sizeof(uintptr_t),
"ObjectOpResult size must match size reserved by masm.Push() here"); "ObjectOpResult size must match size reserved by masm.Push() here");
masm.Push(Imm32(value)); masm.Push(ImmWord(uintptr_t(ObjectOpResult::Uninitialized)));
} }
static bool static bool
@ -1515,7 +1515,7 @@ EmitCallProxyGet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at
masm.movePtr(StackPointer, argProxyReg); masm.movePtr(StackPointer, argProxyReg);
// Unused space, to keep the same stack layout as Proxy::set frames. // Unused space, to keep the same stack layout as Proxy::set frames.
PushObjectOpResult(masm, 0); PushObjectOpResult(masm);
masm.loadJSContext(argJSContextReg); masm.loadJSContext(argJSContextReg);