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

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

Issue 11414207: Remove unused private member variables found by clang -Wunused-private-field (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 | « test/cctest/test-heap-profiler.cc ('k') | no next file » | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using ::v8::Script; 52 using ::v8::Script;
53 using ::v8::String; 53 using ::v8::String;
54 using ::v8::Value; 54 using ::v8::Value;
55 using ::v8::V8; 55 using ::v8::V8;
56 56
57 57
58 // Migrating an isolate 58 // Migrating an isolate
59 class KangarooThread : public v8::internal::Thread { 59 class KangarooThread : public v8::internal::Thread {
60 public: 60 public:
61 KangarooThread(v8::Isolate* isolate, 61 KangarooThread(v8::Isolate* isolate,
62 v8::Handle<v8::Context> context, int value) 62 v8::Handle<v8::Context> context)
63 : Thread("KangarooThread"), 63 : Thread("KangarooThread"),
64 isolate_(isolate), context_(context), value_(value) { 64 isolate_(isolate), context_(context) {
65 } 65 }
66 66
67 void Run() { 67 void Run() {
68 { 68 {
69 v8::Locker locker(isolate_); 69 v8::Locker locker(isolate_);
70 v8::Isolate::Scope isolate_scope(isolate_); 70 v8::Isolate::Scope isolate_scope(isolate_);
71 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); 71 CHECK_EQ(isolate_, v8::internal::Isolate::Current());
72 v8::HandleScope scope; 72 v8::HandleScope scope;
73 v8::Context::Scope context_scope(context_); 73 v8::Context::Scope context_scope(context_);
74 Local<Value> v = CompileRun("getValue()"); 74 Local<Value> v = CompileRun("getValue()");
75 CHECK(v->IsNumber()); 75 CHECK(v->IsNumber());
76 CHECK_EQ(30, static_cast<int>(v->NumberValue())); 76 CHECK_EQ(30, static_cast<int>(v->NumberValue()));
77 } 77 }
78 { 78 {
79 v8::Locker locker(isolate_); 79 v8::Locker locker(isolate_);
80 v8::Isolate::Scope isolate_scope(isolate_); 80 v8::Isolate::Scope isolate_scope(isolate_);
81 v8::Context::Scope context_scope(context_); 81 v8::Context::Scope context_scope(context_);
82 v8::HandleScope scope; 82 v8::HandleScope scope;
83 Local<Value> v = CompileRun("getValue()"); 83 Local<Value> v = CompileRun("getValue()");
84 CHECK(v->IsNumber()); 84 CHECK(v->IsNumber());
85 CHECK_EQ(30, static_cast<int>(v->NumberValue())); 85 CHECK_EQ(30, static_cast<int>(v->NumberValue()));
86 } 86 }
87 isolate_->Dispose(); 87 isolate_->Dispose();
88 } 88 }
89 89
90 private: 90 private:
91 v8::Isolate* isolate_; 91 v8::Isolate* isolate_;
92 Persistent<v8::Context> context_; 92 Persistent<v8::Context> context_;
93 int value_;
94 }; 93 };
95 94
96 // Migrates an isolate from one thread to another 95 // Migrates an isolate from one thread to another
97 TEST(KangarooIsolates) { 96 TEST(KangarooIsolates) {
98 v8::Isolate* isolate = v8::Isolate::New(); 97 v8::Isolate* isolate = v8::Isolate::New();
99 Persistent<v8::Context> context; 98 Persistent<v8::Context> context;
100 { 99 {
101 v8::Locker locker(isolate); 100 v8::Locker locker(isolate);
102 v8::Isolate::Scope isolate_scope(isolate); 101 v8::Isolate::Scope isolate_scope(isolate);
103 v8::HandleScope handle_scope; 102 v8::HandleScope handle_scope;
104 context = v8::Context::New(); 103 context = v8::Context::New();
105 v8::Context::Scope context_scope(context); 104 v8::Context::Scope context_scope(context);
106 CHECK_EQ(isolate, v8::internal::Isolate::Current()); 105 CHECK_EQ(isolate, v8::internal::Isolate::Current());
107 CompileRun("function getValue() { return 30; }"); 106 CompileRun("function getValue() { return 30; }");
108 } 107 }
109 KangarooThread thread1(isolate, context, 1); 108 KangarooThread thread1(isolate, context);
110 thread1.Start(); 109 thread1.Start();
111 thread1.Join(); 110 thread1.Join();
112 } 111 }
113 112
114 static void CalcFibAndCheck() { 113 static void CalcFibAndCheck() {
115 Local<Value> v = CompileRun("function fib(n) {" 114 Local<Value> v = CompileRun("function fib(n) {"
116 " if (n <= 2) return 1;" 115 " if (n <= 2) return 1;"
117 " return fib(n-1) + fib(n-2);" 116 " return fib(n-1) + fib(n-2);"
118 "}" 117 "}"
119 "fib(10)"); 118 "fib(10)");
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 kSimpleExtensionSource)); 712 kSimpleExtensionSource));
714 const char* extension_names[] = { "test0", "test1", 713 const char* extension_names[] = { "test0", "test1",
715 "test2", "test3", "test4", 714 "test2", "test3", "test4",
716 "test5", "test6", "test7" }; 715 "test5", "test6", "test7" };
717 i::List<JoinableThread*> threads(kNThreads); 716 i::List<JoinableThread*> threads(kNThreads);
718 for (int i = 0; i < kNThreads; i++) { 717 for (int i = 0; i < kNThreads; i++) {
719 threads.Add(new IsolateGenesisThread(8, extension_names)); 718 threads.Add(new IsolateGenesisThread(8, extension_names));
720 } 719 }
721 StartJoinAndDeleteThreads(threads); 720 StartJoinAndDeleteThreads(threads);
722 } 721 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698