mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 1 | #! /usr/bin/perl -w |
| 2 | # |
| 3 | # Static Hashtable Generator |
| 4 | # |
| 5 | # (c) 2000-2002 by Harri Porten <porten@kde.org> and |
| 6 | # David Faure <faure@kde.org> |
eseidel | 1abee9d | 2005-07-01 09:48:20 +0000 | [diff] [blame] | 7 | # Modified (c) 2004 by Nikolas Zimmermann <wildfox@kde.org> |
ddkilzer@apple.com | f9f6bbd | 2009-01-02 20:59:17 +0000 | [diff] [blame] | 8 | # Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. |
darin | 170ca98 | 2006-01-29 04:18:56 +0000 | [diff] [blame] | 9 | # |
| 10 | # This library is free software; you can redistribute it and/or |
| 11 | # modify it under the terms of the GNU Lesser General Public |
| 12 | # License as published by the Free Software Foundation; either |
| 13 | # version 2 of the License, or (at your option) any later version. |
| 14 | # |
| 15 | # This library is distributed in the hope that it will be useful, |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | # Lesser General Public License for more details. |
| 19 | # |
| 20 | # You should have received a copy of the GNU Lesser General Public |
| 21 | # License along with this library; if not, write to the Free Software |
| 22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 | # |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 24 | |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 25 | use strict; |
| 26 | |
| 27 | my $file = $ARGV[0]; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 28 | shift; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 29 | my $includelookup = 0; |
darin | 170ca98 | 2006-01-29 04:18:56 +0000 | [diff] [blame] | 30 | |
cwzwarich@webkit.org | 0b51a73 | 2008-11-05 23:21:32 +0000 | [diff] [blame] | 31 | # Use -i as second argument to make it include "Lookup.h" |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 32 | $includelookup = 1 if (defined($ARGV[0]) && $ARGV[0] eq "-i"); |
darin | 170ca98 | 2006-01-29 04:18:56 +0000 | [diff] [blame] | 33 | |
| 34 | # Use -n as second argument to make it use the third argument as namespace parameter ie. -n KDOM |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 35 | my $useNameSpace = $ARGV[1] if (defined($ARGV[0]) && $ARGV[0] eq "-n"); |
eseidel | 1abee9d | 2005-07-01 09:48:20 +0000 | [diff] [blame] | 36 | |
mitz@apple.com | 6cf57f0 | 2011-10-26 16:30:50 +0000 | [diff] [blame] | 37 | print STDERR "Creating hashtable for $file\n"; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 38 | open(IN, $file) or die "No such file $file"; |
| 39 | |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 40 | my @keys = (); |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 41 | my @attrs = (); |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 42 | my @values = (); |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 43 | my @hashes = (); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 44 | |
oliver@apple.com | 10825da | 2014-01-25 01:03:40 +0000 | [diff] [blame] | 45 | my $hasSetter = "false"; |
| 46 | |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 47 | my $inside = 0; |
| 48 | my $name; |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 49 | my $pefectHashSize; |
| 50 | my $compactSize; |
| 51 | my $compactHashSizeMask; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 52 | my $banner = 0; |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 53 | sub calcPerfectHashSize(); |
| 54 | sub calcCompactHashSize(); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 55 | sub output(); |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 56 | sub jsc_ucfirst($); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 57 | sub hashValue($); |
| 58 | |
| 59 | while (<IN>) { |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 60 | chomp; |
| 61 | s/^\s+//; |
| 62 | next if /^\#|^$/; # Comment or blank line. Do nothing. |
| 63 | if (/^\@begin/ && !$inside) { |
| 64 | if (/^\@begin\s*([:_\w]+)\s*\d*\s*$/) { |
| 65 | $inside = 1; |
| 66 | $name = $1; |
| 67 | } else { |
| 68 | print STDERR "WARNING: \@begin without table name, skipping $_\n"; |
| 69 | } |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 70 | } elsif (/^\@end\s*$/ && $inside) { |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 71 | calcPerfectHashSize(); |
| 72 | calcCompactHashSize(); |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 73 | output(); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 74 | |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 75 | @keys = (); |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 76 | @attrs = (); |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 77 | @values = (); |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 78 | @hashes = (); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 79 | |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 80 | $inside = 0; |
ggaren | 91f0374 | 2005-10-11 20:43:49 +0000 | [diff] [blame] | 81 | } elsif (/^(\S+)\s*(\S+)\s*([\w\|]*)\s*(\w*)\s*$/ && $inside) { |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 82 | my $key = $1; |
| 83 | my $val = $2; |
| 84 | my $att = $3; |
| 85 | my $param = $4; |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 86 | |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 87 | push(@keys, $key); |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 88 | push(@attrs, length($att) > 0 ? $att : "0"); |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 89 | |
| 90 | if ($att =~ m/Function/) { |
| 91 | push(@values, { "type" => "Function", "function" => $val, "params" => (length($param) ? $param : "") }); |
| 92 | #printf STDERR "WARNING: Number of arguments missing for $key/$val\n" if (length($param) == 0); |
| 93 | } elsif (length($att)) { |
| 94 | my $get = $val; |
oliver@apple.com | 10825da | 2014-01-25 01:03:40 +0000 | [diff] [blame] | 95 | my $put = "0"; |
| 96 | if (!($att =~ m/ReadOnly/)) { |
| 97 | $put = "set" . jsc_ucfirst($val); |
| 98 | } |
| 99 | $hasSetter = "true"; |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 100 | push(@values, { "type" => "Property", "get" => $get, "put" => $put }); |
| 101 | } else { |
| 102 | push(@values, { "type" => "Lexer", "value" => $val }); |
| 103 | } |
| 104 | push(@hashes, hashValue($key)); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 105 | } elsif ($inside) { |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 106 | die "invalid data {" . $_ . "}"; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 107 | } |
| 108 | } |
| 109 | |
| 110 | die "missing closing \@end" if ($inside); |
| 111 | |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 112 | sub jsc_ucfirst($) |
| 113 | { |
| 114 | my ($value) = @_; |
| 115 | |
| 116 | if ($value =~ /js/) { |
| 117 | $value =~ s/js/JS/; |
| 118 | return $value; |
| 119 | } |
| 120 | |
| 121 | return ucfirst($value); |
| 122 | } |
| 123 | |
| 124 | |
darin | 41d3d9c | 2007-10-24 08:03:02 +0000 | [diff] [blame] | 125 | sub ceilingToPowerOf2 |
| 126 | { |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 127 | my ($pefectHashSize) = @_; |
darin | 41d3d9c | 2007-10-24 08:03:02 +0000 | [diff] [blame] | 128 | |
| 129 | my $powerOf2 = 1; |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 130 | while ($pefectHashSize > $powerOf2) { |
darin | 41d3d9c | 2007-10-24 08:03:02 +0000 | [diff] [blame] | 131 | $powerOf2 <<= 1; |
| 132 | } |
| 133 | |
| 134 | return $powerOf2; |
| 135 | } |
| 136 | |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 137 | sub calcPerfectHashSize() |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 138 | { |
| 139 | tableSizeLoop: |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 140 | for ($pefectHashSize = ceilingToPowerOf2(scalar @keys); ; $pefectHashSize += $pefectHashSize) { |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 141 | my @table = (); |
| 142 | foreach my $key (@keys) { |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 143 | my $h = hashValue($key) % $pefectHashSize; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 144 | next tableSizeLoop if $table[$h]; |
| 145 | $table[$h] = 1; |
| 146 | } |
| 147 | last; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 148 | } |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 149 | } |
| 150 | |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 151 | sub leftShift($$) { |
| 152 | my ($value, $distance) = @_; |
| 153 | return (($value << $distance) & 0xFFFFFFFF); |
| 154 | } |
| 155 | |
ddkilzer@apple.com | aff2b20 | 2008-12-06 01:05:06 +0000 | [diff] [blame] | 156 | sub calcCompactHashSize() |
| 157 | { |
| 158 | my @table = (); |
| 159 | my @links = (); |
| 160 | my $compactHashSize = ceilingToPowerOf2(2 * @keys); |
| 161 | $compactHashSizeMask = $compactHashSize - 1; |
| 162 | $compactSize = $compactHashSize; |
| 163 | my $collisions = 0; |
| 164 | my $maxdepth = 0; |
| 165 | my $i = 0; |
| 166 | foreach my $key (@keys) { |
| 167 | my $depth = 0; |
| 168 | my $h = hashValue($key) % $compactHashSize; |
| 169 | while (defined($table[$h])) { |
| 170 | if (defined($links[$h])) { |
| 171 | $h = $links[$h]; |
| 172 | $depth++; |
| 173 | } else { |
| 174 | $collisions++; |
| 175 | $links[$h] = $compactSize; |
| 176 | $h = $compactSize; |
| 177 | $compactSize++; |
| 178 | } |
| 179 | } |
| 180 | $table[$h] = $i; |
| 181 | $i++; |
| 182 | $maxdepth = $depth if ( $depth > $maxdepth); |
| 183 | } |
| 184 | } |
| 185 | |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 186 | # Paul Hsieh's SuperFastHash |
| 187 | # http://www.azillionmonkeys.com/qed/hash.html |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 188 | sub hashValue($) { |
staikos | 44432f4 | 2006-01-22 06:20:06 +0000 | [diff] [blame] | 189 | my @chars = split(/ */, $_[0]); |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 190 | |
| 191 | # This hash is designed to work on 16-bit chunks at a time. But since the normal case |
| 192 | # (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they |
| 193 | # were 16-bit chunks, which should give matching results |
| 194 | |
| 195 | my $EXP2_32 = 4294967296; |
| 196 | |
| 197 | my $hash = 0x9e3779b9; |
| 198 | my $l = scalar @chars; #I wish this was in Ruby --- Maks |
| 199 | my $rem = $l & 1; |
| 200 | $l = $l >> 1; |
| 201 | |
| 202 | my $s = 0; |
| 203 | |
| 204 | # Main loop |
| 205 | for (; $l > 0; $l--) { |
| 206 | $hash += ord($chars[$s]); |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 207 | my $tmp = leftShift(ord($chars[$s+1]), 11) ^ $hash; |
| 208 | $hash = (leftShift($hash, 16)% $EXP2_32) ^ $tmp; |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 209 | $s += 2; |
| 210 | $hash += $hash >> 11; |
zimmermann | 7305d1c | 2007-07-11 12:56:05 +0000 | [diff] [blame] | 211 | $hash %= $EXP2_32; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 212 | } |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 213 | |
| 214 | # Handle end case |
ggaren@apple.com | 94ba330 | 2011-10-23 07:21:19 +0000 | [diff] [blame] | 215 | if ($rem != 0) { |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 216 | $hash += ord($chars[$s]); |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 217 | $hash ^= (leftShift($hash, 11)% $EXP2_32); |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 218 | $hash += $hash >> 17; |
| 219 | } |
| 220 | |
| 221 | # Force "avalanching" of final 127 bits |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 222 | $hash ^= leftShift($hash, 3); |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 223 | $hash += ($hash >> 5); |
| 224 | $hash = ($hash% $EXP2_32); |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 225 | $hash ^= (leftShift($hash, 2)% $EXP2_32); |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 226 | $hash += ($hash >> 15); |
| 227 | $hash = $hash% $EXP2_32; |
eseidel | 0d42826 | 2006-03-08 10:59:34 +0000 | [diff] [blame] | 228 | $hash ^= (leftShift($hash, 10)% $EXP2_32); |
ggaren@apple.com | 94ba330 | 2011-10-23 07:21:19 +0000 | [diff] [blame] | 229 | |
msaboff@apple.com | 7ef29ea | 2011-10-26 17:12:13 +0000 | [diff] [blame] | 230 | # Save 8 bits for StringImpl to use as flags. |
| 231 | $hash &= 0xffffff; |
ggaren@apple.com | 94ba330 | 2011-10-23 07:21:19 +0000 | [diff] [blame] | 232 | |
| 233 | # This avoids ever returning a hash code of 0, since that is used to |
| 234 | # signal "hash not computed yet". Setting the high bit maintains |
| 235 | # reasonable fidelity to a hash code of 0 because it is likely to yield |
| 236 | # exactly 0 when hash lookup masks out the high bits. |
msaboff@apple.com | 7ef29ea | 2011-10-26 17:12:13 +0000 | [diff] [blame] | 237 | $hash = (0x80000000 >> 8) if ($hash == 0); |
mjs | 768fcac | 2006-01-06 23:51:00 +0000 | [diff] [blame] | 238 | |
| 239 | return $hash; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | sub output() { |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 243 | if (!$banner) { |
| 244 | $banner = 1; |
| 245 | print "// Automatically generated from $file using $0. DO NOT EDIT!\n"; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 246 | } |
darin | 41d3d9c | 2007-10-24 08:03:02 +0000 | [diff] [blame] | 247 | |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 248 | my $nameEntries = "${name}Values"; |
| 249 | $nameEntries =~ s/:/_/g; |
| 250 | |
cwzwarich@webkit.org | 3e34867 | 2008-11-06 00:00:05 +0000 | [diff] [blame] | 251 | print "\n#include \"Lookup.h\"\n" if ($includelookup); |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 252 | if ($useNameSpace) { |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 253 | print "\nnamespace ${useNameSpace} {\n"; |
| 254 | print "\nusing namespace JSC;\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 255 | } else { |
cwzwarich@webkit.org | 3f782f6 | 2008-09-08 01:28:33 +0000 | [diff] [blame] | 256 | print "\nnamespace JSC {\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 257 | } |
| 258 | my $count = scalar @keys + 1; |
ddkilzer@apple.com | 763c4ef | 2008-10-23 19:24:48 +0000 | [diff] [blame] | 259 | print "\nstatic const struct HashTableValue ${nameEntries}\[$count\] = {\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 260 | my $i = 0; |
| 261 | foreach my $key (@keys) { |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 262 | my $firstValue = ""; |
| 263 | my $secondValue = ""; |
oliver@apple.com | 2b5f373 | 2014-01-25 01:26:49 +0000 | [diff] [blame] | 264 | my $firstCastStr = ""; |
| 265 | my $secondCastStr = ""; |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 266 | |
| 267 | if ($values[$i]{"type"} eq "Function") { |
oliver@apple.com | 2b5f373 | 2014-01-25 01:26:49 +0000 | [diff] [blame] | 268 | $firstCastStr = "static_cast<NativeFunction>"; |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 269 | $firstValue = $values[$i]{"function"}; |
| 270 | $secondValue = $values[$i]{"params"}; |
| 271 | } elsif ($values[$i]{"type"} eq "Property") { |
oliver@apple.com | 2b5f373 | 2014-01-25 01:26:49 +0000 | [diff] [blame] | 272 | $firstCastStr = "static_cast<PropertySlot::GetValueFunc>"; |
| 273 | $secondCastStr = "static_cast<PutPropertySlot::PutValueFunc>"; |
weinig@apple.com | caf5e3b | 2008-09-27 02:36:15 +0000 | [diff] [blame] | 274 | $firstValue = $values[$i]{"get"}; |
| 275 | $secondValue = $values[$i]{"put"}; |
| 276 | } elsif ($values[$i]{"type"} eq "Lexer") { |
| 277 | $firstValue = $values[$i]{"value"}; |
| 278 | $secondValue = "0"; |
| 279 | } |
barraclough@apple.com | 6d2ad99 | 2011-12-06 20:46:07 +0000 | [diff] [blame] | 280 | |
| 281 | my $intrinsic = "NoIntrinsic"; |
barraclough@apple.com | 6d2ad99 | 2011-12-06 20:46:07 +0000 | [diff] [blame] | 282 | $intrinsic = "FromCharCodeIntrinsic" if ($key eq "fromCharCode"); |
fpizlo@apple.com | 24d24e5 | 2011-10-04 02:55:54 +0000 | [diff] [blame] | 283 | if ($name eq "arrayPrototypeTable") { |
barraclough@apple.com | 6d2ad99 | 2011-12-06 20:46:07 +0000 | [diff] [blame] | 284 | $intrinsic = "ArrayPushIntrinsic" if ($key eq "push"); |
| 285 | $intrinsic = "ArrayPopIntrinsic" if ($key eq "pop"); |
fpizlo@apple.com | 24d24e5 | 2011-10-04 02:55:54 +0000 | [diff] [blame] | 286 | } |
barraclough@apple.com | 077fdd4 | 2012-03-18 01:08:16 +0000 | [diff] [blame] | 287 | if ($name eq "regExpPrototypeTable") { |
| 288 | $intrinsic = "RegExpExecIntrinsic" if ($key eq "exec"); |
| 289 | $intrinsic = "RegExpTestIntrinsic" if ($key eq "test"); |
| 290 | } |
barraclough@apple.com | 6d2ad99 | 2011-12-06 20:46:07 +0000 | [diff] [blame] | 291 | |
oliver@apple.com | 2b5f373 | 2014-01-25 01:26:49 +0000 | [diff] [blame] | 292 | print " { \"$key\", $attrs[$i], $intrinsic, (intptr_t)" . $firstCastStr . "($firstValue), (intptr_t)" . $secondCastStr . "($secondValue) },\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 293 | $i++; |
| 294 | } |
akling@apple.com | 9b26e5d | 2013-09-17 22:32:31 +0000 | [diff] [blame] | 295 | print " { 0, 0, NoIntrinsic, 0, 0 }\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 296 | print "};\n\n"; |
laszlo.1.gombos@nokia.com | ae65922 | 2011-11-13 04:37:43 +0000 | [diff] [blame] | 297 | print "extern const struct HashTable $name =\n"; |
oliver@apple.com | 10825da | 2014-01-25 01:03:40 +0000 | [diff] [blame] | 298 | print " \{ $compactSize, $compactHashSizeMask, $hasSetter, $nameEntries, 0 \};\n"; |
darin@apple.com | 8a1c16e | 2008-03-19 04:23:21 +0000 | [diff] [blame] | 299 | print "} // namespace\n"; |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 300 | } |