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

Side by Side Diff: src/api.cc

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Created 8 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
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 18 matching lines...) Expand all
29 29
30 #include <math.h> // For isnan. 30 #include <math.h> // For isnan.
31 #include <string.h> // For memcpy, strlen. 31 #include <string.h> // For memcpy, strlen.
32 #include "../include/v8-debug.h" 32 #include "../include/v8-debug.h"
33 #include "../include/v8-profiler.h" 33 #include "../include/v8-profiler.h"
34 #include "../include/v8-testing.h" 34 #include "../include/v8-testing.h"
35 #include "bootstrapper.h" 35 #include "bootstrapper.h"
36 #include "compiler.h" 36 #include "compiler.h"
37 #include "conversions-inl.h" 37 #include "conversions-inl.h"
38 #include "counters.h" 38 #include "counters.h"
39 #include "crankshaft-thread.h"
danno 2012/05/22 10:32:19 crankshaft -> optimizing_compiler
39 #include "debug.h" 40 #include "debug.h"
40 #include "deoptimizer.h" 41 #include "deoptimizer.h"
41 #include "execution.h" 42 #include "execution.h"
42 #include "global-handles.h" 43 #include "global-handles.h"
43 #include "heap-profiler.h" 44 #include "heap-profiler.h"
44 #include "messages.h" 45 #include "messages.h"
45 #ifdef COMPRESS_STARTUP_DATA_BZ2 46 #ifdef COMPRESS_STARTUP_DATA_BZ2
46 #include "natives.h" 47 #include "natives.h"
47 #endif 48 #endif
48 #include "parser.h" 49 #include "parser.h"
(...skipping 5321 matching lines...) Expand 10 before | Expand all | Expand 10 after
5370 5371
5371 5372
5372 Isolate* Isolate::New() { 5373 Isolate* Isolate::New() {
5373 i::Isolate* isolate = new i::Isolate(); 5374 i::Isolate* isolate = new i::Isolate();
5374 return reinterpret_cast<Isolate*>(isolate); 5375 return reinterpret_cast<Isolate*>(isolate);
5375 } 5376 }
5376 5377
5377 5378
5378 void Isolate::Dispose() { 5379 void Isolate::Dispose() {
5379 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 5380 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
5381 bool to_lock = false;
5382
5383 if (i::FLAG_concurrent_crankshaft) {
5384 // We need to acquire the Isolate lock before tearing it down
5385 // since the crankshaft thread could be compiling a function in
5386 // this isolate.
5387 to_lock = !isolate->thread_manager()->IsLockedByCurrentThread();
5388 if (to_lock)
5389 isolate->thread_manager()->Lock();
5390 }
5391
5380 if (!ApiCheck(!isolate->IsInUse(), 5392 if (!ApiCheck(!isolate->IsInUse(),
5381 "v8::Isolate::Dispose()", 5393 "v8::Isolate::Dispose()",
5382 "Disposing the isolate that is entered by a thread.")) { 5394 "Disposing the isolate that is entered by a thread.")) {
5383 return; 5395 return;
5384 } 5396 }
5385 isolate->TearDown(); 5397 isolate->TearDown();
danno 2012/05/22 10:32:19 How do you ensure that the compiler thread properl
sanjoy 2012/05/22 11:38:55 V8::TearDown stops the compiler thread.
5398 if (to_lock)
5399 isolate->thread_manager()->Unlock();
5386 } 5400 }
5387 5401
5388 5402
5389 void Isolate::Enter() { 5403 void Isolate::Enter() {
5390 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 5404 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
5391 isolate->Enter(); 5405 isolate->Enter();
5392 } 5406 }
5393 5407
5394 5408
5395 void Isolate::Exit() { 5409 void Isolate::Exit() {
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
6411 6425
6412 6426
6413 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6427 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6414 HandleScopeImplementer* scope_implementer = 6428 HandleScopeImplementer* scope_implementer =
6415 reinterpret_cast<HandleScopeImplementer*>(storage); 6429 reinterpret_cast<HandleScopeImplementer*>(storage);
6416 scope_implementer->IterateThis(v); 6430 scope_implementer->IterateThis(v);
6417 return storage + ArchiveSpacePerThread(); 6431 return storage + ArchiveSpacePerThread();
6418 } 6432 }
6419 6433
6420 } } // namespace v8::internal 6434 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698