Enable concurrent optimization test after migrating scopes to Thread*

Also move static call target table allocation into old space.

Note that stats are not thread-safe, so running two compilers concurrently may lead to inaccurate stats.

BUG=https://github.com/dart-lang/sdk/issues/24109

Review URL: https://codereview.chromium.org//1291803009 .
This commit is contained in:
Daniel Andersson 2015-08-19 15:16:47 -07:00
parent 27b55b60bb
commit 00ef260503
14 changed files with 105 additions and 87 deletions

View file

@ -9,8 +9,6 @@ cc/CodeImmutability: Crash
cc/SNPrint_BadArgs: Skip
cc/CompileFunctionOnHelperThread: Skip # Issue 24109.
# Flaky on buildbot. Issue 5133 and 10409.
cc/Sleep: Pass, Fail

View file

@ -297,9 +297,9 @@ RawError* Compiler::CompileClass(const Class& cls) {
VMTagScope tagScope(thread, VMTag::kCompileClassTagId);
Class& parse_class = Class::Handle(isolate);
const GrowableObjectArray& parse_list =
GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4));
GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New(4));
const GrowableObjectArray& patch_list =
GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4));
GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New(4));
// Parse the class and all the interfaces it implements and super classes.
LongJumpScope jump;
@ -395,7 +395,7 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
Thread* const thread = Thread::Current();
Zone* const zone = thread->zone();
Isolate* const isolate = thread->isolate();
CSTAT_TIMER_SCOPE(isolate, codegen_timer);
CSTAT_TIMER_SCOPE(thread, codegen_timer);
HANDLESCOPE(thread);
// We may reattempt compilation if the function needs to be assembled using
@ -421,7 +421,7 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
// TimerScope needs an isolate to be properly terminated in case of a
// LongJump.
{
CSTAT_TIMER_SCOPE(isolate, graphbuilder_timer);
CSTAT_TIMER_SCOPE(thread, graphbuilder_timer);
ZoneGrowableArray<const ICData*>* ic_data_array =
new(zone) ZoneGrowableArray<const ICData*>();
if (optimized) {
@ -467,7 +467,7 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
}
if (optimized) {
CSTAT_TIMER_SCOPE(isolate, ssa_timer);
CSTAT_TIMER_SCOPE(thread, ssa_timer);
// Transform to SSA (virtual register 0 and no inlining arguments).
flow_graph->ComputeSSA(0, NULL);
DEBUG_ASSERT(flow_graph->VerifyUseLists());
@ -488,7 +488,7 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
inline_id_to_function.Add(&function);
// Top scope function has no caller (-1).
caller_inline_id.Add(-1);
CSTAT_TIMER_SCOPE(isolate, graphoptimizer_timer);
CSTAT_TIMER_SCOPE(thread, graphoptimizer_timer);
FlowGraphOptimizer optimizer(flow_graph);
if (Compiler::always_optimize()) {
@ -506,7 +506,7 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
// Inlining (mutates the flow graph)
if (FLAG_use_inlining) {
CSTAT_TIMER_SCOPE(isolate, graphinliner_timer);
CSTAT_TIMER_SCOPE(thread, graphinliner_timer);
// Propagate types to create more inlining opportunities.
FlowGraphTypePropagator::Propagate(flow_graph);
DEBUG_ASSERT(flow_graph->VerifyUseLists());
@ -720,16 +720,16 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
inline_id_to_function,
caller_inline_id);
{
CSTAT_TIMER_SCOPE(isolate, graphcompiler_timer);
CSTAT_TIMER_SCOPE(thread, graphcompiler_timer);
graph_compiler.CompileGraph();
pipeline->FinalizeCompilation();
}
{
CSTAT_TIMER_SCOPE(isolate, codefinalizer_timer);
CSTAT_TIMER_SCOPE(thread, codefinalizer_timer);
// CreateDeoptInfo uses the object pool and needs to be done before
// FinalizeCode.
const Array& deopt_info_array =
Array::Handle(isolate, graph_compiler.CreateDeoptInfo(&assembler));
Array::Handle(zone, graph_compiler.CreateDeoptInfo(&assembler));
INC_STAT(isolate, total_code_size,
deopt_info_array.Length() * sizeof(uword));
const Code& code = Code::Handle(
@ -742,13 +742,13 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
code.SetInlinedIntervals(intervals);
const Array& inlined_id_array =
Array::Handle(isolate, graph_compiler.InliningIdToFunction());
Array::Handle(zone, graph_compiler.InliningIdToFunction());
INC_STAT(isolate, total_code_size,
inlined_id_array.Length() * sizeof(uword));
code.SetInlinedIdToFunction(inlined_id_array);
const Array& caller_inlining_id_map_array =
Array::Handle(isolate, graph_compiler.CallerInliningIdMap());
Array::Handle(zone, graph_compiler.CallerInliningIdMap());
INC_STAT(isolate, total_code_size,
caller_inlining_id_map_array.Length() * sizeof(uword));
code.SetInlinedCallerIdMap(caller_inlining_id_map_array);
@ -1024,7 +1024,7 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
Isolate* const isolate = thread->isolate();
StackZone stack_zone(thread);
Zone* const zone = stack_zone.GetZone();
TIMERSCOPE(isolate, time_compilation);
TIMERSCOPE(thread, time_compilation);
Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
per_compile_timer.Start();
@ -1120,7 +1120,7 @@ RawError* Compiler::CompileFunction(Thread* thread,
const Function& function) {
Isolate* isolate = thread->isolate();
VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
TIMELINE_FUNCTION_COMPILATION_DURATION(isolate, "Function", function);
TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function);
if (!isolate->compilation_allowed()) {
FATAL3("Precompilation missed function %s (%" Pd ", %s)\n",
@ -1173,9 +1173,8 @@ RawError* Compiler::EnsureUnoptimizedCode(Thread* thread,
RawError* Compiler::CompileOptimizedFunction(Thread* thread,
const Function& function,
intptr_t osr_id) {
Isolate* isolate = thread->isolate();
VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId);
TIMELINE_FUNCTION_COMPILATION_DURATION(isolate,
TIMELINE_FUNCTION_COMPILATION_DURATION(thread,
"OptimizedFunction", function);
CompilationPipeline* pipeline =
@ -1356,7 +1355,7 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
Isolate* const isolate = thread->isolate();
StackZone zone(thread);
const Error& error =
Error::Handle(isolate, isolate->object_store()->sticky_error());
Error::Handle(thread->zone(), isolate->object_store()->sticky_error());
isolate->object_store()->clear_sticky_error();
return error.raw();
}

View file

@ -67,10 +67,10 @@ class CompilerStats {
#define INC_STAT(isolate, counter, incr) \
if (FLAG_compiler_stats) { (isolate)->compiler_stats()->counter += (incr); }
#define CSTAT_TIMER_SCOPE(iso, t) \
#define CSTAT_TIMER_SCOPE(thr, t) \
TimerScope timer(FLAG_compiler_stats, \
FLAG_compiler_stats ? &((iso)->compiler_stats()->t) : NULL, \
iso);
FLAG_compiler_stats ? &((thr)->isolate()->compiler_stats()->t) : NULL, \
thr);
} // namespace dart

View file

@ -236,8 +236,9 @@ Isolate* Dart::CreateIsolate(const char* name_prefix,
RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
// Initialize the new isolate.
Isolate* isolate = Isolate::Current();
TIMERSCOPE(isolate, time_isolate_initialization);
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
TIMERSCOPE(thread, time_isolate_initialization);
TimelineDurationScope tds(isolate,
isolate->GetIsolateStream(),
"InitializeIsolate");

View file

@ -1510,9 +1510,10 @@ DART_EXPORT Dart_Handle Dart_CreateSnapshot(
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size) {
ASSERT(FLAG_load_deferred_eagerly);
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_creating_snapshot);
TIMERSCOPE(thread, time_creating_snapshot);
if (vm_isolate_snapshot_buffer != NULL &&
vm_isolate_snapshot_size == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_size);
@ -1549,9 +1550,10 @@ DART_EXPORT Dart_Handle Dart_CreateSnapshot(
static Dart_Handle createLibrarySnapshot(Dart_Handle library,
uint8_t** buffer,
intptr_t* size) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_creating_snapshot);
TIMERSCOPE(thread, time_creating_snapshot);
if (buffer == NULL) {
RETURN_NULL_ERROR(buffer);
}
@ -4176,12 +4178,13 @@ DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target,
Dart_Handle name,
int number_of_arguments,
Dart_Handle* arguments) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
CHECK_CALLBACK_STATE(isolate);
// TODO(turnidge): This is a bit simplistic. It overcounts when
// other operations (gc, compilation) are active.
TIMERSCOPE(isolate, time_dart_execution);
TIMERSCOPE(thread, time_dart_execution);
const String& function_name = Api::UnwrapStringHandle(isolate, name);
if (function_name.IsNull()) {
@ -5195,9 +5198,10 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
Dart_Handle source,
intptr_t line_offset,
intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
TIMERSCOPE(thread, time_script_loading);
const String& url_str = Api::UnwrapStringHandle(isolate, url);
if (url_str.IsNull()) {
RETURN_TYPE_ERROR(isolate, url, String);
@ -5241,9 +5245,10 @@ DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
intptr_t buffer_len) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
TIMERSCOPE(thread, time_script_loading);
StackZone zone(isolate);
if (buffer == NULL) {
RETURN_NULL_ERROR(buffer);
@ -5454,9 +5459,10 @@ DART_EXPORT Dart_Handle Dart_LoadLibrary(Dart_Handle url,
Dart_Handle source,
intptr_t line_offset,
intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
TIMERSCOPE(thread, time_script_loading);
const String& url_str = Api::UnwrapStringHandle(isolate, url);
if (url_str.IsNull()) {
RETURN_TYPE_ERROR(isolate, url, String);
@ -5560,9 +5566,10 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
Dart_Handle source,
intptr_t line_offset,
intptr_t column_offset) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
TIMERSCOPE(thread, time_script_loading);
const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
if (lib.IsNull()) {
RETURN_TYPE_ERROR(isolate, library, Library);
@ -5599,9 +5606,10 @@ DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library,
DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library,
Dart_Handle url,
Dart_Handle patch_source) {
Isolate* isolate = Isolate::Current();
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
DARTSCOPE(isolate);
TIMERSCOPE(isolate, time_script_loading);
TIMERSCOPE(thread, time_script_loading);
const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
if (lib.IsNull()) {
RETURN_TYPE_ERROR(isolate, library, Library);

View file

@ -175,7 +175,8 @@ FlowGraphCompiler::FlowGraphCompiler(
block_info_(block_order_.length()),
deopt_infos_(),
static_calls_target_table_(GrowableObjectArray::ZoneHandle(
GrowableObjectArray::New())),
// TODO(srdjan): Zone-allocate this array instead?
GrowableObjectArray::New(Heap::kOld))),
is_optimizing_(is_optimizing),
may_reoptimize_(false),
intrinsic_mode_(false),
@ -516,7 +517,7 @@ void FlowGraphCompiler::VisitBlocks() {
}
if (is_optimizing()) {
LogBlock lb(Isolate::Current());
LogBlock lb(Thread::Current());
intervals.Add(IntervalStruct(prev_offset, prev_inlining_id));
inlined_code_intervals_ =
Array::New(intervals.length() * Code::kInlIntNumEntries, Heap::kOld);

View file

@ -687,7 +687,7 @@ class CallSiteInliner : public ValueObject {
bool in_cache;
ParsedFunction* parsed_function;
{
CSTAT_TIMER_SCOPE(isolate(), graphinliner_parse_timer);
CSTAT_TIMER_SCOPE(thread(), graphinliner_parse_timer);
if (!Compiler::always_optimize()) {
const Error& error = Error::Handle(Z,
Compiler::EnsureUnoptimizedCode(Thread::Current(), function));
@ -713,7 +713,7 @@ class CallSiteInliner : public ValueObject {
builder.SetInitialBlockId(caller_graph_->max_block_id());
FlowGraph* callee_graph;
{
CSTAT_TIMER_SCOPE(isolate(), graphinliner_build_timer);
CSTAT_TIMER_SCOPE(thread(), graphinliner_build_timer);
callee_graph = builder.BuildGraph();
}
@ -767,7 +767,7 @@ class CallSiteInliner : public ValueObject {
block_scheduler.AssignEdgeWeights();
{
CSTAT_TIMER_SCOPE(isolate(), graphinliner_ssa_timer);
CSTAT_TIMER_SCOPE(thread(), graphinliner_ssa_timer);
// Compute SSA on the callee graph, catching bailouts.
callee_graph->ComputeSSA(caller_graph_->max_virtual_register_number(),
param_stubs);
@ -775,7 +775,7 @@ class CallSiteInliner : public ValueObject {
}
{
CSTAT_TIMER_SCOPE(isolate(), graphinliner_opt_timer);
CSTAT_TIMER_SCOPE(thread(), graphinliner_opt_timer);
// TODO(zerny): Do more optimization passes on the callee graph.
FlowGraphOptimizer optimizer(callee_graph);
if (Compiler::always_optimize()) {
@ -956,7 +956,7 @@ class CallSiteInliner : public ValueObject {
}
void InlineCall(InlinedCallData* call_data) {
CSTAT_TIMER_SCOPE(Isolate::Current(), graphinliner_subst_timer);
CSTAT_TIMER_SCOPE(Thread::Current(), graphinliner_subst_timer);
FlowGraph* callee_graph = call_data->callee_graph;
TargetEntryInstr* callee_entry =
callee_graph->graph_entry()->normal_entry();

View file

@ -380,21 +380,24 @@ void IsolateMessageHandler::MessageNotify(Message::Priority priority) {
bool IsolateMessageHandler::HandleMessage(Message* message) {
StackZone zone(I);
HandleScope handle_scope(I);
TimelineDurationScope tds(I, I->GetIsolateStream(), "HandleMessage");
ASSERT(IsCurrentIsolate());
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
Zone* zone = stack_zone.GetZone();
HandleScope handle_scope(thread);
TimelineDurationScope tds(thread, I->GetIsolateStream(), "HandleMessage");
tds.SetNumArguments(1);
tds.CopyArgument(0, "isolateName", I->name());
// TODO(turnidge): Rework collection total dart execution. This can
// overcount when other things (gc, compilation) are active.
TIMERSCOPE(isolate_, time_dart_execution);
TIMERSCOPE(thread, time_dart_execution);
// If the message is in band we lookup the handler to dispatch to. If the
// receive port was closed, we drop the message without deserializing it.
// Illegal port is a special case for artificially enqueued isolate library
// messages which are handled in C++ code below.
Object& msg_handler = Object::Handle(I);
Object& msg_handler = Object::Handle(zone);
if (!message->IsOOB() && (message->dest_port() != Message::kIllegalPort)) {
msg_handler = DartLibraryCalls::LookupHandler(message->dest_port());
if (msg_handler.IsError()) {
@ -416,8 +419,8 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
// Parse the message.
MessageSnapshotReader reader(message->data(),
message->len(),
I, zone.GetZone());
const Object& msg_obj = Object::Handle(I, reader.ReadObject());
I, zone);
const Object& msg_obj = Object::Handle(zone, reader.ReadObject());
if (msg_obj.IsError()) {
// An error occurred while reading the message.
delete message;
@ -432,7 +435,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
UNREACHABLE();
}
Instance& msg = Instance::Handle(I);
Instance& msg = Instance::Handle(zone);
msg ^= msg_obj.raw(); // Can't use Instance::Cast because may be null.
bool success = true;
@ -443,7 +446,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
if (msg.IsArray()) {
const Array& oob_msg = Array::Cast(msg);
if (oob_msg.Length() > 0) {
const Object& oob_tag = Object::Handle(I, oob_msg.At(0));
const Object& oob_tag = Object::Handle(zone, oob_msg.At(0));
if (oob_tag.IsSmi()) {
switch (Smi::Cast(oob_tag).Value()) {
case Message::kServiceOOBMsg: {
@ -472,7 +475,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
if (msg.IsArray()) {
const Array& msg_arr = Array::Cast(msg);
if (msg_arr.Length() > 0) {
const Object& oob_tag = Object::Handle(I, msg_arr.At(0));
const Object& oob_tag = Object::Handle(zone, msg_arr.At(0));
if (oob_tag.IsSmi() &&
(Smi::Cast(oob_tag).Value() == Message::kDelayedIsolateLibOOBMsg)) {
success = HandleLibMessage(Array::Cast(msg_arr));
@ -480,7 +483,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) {
}
}
} else {
const Object& result = Object::Handle(I,
const Object& result = Object::Handle(zone,
DartLibraryCalls::HandleMessage(msg_handler, msg));
if (result.IsError()) {
success = ProcessUnhandledException(Error::Cast(result));

View file

@ -26,14 +26,18 @@ bool LongJumpScope::IsSafeToJump() {
// We do not want to jump past Dart frames. Note that this code
// assumes the stack grows from high to low.
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
uword jumpbuf_addr = Isolate::GetCurrentStackPointer();
#if defined(USING_SIMULATOR)
Isolate* isolate = thread->isolate();
ASSERT(isolate->MutatorThreadIsCurrentThread());
uword top_exit_frame_info = isolate->simulator()->top_exit_frame_info();
#else
uword top_exit_frame_info = thread->top_exit_frame_info();
#endif
if (!isolate->MutatorThreadIsCurrentThread()) {
// A helper thread does not execute Dart code, so it's safe to jump.
ASSERT(top_exit_frame_info == 0);
return true;
}
return ((top_exit_frame_info == 0) || (jumpbuf_addr < top_exit_frame_info));
}

View file

@ -988,7 +988,9 @@ void Object::RegisterPrivateClass(const Class& cls,
RawError* Object::Init(Isolate* isolate) {
TIMERSCOPE(isolate, time_bootstrap);
Thread* thread = Thread::Current();
ASSERT(isolate == thread->isolate());
TIMERSCOPE(thread, time_bootstrap);
TimelineDurationScope tds(isolate,
isolate->GetIsolateStream(),
"Object::Init");
@ -8542,7 +8544,7 @@ void Script::Tokenize(const String& private_key) const {
}
// Get the source, scan and allocate the token stream.
VMTagScope tagScope(thread, VMTag::kCompileScannerTagId);
CSTAT_TIMER_SCOPE(isolate, scanner_timer);
CSTAT_TIMER_SCOPE(thread, scanner_timer);
const String& src = String::Handle(zone, Source());
Scanner scanner(src, private_key);
set_tokens(TokenStream::Handle(zone,
@ -11032,8 +11034,9 @@ void PcDescriptors::CopyData(GrowableArray<uint8_t>* delta_encoded_data) {
RawPcDescriptors* PcDescriptors::New(GrowableArray<uint8_t>* data) {
ASSERT(Object::pc_descriptors_class() != Class::null());
Isolate* isolate = Isolate::Current();
PcDescriptors& result = PcDescriptors::Handle(isolate);
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
PcDescriptors& result = PcDescriptors::Handle(thread->zone());
{
uword size = PcDescriptors::InstanceSize(data->length());
RawObject* raw = Object::Allocate(PcDescriptors::kClassId,
@ -11052,8 +11055,9 @@ RawPcDescriptors* PcDescriptors::New(GrowableArray<uint8_t>* data) {
RawPcDescriptors* PcDescriptors::New(intptr_t length) {
ASSERT(Object::pc_descriptors_class() != Class::null());
Isolate* isolate = Isolate::Current();
PcDescriptors& result = PcDescriptors::Handle(isolate);
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
PcDescriptors& result = PcDescriptors::Handle(thread->zone());
{
uword size = PcDescriptors::InstanceSize(length);
RawObject* raw = Object::Allocate(PcDescriptors::kClassId,

View file

@ -52,7 +52,8 @@ DECLARE_FLAG(bool, profile_vm);
DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
DECLARE_FLAG(bool, warn_on_javascript_compatibility);
// Quick access to the current isolate and zone.
// Quick access to the current thread, isolate and zone.
#define T (thread())
#define I (isolate())
#define Z (zone())
@ -447,7 +448,7 @@ void Parser::ParseCompilationUnit(const Library& library,
const Script& script) {
Thread* thread = Thread::Current();
ASSERT(thread->long_jump_base()->IsSafeToJump());
CSTAT_TIMER_SCOPE(thread->isolate(), parser_timer);
CSTAT_TIMER_SCOPE(thread, parser_timer);
VMTagScope tagScope(thread, VMTag::kCompileTopLevelTagId);
Parser parser(script, library, 0);
parser.ParseTopLevel();
@ -773,9 +774,8 @@ struct TopLevel {
void Parser::ParseClass(const Class& cls) {
if (!cls.is_synthesized_class()) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
CSTAT_TIMER_SCOPE(isolate, parser_timer);
CSTAT_TIMER_SCOPE(thread, parser_timer);
ASSERT(thread->long_jump_base()->IsSafeToJump());
const Script& script = Script::Handle(zone, cls.script());
const Library& lib = Library::Handle(zone, cls.library());
@ -783,9 +783,8 @@ void Parser::ParseClass(const Class& cls) {
parser.ParseClassDefinition(cls);
} else if (cls.is_enum_class()) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
CSTAT_TIMER_SCOPE(isolate, parser_timer);
CSTAT_TIMER_SCOPE(thread, parser_timer);
ASSERT(thread->long_jump_base()->IsSafeToJump());
const Script& script = Script::Handle(zone, cls.script());
const Library& lib = Library::Handle(zone, cls.library());
@ -880,7 +879,7 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
ASSERT(thread == Thread::Current());
Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
CSTAT_TIMER_SCOPE(isolate, parser_timer);
CSTAT_TIMER_SCOPE(thread, parser_timer);
INC_STAT(isolate, num_functions_compiled, 1);
VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId,
FLAG_profile_vm);
@ -11941,7 +11940,7 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field,
ASSERT(func.kind() == RawFunction::kImplicitStaticFinalGetter);
Object& const_value = Object::Handle(Z);
{
PAUSETIMERSCOPE(I, time_compilation);
PAUSETIMERSCOPE(T, time_compilation);
const_value = DartEntry::InvokeFunction(func, Object::empty_array());
}
if (const_value.IsError()) {
@ -12022,7 +12021,7 @@ RawObject* Parser::EvaluateConstConstructorCall(
ArgumentsDescriptor::New(num_arguments, arguments->names()));
Object& result = Object::Handle(Z);
{
PAUSETIMERSCOPE(I, time_compilation);
PAUSETIMERSCOPE(T, time_compilation);
result = DartEntry::InvokeFunction(
constructor, arg_values, args_descriptor);
}
@ -13483,7 +13482,7 @@ String& Parser::Interpolate(const GrowableArray<AstNode*>& values) {
// Call interpolation function.
Object& result = Object::Handle(Z);
{
PAUSETIMERSCOPE(I, time_compilation);
PAUSETIMERSCOPE(T, time_compilation);
result = DartEntry::InvokeFunction(func, interpolate_arg);
}
if (result.IsUnhandledException()) {

View file

@ -393,7 +393,7 @@ RawString* Symbols::NewSymbol(const StringType& str) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
Zone* zone = thread->zone();
String& symbol = String::Handle(isolate);
String& symbol = String::Handle(zone);
{
Isolate* vm_isolate = Dart::vm_isolate();
SymbolTable table(zone, vm_isolate->object_store()->symbol_table());

View file

@ -228,9 +228,9 @@ class TimelineStream {
V(Isolate, false) \
#define TIMELINE_FUNCTION_COMPILATION_DURATION(isolate, suffix, function) \
TimelineDurationScope tds(isolate, \
isolate->GetCompilerStream(), \
#define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, suffix, function) \
TimelineDurationScope tds(thread, \
thread->isolate()->GetCompilerStream(), \
"Compile" suffix); \
if (tds.enabled()) { \
tds.SetNumArguments(1); \

View file

@ -178,8 +178,8 @@ class TimerScope : public StackResource {
class PauseTimerScope : public StackResource {
public:
PauseTimerScope(bool flag, Timer* timer, Isolate* isolate = NULL)
: StackResource(isolate),
PauseTimerScope(bool flag, Timer* timer, Thread* thread = NULL)
: StackResource(thread),
nested_(false),
timer_(flag ? timer : NULL) {
if (timer_) {
@ -214,13 +214,14 @@ isolate->timer_list().name().Start();
#define STOP_TIMER(isolate, name) \
isolate->timer_list().name().Stop();
#define TIMERSCOPE(isolate, name) \
TimerScope vm_internal_timer_(true, &(isolate->timer_list().name()), isolate)
#define TIMERSCOPE(thread, name) \
TimerScope vm_internal_timer_( \
true, &(thread->isolate()->timer_list().name()), thread)
#define PAUSETIMERSCOPE(isolate, name) \
#define PAUSETIMERSCOPE(thread, name) \
PauseTimerScope vm_internal_timer_(true, \
&(isolate->timer_list().name()), \
isolate)
&(thread->isolate()->timer_list().name()), \
thread)
} // namespace dart