| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 8989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9000 } | 9000 } |
| 9001 } | 9001 } |
| 9002 | 9002 |
| 9003 | 9003 |
| 9004 static unsigned linear_congruential_generator; | 9004 static unsigned linear_congruential_generator; |
| 9005 | 9005 |
| 9006 | 9006 |
| 9007 void ApiTestFuzzer::Setup(PartOfTest part) { | 9007 void ApiTestFuzzer::Setup(PartOfTest part) { |
| 9008 linear_congruential_generator = i::FLAG_testing_prng_seed; | 9008 linear_congruential_generator = i::FLAG_testing_prng_seed; |
| 9009 fuzzing_ = true; | 9009 fuzzing_ = true; |
| 9010 int start = (part == FIRST_PART) ? 0 : (RegisterThreadedTest::count() >> 1); | 9010 int count = RegisterThreadedTest::count(); |
| 9011 int end = (part == FIRST_PART) | 9011 int start = count * part / (LAST_PART + 1); |
| 9012 ? (RegisterThreadedTest::count() >> 1) | 9012 int end = (count * (part + 1) / (LAST_PART + 1)) - 1; |
| 9013 : RegisterThreadedTest::count(); | 9013 active_tests_ = tests_being_run_ = end - start + 1; |
| 9014 active_tests_ = tests_being_run_ = end - start; | |
| 9015 for (int i = 0; i < tests_being_run_; i++) { | 9014 for (int i = 0; i < tests_being_run_; i++) { |
| 9016 RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer( | 9015 RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer( |
| 9017 i::Isolate::Current(), i + start); | 9016 i::Isolate::Current(), i + start); |
| 9018 } | 9017 } |
| 9019 for (int i = 0; i < active_tests_; i++) { | 9018 for (int i = 0; i < active_tests_; i++) { |
| 9020 RegisterThreadedTest::nth(i)->fuzzer_->Start(); | 9019 RegisterThreadedTest::nth(i)->fuzzer_->Start(); |
| 9021 } | 9020 } |
| 9022 } | 9021 } |
| 9023 | 9022 |
| 9024 | 9023 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9074 ApiTestFuzzer::RunAllTests(); | 9073 ApiTestFuzzer::RunAllTests(); |
| 9075 ApiTestFuzzer::TearDown(); | 9074 ApiTestFuzzer::TearDown(); |
| 9076 } | 9075 } |
| 9077 | 9076 |
| 9078 TEST(Threading2) { | 9077 TEST(Threading2) { |
| 9079 ApiTestFuzzer::Setup(ApiTestFuzzer::SECOND_PART); | 9078 ApiTestFuzzer::Setup(ApiTestFuzzer::SECOND_PART); |
| 9080 ApiTestFuzzer::RunAllTests(); | 9079 ApiTestFuzzer::RunAllTests(); |
| 9081 ApiTestFuzzer::TearDown(); | 9080 ApiTestFuzzer::TearDown(); |
| 9082 } | 9081 } |
| 9083 | 9082 |
| 9083 TEST(Threading3) { |
| 9084 ApiTestFuzzer::Setup(ApiTestFuzzer::THIRD_PART); |
| 9085 ApiTestFuzzer::RunAllTests(); |
| 9086 ApiTestFuzzer::TearDown(); |
| 9087 } |
| 9088 |
| 9089 TEST(Threading4) { |
| 9090 ApiTestFuzzer::Setup(ApiTestFuzzer::FOURTH_PART); |
| 9091 ApiTestFuzzer::RunAllTests(); |
| 9092 ApiTestFuzzer::TearDown(); |
| 9093 } |
| 9084 | 9094 |
| 9085 void ApiTestFuzzer::CallTest() { | 9095 void ApiTestFuzzer::CallTest() { |
| 9086 if (kLogThreading) | 9096 if (kLogThreading) |
| 9087 printf("Start test %d\n", test_number_); | 9097 printf("Start test %d\n", test_number_); |
| 9088 CallTestNumber(test_number_); | 9098 CallTestNumber(test_number_); |
| 9089 if (kLogThreading) | 9099 if (kLogThreading) |
| 9090 printf("End test %d\n", test_number_); | 9100 printf("End test %d\n", test_number_); |
| 9091 } | 9101 } |
| 9092 | 9102 |
| 9093 | 9103 |
| (...skipping 5064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14158 | 14168 |
| 14159 // Disallow but setting a global callback that will allow the calls. | 14169 // Disallow but setting a global callback that will allow the calls. |
| 14160 context->AllowCodeGenerationFromStrings(false); | 14170 context->AllowCodeGenerationFromStrings(false); |
| 14161 V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationAllowed); | 14171 V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationAllowed); |
| 14162 CheckCodeGenerationAllowed(); | 14172 CheckCodeGenerationAllowed(); |
| 14163 | 14173 |
| 14164 // Set a callback that disallows the code generation. | 14174 // Set a callback that disallows the code generation. |
| 14165 V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed); | 14175 V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed); |
| 14166 CheckCodeGenerationDisallowed(); | 14176 CheckCodeGenerationDisallowed(); |
| 14167 } | 14177 } |
| OLD | NEW |