Ignore:
Timestamp:
Jun 9, 2009, 5:37:01 PM (16 years ago)
Author:
[email protected]
Message:

Bug 26249: Support JSON.stringify
<https://bugs.webkit.org/show_bug.cgi?id=26249>

Reviewed by Sam Weinig.

Implement JSON.stringify. This patch handles all the semantics of the ES5
JSON.stringify function, including replacer functions and arrays and both
string and numeric gap arguments.

Currently uses a clamped recursive algorithm basically identical to the spec
description but with a few minor tweaks for performance and corrected semantics
discussed in the es-discuss mailing list.

File:
1 edited

Legend:

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

    r44522 r44550  
    6161
    6262extern const HashTable arrayTable;
     63extern const HashTable jsonTable;
    6364extern const HashTable dateTable;
    6465extern const HashTable mathTable;
     
    106107    , arrayTable(fastNew<HashTable>(JSC::arrayTable))
    107108    , dateTable(fastNew<HashTable>(JSC::dateTable))
     109    , jsonTable(fastNew<HashTable>(JSC::jsonTable))
    108110    , mathTable(fastNew<HashTable>(JSC::mathTable))
    109111    , numberTable(fastNew<HashTable>(JSC::numberTable))
     
    156158    arrayTable->deleteTable();
    157159    dateTable->deleteTable();
     160    jsonTable->deleteTable();
    158161    mathTable->deleteTable();
    159162    numberTable->deleteTable();
     
    167170    fastDelete(const_cast<HashTable*>(arrayTable));
    168171    fastDelete(const_cast<HashTable*>(dateTable));
     172    fastDelete(const_cast<HashTable*>(jsonTable));
    169173    fastDelete(const_cast<HashTable*>(mathTable));
    170174    fastDelete(const_cast<HashTable*>(numberTable));
Note: See TracChangeset for help on using the changeset viewer.