Changeset 41243 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Feb 25, 2009, 11:04:31 PM (16 years ago)
Author:
[email protected]
Message:

2009-02-25 Cameron Zwarich <[email protected]>

Reviewed by Gavin Barraclough.

Bug 24086: Regression (r40993): WebKit crashes after logging in to lists.zenbe
<https://bugs.webkit.org/show_bug.cgi?id=24086>
<rdar://problem/6625111>

The numeric sort optimization in r40993 generated bytecode for a function
without generating JIT code. This breaks an assumption in some parts of
the JIT's function calling logic that the presence of a CodeBlock implies
the existence of JIT code.

In order to fix this, we simply generate JIT code whenever we check whether
a function is a numeric sort function. This only incurs an additional cost
in the case when the function is a numeric sort function, in which case it
is not expensive to generate JIT code for it.

JavaScriptCore:

  • runtime/ArrayPrototype.cpp: (JSC::isNumericCompareFunction):

LayoutTests:

  • fast/js/resources/sort-no-jit-code-crash.js: Added.
  • fast/js/sort-no-jit-code-crash-expected.txt: Added.
  • fast/js/sort-no-jit-code-crash.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/ArrayPrototype.cpp

    r41168 r41243  
    2727#include "CodeBlock.h"
    2828#include "Interpreter.h"
     29#include "JIT.h"
    2930#include "ObjectPrototype.h"
    3031#include "Lookup.h"
     
    6869    if (callType != CallTypeJS)
    6970        return false;
    70    
    71     return callData.js.functionBody->bytecode(callData.js.scopeChain).isNumericCompareFunction();
     71
     72    CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain);
     73#if ENABLE(JIT)
     74    // If the JIT is enabled then we need to preserve the invariant that every
     75    // function with a CodeBlock also has JIT code.
     76    if (!codeBlock.jitCode())
     77        JIT::compile(callData.js.scopeChain->globalData, &codeBlock);
     78#endif
     79
     80    return codeBlock.isNumericCompareFunction();
    7281}
    7382
Note: See TracChangeset for help on using the changeset viewer.