35 static void Test##Name(); \
36 CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true, true); \
37 static void Test##Name()
40 #ifndef UNINITIALIZED_TEST
41 #define UNINITIALIZED_TEST(Name) \
42 static void Test##Name(); \
43 CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true, false); \
44 static void Test##Name()
47 #ifndef DEPENDENT_TEST
48 #define DEPENDENT_TEST(Name, Dep) \
49 static void Test##Name(); \
50 CcTest register_test_##Name(Test##Name, __FILE__, #Name, #Dep, true, true); \
51 static void Test##Name()
55 #define DISABLED_TEST(Name) \
56 static void Test##Name(); \
57 CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, false, true); \
58 static void Test##Name()
61 #define EXTENSION_LIST(V) \
62 V(GC_EXTENSION, "v8/gc") \
63 V(PRINT_EXTENSION, "v8/print") \
64 V(PROFILER_EXTENSION, "v8/profiler") \
65 V(TRACE_EXTENSION, "v8/trace")
67 #define DEFINE_EXTENSION_ID(Name, Ident) Name##_ID,
72 #undef DEFINE_EXTENSION_ID
75 #define DEFINE_EXTENSION_FLAG(Name, Ident) \
76 static const CcTestExtensionFlags Name(1 << Name##_ID);
77 static const CcTestExtensionFlags NO_EXTENSIONS(0);
78 static const CcTestExtensionFlags ALL_EXTENSIONS((1 <<
kMaxExtensions) - 1);
80 #undef DEFINE_EXTENSION_FLAG
91 const char*
file() {
return file_; }
92 const char*
name() {
return name_; }
117 CHECK(!isolate_used_);
118 CHECK(!initialize_called_);
119 initialize_called_ =
true;
130 CcTestExtensionFlags extensions,
138 friend int main(
int argc,
char** argv);
142 const char* dependency_;
148 static bool initialize_called_;
149 static bool isolate_used_;
184 :
Thread(
"ApiTestFuzzer"),
191 static bool fuzzing_;
192 static int tests_being_run_;
194 static int active_tests_;
195 static bool NextThread();
197 v8::internal::Semaphore gate_;
199 void ContextSwitch();
200 static int GetNextTestNumber();
201 static v8::internal::Semaphore all_tests_done_;
205 #define THREADED_TEST(Name) \
206 static void Test##Name(); \
207 RegisterThreadedTest register_##Name(Test##Name, #Name); \
215 :
fuzzer_(
NULL), callback_(callback), name_(name) {
220 static int count() {
return count_; }
226 current = current->prev_;
232 const char*
name() {
return name_; }
250 Initialize(isolate, extensions, global_template, global_object);
257 Initialize(
CcTest::isolate(), extensions, global_template, global_object);
267 return *
reinterpret_cast<v8::Context**
>(&context_);
286 context_.
Reset(isolate, context);
327 return CompileWithOrigin(source, v8_str(origin_url));
332 const char* origin_url) {
333 return CompileWithOrigin(v8_str(source), v8_str(origin_url));
355 reinterpret_cast<const uint8_t*>(preparse->
Data()),
367 const char* origin_url,
389 const char* source,
const char* origin_url) {
390 return CompileRunWithOrigin(v8_str(source), origin_url);
395 static inline int FlagDependentPortOffset() {
396 return ::v8::internal::FLAG_crankshaft ==
false ? 100 :
397 ::v8::internal::FLAG_always_opt ? 200 : 0;
403 int new_linear_size =
static_cast<int>(
405 if (new_linear_size == 0)
return;
406 v8::internal::MaybeObject* maybe = space->AllocateRaw(new_linear_size);
426 heap_profiler_ = i::Isolate::Current()->heap_profiler();
432 i::Isolate::Current()->heap()->CollectAllAvailableGarbage();
442 #endif // ifndef CCTEST_H_
static void RunAllTests()
static Isolate * GetCurrent()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static V8_INLINE Local< T > New(Isolate *isolate, Handle< T > that)
#define CHECK_EQ(expected, value)
HeapObjectsMap * heap_object_map() const
void set_size(Heap *heap, int size_in_bytes)
static FreeListNode * cast(MaybeObject *maybe)
Thread(const Options &options)
CcTest(TestFunction *callback, const char *file, const char *name, const char *dependency, bool enabled, bool initialize)
LocalContext(v8::ExtensionConfiguration *extensions=0, v8::Handle< v8::ObjectTemplate > global_template=v8::Handle< v8::ObjectTemplate >(), v8::Handle< v8::Value > global_object=v8::Handle< v8::Value >())
v8::Context * operator*()
Address * allocation_top_address()
static void DisableAutomaticDispose()
static v8::Local< v8::Object > global()
#define DEFINE_EXTENSION_FLAG(Name, Ident)
Local< Context > GetCurrentContext()
static Local< Integer > New(Isolate *isolate, int32_t value)
const char * dependency()
LocalContext(v8::Isolate *isolate, v8::ExtensionConfiguration *extensions=0, v8::Handle< v8::ObjectTemplate > global_template=v8::Handle< v8::ObjectTemplate >(), v8::Handle< v8::Value > global_object=v8::Handle< v8::Value >())
static v8::Local< v8::Context > NewContext(CcTestExtensionFlags extensions, v8::Isolate *isolate=CcTest::isolate())
void StartHeapObjectsTracking(bool track_allocations)
virtual const char * Data()=0
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
#define DEFINE_EXTENSION_ID(Name, Ident)
void EmptyAllocationInfo()
friend int main(int argc, char **argv)
RegisterThreadedTest(CcTest::TestFunction *callback, const char *name)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *script_data=NULL)
static i::Isolate * i_isolate()
#define EXTENSION_LIST(V)
static Local< Number > New(Isolate *isolate, double value)
#define CHECK_NE(unexpected, value)
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
void StopHeapObjectsTracking()
static void InitializeVM()
int FindUntrackedObjects()
v8::internal::EnumSet< CcTestExtensionIds > CcTestExtensionFlags
static RegisterThreadedTest * nth(int i)
V8_INLINE bool IsEmpty() const
static Local< Script > Compile(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
CcTest::TestFunction * callback()
Address * allocation_limit_address()
v8::Local< v8::Context > local()
static ScriptData * PreCompile(Handle< String > source)
static void SetUp(PartOfTest part)
v8::Context * operator->()
static v8::Isolate * isolate()
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)