Commit 8b785bd3 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Remove usage of Locker/Unlocker where possible.

This is possible because we removed DebuggerAgent.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/286903004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21424 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e56594f1
...@@ -69,25 +69,6 @@ while (true) { ...@@ -69,25 +69,6 @@ while (true) {
var res = line + " | " + line; var res = line + " | " + line;
print(res); print(res);
} }
*
* When run with "-p" argument, the program starts V8 Debugger Agent and
* allows remote debugger to attach and debug JavaScript code.
*
* Interesting aspects:
* 1. Wait for remote debugger to attach
* Normally the program compiles custom script and immediately runs it.
* If programmer needs to debug script from the very beginning, he should
* run this sample program with "--wait-for-connection" command line parameter.
* This way V8 will suspend on the first statement and wait for
* debugger to attach.
*
* 2. Unresponsive V8
* V8 Debugger Agent holds a connection with remote debugger, but it does
* respond only when V8 is running some script. In particular, when this program
* is waiting for input, all requests from debugger get deferred until V8
* is called again. See how "--callback" command-line parameter in this sample
* fixes this issue.
*/ */
enum MainCycleType { enum MainCycleType {
...@@ -113,7 +94,6 @@ int RunMain(int argc, char* argv[]) { ...@@ -113,7 +94,6 @@ int RunMain(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
v8::Isolate* isolate = v8::Isolate::New(); v8::Isolate* isolate = v8::Isolate::New();
v8::Isolate::Scope isolate_scope(isolate); v8::Isolate::Scope isolate_scope(isolate);
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::String> script_source; v8::Handle<v8::String> script_source;
...@@ -224,7 +204,6 @@ bool RunCppCycle(v8::Handle<v8::Script> script, ...@@ -224,7 +204,6 @@ bool RunCppCycle(v8::Handle<v8::Script> script,
v8::Local<v8::Context> context, v8::Local<v8::Context> context,
bool report_exceptions) { bool report_exceptions) {
v8::Isolate* isolate = context->GetIsolate(); v8::Isolate* isolate = context->GetIsolate();
v8::Locker lock(isolate);
v8::Handle<v8::String> fun_name = v8::Handle<v8::String> fun_name =
v8::String::NewFromUtf8(isolate, "ProcessLine"); v8::String::NewFromUtf8(isolate, "ProcessLine");
...@@ -382,7 +361,6 @@ v8::Handle<v8::String> ReadLine() { ...@@ -382,7 +361,6 @@ v8::Handle<v8::String> ReadLine() {
char* res; char* res;
{ {
v8::Unlocker unlocker(v8::Isolate::GetCurrent());
res = fgets(buffer, kBufferSize, stdin); res = fgets(buffer, kBufferSize, stdin);
} }
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
......
...@@ -82,10 +82,7 @@ bool ReadLineEditor::Close() { ...@@ -82,10 +82,7 @@ bool ReadLineEditor::Close() {
Handle<String> ReadLineEditor::Prompt(const char* prompt) { Handle<String> ReadLineEditor::Prompt(const char* prompt) {
char* result = NULL; char* result = NULL;
{ // Release lock for blocking input.
Unlocker unlock(isolate_);
result = readline(prompt); result = readline(prompt);
}
if (result == NULL) return Handle<String>(); if (result == NULL) return Handle<String>();
AddHistory(result); AddHistory(result);
return String::NewFromUtf8(isolate_, result); return String::NewFromUtf8(isolate_, result);
...@@ -123,7 +120,6 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) { ...@@ -123,7 +120,6 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
static unsigned current_index; static unsigned current_index;
static Persistent<Array> current_completions; static Persistent<Array> current_completions;
Isolate* isolate = read_line_editor.isolate_; Isolate* isolate = read_line_editor.isolate_;
Locker lock(isolate);
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Array> completions; Handle<Array> completions;
if (state == 0) { if (state == 0) {
......
...@@ -472,10 +472,7 @@ Handle<String> Shell::ReadFromStdin(Isolate* isolate) { ...@@ -472,10 +472,7 @@ Handle<String> Shell::ReadFromStdin(Isolate* isolate) {
// not been fully read into the buffer yet (does not end with '\n'). // not been fully read into the buffer yet (does not end with '\n').
// If fgets gets an error, just give up. // If fgets gets an error, just give up.
char* input = NULL; char* input = NULL;
{ // Release lock for blocking input.
Unlocker unlock(isolate);
input = fgets(buffer, kBufferSize, stdin); input = fgets(buffer, kBufferSize, stdin);
}
if (input == NULL) return Handle<String>(); if (input == NULL) return Handle<String>();
length = static_cast<int>(strlen(buffer)); length = static_cast<int>(strlen(buffer));
if (length == 0) { if (length == 0) {
...@@ -737,7 +734,6 @@ void Shell::AddHistogramSample(void* histogram, int sample) { ...@@ -737,7 +734,6 @@ void Shell::AddHistogramSample(void* histogram, int sample) {
void Shell::InstallUtilityScript(Isolate* isolate) { void Shell::InstallUtilityScript(Isolate* isolate) {
Locker lock(isolate);
HandleScope scope(isolate); HandleScope scope(isolate);
// If we use the utility context, we have to set the security tokens so that // If we use the utility context, we have to set the security tokens so that
// utility, evaluation and debug context can all access each other. // utility, evaluation and debug context can all access each other.
...@@ -904,7 +900,6 @@ void Shell::Initialize(Isolate* isolate) { ...@@ -904,7 +900,6 @@ void Shell::Initialize(Isolate* isolate) {
void Shell::InitializeDebugger(Isolate* isolate) { void Shell::InitializeDebugger(Isolate* isolate) {
if (options.test_shell) return; if (options.test_shell) return;
#ifndef V8_SHARED #ifndef V8_SHARED
Locker lock(isolate);
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
utility_context_.Reset(isolate, utility_context_.Reset(isolate,
...@@ -1031,8 +1026,6 @@ static FILE* FOpen(const char* path, const char* mode) { ...@@ -1031,8 +1026,6 @@ static FILE* FOpen(const char* path, const char* mode) {
static char* ReadChars(Isolate* isolate, const char* name, int* size_out) { static char* ReadChars(Isolate* isolate, const char* name, int* size_out) {
// Release the V8 lock while reading files.
v8::Unlocker unlocker(isolate);
FILE* file = FOpen(name, "rb"); FILE* file = FOpen(name, "rb");
if (file == NULL) return NULL; if (file == NULL) return NULL;
...@@ -1112,7 +1105,6 @@ Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { ...@@ -1112,7 +1105,6 @@ Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) {
void Shell::RunShell(Isolate* isolate) { void Shell::RunShell(Isolate* isolate) {
Locker locker(isolate);
HandleScope outer_scope(isolate); HandleScope outer_scope(isolate);
v8::Local<v8::Context> context = v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate, evaluation_context_); v8::Local<v8::Context>::New(isolate, evaluation_context_);
...@@ -1204,7 +1196,6 @@ void SourceGroup::ExecuteInThread() { ...@@ -1204,7 +1196,6 @@ void SourceGroup::ExecuteInThread() {
next_semaphore_.Wait(); next_semaphore_.Wait();
{ {
Isolate::Scope iscope(isolate); Isolate::Scope iscope(isolate);
Locker lock(isolate);
{ {
HandleScope scope(isolate); HandleScope scope(isolate);
PerIsolateData data(isolate); PerIsolateData data(isolate);
...@@ -1351,8 +1342,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { ...@@ -1351,8 +1342,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
options.isolate_sources[i].StartExecuteInThread(); options.isolate_sources[i].StartExecuteInThread();
} }
#endif // !V8_SHARED #endif // !V8_SHARED
{ // NOLINT
Locker lock(isolate);
{ {
HandleScope scope(isolate); HandleScope scope(isolate);
Local<Context> context = CreateEvaluationContext(isolate); Local<Context> context = CreateEvaluationContext(isolate);
...@@ -1380,7 +1369,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { ...@@ -1380,7 +1369,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
V8::IdleNotification(kLongIdlePauseInMs); V8::IdleNotification(kLongIdlePauseInMs);
} }
} }
}
#ifndef V8_SHARED #ifndef V8_SHARED
for (int i = 1; i < options.num_isolates; ++i) { for (int i = 1; i < options.num_isolates; ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment