Changeset 182050 in webkit


Ignore:
Timestamp:
Mar 26, 2015, 7:55:57 PM (10 years ago)
Author:
Joseph Pecoraro
Message:

WebContent Crash when instantiating class with Type Profiling enabled
https://bugs.webkit.org/show_bug.cgi?id=143037

Reviewed by Ryosuke Niwa.

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitMoveEmptyValue):
We cannot profile the type of an uninitialized empty JSValue.
Nor do we expect this to be necessary, since it is effectively
an unseen undefined value. So add a way to put the empty value
without profiling.

(JSC::BytecodeGenerator::emitMove):
Add an assert to try to catch this issue early on, and force
callers to explicitly use emitMoveEmptyValue instead.

  • tests/typeProfiler/classes.js: Added.

(wrapper.Base):
(wrapper.Derived):
(wrapper):
Add test coverage both for this case and classes in general.

Location:
trunk/Source/JavaScriptCore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r182047 r182050  
     12015-03-26  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        WebContent Crash when instantiating class with Type Profiling enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=143037
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * bytecompiler/BytecodeGenerator.h:
     9        * bytecompiler/BytecodeGenerator.cpp:
     10        (JSC::BytecodeGenerator::BytecodeGenerator):
     11        (JSC::BytecodeGenerator::emitMoveEmptyValue):
     12        We cannot profile the type of an uninitialized empty JSValue.
     13        Nor do we expect this to be necessary, since it is effectively
     14        an unseen undefined value. So add a way to put the empty value
     15        without profiling.
     16
     17        (JSC::BytecodeGenerator::emitMove):
     18        Add an assert to try to catch this issue early on, and force
     19        callers to explicitly use emitMoveEmptyValue instead.
     20
     21        * tests/typeProfiler/classes.js: Added.
     22        (wrapper.Base):
     23        (wrapper.Derived):
     24        (wrapper):
     25        Add test coverage both for this case and classes in general.
     26
    1272015-03-26  Joseph Pecoraro  <pecoraro@apple.com>
    228
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r181993 r182050  
    474474            m_newTargetRegister = addVar();
    475475            emitMove(m_newTargetRegister, &m_thisRegister);
    476             emitMove(&m_thisRegister, addConstantEmptyValue());
     476            emitMoveEmptyValue(&m_thisRegister);
    477477        } else
    478478            emitCreateThis(&m_thisRegister);
     
    993993}
    994994
     995RegisterID* BytecodeGenerator::emitMoveEmptyValue(RegisterID* dst)
     996{
     997    RefPtr<RegisterID> emptyValue = addConstantEmptyValue();
     998
     999    emitOpcode(op_mov);
     1000    instructions().append(dst->index());
     1001    instructions().append(emptyValue->index());
     1002    return dst;
     1003}
     1004
    9951005RegisterID* BytecodeGenerator::emitMove(RegisterID* dst, RegisterID* src)
    9961006{
     1007    ASSERT(src != m_emptyValueRegister);
     1008
    9971009    m_staticPropertyAnalyzer.mov(dst->index(), src->index());
    9981010    emitOpcode(op_mov);
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r181993 r182050  
    457457        RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
    458458
     459        RegisterID* emitMoveEmptyValue(RegisterID* dst);
    459460        RegisterID* emitMove(RegisterID* dst, RegisterID* src);
    460461
Note: See TracChangeset for help on using the changeset viewer.