OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 return 0; | 914 return 0; |
915 } | 915 } |
916 | 916 |
917 | 917 |
918 int Shell::Main(int argc, char* argv[]) { | 918 int Shell::Main(int argc, char* argv[]) { |
919 // Figure out if we're requested to stress the optimization | 919 // Figure out if we're requested to stress the optimization |
920 // infrastructure by running tests multiple times and forcing | 920 // infrastructure by running tests multiple times and forcing |
921 // optimization in the last run. | 921 // optimization in the last run. |
922 bool FLAG_stress_opt = false; | 922 bool FLAG_stress_opt = false; |
923 bool FLAG_stress_deopt = false; | 923 bool FLAG_stress_deopt = false; |
924 bool run_shell = (argc == 1); | 924 bool FLAG_run_shell = false; |
925 | 925 |
926 for (int i = 0; i < argc; i++) { | 926 for (int i = 0; i < argc; i++) { |
927 if (strcmp(argv[i], "--stress-opt") == 0) { | 927 if (strcmp(argv[i], "--stress-opt") == 0) { |
928 FLAG_stress_opt = true; | 928 FLAG_stress_opt = true; |
929 argv[i] = NULL; | 929 argv[i] = NULL; |
930 } else if (strcmp(argv[i], "--stress-deopt") == 0) { | 930 } else if (strcmp(argv[i], "--stress-deopt") == 0) { |
931 FLAG_stress_deopt = true; | 931 FLAG_stress_deopt = true; |
932 argv[i] = NULL; | 932 argv[i] = NULL; |
933 } else if (strcmp(argv[i], "--noalways-opt") == 0) { | 933 } else if (strcmp(argv[i], "--noalways-opt") == 0) { |
934 // No support for stressing if we can't use --always-opt. | 934 // No support for stressing if we can't use --always-opt. |
935 FLAG_stress_opt = false; | 935 FLAG_stress_opt = false; |
936 FLAG_stress_deopt = false; | 936 FLAG_stress_deopt = false; |
937 } else if (strcmp(argv[i], "--shell") == 0) { | 937 } else if (strcmp(argv[i], "--shell") == 0) { |
938 run_shell = true; | 938 FLAG_run_shell = true; |
939 argv[i] = NULL; | 939 argv[i] = NULL; |
940 } | 940 } |
941 } | 941 } |
942 | 942 |
943 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 943 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
944 | 944 |
| 945 // Allow SetFlagsFromCommandLine to decrement argc before deciding to |
| 946 // run the shell or not. |
| 947 bool run_shell = FLAG_run_shell || (argc == 1); |
| 948 |
945 Initialize(); | 949 Initialize(); |
946 | 950 |
947 int result = 0; | 951 int result = 0; |
948 if (FLAG_stress_opt || FLAG_stress_deopt) { | 952 if (FLAG_stress_opt || FLAG_stress_deopt) { |
949 v8::Testing::SetStressRunType( | 953 v8::Testing::SetStressRunType( |
950 FLAG_stress_opt ? v8::Testing::kStressTypeOpt | 954 FLAG_stress_opt ? v8::Testing::kStressTypeOpt |
951 : v8::Testing::kStressTypeDeopt); | 955 : v8::Testing::kStressTypeDeopt); |
952 int stress_runs = v8::Testing::GetStressRuns(); | 956 int stress_runs = v8::Testing::GetStressRuns(); |
953 for (int i = 0; i < stress_runs && result == 0; i++) { | 957 for (int i = 0; i < stress_runs && result == 0; i++) { |
954 printf("============ Stress %d/%d ============\n", i + 1, stress_runs); | 958 printf("============ Stress %d/%d ============\n", i + 1, stress_runs); |
(...skipping 24 matching lines...) Expand all Loading... |
979 } | 983 } |
980 | 984 |
981 } // namespace v8 | 985 } // namespace v8 |
982 | 986 |
983 | 987 |
984 #ifndef GOOGLE3 | 988 #ifndef GOOGLE3 |
985 int main(int argc, char* argv[]) { | 989 int main(int argc, char* argv[]) { |
986 return v8::Shell::Main(argc, argv); | 990 return v8::Shell::Main(argc, argv); |
987 } | 991 } |
988 #endif | 992 #endif |
OLD | NEW |