Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: test/cctest/cctest.cc

Issue 1069883002: WIP SharedArrayBuffer implementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 135 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
136 virtual void* Allocate(size_t length) { return malloc(length); } 136 virtual void* Allocate(size_t length) { return malloc(length); }
137 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } 137 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
138 virtual void Free(void* data, size_t length) { free(data); } 138 virtual void Free(void* data, size_t length) { free(data); }
139 // TODO(dslomov): Remove when v8:2823 is fixed. 139 // TODO(dslomov): Remove when v8:2823 is fixed.
140 virtual void Free(void* data) { UNREACHABLE(); } 140 virtual void Free(void* data) { UNREACHABLE(); }
141 }; 141 };
142 142
143 143
144 class CcTestSharedArrayBufferAllocator
145 : public v8::SharedArrayBuffer::Allocator {
146 virtual void* Allocate(size_t length) { return malloc(length); }
147 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
148 virtual void Free(void* data, size_t length) { free(data); }
149 };
150
151
144 static void SuggestTestHarness(int tests) { 152 static void SuggestTestHarness(int tests) {
145 if (tests == 0) return; 153 if (tests == 0) return;
146 printf("Running multiple tests in sequence is deprecated and may cause " 154 printf("Running multiple tests in sequence is deprecated and may cause "
147 "bogus failure. Consider using tools/run-tests.py instead.\n"); 155 "bogus failure. Consider using tools/run-tests.py instead.\n");
148 } 156 }
149 157
150 158
151 int main(int argc, char* argv[]) { 159 int main(int argc, char* argv[]) {
152 #if V8_OS_WIN 160 #if V8_OS_WIN
153 UINT new_flags = 161 UINT new_flags =
(...skipping 16 matching lines...) Expand all
170 v8::V8::InitializePlatform(platform); 178 v8::V8::InitializePlatform(platform);
171 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); 179 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
172 v8::V8::Initialize(); 180 v8::V8::Initialize();
173 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 181 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
174 v8::StartupDataHandler startup_data(argv[0], NULL, NULL); 182 v8::StartupDataHandler startup_data(argv[0], NULL, NULL);
175 #endif 183 #endif
176 184
177 CcTestArrayBufferAllocator array_buffer_allocator; 185 CcTestArrayBufferAllocator array_buffer_allocator;
178 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); 186 v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
179 187
188 CcTestSharedArrayBufferAllocator shared_array_buffer_allocator;
189 v8::V8::SetSharedArrayBufferAllocator(&shared_array_buffer_allocator);
190
180 i::PrintExtension print_extension; 191 i::PrintExtension print_extension;
181 v8::RegisterExtension(&print_extension); 192 v8::RegisterExtension(&print_extension);
182 i::ProfilerExtension profiler_extension; 193 i::ProfilerExtension profiler_extension;
183 v8::RegisterExtension(&profiler_extension); 194 v8::RegisterExtension(&profiler_extension);
184 i::TraceExtension trace_extension; 195 i::TraceExtension trace_extension;
185 v8::RegisterExtension(&trace_extension); 196 v8::RegisterExtension(&trace_extension);
186 197
187 int tests_run = 0; 198 int tests_run = 0;
188 bool print_run_count = true; 199 bool print_run_count = true;
189 for (int i = 1; i < argc; i++) { 200 for (int i = 1; i < argc; i++) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 CcTest::TearDown(); 245 CcTest::TearDown();
235 // TODO(svenpanne) See comment above. 246 // TODO(svenpanne) See comment above.
236 // if (!disable_automatic_dispose_) v8::V8::Dispose(); 247 // if (!disable_automatic_dispose_) v8::V8::Dispose();
237 v8::V8::ShutdownPlatform(); 248 v8::V8::ShutdownPlatform();
238 delete platform; 249 delete platform;
239 return 0; 250 return 0;
240 } 251 }
241 252
242 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; 253 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL;
243 int RegisterThreadedTest::count_ = 0; 254 int RegisterThreadedTest::count_ = 0;
OLDNEW
« src/objects.h ('K') | « src/v8.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698