Changeset 1272 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Jun 4, 2002, 3:33:26 PM (23 years ago)
Author:
darin
Message:

Improve the speed of the JavaScript string append operation by growing
the capacity so we don't need to reallocate the string every time.

Also fix script execution so it doesn't use recursion to advance from
one statement to the next, using iteration instead.

  • Makefile.am: Stop using BUILT_SOURCES to build JavaScriptCore-stamp, because this causes the Project Builder project to build *before* the subdir. Intead, use an all-am rule in a way more similar to all our other directories.
  • kjs/grammar.y: Link the SourceElementsNode in the opposite direction, so we can walk the list and execute each element instead of using recursion to reverse the list.
  • kjs/grammar.cpp: Check in new generated file.
  • kjs/nodes.cpp: (SourceElementsNode::execute): (SourceElementsNode::processFuncDecl): (SourceElementsNode::processVarDecls): Use loops instead of recursion.
  • kjs/ustring.h: Don't initialize all UChar objects to 0. This was wasting a *huge* amount of time.
  • kjs/ustring.cpp: (UString::Rep::create): Add a "capacity" along with the length. (UString::append): Include 50% extra capacity when appending. (UString::operator=): Reuse the buffer if possible rather than always creating a new one.
Location:
trunk/JavaScriptCore/kjs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/grammar.cpp

    r1024 r1272  
    307307    15,    62,    63,   145,     0,    15,    62,   144,    63,   145,
    308308     0,    58,     0,   144,    68,    58,     0,    64,    65,     0,
    309     64,   147,    65,     0,     0,   147,     0,   148,     0,   147,
    310    148,     0,   115,     0,   142,     0
     309    64,   147,    65,     0,     0,   147,     0,   148,     0,   148,
     310   147,     0,   115,     0,   142,     0
    311311};
    312312
     
    334334   553,   555,   558,   560,   563,   569,   573,   575,   576,   579,
    335335   583,   587,   590,   594,   596,   601,   603,   607,   610,   614,
    336    617,   621,   623,   626,   628
     336   617,   621,   624,   630,   632
    337337};
    338338#endif
     
    461461};
    462462
    463 static const short yypact[] = {   779,
    464 -32768,-32768,-32768,-32768,-32768,     5,   -28,   111,   -30,     6,
    465    -31,   335,  1252,  1252,   -16,-32768,   853,    -5,  1252,     9,
    466     57,  1252,   -20,  1252,  1252,-32768,   -21,  1252,  1252,-32768,
    467   1252,   409,    -1,  1252,  1252,  1252,  1252,-32768,-32768,-32768,
    468 -32768,    42,-32768,    43,   179,-32768,-32768,   -14,    12,   195,
    469     82,   118,    72,    85,    93,   151,   -23,-32768,-32768,    11,
     463static const short yypact[] = {   631,
     464-32768,-32768,-32768,-32768,-32768,     3,   -38,   111,   -24,     5,
     465   -14,   335,  1066,  1066,   -12,-32768,   705,     9,  1066,    47,
     466    51,  1066,     0,  1066,  1066,-32768,    50,  1066,  1066,-32768,
     467  1066,   409,    12,  1066,  1066,  1066,  1066,-32768,-32768,-32768,
     468-32768,    42,-32768,    83,   315,-32768,-32768,    71,   -25,    38,
     469    82,   239,    54,    68,    84,   133,   -23,-32768,-32768,    11,
    470470-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    471 -32768,-32768,-32768,-32768,-32768,-32768,-32768,   779,-32768,-32768,
    472      7,-32768,   964,   161,-32768,    45,    42,-32768,   136,    17,
    473 -32768,-32768,     8,-32768,   192,    24,-32768,-32768,    18,    90,
    474 -32768,-32768,  1252,   236,  1252,-32768,  1252,  1252,   -45,   483,
    475    231,-32768,-32768,   853,-32768,-32768,    59,   191,   196,   -21,
    476    935,   123,   208,   557,-32768,   200,  1036,   203,-32768,-32768,
    477 -32768,-32768,  1108,  1252,   222,-32768,  1252,   224,-32768,-32768,
     471-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   631,-32768,
     472     6,-32768,   778,   114,-32768,    45,    42,-32768,   105,    17,
     473-32768,-32768,     7,-32768,   129,   -42,-32768,-32768,    18,   112,
     474-32768,-32768,  1066,   230,  1066,-32768,  1066,  1066,   -45,   483,
     475   162,-32768,-32768,   705,-32768,-32768,    -6,   150,   176,    50,
     476   220,   -37,   185,   212,-32768,   154,   850,   214,-32768,-32768,
     477-32768,-32768,   922,  1066,   234,-32768,  1066,   237,-32768,-32768,
    478478-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
    479 -32768,-32768,-32768,  1252,  1252,  1252,  1252,  1252,  1252,  1252,
    480   1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,
    481   1252,  1252,  1252,  1252,  1252,  1252,  1252,  1252,-32768,  1252,
    482 -32768,-32768,-32768,-32768,   226,    87,   217,   204,-32768,-32768,
    483 -32768,-32768,-32768,  1252,-32768,-32768,   -30,-32768,-32768,-32768,
    484    105,-32768,   223,   103,-32768,-32768,   113,   227,   115,   116,
    485    117,-32768,-32768,   228,   -20,   253,-32768,-32768,-32768,-32768,
    486     35,  1252,-32768,-32768,    -1,-32768,-32768,-32768,-32768,   119,
    487 -32768,   202,-32768,   206,-32768,-32768,-32768,-32768,-32768,   -14,
    488    -14,    12,    12,    12,   195,   195,   195,   195,   195,   195,
    489     82,    82,    82,    82,   118,   118,   118,    93,   151,   225,
    490 -32768,    -3,   -44,  1252,  1252,-32768,-32768,   223,   126,   631,
    491 -32768,   223,   233,   853,  1252,   853,   229,   853,   234,-32768,
    492 -32768,   232,-32768,  1180,-32768,  1252,-32768,-32768,  1252,  1252,
    493    271,  1252,   127,   212,-32768,   223,-32768,   705,-32768,-32768,
    494    274,   157,-32768,   289,-32768,-32768,   237,  1252,-32768,-32768,
    495 -32768,-32768,   174,  1252,   218,   853,  1252,-32768,-32768,   853,
    496 -32768,  1252,    23,   289,-32768,   -20,-32768,   853,   175,  1252,
    497 -32768,   243,-32768,   207,   238,-32768,   289,-32768,-32768,-32768,
    498    853,   246,   853,   853,   853,   245,-32768,   853,-32768,-32768,
    499    853,   853,-32768,-32768,-32768,   312,   314,-32768
     479-32768,-32768,-32768,  1066,  1066,  1066,  1066,  1066,  1066,  1066,
     480  1066,  1066,  1066,  1066,  1066,  1066,  1066,  1066,  1066,  1066,
     481  1066,  1066,  1066,  1066,  1066,  1066,  1066,  1066,-32768,  1066,
     482-32768,-32768,-32768,-32768,   244,    87,   241,   226,-32768,-32768,
     483-32768,-32768,-32768,  1066,-32768,-32768,   -24,-32768,-32768,-32768,
     484    64,-32768,   248,   100,-32768,-32768,   103,   252,   121,   122,
     485   124,-32768,-32768,   253,     0,   283,-32768,-32768,-32768,-32768,
     486    35,  1066,-32768,-32768,    12,-32768,-32768,-32768,-32768,   181,
     487-32768,   203,-32768,   223,-32768,-32768,-32768,-32768,-32768,    71,
     488    71,   -25,   -25,   -25,    38,    38,    38,    38,    38,    38,
     489    82,    82,    82,    82,   239,   239,   239,    84,   133,   249,
     490-32768,   -15,   -41,  1066,  1066,-32768,-32768,   248,   190,   557,
     491-32768,   248,   259,   705,  1066,   705,   255,   705,   262,-32768,
     492-32768,   254,-32768,   994,-32768,  1066,-32768,-32768,  1066,  1066,
     493   298,  1066,   197,   245,-32768,   248,-32768,   260,-32768,-32768,
     494   307,   199,-32768,   323,-32768,-32768,   270,  1066,-32768,-32768,
     495-32768,-32768,   200,  1066,   261,   705,  1066,-32768,-32768,   705,
     496-32768,  1066,    23,   323,-32768,     0,-32768,   705,   201,  1066,
     497-32768,   274,-32768,   232,   275,-32768,   323,-32768,-32768,-32768,
     498   705,   280,   705,   705,   705,   281,-32768,   705,-32768,-32768,
     499   705,   705,-32768,-32768,-32768,   348,   349,-32768
    500500};
    501501
    502502static const short yypgoto[] = {-32768,
    503 -32768,-32768,-32768,    91,-32768,-32768,    94,   309,   310,-32768,
    504    -34,-32768,    41,-32768,     1,   120,    88,   -18,    75,    78,
    505 -32768,-32768,   143,   145,-32768,-32768,  -122,-32768,    -9,   -17,
    506    -22,   -25,-32768,   138,   128,    67,-32768,-32768,-32768,-32768,
    507   -249,-32768,-32768,-32768,-32768,-32768,-32768,    -7,-32768,    13,
    508 -32768,-32768,-32768,-32768,-32768,   129,-32768,-32768,   131,  -223,
    509 -32768,     2,   -74
     503-32768,-32768,-32768,   126,-32768,-32768,   135,   346,   351,-32768,
     504   -34,-32768,    41,-32768,     1,   148,   -10,    15,   117,   123,
     505-32768,-32768,   184,   196,-32768,-32768,  -122,-32768,    -9,   -17,
     506   -22,    29,-32768,   191,   178,   118,-32768,-32768,-32768,-32768,
     507  -225,-32768,-32768,-32768,-32768,-32768,-32768,    44,-32768,    55,
     508-32768,-32768,-32768,-32768,-32768,   166,-32768,-32768,   182,  -223,
     509-32768,     2,-32768
    510510};
    511511
    512512
    513 #define YYLAST          1326
     513#define YYLAST          1140
    514514
    515515
    516516static const short yytable[] = {   104,
    517    111,    78,    99,   182,   227,    80,    92,   183,   199,   139,
    518    231,   179,   109,   101,   102,   294,   177,   196,   205,   106,
    519    290,   117,   180,   197,   112,   113,    95,    89,   115,   116,
    520     96,   236,   335,    83,   129,   130,   131,   132,   212,   292,
    521    189,   190,   315,   110,   295,   103,   155,   114,   299,   182,
    522    189,   190,   193,   100,   100,   260,   105,   261,   178,   100,
    523    156,   157,    81,    93,   100,   100,   125,   332,   100,   100,
    524    107,   266,   318,   187,   100,   100,   100,   100,   180,   194,
    525    342,   202,   158,   159,   197,   180,   203,   336,    82,    94,
    526    184,   200,   191,   207,   181,   209,   218,   210,   211,   283,
    527    198,   206,   191,   133,   133,   163,   164,   134,   137,   192,
    528    264,   135,   138,     1,     2,     3,     4,     5,   108,   165,
    529    166,   219,     8,   186,   232,    84,   180,   234,   140,   141,
    530     16,   140,   141,   142,   143,   144,   145,   146,   147,   148,
    531    149,   150,   151,   152,   245,   246,   247,   248,   249,   250,
    532    173,   169,   170,   171,   172,   237,   238,   239,   167,   168,
    533     26,   310,   202,   311,   174,   272,   312,   268,    85,   153,
    534    273,    30,    31,   175,    86,   274,    33,   276,   277,   278,
    535    180,   285,   180,   180,   180,   327,   286,   220,   296,   316,
    536    221,   176,   280,   273,   180,   100,   100,   100,   100,   100,
     517   111,    78,    99,    80,   227,    92,   183,   199,   290,   139,
     518   231,   179,   109,   101,   102,   202,   177,   196,   205,   106,
     519   203,   117,   180,    83,   112,   113,   197,   220,   115,   116,
     520   221,   236,   335,    89,   129,   130,   131,   132,   212,   294,
     521   189,   190,   292,    95,   295,   158,   159,    96,   299,   103,
     522   189,   190,   193,   100,   100,   260,   219,   261,   178,   100,
     523    81,   180,    93,   110,   100,   100,   315,   194,   100,   100,
     524   105,   266,   318,   187,   100,   100,   100,   100,   180,   125,
     525   182,   160,   161,   162,   197,   180,    82,   336,    94,   184,
     526   200,   332,   191,   207,   181,   209,   218,   210,   211,   283,
     527   198,   206,   191,   133,   342,   163,   164,   134,   107,   192,
     528   264,   135,   108,     1,     2,     3,     4,     5,   114,   165,
     529   166,   202,     8,   186,   232,    84,   268,   234,   140,   141,
     530    16,   155,   173,   142,   143,   144,   145,   146,   147,   148,
     531   149,   150,   151,   152,   133,   156,   157,   174,   137,   242,
     532   243,   244,   138,   140,   141,   237,   238,   239,   167,   168,
     533    26,   310,   272,   311,   175,   274,   312,   273,    85,   153,
     534   180,    30,    31,   176,    86,    96,    33,   245,   246,   247,
     535   248,   249,   250,   276,   277,   327,   278,   194,   180,   180,
     536   201,   180,   280,   214,   215,   100,   100,   100,   100,   100,
    537537   100,   100,   100,   100,   100,   100,   100,   100,   100,   100,
    538    100,   100,   100,   100,   100,   100,   100,   100,   194,   321,
    539    140,   141,    96,   182,   180,   142,   143,   144,   145,   146,
    540    147,   148,   149,   150,   151,   152,   328,   341,   160,   161,
    541    162,   180,   180,   251,   252,   253,   254,   242,   243,   244,
    542    255,   256,   257,   201,   293,   187,   301,   208,   303,   -27,
    543    306,   153,   214,   215,   -28,   302,   224,   225,   287,   180,
    544    228,   298,   288,   180,   180,   344,   222,   240,   241,   233,
    545    313,   235,   187,   262,   180,   215,   270,   265,   275,   279,
    546    300,   307,   304,   289,   314,   317,   320,   322,   331,   326,
    547    308,   330,   333,   339,   329,   343,   345,   187,   348,   353,
    548    340,   357,   334,   358,   282,   284,    87,    88,   258,   352,
    549    187,   259,   263,   347,   267,   349,   350,   350,   291,   346,
    550    354,   269,     0,   355,   355,    97,   338,     1,     2,     3,
    551      4,     5,     0,     0,   281,     0,     8,     0,     0,    84,
    552      0,    13,    14,     0,    16,     0,     0,     0,     0,     0,
    553     19,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    554      0,     0,     0,     0,     0,     0,    24,    25,     0,     0,
    555      0,     0,     0,     0,    26,     0,     0,     0,     0,     0,
    556      0,     0,    85,    28,    29,    30,    31,     0,    86,     0,
     538   100,   100,   100,   100,   100,   100,   100,   100,   -27,  -126,
     539   224,   225,  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,
     540  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,
     541  -126,  -126,  -126,   285,   -28,  -126,  -126,  -126,   286,  -126,
     542  -126,   208,   296,   222,   293,   187,   301,   273,   303,   316,
     543   306,   321,   328,   341,   180,   302,   180,   180,   180,   287,
     544   180,   298,   169,   170,   171,   172,   223,  -126,  -126,  -126,
     545   313,   228,   187,  -126,  -126,   251,   252,   253,   254,   288,
     546   180,   233,  -126,  -126,   235,   255,   256,   257,   331,   180,
     547   344,   262,   333,   339,   329,   240,   241,   187,   180,   265,
     548   340,   270,   334,   275,   279,   215,   300,   289,   304,   307,
     549   187,   314,   308,   347,   319,   349,   350,   350,   317,   320,
     550   354,   322,   326,   355,   355,    97,   343,     1,     2,     3,
     551     4,     5,   348,   345,   330,   353,     8,   357,   358,    84,
     552   284,    13,    14,    87,    16,   282,   140,   141,    88,   258,
     553    19,   142,   143,   144,   145,   146,   147,   148,   149,   150,
     554   151,   152,   259,   352,   267,   263,    24,    25,   338,   291,
     555   346,   281,   269,     0,    26,     0,     0,     0,     0,     0,
     556     0,     0,    85,    28,    29,    30,    31,   153,    86,     0,
    557557    33,     0,     0,     0,     0,    34,    35,    36,    37,     0,
    558558     0,     1,     2,     3,   118,   119,     6,     0,    98,     7,
     
    577577     0,     0,     0,     0,     0,     0,    26,     0,     0,     0,
    578578     0,     0,     0,     0,    27,    28,    29,    30,    31,     0,
    579     32,   223,    33,     0,     0,     0,     0,    34,    35,    36,
     579    32,   297,    33,     0,     0,     0,     0,    34,    35,    36,
    580580    37,     0,     0,     1,     2,     3,     4,     5,     6,     0,
    581581    38,     7,     8,     9,    10,    11,    12,    13,    14,    15,
     
    584584     0,     0,    24,    25,     0,     0,     0,     0,     0,     0,
    585585    26,     0,     0,     0,     0,     0,     0,     0,    27,    28,
    586     29,    30,    31,     0,    32,   297,    33,     0,     0,     0,
     586    29,    30,    31,     0,    32,     0,    33,     0,     0,     0,
    587587     0,    34,    35,    36,    37,     0,     0,     1,     2,     3,
    588      4,     5,     6,     0,    38,     7,     8,     9,    10,    11,
     588     4,     5,     6,     0,    38,     7,     8,     9,    10,    84,
    589589    12,    13,    14,    15,    16,    17,    18,     0,     0,     0,
    590590    19,    20,    21,     0,    22,    23,     0,     0,     0,     0,
    591591     0,     0,     0,     0,     0,     0,    24,    25,     0,     0,
    592592     0,     0,     0,     0,    26,     0,     0,     0,     0,     0,
    593      0,     0,    27,    28,    29,    30,    31,     0,    32,   319,
     593     0,     0,    27,    28,    29,    30,    31,     0,    32,     0,
    594594    33,     0,     0,     0,     0,    34,    35,    36,    37,     0,
    595      0,     1,     2,     3,     4,     5,     6,     0,    38,     7,
    596      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    597     18,     0,     0,     0,    19,    20,    21,     0,    22,    23,
     595     1,     2,     3,     4,     5,     0,     0,     0,    38,     8,
     596   185,     0,    84,     0,    13,    14,     0,    16,     0,     0,
     597     0,     0,     0,    19,     0,     0,     0,     0,     0,     0,
     598     0,     0,     0,     0,     0,     0,     0,     0,     0,    24,
     599    25,     0,     0,     0,     0,     0,     0,    26,     0,     0,
     600     0,     0,     0,     0,     0,    85,    28,    29,    30,    31,
     601     0,    86,     0,    33,     0,     0,     0,     0,    34,    35,
     602    36,    37,     1,     2,     3,     4,     5,     0,     0,     0,
     603     0,     8,     0,     0,    84,     0,    13,    14,     0,    16,
     604     0,     0,     0,     0,     0,    19,     0,     0,     0,     0,
    598605     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    599     24,    25,     0,     0,     0,     0,     0,     0,    26,     0,
    600      0,     0,     0,     0,     0,     0,    27,    28,    29,    30,
    601     31,     0,    32,     0,    33,     0,     0,     0,     0,    34,
    602     35,    36,    37,     0,     0,     1,     2,     3,     4,     5,
    603      6,     0,    38,     7,     8,     9,    10,    84,    12,    13,
    604     14,    15,    16,    17,    18,     0,     0,     0,    19,    20,
    605     21,     0,    22,    23,     0,     0,     0,     0,     0,     0,
    606      0,     0,     0,     0,    24,    25,     0,     0,     0,     0,
    607      0,     0,    26,     0,     0,     0,     0,     0,     0,     0,
    608     27,    28,    29,    30,    31,     0,    32,     0,    33,     0,
    609      0,     0,     0,    34,    35,    36,    37,     0,     0,     0,
    610      0,     0,     0,     0,  -126,     0,    38,  -126,  -126,  -126,
    611   -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,
    612   -126,  -126,  -126,  -126,  -126,  -126,  -126,  -126,     0,     0,
    613   -126,  -126,  -126,     0,  -126,  -126,     1,     2,     3,     4,
    614      5,     0,     0,     0,     0,     8,   185,     0,    84,     0,
     606     0,    24,    25,     0,     0,     0,     0,     0,     0,    26,
     607     0,     0,     0,     0,     0,     0,     0,    85,    28,    29,
     608    30,    31,     0,    86,     0,    33,   226,     0,     0,     0,
     609    34,    35,    36,    37,     1,     2,     3,     4,     5,     0,
     610     0,     0,     0,     8,     0,     0,    84,     0,    13,    14,
     611     0,    16,     0,     0,     0,     0,     0,    19,     0,     0,
     612     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     613     0,     0,     0,    24,    25,     0,     0,     0,     0,     0,
     614     0,    26,     0,     0,     0,     0,     0,     0,     0,    85,
     615    28,    29,    30,    31,   229,    86,     0,    33,     0,     0,
     616     0,     0,    34,    35,    36,    37,     1,     2,     3,     4,
     617     5,     0,     0,     0,     0,     8,     0,     0,    84,     0,
    615618    13,    14,     0,    16,     0,     0,     0,     0,     0,    19,
    616      0,     0,  -126,  -126,  -126,     0,     0,     0,  -126,  -126,
    617      0,     0,     0,     0,     0,    24,    25,  -126,  -126,     0,
     619     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     620     0,     0,     0,     0,     0,    24,    25,     0,     0,     0,
    618621     0,     0,     0,    26,     0,     0,     0,     0,     0,     0,
    619622     0,    85,    28,    29,    30,    31,     0,    86,     0,    33,
    620      0,     0,     0,     0,    34,    35,    36,    37,     1,     2,
     623   309,     0,     0,     0,    34,    35,    36,    37,     1,     2,
    621624     3,     4,     5,     0,     0,     0,     0,     8,     0,     0,
    622625    84,     0,    13,    14,     0,    16,     0,     0,     0,     0,
     
    625628     0,     0,     0,     0,     0,    26,     0,     0,     0,     0,
    626629     0,     0,     0,    85,    28,    29,    30,    31,     0,    86,
    627      0,    33,   226,     0,     0,     0,    34,    35,    36,    37,
    628      1,     2,     3,     4,     5,     0,     0,     0,     0,     8,
    629      0,     0,    84,     0,    13,    14,     0,    16,     0,     0,
    630      0,     0,     0,    19,     0,     0,     0,     0,     0,     0,
    631      0,     0,     0,     0,     0,     0,     0,     0,     0,    24,
    632     25,     0,     0,     0,     0,     0,     0,    26,     0,     0,
    633      0,     0,     0,     0,     0,    85,    28,    29,    30,    31,
    634    229,    86,     0,    33,     0,     0,     0,     0,    34,    35,
    635     36,    37,     1,     2,     3,     4,     5,     0,     0,     0,
    636      0,     8,     0,     0,    84,     0,    13,    14,     0,    16,
    637      0,     0,     0,     0,     0,    19,     0,     0,     0,     0,
    638      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    639      0,    24,    25,     0,     0,     0,     0,     0,     0,    26,
    640      0,     0,     0,     0,     0,     0,     0,    85,    28,    29,
    641     30,    31,     0,    86,     0,    33,   309,     0,     0,     0,
    642     34,    35,    36,    37,     1,     2,     3,     4,     5,     0,
    643      0,     0,     0,     8,     0,     0,    84,     0,    13,    14,
    644      0,    16,     0,     0,     0,     0,     0,    19,     0,     0,
    645      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    646      0,     0,     0,    24,    25,     0,     0,     0,     0,     0,
    647      0,    26,     0,     0,     0,     0,     0,     0,     0,    85,
    648     28,    29,    30,    31,     0,    86,     0,    33,     0,     0,
    649      0,     0,    34,    35,    36,    37
     630     0,    33,     0,     0,     0,     0,    34,    35,    36,    37
    650631};
    651632
    652633static const short yycheck[] = {    17,
    653     23,     0,    12,    78,   127,     1,     1,     1,     1,    44,
    654    133,     1,    22,    13,    14,   265,    40,     1,     1,    19,
    655     24,    31,    68,    68,    24,    25,    58,    58,    28,    29,
    656     62,   154,    10,    62,    34,    35,    36,    37,    84,    84,
    657      6,     7,   292,    64,   268,    62,    61,    69,   272,   124,
    658      6,     7,    87,    13,    14,   178,    62,   180,    82,    19,
    659     75,    76,    58,    58,    24,    25,    68,   317,    28,    29,
    660     62,   194,   296,    83,    34,    35,    36,    37,    68,    83,
    661    330,    58,    71,    72,    68,    68,    63,    65,    84,    84,
    662     84,    84,    58,   103,    84,   105,   114,   107,   108,   222,
    663     84,    84,    58,    62,    62,    24,    25,    66,    66,    65,
    664     24,    70,    70,     3,     4,     5,     6,     7,    62,    38,
    665     39,    63,    12,    83,   134,    15,    68,   137,    42,    43,
    666     20,    42,    43,    47,    48,    49,    50,    51,    52,    53,
    667     54,    55,    56,    57,   163,   164,   165,   166,   167,   168,
    668     79,    34,    35,    36,    37,   155,   156,   157,    77,    78,
    669     50,   284,    58,   286,    80,    63,   289,    63,    58,    83,
    670     68,    61,    62,    81,    64,    63,    66,    63,    63,    63,
    671     68,    63,    68,    68,    68,   308,    68,    65,    63,    63,
    672     68,    41,   215,    68,    68,   155,   156,   157,   158,   159,
     634    23,     0,    12,     1,   127,     1,     1,     1,    24,    44,
     635   133,     1,    22,    13,    14,    58,    40,     1,     1,    19,
     636    63,    31,    68,    62,    24,    25,    68,    65,    28,    29,
     637    68,   154,    10,    58,    34,    35,    36,    37,    84,   265,
     638     6,     7,    84,    58,   268,    71,    72,    62,   272,    62,
     639     6,     7,    87,    13,    14,   178,    63,   180,    82,    19,
     640    58,    68,    58,    64,    24,    25,   292,    83,    28,    29,
     641    62,   194,   296,    83,    34,    35,    36,    37,    68,    68,
     642    79,    44,    45,    46,    68,    68,    84,    65,    84,    84,
     643    84,   317,    58,   103,    84,   105,   114,   107,   108,   222,
     644    84,    84,    58,    62,   330,    24,    25,    66,    62,    65,
     645    24,    70,    62,     3,     4,     5,     6,     7,    69,    38,
     646    39,    58,    12,    83,   134,    15,    63,   137,    42,    43,
     647    20,    61,    79,    47,    48,    49,    50,    51,    52,    53,
     648    54,    55,    56,    57,    62,    75,    76,    80,    66,   160,
     649   161,   162,    70,    42,    43,   155,   156,   157,    77,    78,
     650    50,   284,    63,   286,    81,    63,   289,    68,    58,    83,
     651    68,    61,    62,    41,    64,    62,    66,   163,   164,   165,
     652   166,   167,   168,    63,    63,   308,    63,    83,    68,    68,
     653    62,    68,   215,    32,    33,   155,   156,   157,   158,   159,
    673654   160,   161,   162,   163,   164,   165,   166,   167,   168,   169,
    674    170,   171,   172,   173,   174,   175,   176,   177,    83,    63,
    675     42,    43,    62,   298,    68,    47,    48,    49,    50,    51,
    676     52,    53,    54,    55,    56,    57,    63,    63,    44,    45,
    677     46,    68,    68,   169,   170,   171,   172,   160,   161,   162,
    678    173,   174,   175,    62,   264,   265,   274,    22,   276,    69,
    679    278,    83,    32,    33,    69,   275,    67,    68,    67,    68,
    680     68,   270,    67,    68,    68,    69,    69,   158,   159,    58,
    681    290,    58,   292,    58,    68,    33,    64,    84,    62,    62,
    682     58,    58,    64,    69,    24,    84,    23,     9,   316,    63,
    683     69,    84,   320,   326,   314,    63,    69,   317,    63,    65,
    684    328,     0,   322,     0,   221,   225,     8,     8,   176,   345,
    685    330,   177,   185,   341,   197,   343,   344,   345,   262,   337,
    686    348,   201,    -1,   351,   352,     1,   324,     3,     4,     5,
    687      6,     7,    -1,    -1,   216,    -1,    12,    -1,    -1,    15,
    688     -1,    17,    18,    -1,    20,    -1,    -1,    -1,    -1,    -1,
    689     26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    690     -1,    -1,    -1,    -1,    -1,    -1,    42,    43,    -1,    -1,
    691     -1,    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,
    692     -1,    -1,    58,    59,    60,    61,    62,    -1,    64,    -1,
     655   170,   171,   172,   173,   174,   175,   176,   177,    69,     0,
     656    67,    68,     3,     4,     5,     6,     7,     8,     9,    10,
     657    11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
     658    21,    22,    23,    63,    69,    26,    27,    28,    68,    30,
     659    31,    22,    63,    69,   264,   265,   274,    68,   276,    63,
     660   278,    63,    63,    63,    68,   275,    68,    68,    68,    67,
     661    68,   270,    34,    35,    36,    37,    65,    58,    59,    60,
     662   290,    68,   292,    64,    65,   169,   170,   171,   172,    67,
     663    68,    58,    73,    74,    58,   173,   174,   175,   316,    68,
     664    69,    58,   320,   326,   314,   158,   159,   317,    68,    84,
     665   328,    64,   322,    62,    62,    33,    58,    69,    64,    58,
     666   330,    24,    69,   341,    65,   343,   344,   345,    84,    23,
     667   348,     9,    63,   351,   352,     1,    63,     3,     4,     5,
     668     6,     7,    63,    69,    84,    65,    12,     0,     0,    15,
     669   225,    17,    18,     8,    20,   221,    42,    43,     8,   176,
     670    26,    47,    48,    49,    50,    51,    52,    53,    54,    55,
     671    56,    57,   177,   345,   197,   185,    42,    43,   324,   262,
     672   337,   216,   201,    -1,    50,    -1,    -1,    -1,    -1,    -1,
     673    -1,    -1,    58,    59,    60,    61,    62,    83,    64,    -1,
    693674    66,    -1,    -1,    -1,    -1,    71,    72,    73,    74,    -1,
    694675    -1,     3,     4,     5,     6,     7,     8,    -1,    84,    11,
     
    720701    -1,    -1,    42,    43,    -1,    -1,    -1,    -1,    -1,    -1,
    721702    50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,    59,
    722     60,    61,    62,    -1,    64,    65,    66,    -1,    -1,    -1,
     703    60,    61,    62,    -1,    64,    -1,    66,    -1,    -1,    -1,
    723704    -1,    71,    72,    73,    74,    -1,    -1,     3,     4,     5,
    724705     6,     7,     8,    -1,    84,    11,    12,    13,    14,    15,
     
    727708    -1,    -1,    -1,    -1,    -1,    -1,    42,    43,    -1,    -1,
    728709    -1,    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,
    729     -1,    -1,    58,    59,    60,    61,    62,    -1,    64,    65,
     710    -1,    -1,    58,    59,    60,    61,    62,    -1,    64,    -1,
    730711    66,    -1,    -1,    -1,    -1,    71,    72,    73,    74,    -1,
    731     -1,     3,     4,     5,     6,     7,     8,    -1,    84,    11,
    732     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
    733     22,    -1,    -1,    -1,    26,    27,    28,    -1,    30,    31,
    734     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    735     42,    43,    -1,    -1,    -1,    -1,    -1,    -1,    50,    -1,
    736     -1,    -1,    -1,    -1,    -1,    -1,    58,    59,    60,    61,
    737     62,    -1,    64,    -1,    66,    -1,    -1,    -1,    -1,    71,
    738     72,    73,    74,    -1,    -1,     3,     4,     5,     6,     7,
    739      8,    -1,    84,    11,    12,    13,    14,    15,    16,    17,
    740     18,    19,    20,    21,    22,    -1,    -1,    -1,    26,    27,
    741     28,    -1,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,
    742     -1,    -1,    -1,    -1,    42,    43,    -1,    -1,    -1,    -1,
    743     -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    744     58,    59,    60,    61,    62,    -1,    64,    -1,    66,    -1,
    745     -1,    -1,    -1,    71,    72,    73,    74,    -1,    -1,    -1,
    746     -1,    -1,    -1,    -1,     0,    -1,    84,     3,     4,     5,
    747      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    748     16,    17,    18,    19,    20,    21,    22,    23,    -1,    -1,
    749     26,    27,    28,    -1,    30,    31,     3,     4,     5,     6,
    750      7,    -1,    -1,    -1,    -1,    12,    13,    -1,    15,    -1,
    751     17,    18,    -1,    20,    -1,    -1,    -1,    -1,    -1,    26,
    752     -1,    -1,    58,    59,    60,    -1,    -1,    -1,    64,    65,
    753     -1,    -1,    -1,    -1,    -1,    42,    43,    73,    74,    -1,
    754     -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,
    755     -1,    58,    59,    60,    61,    62,    -1,    64,    -1,    66,
    756     -1,    -1,    -1,    -1,    71,    72,    73,    74,     3,     4,
    757      5,     6,     7,    -1,    -1,    -1,    -1,    12,    -1,    -1,
    758     15,    -1,    17,    18,    -1,    20,    -1,    -1,    -1,    -1,
    759     -1,    26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    760     -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    43,    -1,
    761     -1,    -1,    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,
    762     -1,    -1,    -1,    58,    59,    60,    61,    62,    -1,    64,
    763     -1,    66,    67,    -1,    -1,    -1,    71,    72,    73,    74,
    764      3,     4,     5,     6,     7,    -1,    -1,    -1,    -1,    12,
    765     -1,    -1,    15,    -1,    17,    18,    -1,    20,    -1,    -1,
     712     3,     4,     5,     6,     7,    -1,    -1,    -1,    84,    12,
     713    13,    -1,    15,    -1,    17,    18,    -1,    20,    -1,    -1,
    766714    -1,    -1,    -1,    26,    -1,    -1,    -1,    -1,    -1,    -1,
    767715    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,
    768716    43,    -1,    -1,    -1,    -1,    -1,    -1,    50,    -1,    -1,
    769717    -1,    -1,    -1,    -1,    -1,    58,    59,    60,    61,    62,
    770     63,    64,    -1,    66,    -1,    -1,    -1,    -1,    71,    72,
     718    -1,    64,    -1,    66,    -1,    -1,    -1,    -1,    71,    72,
    771719    73,    74,     3,     4,     5,     6,     7,    -1,    -1,    -1,
    772720    -1,    12,    -1,    -1,    15,    -1,    17,    18,    -1,    20,
     
    782730    -1,    -1,    -1,    42,    43,    -1,    -1,    -1,    -1,    -1,
    783731    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,
    784     59,    60,    61,    62,    -1,    64,    -1,    66,    -1,    -1,
    785     -1,    -1,    71,    72,    73,    74
     732    59,    60,    61,    62,    63,    64,    -1,    66,    -1,    -1,
     733    -1,    -1,    71,    72,    73,    74,     3,     4,     5,     6,
     734     7,    -1,    -1,    -1,    -1,    12,    -1,    -1,    15,    -1,
     735    17,    18,    -1,    20,    -1,    -1,    -1,    -1,    -1,    26,
     736    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     737    -1,    -1,    -1,    -1,    -1,    42,    43,    -1,    -1,    -1,
     738    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,
     739    -1,    58,    59,    60,    61,    62,    -1,    64,    -1,    66,
     740    67,    -1,    -1,    -1,    71,    72,    73,    74,     3,     4,
     741     5,     6,     7,    -1,    -1,    -1,    -1,    12,    -1,    -1,
     742    15,    -1,    17,    18,    -1,    20,    -1,    -1,    -1,    -1,
     743    -1,    26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     744    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    43,    -1,
     745    -1,    -1,    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,
     746    -1,    -1,    -1,    58,    59,    60,    61,    62,    -1,    64,
     747    -1,    66,    -1,    -1,    -1,    -1,    71,    72,    73,    74
    786748};
    787749/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
     
    20041966    break;}
    20051967case 193:
    2006 #line 623 "grammar.y"
    2007 { yyval.srcs = new SourceElementsNode(yyvsp[-1].srcs, yyvsp[0].src); ;
     1968#line 624 "grammar.y"
     1969{ yyval.srcs = new SourceElementsNode(yyvsp[0].srcs, yyvsp[-1].src); ;
    20081970    break;}
    20091971case 194:
    2010 #line 627 "grammar.y"
     1972#line 631 "grammar.y"
    20111973{ yyval.src = new SourceElementNode(yyvsp[0].stat); ;
    20121974    break;}
    20131975case 195:
    2014 #line 628 "grammar.y"
     1976#line 632 "grammar.y"
    20151977{ yyval.src = new SourceElementNode(yyvsp[0].func); ;
    20161978    break;}
     
    22382200  return 1;
    22392201}
    2240 #line 631 "grammar.y"
     2202#line 635 "grammar.y"
    22412203
    22422204
  • trunk/JavaScriptCore/kjs/grammar.y

    r1024 r1272  
    621621SourceElements:
    622622    SourceElement                  { $$ = new SourceElementsNode($1); }
    623   | SourceElements SourceElement   { $$ = new SourceElementsNode($1, $2); }
     623/* #ifdef APPLE_CHANGES (not using an actual ifdef because this is yacc) */
     624  | SourceElement SourceElements   { $$ = new SourceElementsNode($2, $1); }
     625/* #else */
     626/*| SourceElements SourceElement   { $$ = new SourceElementsNode($1, $2); } */
     627/* #endif */
    624628;
    625629
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r1024 r1272  
    31363136  KJS_CHECKEXCEPTION
    31373137
     3138#ifdef APPLE_CHANGES
     3139  Completion c1 = element->execute(exec);
     3140  KJS_CHECKEXCEPTION;
     3141  if (c1.complType() != Normal)
     3142    return c1;
     3143 
     3144  for (SourceElementsNode *node = elements; node; node = node->elements) {
     3145    Completion c2 = node->element->execute(exec);
     3146    if (c2.complType() != Normal)
     3147      return c2;
     3148    // The spec says to return c2 here, but it seems that mozilla returns c1 if
     3149    // c2 doesn't have a value
     3150    if (!c2.value().isNull())
     3151      c1 = c2;
     3152  }
     3153 
     3154  return c1;
     3155#else
    31383156  if (!elements)
    31393157    return element->execute(exec);
     
    31533171  else
    31543172    return c2;
     3173#endif
    31553174}
    31563175
     
    31583177void SourceElementsNode::processFuncDecl(ExecState *exec)
    31593178{
     3179#ifdef APPLE_CHANGES
     3180  for (SourceElementsNode *node = this; node; node = node->elements) {
     3181    node->element->processFuncDecl(exec);
     3182  }
     3183#else
    31603184  if (elements)
    31613185    elements->processFuncDecl(exec);
    31623186
    31633187  element->processFuncDecl(exec);
     3188#endif
    31643189}
    31653190
    31663191void SourceElementsNode::processVarDecls(ExecState *exec)
    31673192{
     3193#ifdef APPLE_CHANGES
     3194  for (SourceElementsNode *node = this; node; node = node->elements) {
     3195    node->element->processVarDecls(exec);
     3196  }
     3197#else
    31683198  if (elements)
    31693199    elements->processVarDecls(exec);
    31703200
    31713201  element->processVarDecls(exec);
     3202#endif
    31723203}
    31733204
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r1126 r1272  
    120120
    121121UChar UChar::null;
     122#ifdef APPLE_CHANGES
     123UString::Rep UString::Rep::null = { 0, 0, 0, 1 };
     124#else
    122125UString::Rep UString::Rep::null = { 0, 0, 1 };
     126#endif
    123127UString UString::null;
    124128#ifdef APPLE_CHANGES
     
    174178  r->dat = d;
    175179  r->len = l;
     180#ifdef APPLE_CHANGES
     181  r->capacity = l;
     182#endif
    176183  r->rc = 1;
    177184
     
    269276UString &UString::append(const UString &t)
    270277{
     278#ifdef APPLE_CHANGES
     279  int l = size();
     280  int tLen = t.size();
     281  int newLen = l + tLen;
     282  if (rep->rc == 1 && newLen <= rep->capacity) {
     283    memcpy(rep->dat+l, t.data(), tLen * sizeof(UChar));
     284    rep->len = newLen;
     285    return *this;
     286  }
     287 
     288  int newCapacity = (newLen * 3 + 1) / 2;
     289  UChar *n = new UChar[newCapacity];
     290  memcpy(n, data(), l * sizeof(UChar));
     291  memcpy(n+l, t.data(), tLen * sizeof(UChar));
     292  release();
     293  rep = Rep::create(n, newLen);
     294  rep->capacity = newCapacity;
     295#else
    271296  int l = size();
    272297  UChar *n = new UChar[l+t.size()];
     
    275300  release();
    276301  rep = Rep::create(n, l + t.size());
     302#endif
    277303
    278304  return *this;
     
    319345UString &UString::operator=(const char *c)
    320346{
     347#ifdef APPLE_CHANGES
     348  int l = c ? strlen(c) : 0;
     349  UChar *d;
     350  if (rep->rc == 1 && l < rep->capacity) {
     351    d = rep->dat;
     352  } else {
     353    release();
     354    d = new UChar[l];
     355    rep = Rep::create(d, l);
     356  }
     357  for (int i = 0; i < l; i++)
     358    d[i].uc = (uchar)c[i];
     359#else
    321360  release();
    322361  int l = c ? strlen(c) : 0;
     362
    323363  UChar *d = new UChar[l];
    324364  for (int i = 0; i < l; i++)
    325365    d[i].uc = c[i];
    326366  rep = Rep::create(d, l);
     367#endif
    327368
    328369  return *this;
  • trunk/JavaScriptCore/kjs/ustring.h

    r1024 r1272  
    5757   */
    5858  struct UChar {
    59     /**
    60      * Construct a character with value 0.
    61      */
     59#ifdef APPLE_CHANGES
     60    /**
     61     * Construct a character with uninitialized value.   
     62     */
     63#else
     64    /**
     65     * Construct a character with value 0.   
     66     */
     67#endif
    6268    UChar();
    6369    /**
     
    108114  };
    109115
     116#ifdef APPLE_CHANGES
    110117  inline UChar::UChar() : uc(0) { }
     118#else
     119  inline UChar::UChar() { }
     120#endif
    111121  inline UChar::UChar(unsigned char h , unsigned char l) : uc(h << 8 | l) { }
    112122  inline UChar::UChar(unsigned short u) : uc(u) { }
     
    210220      UChar *dat;
    211221      int len;
     222#ifdef APPLE_CHANGES
     223      int capacity;
     224#endif
    212225      int rc;
    213226      static Rep null;
     
    232245     */
    233246    UString(const UChar *c, int length);
     247#ifdef APPLE_CHANGES
     248    /**
     249     * If copy is false the string data will be adopted.
     250     * That means that the data will NOT be copied and the pointer will
     251     * be deleted when the UString object is modified or destroyed.
     252     * Behaviour defaults to a deep copy if copy is true.
     253     */
     254#else
    234255    /**
    235256     * If copy is false a shallow copy of the string will be created. That
     
    238259     * Behaviour defaults to a deep copy if copy is true.
    239260     */
     261#endif
    240262    UString(UChar *c, int length, bool copy);
    241263    /**
Note: See TracChangeset for help on using the changeset viewer.