Changeset 154120 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Aug 15, 2013, 12:44:16 PM (12 years ago)
Author:
[email protected]
Message:

<https://webkit.org/b/119830> Assigning to a readonly global results in DFG byte code parse failure

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Make sure dfgCapabilities doesn't report a Dynamic put as
being compilable when we don't actually support it.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

LayoutTests:

Add a test

  • fast/js/dfg-put-to-readonly-property-expected.txt: Added.
  • fast/js/dfg-put-to-readonly-property.html: Added.
  • fast/js/script-tests/dfg-put-to-readonly-property.js: Added.

(foo):
(bar):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r154119 r154120  
     12013-08-15  Oliver Hunt  <[email protected]>
     2
     3        <https://webkit.org/b/119830> Assigning to a readonly global results in DFG byte code parse failure
     4
     5        Reviewed by Filip Pizlo.
     6
     7        Make sure dfgCapabilities doesn't report a Dynamic put as
     8        being compilable when we don't actually support it. 
     9
     10        * bytecode/CodeBlock.cpp:
     11        (JSC::CodeBlock::dumpBytecode):
     12        * dfg/DFGCapabilities.cpp:
     13        (JSC::DFG::capabilityLevel):
     14
    1152013-08-15  Brent Fulgham  <[email protected]>
    216
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r153962 r154120  
    12921292            int r0 = (++it)->u.operand;
    12931293            int id0 = (++it)->u.operand;
    1294             ++it; // ResolveType
     1294            int resolveModeAndType = (++it)->u.operand;
    12951295            ++it; // depth
    1296             out.printf("[%4d] resolve_scope\t %s, %s", location, registerName(r0).data(), idName(id0, identifier(id0)).data());
     1296            out.printf("[%4d] resolve_scope\t %s, %s, %d", location, registerName(r0).data(), idName(id0, identifier(id0)).data(), resolveModeAndType);
    12971297            break;
    12981298        }
  • trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp

    r153248 r154120  
    171171    case op_in:
    172172    case op_get_from_scope:
    173     case op_put_to_scope:
    174173        return CanCompileAndInline;
     174
     175    case op_put_to_scope: {
     176        ResolveType resolveType = ResolveModeAndType(pc[4].u.operand).type();
     177        // If we're writing to a readonly property we emit a Dynamic put that
     178        // the DFG can't currently handle.
     179        if (resolveType == Dynamic)
     180            return CannotCompile;
     181        return CanCompileAndInline;
     182    }
    175183
    176184    case op_resolve_scope: {
    177185        // We don't compile 'catch' or 'with', so there's no point in compiling variable resolution within them.
    178         ResolveType resolveType = static_cast<ResolveType>(pc[3].u.operand);
     186        ResolveType resolveType = ResolveModeAndType(pc[4].u.operand).type();
    179187        if (resolveType == Dynamic)
    180188            return CannotCompile;
Note: See TracChangeset for help on using the changeset viewer.