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

Side by Side Diff: runtime/vm/compiler.cc

Issue 1284713003: Refactor VMTagScope to Thread* rather than Isolate*. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return Error::null(); 281 return Error::null();
282 } else { 282 } else {
283 Isolate* isolate = Isolate::Current(); 283 Isolate* isolate = Isolate::Current();
284 Error& error = Error::Handle(isolate); 284 Error& error = Error::Handle(isolate);
285 error = isolate->object_store()->sticky_error(); 285 error = isolate->object_store()->sticky_error();
286 isolate->object_store()->clear_sticky_error(); 286 isolate->object_store()->clear_sticky_error();
287 return error.raw(); 287 return error.raw();
288 } 288 }
289 } 289 }
290 290
291 Isolate* const isolate = Isolate::Current(); 291 Thread* const thread = Thread::Current();
292 Isolate* const isolate = thread->isolate();
292 // We remember all the classes that are being compiled in these lists. This 293 // We remember all the classes that are being compiled in these lists. This
293 // also allows us to reset the marked_for_parsing state in case we see an 294 // also allows us to reset the marked_for_parsing state in case we see an
294 // error. 295 // error.
295 VMTagScope tagScope(isolate, VMTag::kCompileClassTagId); 296 VMTagScope tagScope(thread, VMTag::kCompileClassTagId);
296 Class& parse_class = Class::Handle(isolate); 297 Class& parse_class = Class::Handle(isolate);
297 const GrowableObjectArray& parse_list = 298 const GrowableObjectArray& parse_list =
298 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4)); 299 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4));
299 const GrowableObjectArray& patch_list = 300 const GrowableObjectArray& patch_list =
300 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4)); 301 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4));
301 302
302 // Parse the class and all the interfaces it implements and super classes. 303 // Parse the class and all the interfaces it implements and super classes.
303 LongJumpScope jump; 304 LongJumpScope jump;
304 if (setjmp(*jump.Set()) == 0) { 305 if (setjmp(*jump.Set()) == 0) {
305 StackZone zone(isolate); 306 StackZone zone(thread);
306 if (FLAG_trace_compiler) { 307 if (FLAG_trace_compiler) {
307 ISL_Print("Compiling Class %s '%s'\n", "", cls.ToCString()); 308 ISL_Print("Compiling Class %s '%s'\n", "", cls.ToCString());
308 } 309 }
309 310
310 // Add the primary class which needs to be parsed to the parse list. 311 // Add the primary class which needs to be parsed to the parse list.
311 // Mark the class as parsed so that we don't recursively add the same 312 // Mark the class as parsed so that we don't recursively add the same
312 // class back into the list. 313 // class back into the list.
313 parse_list.Add(cls); 314 parse_list.Add(cls);
314 cls.set_is_marked_for_parsing(); 315 cls.set_is_marked_for_parsing();
315 316
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (parse_class.is_marked_for_parsing()) { 361 if (parse_class.is_marked_for_parsing()) {
361 parse_class.reset_is_marked_for_parsing(); 362 parse_class.reset_is_marked_for_parsing();
362 } 363 }
363 } 364 }
364 for (intptr_t i = 0; i < patch_list.Length(); i++) { 365 for (intptr_t i = 0; i < patch_list.Length(); i++) {
365 parse_class ^= patch_list.At(i); 366 parse_class ^= patch_list.At(i);
366 if (parse_class.is_marked_for_parsing()) { 367 if (parse_class.is_marked_for_parsing()) {
367 parse_class.reset_is_marked_for_parsing(); 368 parse_class.reset_is_marked_for_parsing();
368 } 369 }
369 } 370 }
371 Thread* const thread = Thread::Current();
370 Isolate* const isolate = Isolate::Current(); 372 Isolate* const isolate = Isolate::Current();
371 StackZone zone(isolate); 373 StackZone zone(thread);
372 Error& error = Error::Handle(isolate); 374 Error& error = Error::Handle(isolate);
373 error = isolate->object_store()->sticky_error(); 375 error = isolate->object_store()->sticky_error();
374 isolate->object_store()->clear_sticky_error(); 376 isolate->object_store()->clear_sticky_error();
375 return error.raw(); 377 return error.raw();
376 } 378 }
377 UNREACHABLE(); 379 UNREACHABLE();
378 return Error::null(); 380 return Error::null();
379 } 381 }
380 382
381 383
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 return error.raw(); 1103 return error.raw();
1102 } 1104 }
1103 UNREACHABLE(); 1105 UNREACHABLE();
1104 return Error::null(); 1106 return Error::null();
1105 } 1107 }
1106 1108
1107 1109
1108 RawError* Compiler::CompileFunction(Thread* thread, 1110 RawError* Compiler::CompileFunction(Thread* thread,
1109 const Function& function) { 1111 const Function& function) {
1110 Isolate* isolate = thread->isolate(); 1112 Isolate* isolate = thread->isolate();
1111 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); 1113 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
1112 TIMELINE_FUNCTION_COMPILATION_DURATION(isolate, "Function", function); 1114 TIMELINE_FUNCTION_COMPILATION_DURATION(isolate, "Function", function);
1113 1115
1114 if (!isolate->compilation_allowed()) { 1116 if (!isolate->compilation_allowed()) {
1115 FATAL3("Precompilation missed function %s (%" Pd ", %s)\n", 1117 FATAL3("Precompilation missed function %s (%" Pd ", %s)\n",
1116 function.ToLibNamePrefixedQualifiedCString(), 1118 function.ToLibNamePrefixedQualifiedCString(),
1117 function.token_pos(), 1119 function.token_pos(),
1118 Function::KindToCString(function.kind())); 1120 Function::KindToCString(function.kind()));
1119 } 1121 }
1120 1122
1121 CompilationPipeline* pipeline = 1123 CompilationPipeline* pipeline =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 ISL_Print("Ensure unoptimized code for %s\n", function.ToCString()); 1158 ISL_Print("Ensure unoptimized code for %s\n", function.ToCString());
1157 } 1159 }
1158 return Error::null(); 1160 return Error::null();
1159 } 1161 }
1160 1162
1161 1163
1162 RawError* Compiler::CompileOptimizedFunction(Thread* thread, 1164 RawError* Compiler::CompileOptimizedFunction(Thread* thread,
1163 const Function& function, 1165 const Function& function,
1164 intptr_t osr_id) { 1166 intptr_t osr_id) {
1165 Isolate* isolate = thread->isolate(); 1167 Isolate* isolate = thread->isolate();
1166 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); 1168 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId);
1167 TIMELINE_FUNCTION_COMPILATION_DURATION(isolate, 1169 TIMELINE_FUNCTION_COMPILATION_DURATION(isolate,
1168 "OptimizedFunction", function); 1170 "OptimizedFunction", function);
1169 1171
1170 CompilationPipeline* pipeline = 1172 CompilationPipeline* pipeline =
1171 CompilationPipeline::New(thread->zone(), function); 1173 CompilationPipeline::New(thread->zone(), function);
1172 return CompileFunctionHelper(pipeline, function, true, osr_id); 1174 return CompileFunctionHelper(pipeline, function, true, osr_id);
1173 } 1175 }
1174 1176
1175 1177
1176 // This is only used from unit tests. 1178 // This is only used from unit tests.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 const Object& result = 1416 const Object& result =
1415 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1417 PassiveObject::Handle(isolate->object_store()->sticky_error());
1416 isolate->object_store()->clear_sticky_error(); 1418 isolate->object_store()->clear_sticky_error();
1417 return result.raw(); 1419 return result.raw();
1418 } 1420 }
1419 UNREACHABLE(); 1421 UNREACHABLE();
1420 return Object::null(); 1422 return Object::null();
1421 } 1423 }
1422 1424
1423 } // namespace dart 1425 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698