Last Comment Bug 664667 - JSObject::slotsAndStructSize returns incorrect size
: JSObject::slotsAndStructSize returns incorrect size
Status: RESOLVED FIXED
fixed-in-tracemonkey
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: general
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-16 00:11 PDT by Craig Topper
Modified: 2011-06-20 17:13 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Fix operator precedence issue in JSObject::slotsAndStructSize (933 bytes, patch)
2011-06-16 00:14 PDT, Craig Topper
jorendorff: review+
Details | Diff | Review

Description Craig Topper 2011-06-16 00:11:07 PDT
?: has lower precendence than + and * which causes the return in the following code to calculate size incorrectly. The ?: should be in parentheses.

inline size_t
JSObject::slotsAndStructSize(uint32 nslots) const
{
   bool isFun = isFunction() && this == (JSObject*) getPrivate();

   int ndslots = hasSlotsArray() ? nslots : 0;
   int nfslots = isFun ? 0 : numFixedSlots();

   return sizeof(js::Value) * (ndslots + nfslots)
          + isFun ? sizeof(JSFunction) : sizeof(JSObject);
}
Comment 1 Craig Topper 2011-06-16 00:14:43 PDT
Created attachment 539737 [details] [diff] [review]
Fix operator precedence issue in JSObject::slotsAndStructSize
Comment 2 Josh Matthews [:jdm] 2011-06-16 06:53:10 PDT
Comment on attachment 539737 [details] [diff] [review]
Fix operator precedence issue in JSObject::slotsAndStructSize

Playing spin the r? bottle here.
Comment 3 David Mandelin [:dmandelin] 2011-06-16 17:59:27 PDT
http://hg.mozilla.org/tracemonkey/rev/01f0e75fce22
Comment 4 Chris Leary [:cdleary] (not checking bugmail) 2011-06-20 17:12:53 PDT
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/01f0e75fce22

Note You need to log in before you can comment on or make changes to this bug.