mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:10:27 +00:00
Remove some Isolate::current_zone() calls, as it gets the zone from mutator thread not the current thread
BUG= R=zra@google.com Review URL: https://codereview.chromium.org/1414493003 .
This commit is contained in:
parent
78c7cde132
commit
465cf10a7c
|
@ -21,7 +21,7 @@ DEFINE_NATIVE_ENTRY(Bool_fromEnvironment, 3) {
|
||||||
GET_NATIVE_ARGUMENT(Bool, default_value, arguments->NativeArgAt(2));
|
GET_NATIVE_ARGUMENT(Bool, default_value, arguments->NativeArgAt(2));
|
||||||
// Call the embedder to supply us with the environment.
|
// Call the embedder to supply us with the environment.
|
||||||
const String& env_value =
|
const String& env_value =
|
||||||
String::Handle(Api::CallEnvironmentCallback(isolate, name));
|
String::Handle(Api::CallEnvironmentCallback(thread, name));
|
||||||
if (!env_value.IsNull()) {
|
if (!env_value.IsNull()) {
|
||||||
if (Symbols::True().Equals(env_value)) {
|
if (Symbols::True().Equals(env_value)) {
|
||||||
return Bool::True().raw();
|
return Bool::True().raw();
|
||||||
|
|
|
@ -237,7 +237,7 @@ DEFINE_NATIVE_ENTRY(Integer_fromEnvironment, 3) {
|
||||||
GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2));
|
GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2));
|
||||||
// Call the embedder to supply us with the environment.
|
// Call the embedder to supply us with the environment.
|
||||||
const String& env_value =
|
const String& env_value =
|
||||||
String::Handle(Api::CallEnvironmentCallback(isolate, name));
|
String::Handle(Api::CallEnvironmentCallback(thread, name));
|
||||||
if (!env_value.IsNull()) {
|
if (!env_value.IsNull()) {
|
||||||
const Integer& result = Integer::Handle(ParseInteger(env_value));
|
const Integer& result = Integer::Handle(ParseInteger(env_value));
|
||||||
if (!result.IsNull()) {
|
if (!result.IsNull()) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ DEFINE_NATIVE_ENTRY(String_fromEnvironment, 3) {
|
||||||
GET_NATIVE_ARGUMENT(String, default_value, arguments->NativeArgAt(2));
|
GET_NATIVE_ARGUMENT(String, default_value, arguments->NativeArgAt(2));
|
||||||
// Call the embedder to supply us with the environment.
|
// Call the embedder to supply us with the environment.
|
||||||
const String& env_value =
|
const String& env_value =
|
||||||
String::Handle(Api::CallEnvironmentCallback(isolate, name));
|
String::Handle(Api::CallEnvironmentCallback(thread, name));
|
||||||
if (!env_value.IsNull()) {
|
if (!env_value.IsNull()) {
|
||||||
return Symbols::New(env_value);
|
return Symbols::New(env_value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ BENCHMARK(CorelibCompileAll) {
|
||||||
bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
|
bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
|
||||||
Timer timer(true, "Compile all of Core lib benchmark");
|
Timer timer(true, "Compile all of Core lib benchmark");
|
||||||
timer.Start();
|
timer.Start();
|
||||||
const Error& error = Error::Handle(benchmark->isolate()->current_zone(),
|
const Error& error = Error::Handle(Library::CompileAll());
|
||||||
Library::CompileAll());
|
|
||||||
if (!error.IsNull()) {
|
if (!error.IsNull()) {
|
||||||
OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
|
OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
|
||||||
error.ToErrorCString());
|
error.ToErrorCString());
|
||||||
|
@ -61,8 +60,7 @@ BENCHMARK(CorelibCompilerStats) {
|
||||||
stats->EnableBenchmark();
|
stats->EnableBenchmark();
|
||||||
Timer timer(true, "Compiler stats compiling all of Core lib");
|
Timer timer(true, "Compiler stats compiling all of Core lib");
|
||||||
timer.Start();
|
timer.Start();
|
||||||
const Error& error = Error::Handle(benchmark->isolate()->current_zone(),
|
const Error& error = Error::Handle(Library::CompileAll());
|
||||||
Library::CompileAll());
|
|
||||||
if (!error.IsNull()) {
|
if (!error.IsNull()) {
|
||||||
OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
|
OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
|
||||||
error.ToErrorCString());
|
error.ToErrorCString());
|
||||||
|
|
|
@ -1452,7 +1452,7 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
|
||||||
// prevent recursive triggering of function optimization.
|
// prevent recursive triggering of function optimization.
|
||||||
function.set_usage_counter(0);
|
function.set_usage_counter(0);
|
||||||
if (FLAG_background_compilation) {
|
if (FLAG_background_compilation) {
|
||||||
BackgroundCompiler::EnsureInit(isolate);
|
BackgroundCompiler::EnsureInit(thread);
|
||||||
ASSERT(isolate->background_compiler() != NULL);
|
ASSERT(isolate->background_compiler() != NULL);
|
||||||
isolate->background_compiler()->CompileOptimized(function);
|
isolate->background_compiler()->CompileOptimized(function);
|
||||||
// Continue in the same code.
|
// Continue in the same code.
|
||||||
|
|
|
@ -1569,15 +1569,16 @@ void BackgroundCompiler::Stop(BackgroundCompiler* task) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BackgroundCompiler::EnsureInit(Isolate* isolate) {
|
void BackgroundCompiler::EnsureInit(Thread* thread) {
|
||||||
bool start_task = false;
|
bool start_task = false;
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
{
|
{
|
||||||
MutexLocker ml(isolate->mutex());
|
MutexLocker ml(isolate->mutex());
|
||||||
if (isolate->background_compiler() == NULL) {
|
if (isolate->background_compiler() == NULL) {
|
||||||
BackgroundCompiler* task = new BackgroundCompiler(isolate);
|
BackgroundCompiler* task = new BackgroundCompiler(isolate);
|
||||||
isolate->set_background_compiler(task);
|
isolate->set_background_compiler(task);
|
||||||
isolate->set_background_compilation_queue(GrowableObjectArray::Handle(
|
isolate->set_background_compilation_queue(GrowableObjectArray::Handle(
|
||||||
isolate->current_zone(), GrowableObjectArray::New()));
|
thread->zone(), GrowableObjectArray::New()));
|
||||||
start_task = true;
|
start_task = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ class Compiler : public AllStatic {
|
||||||
// isolate.
|
// isolate.
|
||||||
class BackgroundCompiler : public ThreadPool::Task {
|
class BackgroundCompiler : public ThreadPool::Task {
|
||||||
public:
|
public:
|
||||||
static void EnsureInit(Isolate* isolate);
|
static void EnsureInit(Thread* thread);
|
||||||
|
|
||||||
static void Stop(BackgroundCompiler* task);
|
static void Stop(BackgroundCompiler* task);
|
||||||
|
|
||||||
|
|
|
@ -4966,17 +4966,18 @@ DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args,
|
||||||
|
|
||||||
|
|
||||||
// --- Environment ---
|
// --- Environment ---
|
||||||
RawString* Api::CallEnvironmentCallback(Isolate* isolate, const String& name) {
|
RawString* Api::CallEnvironmentCallback(Thread* thread, const String& name) {
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
Scope api_scope(isolate);
|
Scope api_scope(isolate);
|
||||||
Dart_EnvironmentCallback callback = isolate->environment_callback();
|
Dart_EnvironmentCallback callback = isolate->environment_callback();
|
||||||
String& result = String::Handle(isolate->current_zone());
|
String& result = String::Handle(thread->zone());
|
||||||
if (callback != NULL) {
|
if (callback != NULL) {
|
||||||
Dart_Handle response = callback(Api::NewHandle(isolate, name.raw()));
|
Dart_Handle response = callback(Api::NewHandle(isolate, name.raw()));
|
||||||
if (::Dart_IsString(response)) {
|
if (::Dart_IsString(response)) {
|
||||||
result ^= Api::UnwrapHandle(response);
|
result ^= Api::UnwrapHandle(response);
|
||||||
} else if (::Dart_IsError(response)) {
|
} else if (::Dart_IsError(response)) {
|
||||||
const Object& error =
|
const Object& error = Object::Handle(
|
||||||
Object::Handle(isolate->current_zone(), Api::UnwrapHandle(response));
|
thread->zone(), Api::UnwrapHandle(response));
|
||||||
Exceptions::ThrowArgumentError(
|
Exceptions::ThrowArgumentError(
|
||||||
String::Handle(String::New(Error::Cast(error).ToErrorCString())));
|
String::Handle(String::New(Error::Cast(error).ToErrorCString())));
|
||||||
} else if (!::Dart_IsNull(response)) {
|
} else if (!::Dart_IsNull(response)) {
|
||||||
|
@ -5052,7 +5053,7 @@ DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(
|
||||||
// NOTE: Need to pass 'result' as a parameter here in order to avoid
|
// NOTE: Need to pass 'result' as a parameter here in order to avoid
|
||||||
// warning: variable 'result' might be clobbered by 'longjmp' or 'vfork'
|
// warning: variable 'result' might be clobbered by 'longjmp' or 'vfork'
|
||||||
// which shows up because of the use of setjmp.
|
// which shows up because of the use of setjmp.
|
||||||
static void CompileSource(Isolate* isolate,
|
static void CompileSource(Thread* thread,
|
||||||
const Library& lib,
|
const Library& lib,
|
||||||
const Script& script,
|
const Script& script,
|
||||||
Dart_Handle* result) {
|
Dart_Handle* result) {
|
||||||
|
@ -5061,13 +5062,13 @@ static void CompileSource(Isolate* isolate,
|
||||||
if (update_lib_status) {
|
if (update_lib_status) {
|
||||||
lib.SetLoadInProgress();
|
lib.SetLoadInProgress();
|
||||||
}
|
}
|
||||||
ASSERT(isolate != NULL);
|
ASSERT(thread != NULL);
|
||||||
const Error& error =
|
const Error& error =
|
||||||
Error::Handle(isolate->current_zone(), Compiler::Compile(lib, script));
|
Error::Handle(thread->zone(), Compiler::Compile(lib, script));
|
||||||
if (error.IsNull()) {
|
if (error.IsNull()) {
|
||||||
*result = Api::NewHandle(isolate, lib.raw());
|
*result = Api::NewHandle(thread->isolate(), lib.raw());
|
||||||
} else {
|
} else {
|
||||||
*result = Api::NewHandle(isolate, error.raw());
|
*result = Api::NewHandle(thread->isolate(), error.raw());
|
||||||
// Compilation errors are not Dart instances, so just mark the library
|
// Compilation errors are not Dart instances, so just mark the library
|
||||||
// as having failed to load without providing an error instance.
|
// as having failed to load without providing an error instance.
|
||||||
lib.SetLoadError(Object::null_instance());
|
lib.SetLoadError(Object::null_instance());
|
||||||
|
@ -5116,7 +5117,7 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
|
||||||
Script::New(url_str, source_str, RawScript::kScriptTag));
|
Script::New(url_str, source_str, RawScript::kScriptTag));
|
||||||
script.SetLocationOffset(line_offset, column_offset);
|
script.SetLocationOffset(line_offset, column_offset);
|
||||||
Dart_Handle result;
|
Dart_Handle result;
|
||||||
CompileSource(I, library, script, &result);
|
CompileSource(T, library, script, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5361,7 +5362,7 @@ DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
|
||||||
Script::New(url_str, source_str, RawScript::kLibraryTag));
|
Script::New(url_str, source_str, RawScript::kLibraryTag));
|
||||||
script.SetLocationOffset(line_offset, column_offset);
|
script.SetLocationOffset(line_offset, column_offset);
|
||||||
Dart_Handle result;
|
Dart_Handle result;
|
||||||
CompileSource(I, library, script, &result);
|
CompileSource(T, library, script, &result);
|
||||||
// Propagate the error out right now.
|
// Propagate the error out right now.
|
||||||
if (::Dart_IsError(result)) {
|
if (::Dart_IsError(result)) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -5456,7 +5457,7 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
|
||||||
Script::New(url_str, source_str, RawScript::kSourceTag));
|
Script::New(url_str, source_str, RawScript::kSourceTag));
|
||||||
script.SetLocationOffset(line_offset, column_offset);
|
script.SetLocationOffset(line_offset, column_offset);
|
||||||
Dart_Handle result;
|
Dart_Handle result;
|
||||||
CompileSource(I, lib, script, &result);
|
CompileSource(T, lib, script, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5485,7 +5486,7 @@ DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library,
|
||||||
const Script& script = Script::Handle(Z,
|
const Script& script = Script::Handle(Z,
|
||||||
Script::New(url_str, source_str, RawScript::kPatchTag));
|
Script::New(url_str, source_str, RawScript::kPatchTag));
|
||||||
Dart_Handle result;
|
Dart_Handle result;
|
||||||
CompileSource(I, lib, script, &result);
|
CompileSource(T, lib, script, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ class Api : AllStatic {
|
||||||
static void SetWeakHandleReturnValue(NativeArguments* args,
|
static void SetWeakHandleReturnValue(NativeArguments* args,
|
||||||
Dart_WeakPersistentHandle retval);
|
Dart_WeakPersistentHandle retval);
|
||||||
|
|
||||||
static RawString* CallEnvironmentCallback(Isolate* isolate,
|
static RawString* CallEnvironmentCallback(Thread* thread,
|
||||||
const String& name);
|
const String& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -2402,10 +2402,10 @@ void Debugger::CollectLibraryFields(const GrowableObjectArray& field_list,
|
||||||
const String& prefix,
|
const String& prefix,
|
||||||
bool include_private_fields) {
|
bool include_private_fields) {
|
||||||
DictionaryIterator it(lib);
|
DictionaryIterator it(lib);
|
||||||
Object& entry = Object::Handle(isolate_->current_zone());
|
Object& entry = Object::Handle(zone());
|
||||||
Field& field = Field::Handle(zone());
|
Field& field = Field::Handle(zone());
|
||||||
String& field_name = String::Handle(zone());
|
String& field_name = String::Handle(zone());
|
||||||
PassiveObject& field_value = PassiveObject::Handle(isolate_->current_zone());
|
PassiveObject& field_value = PassiveObject::Handle(zone());
|
||||||
while (it.HasNext()) {
|
while (it.HasNext()) {
|
||||||
entry = it.GetNext();
|
entry = it.GetNext();
|
||||||
if (entry.IsField()) {
|
if (entry.IsField()) {
|
||||||
|
|
|
@ -650,7 +650,10 @@ class Debugger {
|
||||||
|
|
||||||
void HandleSteppingRequest(DebuggerStackTrace* stack_trace);
|
void HandleSteppingRequest(DebuggerStackTrace* stack_trace);
|
||||||
|
|
||||||
Zone* zone() const { return isolate_->current_zone(); }
|
Zone* zone() const {
|
||||||
|
ASSERT(isolate_->MutatorThreadIsCurrentThread());
|
||||||
|
return isolate_->current_zone();
|
||||||
|
}
|
||||||
|
|
||||||
Isolate* isolate_;
|
Isolate* isolate_;
|
||||||
Dart_Port isolate_id_; // A unique ID for the isolate in the debugger.
|
Dart_Port isolate_id_; // A unique ID for the isolate in the debugger.
|
||||||
|
|
|
@ -217,7 +217,7 @@ const char* IsolateMessageHandler::name() const {
|
||||||
// [ OOB dispatch, Isolate library dispatch, <message specific data> ]
|
// [ OOB dispatch, Isolate library dispatch, <message specific data> ]
|
||||||
RawError* IsolateMessageHandler::HandleLibMessage(const Array& message) {
|
RawError* IsolateMessageHandler::HandleLibMessage(const Array& message) {
|
||||||
if (message.Length() < 2) return Error::null();
|
if (message.Length() < 2) return Error::null();
|
||||||
Zone* zone = I->current_zone();
|
Zone* zone = T->zone();
|
||||||
const Object& type = Object::Handle(zone, message.At(1));
|
const Object& type = Object::Handle(zone, message.At(1));
|
||||||
if (!type.IsSmi()) return Error::null();
|
if (!type.IsSmi()) return Error::null();
|
||||||
const intptr_t msg_type = Smi::Cast(type).Value();
|
const intptr_t msg_type = Smi::Cast(type).Value();
|
||||||
|
@ -640,10 +640,10 @@ MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the error and stacktrace strings for the error message.
|
// Generate the error and stacktrace strings for the error message.
|
||||||
String& exc_str = String::Handle(I->current_zone());
|
String& exc_str = String::Handle(T->zone());
|
||||||
String& stacktrace_str = String::Handle(I->current_zone());
|
String& stacktrace_str = String::Handle(T->zone());
|
||||||
if (result.IsUnhandledException()) {
|
if (result.IsUnhandledException()) {
|
||||||
Zone* zone = I->current_zone();
|
Zone* zone = T->zone();
|
||||||
const UnhandledException& uhe = UnhandledException::Cast(result);
|
const UnhandledException& uhe = UnhandledException::Cast(result);
|
||||||
const Instance& exception = Instance::Handle(zone, uhe.exception());
|
const Instance& exception = Instance::Handle(zone, uhe.exception());
|
||||||
Object& tmp = Object::Handle(zone);
|
Object& tmp = Object::Handle(zone);
|
||||||
|
@ -1887,8 +1887,7 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
|
||||||
vm_tag_counters()->PrintToJSONObject(&tagCounters);
|
vm_tag_counters()->PrintToJSONObject(&tagCounters);
|
||||||
}
|
}
|
||||||
if (object_store()->sticky_error() != Object::null()) {
|
if (object_store()->sticky_error() != Object::null()) {
|
||||||
Error& error = Error::Handle(current_zone(),
|
Error& error = Error::Handle(object_store()->sticky_error());
|
||||||
object_store()->sticky_error());
|
|
||||||
ASSERT(!error.IsNull());
|
ASSERT(!error.IsNull());
|
||||||
jsobj.AddProperty("error", error, false);
|
jsobj.AddProperty("error", error, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,14 +69,13 @@ DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id) {
|
||||||
|
|
||||||
// --- Verification tools ---
|
// --- Verification tools ---
|
||||||
|
|
||||||
static void CompileAll(Isolate* isolate, Dart_Handle* result) {
|
static void CompileAll(Thread* thread, Dart_Handle* result) {
|
||||||
ASSERT(isolate != NULL);
|
ASSERT(thread != NULL);
|
||||||
const Error& error =
|
const Error& error = Error::Handle(thread->zone(), Library::CompileAll());
|
||||||
Error::Handle(isolate->current_zone(), Library::CompileAll());
|
|
||||||
if (error.IsNull()) {
|
if (error.IsNull()) {
|
||||||
*result = Api::Success();
|
*result = Api::Success();
|
||||||
} else {
|
} else {
|
||||||
*result = Api::NewHandle(isolate, error.raw());
|
*result = Api::NewHandle(thread->isolate(), error.raw());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ DART_EXPORT Dart_Handle Dart_CompileAll() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
CHECK_CALLBACK_STATE(T);
|
CHECK_CALLBACK_STATE(T);
|
||||||
CompileAll(I, &result);
|
CompileAll(T, &result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17641,7 +17641,7 @@ bool Bigint::CheckAndCanonicalizeFields(const char** error_str) const {
|
||||||
ASSERT(!digits_.IsNull());
|
ASSERT(!digits_.IsNull());
|
||||||
set_digits(digits_);
|
set_digits(digits_);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(digits() == TypedData::EmptyUint32Array(Isolate::Current()));
|
ASSERT(digits() == TypedData::EmptyUint32Array(Thread::Current()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17663,7 +17663,7 @@ RawBigint* Bigint::New(Heap::Space space) {
|
||||||
result.SetNeg(false);
|
result.SetNeg(false);
|
||||||
result.SetUsed(0);
|
result.SetUsed(0);
|
||||||
result.set_digits(
|
result.set_digits(
|
||||||
TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate)));
|
TypedData::Handle(zone, TypedData::EmptyUint32Array(thread)));
|
||||||
return result.raw();
|
return result.raw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17697,7 +17697,7 @@ RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits,
|
||||||
} else {
|
} else {
|
||||||
neg = false;
|
neg = false;
|
||||||
result.set_digits(
|
result.set_digits(
|
||||||
TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate)));
|
TypedData::Handle(zone, TypedData::EmptyUint32Array(thread)));
|
||||||
}
|
}
|
||||||
result.SetNeg(neg);
|
result.SetNeg(neg);
|
||||||
result.SetUsed(used);
|
result.SetUsed(used);
|
||||||
|
@ -20920,14 +20920,16 @@ RawTypedData* TypedData::New(intptr_t class_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RawTypedData* TypedData::EmptyUint32Array(Isolate* isolate) {
|
RawTypedData* TypedData::EmptyUint32Array(Thread* thread) {
|
||||||
|
ASSERT(thread != NULL);
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
ASSERT(isolate != NULL);
|
ASSERT(isolate != NULL);
|
||||||
ASSERT(isolate->object_store() != NULL);
|
ASSERT(isolate->object_store() != NULL);
|
||||||
if (isolate->object_store()->empty_uint32_array() != TypedData::null()) {
|
if (isolate->object_store()->empty_uint32_array() != TypedData::null()) {
|
||||||
// Already created.
|
// Already created.
|
||||||
return isolate->object_store()->empty_uint32_array();
|
return isolate->object_store()->empty_uint32_array();
|
||||||
}
|
}
|
||||||
const TypedData& array = TypedData::Handle(isolate->current_zone(),
|
const TypedData& array = TypedData::Handle(thread->zone(),
|
||||||
TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld));
|
TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld));
|
||||||
isolate->object_store()->set_empty_uint32_array(array);
|
isolate->object_store()->set_empty_uint32_array(array);
|
||||||
return array.raw();
|
return array.raw();
|
||||||
|
@ -21590,10 +21592,11 @@ void UserTag::MakeActive() const {
|
||||||
|
|
||||||
|
|
||||||
RawUserTag* UserTag::New(const String& label, Heap::Space space) {
|
RawUserTag* UserTag::New(const String& label, Heap::Space space) {
|
||||||
Isolate* isolate = Isolate::Current();
|
Thread* thread = Thread::Current();
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
||||||
// Canonicalize by name.
|
// Canonicalize by name.
|
||||||
UserTag& result = UserTag::Handle(FindTagInIsolate(isolate, label));
|
UserTag& result = UserTag::Handle(FindTagInIsolate(thread, label));
|
||||||
if (!result.IsNull()) {
|
if (!result.IsNull()) {
|
||||||
// Tag already exists, return existing instance.
|
// Tag already exists, return existing instance.
|
||||||
return result.raw();
|
return result.raw();
|
||||||
|
@ -21615,7 +21618,7 @@ RawUserTag* UserTag::New(const String& label, Heap::Space space) {
|
||||||
result ^= raw;
|
result ^= raw;
|
||||||
}
|
}
|
||||||
result.set_label(label);
|
result.set_label(label);
|
||||||
AddTagToIsolate(isolate, result);
|
AddTagToIsolate(thread, result);
|
||||||
return result.raw();
|
return result.raw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21638,12 +21641,14 @@ RawUserTag* UserTag::DefaultTag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) {
|
RawUserTag* UserTag::FindTagInIsolate(Thread* thread, const String& label) {
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
|
Zone* zone = thread->zone();
|
||||||
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
||||||
const GrowableObjectArray& tag_table = GrowableObjectArray::Handle(
|
const GrowableObjectArray& tag_table = GrowableObjectArray::Handle(
|
||||||
isolate->current_zone(), isolate->tag_table());
|
zone, isolate->tag_table());
|
||||||
UserTag& other = UserTag::Handle(isolate->current_zone());
|
UserTag& other = UserTag::Handle(zone);
|
||||||
String& tag_label = String::Handle(isolate->current_zone());
|
String& tag_label = String::Handle(zone);
|
||||||
for (intptr_t i = 0; i < tag_table.Length(); i++) {
|
for (intptr_t i = 0; i < tag_table.Length(); i++) {
|
||||||
other ^= tag_table.At(i);
|
other ^= tag_table.At(i);
|
||||||
ASSERT(!other.IsNull());
|
ASSERT(!other.IsNull());
|
||||||
|
@ -21657,10 +21662,12 @@ RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UserTag::AddTagToIsolate(Isolate* isolate, const UserTag& tag) {
|
void UserTag::AddTagToIsolate(Thread* thread, const UserTag& tag) {
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
|
Zone* zone = thread->zone();
|
||||||
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
ASSERT(isolate->tag_table() != GrowableObjectArray::null());
|
||||||
const GrowableObjectArray& tag_table = GrowableObjectArray::Handle(
|
const GrowableObjectArray& tag_table = GrowableObjectArray::Handle(
|
||||||
isolate->current_zone(), isolate->tag_table());
|
zone, isolate->tag_table());
|
||||||
ASSERT(!TagTableIsFull(isolate));
|
ASSERT(!TagTableIsFull(isolate));
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
// Verify that no existing tag has the same tag id.
|
// Verify that no existing tag has the same tag id.
|
||||||
|
|
|
@ -7208,7 +7208,7 @@ class TypedData : public Instance {
|
||||||
return RawObject::IsTypedDataClassId(cid);
|
return RawObject::IsTypedDataClassId(cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RawTypedData* EmptyUint32Array(Isolate* isolate);
|
static RawTypedData* EmptyUint32Array(Thread* thread);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetLength(intptr_t value) const {
|
void SetLength(intptr_t value) const {
|
||||||
|
@ -7978,8 +7978,8 @@ class UserTag : public Instance {
|
||||||
static RawUserTag* FindTagById(uword tag_id);
|
static RawUserTag* FindTagById(uword tag_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static RawUserTag* FindTagInIsolate(Isolate* isolate, const String& label);
|
static RawUserTag* FindTagInIsolate(Thread* thread, const String& label);
|
||||||
static void AddTagToIsolate(Isolate* isolate, const UserTag& tag);
|
static void AddTagToIsolate(Thread* thread, const UserTag& tag);
|
||||||
|
|
||||||
void set_label(const String& tag_label) const {
|
void set_label(const String& tag_label) const {
|
||||||
StorePointer(&raw_ptr()->label_, tag_label.raw());
|
StorePointer(&raw_ptr()->label_, tag_label.raw());
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ static bool ContainsNonInstance(const Object& obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static RawObject* LookupObjectId(Isolate* isolate,
|
static RawObject* LookupObjectId(Thread* thread,
|
||||||
const char* arg,
|
const char* arg,
|
||||||
ObjectIdRing::LookupResult* kind) {
|
ObjectIdRing::LookupResult* kind) {
|
||||||
*kind = ObjectIdRing::kValid;
|
*kind = ObjectIdRing::kValid;
|
||||||
|
@ -1113,7 +1113,7 @@ static RawObject* LookupObjectId(Isolate* isolate,
|
||||||
*kind = ObjectIdRing::kInvalid;
|
*kind = ObjectIdRing::kInvalid;
|
||||||
return Object::null();
|
return Object::null();
|
||||||
}
|
}
|
||||||
const Integer& obj = Integer::Handle(isolate->current_zone(),
|
const Integer& obj = Integer::Handle(thread->zone(),
|
||||||
Smi::New(static_cast<intptr_t>(value)));
|
Smi::New(static_cast<intptr_t>(value)));
|
||||||
return obj.raw();
|
return obj.raw();
|
||||||
} else if (strcmp(arg, "bool-true") == 0) {
|
} else if (strcmp(arg, "bool-true") == 0) {
|
||||||
|
@ -1124,7 +1124,7 @@ static RawObject* LookupObjectId(Isolate* isolate,
|
||||||
return Object::null();
|
return Object::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectIdRing* ring = isolate->object_id_ring();
|
ObjectIdRing* ring = thread->isolate()->object_id_ring();
|
||||||
ASSERT(ring != NULL);
|
ASSERT(ring != NULL);
|
||||||
intptr_t id = -1;
|
intptr_t id = -1;
|
||||||
if (!GetIntegerId(arg, &id)) {
|
if (!GetIntegerId(arg, &id)) {
|
||||||
|
@ -1185,19 +1185,21 @@ static RawObject* LookupHeapObjectLibraries(Isolate* isolate,
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
|
|
||||||
static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
static RawObject* LookupHeapObjectClasses(Thread* thread,
|
||||||
char** parts, int num_parts) {
|
char** parts, int num_parts) {
|
||||||
// Class ids look like: "classes/17"
|
// Class ids look like: "classes/17"
|
||||||
if (num_parts < 2) {
|
if (num_parts < 2) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
|
Zone* zone = thread->zone();
|
||||||
ClassTable* table = isolate->class_table();
|
ClassTable* table = isolate->class_table();
|
||||||
intptr_t id;
|
intptr_t id;
|
||||||
if (!GetIntegerId(parts[1], &id) ||
|
if (!GetIntegerId(parts[1], &id) ||
|
||||||
!table->IsValidIndex(id)) {
|
!table->IsValidIndex(id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Class& cls = Class::Handle(table->At(id));
|
Class& cls = Class::Handle(zone, table->At(id));
|
||||||
if (num_parts == 2) {
|
if (num_parts == 2) {
|
||||||
return cls.raw();
|
return cls.raw();
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1212,7 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
if (!GetIntegerId(parts[3], &id)) {
|
if (!GetIntegerId(parts[3], &id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Function& func = Function::Handle();
|
Function& func = Function::Handle(zone);
|
||||||
func ^= cls.ClosureFunctionFromIndex(id);
|
func ^= cls.ClosureFunctionFromIndex(id);
|
||||||
if (func.IsNull()) {
|
if (func.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
|
@ -1226,7 +1228,7 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
if (!GetIntegerId(parts[3], &id)) {
|
if (!GetIntegerId(parts[3], &id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Field& field = Field::Handle(cls.FieldFromIndex(id));
|
Field& field = Field::Handle(zone, cls.FieldFromIndex(id));
|
||||||
if (field.IsNull()) {
|
if (field.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
|
@ -1238,13 +1240,12 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
const char* encoded_id = parts[3];
|
const char* encoded_id = parts[3];
|
||||||
String& id = String::Handle(isolate->current_zone(),
|
String& id = String::Handle(zone, String::New(encoded_id));
|
||||||
String::New(encoded_id));
|
|
||||||
id = String::DecodeIRI(id);
|
id = String::DecodeIRI(id);
|
||||||
if (id.IsNull()) {
|
if (id.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Function& func = Function::Handle(cls.LookupFunction(id));
|
Function& func = Function::Handle(zone, cls.LookupFunction(id));
|
||||||
if (func.IsNull()) {
|
if (func.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
|
@ -1259,7 +1260,7 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
if (!GetIntegerId(parts[3], &id)) {
|
if (!GetIntegerId(parts[3], &id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Function& func = Function::Handle();
|
Function& func = Function::Handle(zone);
|
||||||
func ^= cls.ImplicitClosureFunctionFromIndex(id);
|
func ^= cls.ImplicitClosureFunctionFromIndex(id);
|
||||||
if (func.IsNull()) {
|
if (func.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
|
@ -1275,7 +1276,7 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
if (!GetIntegerId(parts[3], &id)) {
|
if (!GetIntegerId(parts[3], &id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Function& func = Function::Handle();
|
Function& func = Function::Handle(zone);
|
||||||
func ^= cls.InvocationDispatcherFunctionFromIndex(id);
|
func ^= cls.InvocationDispatcherFunctionFromIndex(id);
|
||||||
if (func.IsNull()) {
|
if (func.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
|
@ -1291,7 +1292,7 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
if (!GetIntegerId(parts[3], &id)) {
|
if (!GetIntegerId(parts[3], &id)) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
Type& type = Type::Handle();
|
Type& type = Type::Handle(zone);
|
||||||
type ^= cls.CanonicalTypeFromIndex(id);
|
type ^= cls.CanonicalTypeFromIndex(id);
|
||||||
if (type.IsNull()) {
|
if (type.IsNull()) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
|
@ -1304,8 +1305,9 @@ static RawObject* LookupHeapObjectClasses(Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static RawObject* LookupHeapObjectTypeArguments(Isolate* isolate,
|
static RawObject* LookupHeapObjectTypeArguments(Thread* thread,
|
||||||
char** parts, int num_parts) {
|
char** parts, int num_parts) {
|
||||||
|
Isolate* isolate = thread->isolate();
|
||||||
// TypeArguments ids look like: "typearguments/17"
|
// TypeArguments ids look like: "typearguments/17"
|
||||||
if (num_parts < 2) {
|
if (num_parts < 2) {
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
|
@ -1315,7 +1317,8 @@ static RawObject* LookupHeapObjectTypeArguments(Isolate* isolate,
|
||||||
return Object::sentinel().raw();
|
return Object::sentinel().raw();
|
||||||
}
|
}
|
||||||
ObjectStore* object_store = isolate->object_store();
|
ObjectStore* object_store = isolate->object_store();
|
||||||
const Array& table = Array::Handle(object_store->canonical_type_arguments());
|
const Array& table = Array::Handle(thread->zone(),
|
||||||
|
object_store->canonical_type_arguments());
|
||||||
ASSERT(table.Length() > 0);
|
ASSERT(table.Length() > 0);
|
||||||
const intptr_t table_size = table.Length() - 1;
|
const intptr_t table_size = table.Length() - 1;
|
||||||
if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) {
|
if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) {
|
||||||
|
@ -1399,7 +1402,8 @@ static RawObject* LookupHeapObjectMessage(Isolate* isolate,
|
||||||
static RawObject* LookupHeapObject(Isolate* isolate,
|
static RawObject* LookupHeapObject(Isolate* isolate,
|
||||||
const char* id_original,
|
const char* id_original,
|
||||||
ObjectIdRing::LookupResult* result) {
|
ObjectIdRing::LookupResult* result) {
|
||||||
char* id = Thread::Current()->zone()->MakeCopyOfString(id_original);
|
Thread* thread = Thread::Current();
|
||||||
|
char* id = thread->zone()->MakeCopyOfString(id_original);
|
||||||
|
|
||||||
// Parse the id by splitting at each '/'.
|
// Parse the id by splitting at each '/'.
|
||||||
const int MAX_PARTS = 8;
|
const int MAX_PARTS = 8;
|
||||||
|
@ -1429,9 +1433,9 @@ static RawObject* LookupHeapObject(Isolate* isolate,
|
||||||
|
|
||||||
if (strcmp(parts[0], "objects") == 0) {
|
if (strcmp(parts[0], "objects") == 0) {
|
||||||
// Object ids look like "objects/1123"
|
// Object ids look like "objects/1123"
|
||||||
Object& obj = Object::Handle(isolate->current_zone());
|
Object& obj = Object::Handle(thread->zone());
|
||||||
ObjectIdRing::LookupResult lookup_result;
|
ObjectIdRing::LookupResult lookup_result;
|
||||||
obj = LookupObjectId(isolate, parts[1], &lookup_result);
|
obj = LookupObjectId(thread, parts[1], &lookup_result);
|
||||||
if (lookup_result != ObjectIdRing::kValid) {
|
if (lookup_result != ObjectIdRing::kValid) {
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
*result = lookup_result;
|
*result = lookup_result;
|
||||||
|
@ -1443,9 +1447,9 @@ static RawObject* LookupHeapObject(Isolate* isolate,
|
||||||
} else if (strcmp(parts[0], "libraries") == 0) {
|
} else if (strcmp(parts[0], "libraries") == 0) {
|
||||||
return LookupHeapObjectLibraries(isolate, parts, num_parts);
|
return LookupHeapObjectLibraries(isolate, parts, num_parts);
|
||||||
} else if (strcmp(parts[0], "classes") == 0) {
|
} else if (strcmp(parts[0], "classes") == 0) {
|
||||||
return LookupHeapObjectClasses(isolate, parts, num_parts);
|
return LookupHeapObjectClasses(thread, parts, num_parts);
|
||||||
} else if (strcmp(parts[0], "typearguments") == 0) {
|
} else if (strcmp(parts[0], "typearguments") == 0) {
|
||||||
return LookupHeapObjectTypeArguments(isolate, parts, num_parts);
|
return LookupHeapObjectTypeArguments(thread, parts, num_parts);
|
||||||
} else if (strcmp(parts[0], "code") == 0) {
|
} else if (strcmp(parts[0], "code") == 0) {
|
||||||
return LookupHeapObjectCode(isolate, parts, num_parts);
|
return LookupHeapObjectCode(isolate, parts, num_parts);
|
||||||
} else if (strcmp(parts[0], "messages") == 0) {
|
} else if (strcmp(parts[0], "messages") == 0) {
|
||||||
|
@ -1779,11 +1783,11 @@ static bool Evaluate(Isolate* isolate, JSONStream* js) {
|
||||||
PrintMissingParamError(js, "expression");
|
PrintMissingParamError(js, "expression");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const String& expr_str =
|
Zone* zone = Thread::Current()->zone();
|
||||||
String::Handle(isolate->current_zone(), String::New(expr));
|
const String& expr_str = String::Handle(zone, String::New(expr));
|
||||||
ObjectIdRing::LookupResult lookup_result;
|
ObjectIdRing::LookupResult lookup_result;
|
||||||
Object& obj = Object::Handle(LookupHeapObject(isolate, target_id,
|
Object& obj = Object::Handle(zone, LookupHeapObject(isolate, target_id,
|
||||||
&lookup_result));
|
&lookup_result));
|
||||||
if (obj.raw() == Object::sentinel().raw()) {
|
if (obj.raw() == Object::sentinel().raw()) {
|
||||||
if (lookup_result == ObjectIdRing::kCollected) {
|
if (lookup_result == ObjectIdRing::kCollected) {
|
||||||
PrintSentinel(js, kCollectedSentinel);
|
PrintSentinel(js, kCollectedSentinel);
|
||||||
|
@ -1796,29 +1800,27 @@ static bool Evaluate(Isolate* isolate, JSONStream* js) {
|
||||||
}
|
}
|
||||||
if (obj.IsLibrary()) {
|
if (obj.IsLibrary()) {
|
||||||
const Library& lib = Library::Cast(obj);
|
const Library& lib = Library::Cast(obj);
|
||||||
const Object& result = Object::Handle(lib.Evaluate(expr_str,
|
const Object& result = Object::Handle(zone,
|
||||||
Array::empty_array(),
|
lib.Evaluate(expr_str, Array::empty_array(), Array::empty_array()));
|
||||||
Array::empty_array()));
|
|
||||||
result.PrintJSON(js, true);
|
result.PrintJSON(js, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj.IsClass()) {
|
if (obj.IsClass()) {
|
||||||
const Class& cls = Class::Cast(obj);
|
const Class& cls = Class::Cast(obj);
|
||||||
const Object& result = Object::Handle(cls.Evaluate(expr_str,
|
const Object& result = Object::Handle(zone,
|
||||||
Array::empty_array(),
|
cls.Evaluate(expr_str, Array::empty_array(), Array::empty_array()));
|
||||||
Array::empty_array()));
|
|
||||||
result.PrintJSON(js, true);
|
result.PrintJSON(js, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((obj.IsInstance() || obj.IsNull()) &&
|
if ((obj.IsInstance() || obj.IsNull()) &&
|
||||||
!ContainsNonInstance(obj)) {
|
!ContainsNonInstance(obj)) {
|
||||||
// We don't use Instance::Cast here because it doesn't allow null.
|
// We don't use Instance::Cast here because it doesn't allow null.
|
||||||
Instance& instance = Instance::Handle(isolate->current_zone());
|
Instance& instance = Instance::Handle(zone);
|
||||||
instance ^= obj.raw();
|
instance ^= obj.raw();
|
||||||
const Object& result =
|
const Object& result =
|
||||||
Object::Handle(instance.Evaluate(expr_str,
|
Object::Handle(zone, instance.Evaluate(expr_str,
|
||||||
Array::empty_array(),
|
Array::empty_array(),
|
||||||
Array::empty_array()));
|
Array::empty_array()));
|
||||||
result.PrintJSON(js, true);
|
result.PrintJSON(js, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1852,11 +1854,11 @@ static bool EvaluateInFrame(Isolate* isolate, JSONStream* js) {
|
||||||
}
|
}
|
||||||
ActivationFrame* frame = stack->FrameAt(framePos);
|
ActivationFrame* frame = stack->FrameAt(framePos);
|
||||||
|
|
||||||
|
Zone* zone = Thread::Current()->zone();
|
||||||
const char* expr = js->LookupParam("expression");
|
const char* expr = js->LookupParam("expression");
|
||||||
const String& expr_str = String::Handle(isolate->current_zone(),
|
const String& expr_str = String::Handle(zone, String::New(expr));
|
||||||
String::New(expr));
|
|
||||||
|
|
||||||
const Object& result = Object::Handle(frame->Evaluate(expr_str));
|
const Object& result = Object::Handle(zone, frame->Evaluate(expr_str));
|
||||||
result.PrintJSON(js, true);
|
result.PrintJSON(js, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1729,15 +1729,15 @@ bool SnapshotWriter::HandleVMIsolateObject(RawObject* rawobj) {
|
||||||
// objects and their accompanying token streams.
|
// objects and their accompanying token streams.
|
||||||
class ScriptVisitor : public ObjectVisitor {
|
class ScriptVisitor : public ObjectVisitor {
|
||||||
public:
|
public:
|
||||||
explicit ScriptVisitor(Isolate* isolate) :
|
explicit ScriptVisitor(Thread* thread) :
|
||||||
ObjectVisitor(isolate),
|
ObjectVisitor(thread->isolate()),
|
||||||
objHandle_(Object::Handle(isolate->current_zone())),
|
objHandle_(Object::Handle(thread->zone())),
|
||||||
count_(0),
|
count_(0),
|
||||||
scripts_(NULL) {}
|
scripts_(NULL) {}
|
||||||
|
|
||||||
ScriptVisitor(Isolate* isolate, const Array* scripts) :
|
ScriptVisitor(Thread* thread, const Array* scripts) :
|
||||||
ObjectVisitor(isolate),
|
ObjectVisitor(thread->isolate()),
|
||||||
objHandle_(Object::Handle(isolate->current_zone())),
|
objHandle_(Object::Handle(thread->zone())),
|
||||||
count_(0),
|
count_(0),
|
||||||
scripts_(scripts) {}
|
scripts_(scripts) {}
|
||||||
|
|
||||||
|
@ -1797,11 +1797,11 @@ FullSnapshotWriter::FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
|
||||||
// into an array so that we can write it out as part of the VM isolate
|
// into an array so that we can write it out as part of the VM isolate
|
||||||
// snapshot. We first count the number of script objects, allocate an array
|
// snapshot. We first count the number of script objects, allocate an array
|
||||||
// and then fill it up with the script objects.
|
// and then fill it up with the script objects.
|
||||||
ScriptVisitor scripts_counter(isolate());
|
ScriptVisitor scripts_counter(thread());
|
||||||
heap()->IterateOldObjects(&scripts_counter);
|
heap()->IterateOldObjects(&scripts_counter);
|
||||||
intptr_t count = scripts_counter.count();
|
intptr_t count = scripts_counter.count();
|
||||||
scripts_ = Array::New(count, Heap::kOld);
|
scripts_ = Array::New(count, Heap::kOld);
|
||||||
ScriptVisitor script_visitor(isolate(), &scripts_);
|
ScriptVisitor script_visitor(thread(), &scripts_);
|
||||||
heap()->IterateOldObjects(&script_visitor);
|
heap()->IterateOldObjects(&script_visitor);
|
||||||
|
|
||||||
// Stash the symbol table away for writing and reading into the vm isolate,
|
// Stash the symbol table away for writing and reading into the vm isolate,
|
||||||
|
|
Loading…
Reference in a new issue