OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static bool disable_automatic_dispose_ = false; | 46 static bool disable_automatic_dispose_ = false; |
47 | 47 |
48 CcTest* CcTest::last_ = NULL; | 48 CcTest* CcTest::last_ = NULL; |
49 bool CcTest::initialize_called_ = false; | 49 bool CcTest::initialize_called_ = false; |
50 v8::base::Atomic32 CcTest::isolate_used_ = 0; | 50 v8::base::Atomic32 CcTest::isolate_used_ = 0; |
51 v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL; | 51 v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL; |
52 v8::Isolate* CcTest::isolate_ = NULL; | 52 v8::Isolate* CcTest::isolate_ = NULL; |
53 | 53 |
54 | 54 |
55 CcTest::CcTest(TestFunction* callback, const char* file, const char* name, | 55 CcTest::CcTest(TestFunction* callback, const char* file, const char* name, |
56 const char* dependency, bool enabled, bool initialize) | 56 bool enabled, bool initialize) |
57 : callback_(callback), name_(name), dependency_(dependency), | 57 : callback_(callback), name_(name), enabled_(enabled), |
58 enabled_(enabled), initialize_(initialize), prev_(last_) { | 58 initialize_(initialize), prev_(last_) { |
59 // Find the base name of this test (const_cast required on Windows). | 59 // Find the base name of this test (const_cast required on Windows). |
60 char *basename = strrchr(const_cast<char *>(file), '/'); | 60 char *basename = strrchr(const_cast<char *>(file), '/'); |
61 if (!basename) { | 61 if (!basename) { |
62 basename = strrchr(const_cast<char *>(file), '\\'); | 62 basename = strrchr(const_cast<char *>(file), '\\'); |
63 } | 63 } |
64 if (!basename) { | 64 if (!basename) { |
65 basename = v8::internal::StrDup(file); | 65 basename = v8::internal::StrDup(file); |
66 } else { | 66 } else { |
67 basename = v8::internal::StrDup(basename + 1); | 67 basename = v8::internal::StrDup(basename + 1); |
68 } | 68 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void CcTest::DisableAutomaticDispose() { | 122 void CcTest::DisableAutomaticDispose() { |
123 CHECK_EQ(kUnintialized, initialization_state_); | 123 CHECK_EQ(kUnintialized, initialization_state_); |
124 disable_automatic_dispose_ = true; | 124 disable_automatic_dispose_ = true; |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 static void PrintTestList(CcTest* current) { | 128 static void PrintTestList(CcTest* current) { |
129 if (current == NULL) return; | 129 if (current == NULL) return; |
130 PrintTestList(current->prev()); | 130 PrintTestList(current->prev()); |
131 if (current->dependency() != NULL) { | 131 printf("%s/%s\n", current->file(), current->name()); |
132 printf("%s/%s<%s\n", | |
133 current->file(), current->name(), current->dependency()); | |
134 } else { | |
135 printf("%s/%s<\n", current->file(), current->name()); | |
136 } | |
137 } | 132 } |
138 | 133 |
139 | 134 |
140 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 135 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
141 virtual void* Allocate(size_t length) { | 136 virtual void* Allocate(size_t length) { |
142 void* data = AllocateUninitialized(length); | 137 void* data = AllocateUninitialized(length); |
143 return data == NULL ? data : memset(data, 0, length); | 138 return data == NULL ? data : memset(data, 0, length); |
144 } | 139 } |
145 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } | 140 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
146 virtual void Free(void* data, size_t length) { free(data); } | 141 virtual void Free(void* data, size_t length) { free(data); } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 CcTest::TearDown(); | 249 CcTest::TearDown(); |
255 // TODO(svenpanne) See comment above. | 250 // TODO(svenpanne) See comment above. |
256 // if (!disable_automatic_dispose_) v8::V8::Dispose(); | 251 // if (!disable_automatic_dispose_) v8::V8::Dispose(); |
257 v8::V8::ShutdownPlatform(); | 252 v8::V8::ShutdownPlatform(); |
258 delete platform; | 253 delete platform; |
259 return 0; | 254 return 0; |
260 } | 255 } |
261 | 256 |
262 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; | 257 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; |
263 int RegisterThreadedTest::count_ = 0; | 258 int RegisterThreadedTest::count_ = 0; |
OLD | NEW |