]>
git.saurik.com Git - apple/javascriptcore.git/blob - create_jit_stubs
3 # Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
4 # Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public
8 # License as published by the Free Software Foundation; either
9 # version 2 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public License
17 # along with this library; see the file COPYING.LIB. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
25 my $usage = basename
($0) . " --prefix prefix --header header file";
27 my $rtype_template = quotemeta("#rtype#");
28 my $op_template = quotemeta("#op#");
35 my $getOptionsResult = GetOptions
(
36 'prefix=s' => \
$prefix,
37 'header=s' => \
$header,
38 'dfg!' => \
$enable_dfg
43 die "$usage\n" unless ($header and $prefix and $file);
45 my $stub_template = "";
54 print STDERR
"Creating JIT stubs for $file \n";
55 open(IN
, $header) or die "No such file $header";
58 if ( /^$prefix\_BEGIN\((.*)\)/ ) {
62 if ( /^$prefix\((.*)\)/ ) {
63 $stub_template .= $1 . "\n";
65 if ( /^$prefix\_END\((.*)\)/ ) {
66 $output_end .= $1 . "\n";
71 open(IN
, $file) or die "No such file $file";
76 if ( $1 eq "ENABLE(DFG_JIT)" ) {
77 $dfg_begin = $if_counter;
81 if ( $if_counter == $dfg_begin ) {
86 if ( /^DEFINE_STUB_FUNCTION\((.*), (.*)\)/ ) {
87 $stub = $stub_template;
88 $rtype = quotemeta($1);
90 $stub =~ s/$rtype_template/$rtype/g;
91 $stub =~ s/$op_template/$op/g;
93 if ( $enable_dfg == 1 || $dfg_begin == 0 ) {