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

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

Issue 15096011: Various minor cctest fixes to make ASAN a bit happier. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-mark-compact.cc » ('j') | test/cctest/test-mark-compact.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 15865 matching lines...) Expand 10 before | Expand all | Expand 10 after
15876 uint32_t* answer = &size - (size / sizeof(size)); 15876 uint32_t* answer = &size - (size / sizeof(size));
15877 // If the size is very large and the stack is very near the bottom of 15877 // If the size is very large and the stack is very near the bottom of
15878 // memory then the calculation above may wrap around and give an address 15878 // memory then the calculation above may wrap around and give an address
15879 // that is above the (downwards-growing) stack. In that case we return 15879 // that is above the (downwards-growing) stack. In that case we return
15880 // a very low address. 15880 // a very low address.
15881 if (answer > &size) return reinterpret_cast<uint32_t*>(sizeof(size)); 15881 if (answer > &size) return reinterpret_cast<uint32_t*>(sizeof(size));
15882 return answer; 15882 return answer;
15883 } 15883 }
15884 15884
15885 15885
15886 // We need at least 165kB for an x64 debug build with clang and ASAN.
15887 static const int stack_breathing_room = 256 * 1024;
Michael Starzinger 2013/05/15 08:23:48 nit: Let's use the "KB" constant from globals.h in
Sven Panne 2013/05/15 08:59:02 Done.
15888
15889
15886 TEST(SetResourceConstraints) { 15890 TEST(SetResourceConstraints) {
15887 static const int K = 1024; 15891 uint32_t* set_limit = ComputeStackLimit(stack_breathing_room);
15888 uint32_t* set_limit = ComputeStackLimit(128 * K);
15889 15892
15890 // Set stack limit. 15893 // Set stack limit.
15891 v8::ResourceConstraints constraints; 15894 v8::ResourceConstraints constraints;
15892 constraints.set_stack_limit(set_limit); 15895 constraints.set_stack_limit(set_limit);
15893 CHECK(v8::SetResourceConstraints(&constraints)); 15896 CHECK(v8::SetResourceConstraints(&constraints));
15894 15897
15895 // Execute a script. 15898 // Execute a script.
15896 LocalContext env; 15899 LocalContext env;
15897 v8::HandleScope scope(env->GetIsolate()); 15900 v8::HandleScope scope(env->GetIsolate());
15898 Local<v8::FunctionTemplate> fun_templ = 15901 Local<v8::FunctionTemplate> fun_templ =
15899 v8::FunctionTemplate::New(GetStackLimitCallback); 15902 v8::FunctionTemplate::New(GetStackLimitCallback);
15900 Local<Function> fun = fun_templ->GetFunction(); 15903 Local<Function> fun = fun_templ->GetFunction();
15901 env->Global()->Set(v8_str("get_stack_limit"), fun); 15904 env->Global()->Set(v8_str("get_stack_limit"), fun);
15902 CompileRun("get_stack_limit();"); 15905 CompileRun("get_stack_limit();");
15903 15906
15904 CHECK(stack_limit == set_limit); 15907 CHECK(stack_limit == set_limit);
15905 } 15908 }
15906 15909
15907 15910
15908 TEST(SetResourceConstraintsInThread) { 15911 TEST(SetResourceConstraintsInThread) {
15909 uint32_t* set_limit; 15912 uint32_t* set_limit;
15910 { 15913 {
15911 v8::Locker locker(CcTest::default_isolate()); 15914 v8::Locker locker(CcTest::default_isolate());
15912 static const int K = 1024; 15915 set_limit = ComputeStackLimit(stack_breathing_room);
15913 set_limit = ComputeStackLimit(128 * K);
15914 15916
15915 // Set stack limit. 15917 // Set stack limit.
15916 v8::ResourceConstraints constraints; 15918 v8::ResourceConstraints constraints;
15917 constraints.set_stack_limit(set_limit); 15919 constraints.set_stack_limit(set_limit);
15918 CHECK(v8::SetResourceConstraints(&constraints)); 15920 CHECK(v8::SetResourceConstraints(&constraints));
15919 15921
15920 // Execute a script. 15922 // Execute a script.
15921 v8::HandleScope scope(CcTest::default_isolate()); 15923 v8::HandleScope scope(CcTest::default_isolate());
15922 LocalContext env; 15924 LocalContext env;
15923 Local<v8::FunctionTemplate> fun_templ = 15925 Local<v8::FunctionTemplate> fun_templ =
(...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after
18980 i::Semaphore* sem_; 18982 i::Semaphore* sem_;
18981 volatile int sem_value_; 18983 volatile int sem_value_;
18982 }; 18984 };
18983 18985
18984 18986
18985 THREADED_TEST(SemaphoreInterruption) { 18987 THREADED_TEST(SemaphoreInterruption) {
18986 ThreadInterruptTest().RunTest(); 18988 ThreadInterruptTest().RunTest();
18987 } 18989 }
18988 18990
18989 #endif // WIN32 18991 #endif // WIN32
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-mark-compact.cc » ('j') | test/cctest/test-mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698