Changeset 46210 in webkit


Ignore:
Timestamp:
Jul 21, 2009, 9:03:32 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-07-21 Zoltan Herczeg <[email protected]>

Reviewed by Gavin Barraclough.

Cache not only the structure of the method, but the
structure of its prototype as well.
https://bugs.webkit.org/show_bug.cgi?id=27077

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::~CodeBlock):
  • bytecode/CodeBlock.h: (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::patchMethodCallProto):

LayoutTests:

2009-07-21 Zoltan Herczeg <[email protected]>

Reviewed by Gavin Barraclough, RS olliej fix to make the test pass.

Check whether a crash happens after the string
prototype is overwritten twice. The JIT'ed code
may crash if one of its already cached method
called again. Note: This test is not necessary
crash on all systems, because they use different
memory allocators!
https://bugs.webkit.org/show_bug.cgi?id=27077

  • fast/js/method-check-expected.txt: Added.
  • fast/js/method-check.html: Added.
  • fast/js/resources/method-check.js: Added. (func2): (func.String.prototype.a): (func.String.prototype.b): (func):
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r46209 r46210  
     12009-07-21  Zoltan Herczeg  <[email protected]>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Cache not only the structure of the method, but the
     6        structure of its prototype as well.
     7        https://bugs.webkit.org/show_bug.cgi?id=27077
     8
     9        * bytecode/CodeBlock.cpp:
     10        (JSC::CodeBlock::~CodeBlock):
     11        * bytecode/CodeBlock.h:
     12        (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
     13        * jit/JITPropertyAccess.cpp:
     14        (JSC::JIT::patchMethodCallProto):
     15
    1162009-07-21  Gavin Barraclough  <[email protected]>
    217
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r46004 r46210  
    13201320
    13211321    for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) {
    1322         if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure)
     1322        if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure) {
    13231323            structure->deref();
     1324            // Both members must be filled at the same time
     1325            ASSERT(m_methodCallLinkInfos[i].cachedPrototypeStructure);
     1326            m_methodCallLinkInfos[i].cachedPrototypeStructure->deref();
     1327        }
    13241328    }
    13251329
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r45995 r46210  
    116116        MethodCallLinkInfo()
    117117            : cachedStructure(0)
     118            , cachedPrototypeStructure(0)
    118119        {
    119120        }
     
    122123        CodeLocationDataLabelPtr structureLabel;
    123124        Structure* cachedStructure;
     125        Structure* cachedPrototypeStructure;
    124126    };
    125127
  • trunk/JavaScriptCore/jit/JITPropertyAccess.cpp

    r46202 r46210  
    536536    structure->ref();
    537537
     538    Structure* prototypeStructure = proto->structure();
     539    ASSERT(!methodCallLinkInfo.cachedPrototypeStructure);
     540    methodCallLinkInfo.cachedPrototypeStructure = prototypeStructure;
     541    prototypeStructure->ref();
     542
    538543    repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure);
    539544    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto);
    540     repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), proto->structure());
     545    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), prototypeStructure);
    541546    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction), callee);
    542547}
  • trunk/LayoutTests/ChangeLog

    r46208 r46210  
     12009-07-21  Zoltan Herczeg  <[email protected]>
     2
     3        Reviewed by Gavin Barraclough, RS olliej fix to make the test pass.
     4
     5        Check whether a crash happens after the string
     6        prototype is overwritten twice. The JIT'ed code
     7        may crash if one of its already cached method
     8        called again. Note: This test is not necessary
     9        crash on all systems, because they use different
     10        memory allocators!
     11        https://bugs.webkit.org/show_bug.cgi?id=27077
     12
     13        * fast/js/method-check-expected.txt: Added.
     14        * fast/js/method-check.html: Added.
     15        * fast/js/resources/method-check.js: Added.
     16        (func2):
     17        (func.String.prototype.a):
     18        (func.String.prototype.b):
     19        (func):
     20
    1212009-07-21  Dan Bernstein  <[email protected]>
    222
Note: See TracChangeset for help on using the changeset viewer.