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

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

Issue 893533003: Revert "Make GCC happy again." and "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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(reinterpret_cast<v8::internal::Isolate*>(isolate_), 70 CHECK_EQ(isolate_, v8::internal::Isolate::Current());
71 v8::internal::Isolate::Current());
72 v8::HandleScope scope(isolate_); 71 v8::HandleScope scope(isolate_);
73 v8::Local<v8::Context> context = 72 v8::Local<v8::Context> context =
74 v8::Local<v8::Context>::New(isolate_, context_); 73 v8::Local<v8::Context>::New(isolate_, context_);
75 v8::Context::Scope context_scope(context); 74 v8::Context::Scope context_scope(context);
76 Local<Value> v = CompileRun("getValue()"); 75 Local<Value> v = CompileRun("getValue()");
77 CHECK(v->IsNumber()); 76 CHECK(v->IsNumber());
78 CHECK_EQ(30, static_cast<int>(v->NumberValue())); 77 CHECK_EQ(30, static_cast<int>(v->NumberValue()));
79 } 78 }
80 { 79 {
81 v8::Locker locker(isolate_); 80 v8::Locker locker(isolate_);
(...skipping 18 matching lines...) Expand all
100 // Migrates an isolate from one thread to another 99 // Migrates an isolate from one thread to another
101 TEST(KangarooIsolates) { 100 TEST(KangarooIsolates) {
102 v8::Isolate* isolate = v8::Isolate::New(); 101 v8::Isolate* isolate = v8::Isolate::New();
103 i::SmartPointer<KangarooThread> thread1; 102 i::SmartPointer<KangarooThread> thread1;
104 { 103 {
105 v8::Locker locker(isolate); 104 v8::Locker locker(isolate);
106 v8::Isolate::Scope isolate_scope(isolate); 105 v8::Isolate::Scope isolate_scope(isolate);
107 v8::HandleScope handle_scope(isolate); 106 v8::HandleScope handle_scope(isolate);
108 v8::Local<v8::Context> context = v8::Context::New(isolate); 107 v8::Local<v8::Context> context = v8::Context::New(isolate);
109 v8::Context::Scope context_scope(context); 108 v8::Context::Scope context_scope(context);
110 CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate), 109 CHECK_EQ(isolate, v8::internal::Isolate::Current());
111 v8::internal::Isolate::Current());
112 CompileRun("function getValue() { return 30; }"); 110 CompileRun("function getValue() { return 30; }");
113 thread1.Reset(new KangarooThread(isolate, context)); 111 thread1.Reset(new KangarooThread(isolate, context));
114 } 112 }
115 thread1->Start(); 113 thread1->Start();
116 thread1->Join(); 114 thread1->Join();
117 } 115 }
118 116
119 117
120 static void CalcFibAndCheck() { 118 static void CalcFibAndCheck() {
121 Local<Value> v = CompileRun("function fib(n) {" 119 Local<Value> v = CompileRun("function fib(n) {"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate) 177 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate)
180 : JoinableThread("IsolateLockingThread"), 178 : JoinableThread("IsolateLockingThread"),
181 isolate_(isolate) { 179 isolate_(isolate) {
182 } 180 }
183 181
184 virtual void Run() { 182 virtual void Run() {
185 v8::Locker locker(isolate_); 183 v8::Locker locker(isolate_);
186 v8::Isolate::Scope isolate_scope(isolate_); 184 v8::Isolate::Scope isolate_scope(isolate_);
187 v8::HandleScope handle_scope(isolate_); 185 v8::HandleScope handle_scope(isolate_);
188 LocalContext local_context(isolate_); 186 LocalContext local_context(isolate_);
189 CHECK_EQ(reinterpret_cast<v8::internal::Isolate*>(isolate_), 187 CHECK_EQ(isolate_, v8::internal::Isolate::Current());
190 v8::internal::Isolate::Current());
191 CalcFibAndCheck(); 188 CalcFibAndCheck();
192 } 189 }
193 private: 190 private:
194 v8::Isolate* isolate_; 191 v8::Isolate* isolate_;
195 }; 192 };
196 193
197 194
198 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) { 195 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) {
199 for (int i = 0; i < threads.length(); i++) { 196 for (int i = 0; i < threads.length(); i++) {
200 threads[i]->Start(); 197 threads[i]->Start();
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 kSimpleExtensionSource)); 700 kSimpleExtensionSource));
704 const char* extension_names[] = { "test0", "test1", 701 const char* extension_names[] = { "test0", "test1",
705 "test2", "test3", "test4", 702 "test2", "test3", "test4",
706 "test5", "test6", "test7" }; 703 "test5", "test6", "test7" };
707 i::List<JoinableThread*> threads(kNThreads); 704 i::List<JoinableThread*> threads(kNThreads);
708 for (int i = 0; i < kNThreads; i++) { 705 for (int i = 0; i < kNThreads; i++) {
709 threads.Add(new IsolateGenesisThread(8, extension_names)); 706 threads.Add(new IsolateGenesisThread(8, extension_names));
710 } 707 }
711 StartJoinAndDeleteThreads(threads); 708 StartJoinAndDeleteThreads(threads);
712 } 709 }
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