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

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

Issue 877753007: Reland "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: VS201x now happy? Created 5 years, 10 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
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2011 the V8 project authors. All rights reserved. 1 // Copyright 2007-2011 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 public: 60 public:
61 KangarooThread(v8::Isolate* isolate, v8::Handle<v8::Context> context) 61 KangarooThread(v8::Isolate* isolate, v8::Handle<v8::Context> context)
62 : Thread(Options("KangarooThread")), 62 : Thread(Options("KangarooThread")),
63 isolate_(isolate), 63 isolate_(isolate),
64 context_(isolate, context) {} 64 context_(isolate, context) {}
65 65
66 void Run() { 66 void Run() {
67 { 67 {
68 v8::Locker locker(isolate_); 68 v8::Locker locker(isolate_);
69 v8::Isolate::Scope isolate_scope(isolate_); 69 v8::Isolate::Scope isolate_scope(isolate_);
70 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); 70 CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_),
71 v8::internal::Isolate::Current());
71 v8::HandleScope scope(isolate_); 72 v8::HandleScope scope(isolate_);
72 v8::Local<v8::Context> context = 73 v8::Local<v8::Context> context =
73 v8::Local<v8::Context>::New(isolate_, context_); 74 v8::Local<v8::Context>::New(isolate_, context_);
74 v8::Context::Scope context_scope(context); 75 v8::Context::Scope context_scope(context);
75 Local<Value> v = CompileRun("getValue()"); 76 Local<Value> v = CompileRun("getValue()");
76 CHECK(v->IsNumber()); 77 CHECK(v->IsNumber());
77 CHECK_EQ(30, static_cast<int>(v->NumberValue())); 78 CHECK_EQ(30, static_cast<int>(v->NumberValue()));
78 } 79 }
79 { 80 {
80 v8::Locker locker(isolate_); 81 v8::Locker locker(isolate_);
(...skipping 18 matching lines...) Expand all
99 // Migrates an isolate from one thread to another 100 // Migrates an isolate from one thread to another
100 TEST(KangarooIsolates) { 101 TEST(KangarooIsolates) {
101 v8::Isolate* isolate = v8::Isolate::New(); 102 v8::Isolate* isolate = v8::Isolate::New();
102 i::SmartPointer<KangarooThread> thread1; 103 i::SmartPointer<KangarooThread> thread1;
103 { 104 {
104 v8::Locker locker(isolate); 105 v8::Locker locker(isolate);
105 v8::Isolate::Scope isolate_scope(isolate); 106 v8::Isolate::Scope isolate_scope(isolate);
106 v8::HandleScope handle_scope(isolate); 107 v8::HandleScope handle_scope(isolate);
107 v8::Local<v8::Context> context = v8::Context::New(isolate); 108 v8::Local<v8::Context> context = v8::Context::New(isolate);
108 v8::Context::Scope context_scope(context); 109 v8::Context::Scope context_scope(context);
109 CHECK_EQ(isolate, v8::internal::Isolate::Current()); 110 CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate),
111 v8::internal::Isolate::Current());
110 CompileRun("function getValue() { return 30; }"); 112 CompileRun("function getValue() { return 30; }");
111 thread1.Reset(new KangarooThread(isolate, context)); 113 thread1.Reset(new KangarooThread(isolate, context));
112 } 114 }
113 thread1->Start(); 115 thread1->Start();
114 thread1->Join(); 116 thread1->Join();
115 } 117 }
116 118
117 119
118 static void CalcFibAndCheck() { 120 static void CalcFibAndCheck() {
119 Local<Value> v = CompileRun("function fib(n) {" 121 Local<Value> v = CompileRun("function fib(n) {"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate) 179 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate)
178 : JoinableThread("IsolateLockingThread"), 180 : JoinableThread("IsolateLockingThread"),
179 isolate_(isolate) { 181 isolate_(isolate) {
180 } 182 }
181 183
182 virtual void Run() { 184 virtual void Run() {
183 v8::Locker locker(isolate_); 185 v8::Locker locker(isolate_);
184 v8::Isolate::Scope isolate_scope(isolate_); 186 v8::Isolate::Scope isolate_scope(isolate_);
185 v8::HandleScope handle_scope(isolate_); 187 v8::HandleScope handle_scope(isolate_);
186 LocalContext local_context(isolate_); 188 LocalContext local_context(isolate_);
187 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); 189 CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_),
190 v8::internal::Isolate::Current());
188 CalcFibAndCheck(); 191 CalcFibAndCheck();
189 } 192 }
190 private: 193 private:
191 v8::Isolate* isolate_; 194 v8::Isolate* isolate_;
192 }; 195 };
193 196
194 197
195 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) { 198 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) {
196 for (int i = 0; i < threads.length(); i++) { 199 for (int i = 0; i < threads.length(); i++) {
197 threads[i]->Start(); 200 threads[i]->Start();
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 kSimpleExtensionSource)); 703 kSimpleExtensionSource));
701 const char* extension_names[] = { "test0", "test1", 704 const char* extension_names[] = { "test0", "test1",
702 "test2", "test3", "test4", 705 "test2", "test3", "test4",
703 "test5", "test6", "test7" }; 706 "test5", "test6", "test7" };
704 i::List<JoinableThread*> threads(kNThreads); 707 i::List<JoinableThread*> threads(kNThreads);
705 for (int i = 0; i < kNThreads; i++) { 708 for (int i = 0; i < kNThreads; i++) {
706 threads.Add(new IsolateGenesisThread(8, extension_names)); 709 threads.Add(new IsolateGenesisThread(8, extension_names));
707 } 710 }
708 StartJoinAndDeleteThreads(threads); 711 StartJoinAndDeleteThreads(threads);
709 } 712 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698