<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16033</bug_id>
          
          <creation_ts>2007-11-17 16:38:58 -0800</creation_ts>
          <short_desc>REGRESSION(r27022): testapi exits with assertion failure in debug build: ASSERTION FAILED: s &lt;= HeapConstants&lt;heapType&gt;::cellSize</short_desc>
          <delta_ts>2007-11-18 01:12:02 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar, Regression</keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Rowe (bdash)">mrowe</reporter>
          <assigned_to name="Mark Rowe (bdash)">mrowe</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>61500</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-11-17 16:38:58 -0800</bug_when>
    <thetext>ASSERTION FAILED: s &lt;= HeapConstants&lt;heapType&gt;::cellSize
(/Volumes/Data/Home/Documents/Work/WebKit-git/OpenSource/JavaScriptCore/kjs/collector.cpp:202 static void* KJS::Collector::heapAllocate(size_t) [with KJS::Collector::HeapType heapType = PrimaryHeap])

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xbbadbeef
#0  0x002f3403 in KJS::Collector::heapAllocate&lt;(KJS::Collector::HeapType)0&gt; (s=36) at collector.cpp:202
#1  0x00299339 in KJS::Collector::allocate (s=36) at collector.cpp:306
#2  0x0029934d in KJS::JSCell::operator new (size=36) at value.cpp:39
#3  0x002fc922 in JSGlobalContextCreate (globalObjectClass=0x507b10) at /Volumes/Data/Home/Documents/Work/WebKit-git/OpenSource/JavaScriptCore/API/JSContextRef.cpp:48
#4  0x0000340b in main (argc=1, argv=0xbffff72c) at /Volumes/Data/Home/Documents/Work/WebKit-git/OpenSource/JavaScriptCore/API/testapi.c:501

The allocation in question is:
globalObject = new JSCallbackObject&lt;JSGlobalObject&gt;(0, globalObjectClass, jsNull(), 0);

which is apparently now 36 bytes in size, 4 bytes larger than the maximum cell size of 32 bytes.

This is simple to reproduce.  Simply run testapi without any arguments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61501</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-11-17 17:00:01 -0800</bug_when>
    <thetext>The fix to this is probably going to be to remove the m_isInitialized member of JSCallbackObject.  Geoff mentioned the following in the patch review that added that member:

&gt; A solution to this problem that would avoid the awkwardness of double initializaiton,
&gt; fix &lt;rdar://problem/5440659&gt;, and avoid taking the precious last 4 bytes away from
&gt; JSCallbackObject would be to refactor Interpreter so that construction and global
&gt; object initialization were two separate steps (i.e., remove the JSObject* parameter to
&gt; Interpreter::Interpreter()). 
&gt;
&gt; That way, you could make an interpreter, use it to construct the global object, and
&gt; then assign the global object to the interpreter.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61503</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-11-17 17:04:31 -0800</bug_when>
    <thetext>&lt;rdar://problem/5607032&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61561</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-11-18 01:12:02 -0800</bug_when>
    <thetext>Fixed with r27885.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>