Reviewers: Yury Semikhatsky, alph,
Message:
the most part of the patch is a mechanical changes that were made by the
script.
use strict;
my %map;
my $filter =
'Bailout\("|Abort\("|set_bailout_reason\("|DisableOptimization\("|
\sCheck\([^"].+"|\sAssert\([^"].+"';
print $filter . "\n";
my @reasons = `git grep -E '$filter' | cut -f2 -d\\" | sort | uniq`;
foreach my $string (@reasons) {
chomp $string;
my $constant = $string;
$constant =~ s/((^\w)|\W(\w))/\U$1/g;
$constant =~ s/\W//g;
$constant = "k" . $constant;
$map{$string} = $constant;
print $string . " => " . $constant . "\n";
}
my @matched_files = `git grep -lE '$filter'`;
foreach my $file (@matched_files) {
chomp $file;
print $file . "...";
foreach my $string (keys %map) {
$string =~ s/\//\\\//; # escape slash symbol.
print `sed -i "s/\\"$string\\"/$map{$string}/" $file`;
}
print "done.\n";
}
print "enum BailoutReason {\n";
foreach my $reason (@reasons) {
print " " . $map{$reason} . ",\n";
}
print "}\n";
print "\n\n\n";
print "const char* GetBailoutReason(BailoutReason reason) {\n";
print " switch (reason) {\n";
foreach my $reason (@reasons) {
print " case " . $map{$reason} . ": return \"" . $reason . "\";\n";
}
print " }\n";
print "}\n";
Description:
Extract hardcoded error strings into a single place and replace them with
enum.
BUG=
Please review this at https://codereview.chromium.org/20843012/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/builtins-arm.cc
M src/arm/code-stubs-arm.cc
M src/arm/codegen-arm.cc
M src/arm/debug-arm.cc
M src/arm/full-codegen-arm.cc
M src/arm/lithium-arm.h
M src/arm/lithium-arm.cc
M src/arm/lithium-codegen-arm.h
M src/arm/lithium-codegen-arm.cc
M src/arm/macro-assembler-arm.h
M src/arm/macro-assembler-arm.cc
M src/code-stubs-hydrogen.cc
M src/compiler.h
M src/compiler.cc
M src/hydrogen.h
M src/hydrogen.cc
M src/ia32/builtins-ia32.cc
M src/ia32/code-stubs-ia32.cc
M src/ia32/codegen-ia32.cc
M src/ia32/debug-ia32.cc
M src/ia32/deoptimizer-ia32.cc
M src/ia32/full-codegen-ia32.cc
M src/ia32/ic-ia32.cc
M src/ia32/lithium-codegen-ia32.h
M src/ia32/lithium-codegen-ia32.cc
M src/ia32/lithium-ia32.h
M src/ia32/lithium-ia32.cc
M src/ia32/macro-assembler-ia32.h
M src/ia32/macro-assembler-ia32.cc
M src/ia32/stub-cache-ia32.cc
M src/lithium.cc
M src/mips/builtins-mips.cc
M src/mips/code-stubs-mips.cc
M src/mips/codegen-mips.cc
M src/mips/debug-mips.cc
M src/mips/full-codegen-mips.cc
M src/mips/lithium-codegen-mips.h
M src/mips/lithium-codegen-mips.cc
M src/mips/lithium-mips.h
M src/mips/lithium-mips.cc
M src/mips/macro-assembler-mips.h
M src/mips/macro-assembler-mips.cc
M src/objects.h
M src/objects.cc
M src/x64/builtins-x64.cc
M src/x64/code-stubs-x64.cc
M src/x64/codegen-x64.cc
M src/x64/full-codegen-x64.cc
M src/x64/lithium-codegen-x64.h
M src/x64/lithium-codegen-x64.cc
M src/x64/lithium-x64.h
M src/x64/lithium-x64.cc
M src/x64/macro-assembler-x64.h
M src/x64/macro-assembler-x64.cc
M src/x64/regexp-macro-assembler-x64.cc
M src/x64/stub-cache-x64.cc
M test/cctest/test-code-stubs-ia32.cc
M test/cctest/test-code-stubs-x64.cc
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.