| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_V8_TEST_H_ | 28 #ifndef V8_EXPORT_H_ |
| 29 #define V8_V8_TEST_H_ | 29 #define V8_EXPORT_H_ |
| 30 | |
| 31 #include "v8.h" | |
| 32 | 30 |
| 33 #ifdef _WIN32 | 31 #ifdef _WIN32 |
| 34 // Setup for Windows DLL export/import. See v8.h in this directory for | 32 |
| 35 // information on how to build/use V8 as a DLL. | 33 // Setup for Windows DLL export/import. When building the V8 DLL the |
| 34 // BUILDING_V8_SHARED needs to be defined. When building a program which uses |
| 35 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 |
| 36 // static library or building a program which uses the V8 static library neither |
| 37 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. |
| 36 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) | 38 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) |
| 37 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ | 39 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ |
| 38 build configuration to ensure that at most one of these is set | 40 build configuration to ensure that at most one of these is set |
| 39 #endif | 41 #endif |
| 40 | 42 |
| 41 #ifdef BUILDING_V8_SHARED | 43 #ifdef BUILDING_V8_SHARED |
| 42 #define V8EXPORT __declspec(dllexport) | 44 #define V8EXPORT __declspec(dllexport) |
| 43 #elif USING_V8_SHARED | 45 #elif USING_V8_SHARED |
| 44 #define V8EXPORT __declspec(dllimport) | 46 #define V8EXPORT __declspec(dllimport) |
| 45 #else | 47 #else |
| 46 #define V8EXPORT | 48 #define V8EXPORT |
| 47 #endif | 49 #endif // BUILDING_V8_SHARED |
| 48 | 50 |
| 49 #else // _WIN32 | 51 #else // _WIN32 |
| 50 | 52 |
| 51 // Setup for Linux shared library export. See v8.h in this directory for | 53 // Setup for Linux shared library export. |
| 52 // information on how to build/use V8 as shared library. | |
| 53 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ | 54 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ |
| 54 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) | 55 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) |
| 56 #ifdef BUILDING_V8_SHARED |
| 55 #define V8EXPORT __attribute__ ((visibility("default"))) | 57 #define V8EXPORT __attribute__ ((visibility("default"))) |
| 56 #else | 58 #else |
| 57 #define V8EXPORT | 59 #define V8EXPORT |
| 58 #endif | 60 #endif |
| 61 #else |
| 62 #define V8EXPORT |
| 63 #endif |
| 59 | 64 |
| 60 #endif // _WIN32 | 65 #endif // _WIN32 |
| 61 | 66 |
| 62 | 67 #endif // V8_EXPORT_H_ |
| 63 /** | |
| 64 * Testing support for the V8 JavaScript engine. | |
| 65 */ | |
| 66 namespace v8 { | |
| 67 | |
| 68 class V8EXPORT Testing { | |
| 69 public: | |
| 70 enum StressType { | |
| 71 kStressTypeOpt, | |
| 72 kStressTypeDeopt | |
| 73 }; | |
| 74 | |
| 75 /** | |
| 76 * Set the type of stressing to do. The default if not set is kStressTypeOpt. | |
| 77 */ | |
| 78 static void SetStressRunType(StressType type); | |
| 79 | |
| 80 /** | |
| 81 * Get the number of runs of a given test that is required to get the full | |
| 82 * stress coverage. | |
| 83 */ | |
| 84 static int GetStressRuns(); | |
| 85 | |
| 86 /** | |
| 87 * Indicate the number of the run which is about to start. The value of run | |
| 88 * should be between 0 and one less than the result from GetStressRuns() | |
| 89 */ | |
| 90 static void PrepareStressRun(int run); | |
| 91 | |
| 92 /** | |
| 93 * Force deoptimization of all functions. | |
| 94 */ | |
| 95 static void DeoptimizeAll(); | |
| 96 }; | |
| 97 | |
| 98 | |
| 99 } // namespace v8 | |
| 100 | |
| 101 | |
| 102 #undef V8EXPORT | |
| 103 | |
| 104 | |
| 105 #endif // V8_V8_TEST_H_ | |
| OLD | NEW |