Reviewers: Sven Panne,
Description:
Remove usage of Locker/Unlocker where possible.
This is possible because we removed DebuggerAgent.
[email protected]
Please review this at https://codereview.chromium.org/286903004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+24, -62 lines):
M samples/lineprocessor.cc
M src/d8.cc
M src/d8-readline.cc
Index: samples/lineprocessor.cc
diff --git a/samples/lineprocessor.cc b/samples/lineprocessor.cc
index
6f8fd35c76526231994d39cb88093acff73faae0..edb0ba0a1e62ab01f3e32528eebe6196e679ff52
100644
--- a/samples/lineprocessor.cc
+++ b/samples/lineprocessor.cc
@@ -69,25 +69,6 @@ while (true) {
var res = line + " | " + line;
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 {
@@ -113,7 +94,6 @@ int RunMain(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
v8::Isolate* isolate = v8::Isolate::New();
v8::Isolate::Scope isolate_scope(isolate);
- v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::String> script_source;
@@ -224,7 +204,6 @@ bool RunCppCycle(v8::Handle<v8::Script> script,
v8::Local<v8::Context> context,
bool report_exceptions) {
v8::Isolate* isolate = context->GetIsolate();
- v8::Locker lock(isolate);
v8::Handle<v8::String> fun_name =
v8::String::NewFromUtf8(isolate, "ProcessLine");
@@ -382,7 +361,6 @@ v8::Handle<v8::String> ReadLine() {
char* res;
{
- v8::Unlocker unlocker(v8::Isolate::GetCurrent());
res = fgets(buffer, kBufferSize, stdin);
}
v8::Isolate* isolate = v8::Isolate::GetCurrent();
Index: src/d8-readline.cc
diff --git a/src/d8-readline.cc b/src/d8-readline.cc
index
225c6f06a222a1cfe8ac01c9c68b9cde9344406d..a11cf4dc80cd58db1424960b6ec17b8da063f6f0
100644
--- a/src/d8-readline.cc
+++ b/src/d8-readline.cc
@@ -82,10 +82,7 @@ bool ReadLineEditor::Close() {
Handle<String> ReadLineEditor::Prompt(const char* prompt) {
char* result = NULL;
- { // Release lock for blocking input.
- Unlocker unlock(isolate_);
- result = readline(prompt);
- }
+ result = readline(prompt);
if (result == NULL) return Handle<String>();
AddHistory(result);
return String::NewFromUtf8(isolate_, result);
@@ -123,7 +120,6 @@ char* ReadLineEditor::CompletionGenerator(const char*
text, int state) {
static unsigned current_index;
static Persistent<Array> current_completions;
Isolate* isolate = read_line_editor.isolate_;
- Locker lock(isolate);
HandleScope scope(isolate);
Handle<Array> completions;
if (state == 0) {
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index
a467333060ee6635e5cce1aac7b83d6474a72afa..ffc58e6478377f592210946e292b1a72d9337dfe
100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -472,10 +472,7 @@ Handle<String> Shell::ReadFromStdin(Isolate* isolate) {
// not been fully read into the buffer yet (does not end with '\n').
// If fgets gets an error, just give up.
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>();
length = static_cast<int>(strlen(buffer));
if (length == 0) {
@@ -737,7 +734,6 @@ void Shell::AddHistogramSample(void* histogram, int
sample) {
void Shell::InstallUtilityScript(Isolate* isolate) {
- Locker lock(isolate);
HandleScope scope(isolate);
// 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.
@@ -904,7 +900,6 @@ void Shell::Initialize(Isolate* isolate) {
void Shell::InitializeDebugger(Isolate* isolate) {
if (options.test_shell) return;
#ifndef V8_SHARED
- Locker lock(isolate);
HandleScope scope(isolate);
Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
utility_context_.Reset(isolate,
@@ -1031,8 +1026,6 @@ static FILE* FOpen(const char* path, const char*
mode) {
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");
if (file == NULL) return NULL;
@@ -1112,7 +1105,6 @@ Handle<String> Shell::ReadFile(Isolate* isolate,
const char* name) {
void Shell::RunShell(Isolate* isolate) {
- Locker locker(isolate);
HandleScope outer_scope(isolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate, evaluation_context_);
@@ -1204,7 +1196,6 @@ void SourceGroup::ExecuteInThread() {
next_semaphore_.Wait();
{
Isolate::Scope iscope(isolate);
- Locker lock(isolate);
{
HandleScope scope(isolate);
PerIsolateData data(isolate);
@@ -1351,34 +1342,31 @@ int Shell::RunMain(Isolate* isolate, int argc,
char* argv[]) {
options.isolate_sources[i].StartExecuteInThread();
}
#endif // !V8_SHARED
- { // NOLINT
- Locker lock(isolate);
- {
- HandleScope scope(isolate);
- Local<Context> context = CreateEvaluationContext(isolate);
- if (options.last_run) {
- // Keep using the same context in the interactive shell.
- evaluation_context_.Reset(isolate, context);
+ {
+ HandleScope scope(isolate);
+ Local<Context> context = CreateEvaluationContext(isolate);
+ if (options.last_run) {
+ // Keep using the same context in the interactive shell.
+ evaluation_context_.Reset(isolate, context);
#ifndef V8_SHARED
- // If the interactive debugger is enabled make sure to activate
- // it before running the files passed on the command line.
- if (i::FLAG_debugger) {
- InstallUtilityScript(isolate);
- }
-#endif // !V8_SHARED
- }
- {
- Context::Scope cscope(context);
- PerIsolateData::RealmScope
realm_scope(PerIsolateData::Get(isolate));
- options.isolate_sources[0].Execute(isolate);
+ // If the interactive debugger is enabled make sure to activate
+ // it before running the files passed on the command line.
+ if (i::FLAG_debugger) {
+ InstallUtilityScript(isolate);
}
+#endif // !V8_SHARED
}
- if (!options.last_run) {
- if (options.send_idle_notification) {
- const int kLongIdlePauseInMs = 1000;
- V8::ContextDisposedNotification();
- V8::IdleNotification(kLongIdlePauseInMs);
- }
+ {
+ Context::Scope cscope(context);
+ PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate));
+ options.isolate_sources[0].Execute(isolate);
+ }
+ }
+ if (!options.last_run) {
+ if (options.send_idle_notification) {
+ const int kLongIdlePauseInMs = 1000;
+ V8::ContextDisposedNotification();
+ V8::IdleNotification(kLongIdlePauseInMs);
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.