Changeset 109275 in webkit


Ignore:
Timestamp:
Feb 29, 2012 3:23:58 PM (12 years ago)
Author:
barraclough@apple.com
Message:

Source/JavaScriptCore: RefCounted::deprecatedTurnOffVerifier() should not be deprecated
https://bugs.webkit.org/show_bug.cgi?id=79864

Patch by Filip Pizlo <fpizlo@apple.com> on 2012-02-28
Reviewed by Oliver Hunt.

Removed the word "deprecated" from the name of this method, since this method
should not be deprecated. It works just fine as it is, and there is simply no
alternative to calling this method for many interesting JSC classes.

  • parser/SourceProvider.h:

(JSC::SourceProvider::SourceProvider):

  • runtime/SymbolTable.h:

(JSC::SharedSymbolTable::SharedSymbolTable):

  • wtf/MetaAllocator.cpp:

(WTF::MetaAllocatorHandle::MetaAllocatorHandle):
(WTF::MetaAllocator::allocate):

  • wtf/RefCounted.h:

(RefCountedBase):
(WTF::RefCountedBase::turnOffVerifier):

LayoutTests: 'source' property of RegExp instance cannot be ""
https://bugs.webkit.org/show_bug.cgi?id=79938

Reviewed by Oliver Hunt.

15.10.6.4 specifies that RegExp.prototype.toString must return '/' + source + '/',
and also states that the result must be a valid RegularExpressionLiteral. '' is
not a valid RegularExpressionLiteral (since it is a single line comment), and hence
source cannot ever validly be "". If the source is empty, return a different Pattern
that would match the same thing.

  • fast/js/kde/RegExp-expected.txt:
  • fast/js/kde/script-tests/RegExp.js:
  • fast/regex/script-tests/toString.js:
  • fast/regex/toString-expected.txt:
    • Update these tests to check for the correct result.
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T1-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T2-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T4-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T5-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T2-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T3-expected.txt:
  • sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T5-expected.txt:
    • Check in failing results, these tests are all incorrect.
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109271 r109275  
     12012-02-29  Gavin Barraclough  <barraclough@apple.com>
     2
     3        'source' property of RegExp instance cannot be ""
     4        https://bugs.webkit.org/show_bug.cgi?id=79938
     5
     6        Reviewed by Oliver Hunt.
     7
     8        15.10.6.4 specifies that RegExp.prototype.toString must return '/' + source + '/',
     9        and also states that the result must be a valid RegularExpressionLiteral. '//' is
     10        not a valid RegularExpressionLiteral (since it is a single line comment), and hence
     11        source cannot ever validly be "". If the source is empty, return a different Pattern
     12        that would match the same thing.
     13
     14        * fast/js/kde/RegExp-expected.txt:
     15        * fast/js/kde/script-tests/RegExp.js:
     16        * fast/regex/script-tests/toString.js:
     17        * fast/regex/toString-expected.txt:
     18            - Update these tests to check for the correct result.
     19        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T1-expected.txt:
     20        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T2-expected.txt:
     21        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T3-expected.txt:
     22        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T4-expected.txt:
     23        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T5-expected.txt:
     24        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T2-expected.txt:
     25        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T3-expected.txt:
     26        * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T5-expected.txt:
     27            - Check in failing results, these tests are all incorrect.
     28
    1292012-02-29  Joshua Bell  <jsbell@chromium.org>
    230
  • trunk/LayoutTests/fast/js/kde/RegExp-expected.txt

    r66616 r109275  
    44
    55
    6 PASS (new RegExp()).source is ''
     6PASS (new RegExp()).source is '(?:)'
    77PASS Boolean(new RegExp()) is true
    88PASS isNaN(Number(new RegExp())) is true
  • trunk/LayoutTests/fast/js/kde/script-tests/RegExp.js

    r98407 r109275  
    1 shouldBe("(new RegExp()).source", "''");
     1shouldBe("(new RegExp()).source", "'(?:)'");
    22shouldBe("Boolean(new RegExp())", "true");
    33shouldBeTrue("isNaN(Number(new RegExp()))");
  • trunk/LayoutTests/fast/regex/script-tests/toString.js

    r100469 r109275  
    1919
    2020shouldBe("RegExp('/').source", '"\\\\/"');
    21 shouldBe("RegExp('').source", '""');
    22 shouldBe("RegExp.prototype.source", '""');
     21shouldBe("RegExp('').source", '"(?:)"');
     22shouldBe("RegExp.prototype.source", '"(?:)"');
    2323
    2424shouldBe("RegExp('/').toString()", '"/\\\\//"');
     
    5454shouldBe("RegExp('[/]').source", "'[/]'");
    5555shouldBe("RegExp('\\\\[/]').source", "'\\\\[\\\\/]'");
     56
     57// See 15.10.6.4
     58// The first half of this checks that:
     59//     Return the String value formed by concatenating the Strings "/", the
     60//     String value of the source property of this RegExp object, and "/";
     61// The second half checks that:
     62//     The returned String has the form of a RegularExpressionLiteral that
     63//     evaluates to another RegExp object with the same behaviour as this object.
     64shouldBe("var o = new RegExp(); o.toString() === '/'+o.source+'/' && eval(o.toString()+'.exec(String())')", '[""]');
  • trunk/LayoutTests/fast/regex/toString-expected.txt

    r100469 r109275  
    55
    66PASS RegExp('/').source is "\\/"
    7 PASS RegExp('').source is ""
    8 PASS RegExp.prototype.source is ""
     7PASS RegExp('').source is "(?:)"
     8PASS RegExp.prototype.source is "(?:)"
    99PASS RegExp('/').toString() is "/\\//"
    1010PASS RegExp('').toString() is "/(?:)/"
     
    3131PASS RegExp('[/]').source is '[/]'
    3232PASS RegExp('\\[/]').source is '\\[\\/]'
     33PASS var o = new RegExp(); o.toString() === '/'+o.source+'/' && eval(o.toString()+'.exec(String())') is [""]
    3334PASS successfullyParsed is true
    3435
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T1-expected.txt

    r58534 r109275  
    11S15.10.4.1_A3_T1
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp; __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T2-expected.txt

    r58534 r109275  
    11S15.10.4.1_A3_T2
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp(void 0); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T3-expected.txt

    r58534 r109275  
    11S15.10.4.1_A3_T3
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp(x); var x; __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T4-expected.txt

    r58534 r109275  
    11S15.10.4.1_A3_T4
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp(undefined); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A3_T5-expected.txt

    r58534 r109275  
    11S15.10.4.1_A3_T5
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp((function(){})()); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T2-expected.txt

    r58534 r109275  
    11S15.10.4.1_A4_T2
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp(undefined, undefined); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T3-expected.txt

    r58534 r109275  
    11S15.10.4.1_A4_T3
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp({}.p, {}.q); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A4_T5-expected.txt

    r58534 r109275  
    11S15.10.4.1_A4_T5
    22
    3 PASS
     3FAIL SputnikError: #1: __re = new RegExp("", (function(){})()); __re.source === "". Actual: (?:)
    44
    55TEST COMPLETE
  • trunk/Source/JavaScriptCore/ChangeLog

    r109268 r109275  
    2020        (RefCountedBase):
    2121        (WTF::RefCountedBase::turnOffVerifier):
     22
     232012-02-29  Gavin Barraclough  <barraclough@apple.com>
     24
     25        'source' property of RegExp instance cannot be ""
     26        https://bugs.webkit.org/show_bug.cgi?id=79938
     27
     28        Reviewed by Oliver Hunt.
     29
     30        15.10.6.4 specifies that RegExp.prototype.toString must return '/' + source + '/',
     31        and also states that the result must be a valid RegularExpressionLiteral. '//' is
     32        not a valid RegularExpressionLiteral (since it is a single line comment), and hence
     33        source cannot ever validly be "". If the source is empty, return a different Pattern
     34        that would match the same thing.
     35
     36        * runtime/RegExpObject.cpp:
     37        (JSC::regExpObjectSource):
     38            - Do not return "" if the source is empty, this would lead to invalid behaviour in toString.
     39        * runtime/RegExpPrototype.cpp:
     40        (JSC::regExpProtoFuncToString):
     41            - No need to special case the empty string - this should be being done by 'source'.
    2242
    23432012-02-29  Gavin Barraclough  <barraclough@apple.com>
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r109008 r109275  
    190190    bool shouldEscape = false;
    191191
     192    // 15.10.6.4 specifies that RegExp.prototype.toString must return '/' + source + '/',
     193    // and also states that the result must be a valid RegularExpressionLiteral. '//' is
     194    // not a valid RegularExpressionLiteral (since it is a single line comment), and hence
     195    // source cannot ever validly be "". If the source is empty, return a different Pattern
     196    // that would match the same thing.
     197    if (!length)
     198        return jsString(exec, "(?:)");
     199
    192200    // early return for strings that don't contain a forwards slash and LineTerminator
    193201    for (unsigned i = 0; i < length; ++i) {
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r109008 r109275  
    156156    UString source = thisObject->get(exec, exec->propertyNames().source).toString(exec)->value(exec);
    157157    // If source is empty, use "/(?:)/" to avoid colliding with comment syntax
    158     return JSValue::encode(jsMakeNontrivialString(exec, "/", source.length() ? source : UString("(?:)"), postfix));
     158    return JSValue::encode(jsMakeNontrivialString(exec, "/", source, postfix));
    159159}
    160160
Note: See TracChangeset for help on using the changeset viewer.