OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include <limits.h> | 28 #include <climits> |
29 | 29 #include <csignal> |
30 #ifndef WIN32 | |
31 #include <signal.h> // kill | |
32 #include <unistd.h> // getpid | |
33 #endif // WIN32 | |
34 #include <string> | 30 #include <string> |
35 #include <map> | 31 #include <map> |
36 | 32 |
37 #include "v8.h" | 33 #include "v8.h" |
38 | 34 |
| 35 #if V8_OS_POSIX |
| 36 #include <unistd.h> // NOLINT |
| 37 #endif |
| 38 |
39 #include "api.h" | 39 #include "api.h" |
40 #include "arguments.h" | 40 #include "arguments.h" |
41 #include "cctest.h" | 41 #include "cctest.h" |
42 #include "compilation-cache.h" | 42 #include "compilation-cache.h" |
43 #include "cpu-profiler.h" | 43 #include "cpu-profiler.h" |
44 #include "execution.h" | 44 #include "execution.h" |
45 #include "isolate.h" | 45 #include "isolate.h" |
46 #include "objects.h" | 46 #include "objects.h" |
47 #include "parser.h" | 47 #include "parser.h" |
48 #include "platform.h" | 48 #include "platform.h" |
(...skipping 19975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20024 THREADED_TEST(JSONParseNumber) { | 20024 THREADED_TEST(JSONParseNumber) { |
20025 LocalContext context; | 20025 LocalContext context; |
20026 HandleScope scope(context->GetIsolate()); | 20026 HandleScope scope(context->GetIsolate()); |
20027 Local<Value> obj = v8::JSON::Parse(v8_str("42")); | 20027 Local<Value> obj = v8::JSON::Parse(v8_str("42")); |
20028 Handle<Object> global = context->Global(); | 20028 Handle<Object> global = context->Global(); |
20029 global->Set(v8_str("obj"), obj); | 20029 global->Set(v8_str("obj"), obj); |
20030 ExpectString("JSON.stringify(obj)", "42"); | 20030 ExpectString("JSON.stringify(obj)", "42"); |
20031 } | 20031 } |
20032 | 20032 |
20033 | 20033 |
20034 #ifndef WIN32 | 20034 #if V8_OS_POSIX |
20035 class ThreadInterruptTest { | 20035 class ThreadInterruptTest { |
20036 public: | 20036 public: |
20037 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { } | 20037 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { } |
20038 ~ThreadInterruptTest() { delete sem_; } | 20038 ~ThreadInterruptTest() { delete sem_; } |
20039 | 20039 |
20040 void RunTest() { | 20040 void RunTest() { |
20041 sem_ = i::OS::CreateSemaphore(0); | 20041 sem_ = i::OS::CreateSemaphore(0); |
20042 | 20042 |
20043 InterruptThread i_thread(this); | 20043 InterruptThread i_thread(this); |
20044 i_thread.Start(); | 20044 i_thread.Start(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20266 CheckCorrectThrow("%GetPropertyNames(other)"); | 20266 CheckCorrectThrow("%GetPropertyNames(other)"); |
20267 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 20267 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
20268 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 20268 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
20269 "other, 'x', null, null, 1)"); | 20269 "other, 'x', null, null, 1)"); |
20270 | 20270 |
20271 // Reset the failed access check callback so it does not influence | 20271 // Reset the failed access check callback so it does not influence |
20272 // the other tests. | 20272 // the other tests. |
20273 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); | 20273 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); |
20274 } | 20274 } |
20275 | 20275 |
20276 #endif // WIN32 | 20276 #endif // V8_OS_POSIX |
OLD | NEW |