X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..4e4e5a6f2694187498445a6ac6f1634ce8141119:/create_hash_table?ds=sidebyside diff --git a/create_hash_table b/create_hash_table index 3bd9f76..6078f97 100755 --- a/create_hash_table +++ b/create_hash_table @@ -247,32 +247,50 @@ sub output() { print "\nnamespace JSC {\n"; } my $count = scalar @keys + 1; + print "#if ENABLE(JIT)\n"; + print "#define THUNK_GENERATOR(generator) , generator\n"; + print "#else\n"; + print "#define THUNK_GENERATOR(generator)\n"; + print "#endif\n"; print "\nstatic const struct HashTableValue ${nameEntries}\[$count\] = {\n"; my $i = 0; foreach my $key (@keys) { my $firstValue = ""; my $secondValue = ""; + my $castStr = ""; if ($values[$i]{"type"} eq "Function") { + $castStr = "static_cast"; $firstValue = $values[$i]{"function"}; $secondValue = $values[$i]{"params"}; } elsif ($values[$i]{"type"} eq "Property") { + $castStr = "static_cast"; $firstValue = $values[$i]{"get"}; $secondValue = $values[$i]{"put"}; } elsif ($values[$i]{"type"} eq "Lexer") { $firstValue = $values[$i]{"value"}; $secondValue = "0"; } - print " { \"$key\", $attrs[$i], (intptr_t)$firstValue, (intptr_t)$secondValue },\n"; + my $thunkGenerator = "0"; + if ($key eq "charCodeAt") { + $thunkGenerator = "charCodeAtThunkGenerator"; + } + if ($key eq "charAt") { + $thunkGenerator = "charAtThunkGenerator"; + } + if ($key eq "sqrt") { + $thunkGenerator = "sqrtThunkGenerator"; + } + if ($key eq "pow") { + $thunkGenerator = "powThunkGenerator"; + } + print " { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) },\n"; $i++; } - print " { 0, 0, 0, 0 }\n"; + print " { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n"; print "};\n\n"; - print "extern const struct HashTable $name =\n"; - print "#if ENABLE(PERFECT_HASH_SIZE)\n"; - print " \{ ", $pefectHashSize - 1, ", $nameEntries, 0 \};\n"; - print "#else\n"; + print "#undef THUNK_GENERATOR\n"; + print "extern JSC_CONST_HASHTABLE HashTable $name =\n"; print " \{ $compactSize, $compactHashSizeMask, $nameEntries, 0 \};\n"; - print "#endif\n\n"; print "} // namespace\n"; }