OLD | NEW |
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 bool optimized, | 256 bool optimized, |
257 intptr_t osr_id) { | 257 intptr_t osr_id) { |
258 const Function& function = parsed_function->function(); | 258 const Function& function = parsed_function->function(); |
259 if (optimized && !function.IsOptimizable()) { | 259 if (optimized && !function.IsOptimizable()) { |
260 return false; | 260 return false; |
261 } | 261 } |
262 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); | 262 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); |
263 bool is_compiled = false; | 263 bool is_compiled = false; |
264 Isolate* isolate = Isolate::Current(); | 264 Isolate* isolate = Isolate::Current(); |
265 HANDLESCOPE(isolate); | 265 HANDLESCOPE(isolate); |
| 266 isolate->set_cha_used(false); |
266 | 267 |
267 // We may reattempt compilation if the function needs to be assembled using | 268 // We may reattempt compilation if the function needs to be assembled using |
268 // far branches on ARM and MIPS. In the else branch of the setjmp call, | 269 // far branches on ARM and MIPS. In the else branch of the setjmp call, |
269 // done is set to false, and use_far_branches is set to true if there is a | 270 // done is set to false, and use_far_branches is set to true if there is a |
270 // longjmp from the ARM or MIPS assemblers. In all other paths through this | 271 // longjmp from the ARM or MIPS assemblers. In all other paths through this |
271 // while loop, done is set to true. use_far_branches is always false on ia32 | 272 // while loop, done is set to true. use_far_branches is always false on ia32 |
272 // and x64. | 273 // and x64. |
273 bool done = false; | 274 bool done = false; |
274 // volatile because the variable may be clobbered by a longjmp. | 275 // volatile because the variable may be clobbered by a longjmp. |
275 volatile bool use_far_branches = false; | 276 volatile bool use_far_branches = false; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 isolate); | 534 isolate); |
534 graph_compiler.CompileGraph(); | 535 graph_compiler.CompileGraph(); |
535 } | 536 } |
536 { | 537 { |
537 TimerScope timer(FLAG_compiler_stats, | 538 TimerScope timer(FLAG_compiler_stats, |
538 &CompilerStats::codefinalizer_timer, | 539 &CompilerStats::codefinalizer_timer, |
539 isolate); | 540 isolate); |
540 const Code& code = Code::Handle( | 541 const Code& code = Code::Handle( |
541 Code::FinalizeCode(function, &assembler, optimized)); | 542 Code::FinalizeCode(function, &assembler, optimized)); |
542 code.set_is_optimized(optimized); | 543 code.set_is_optimized(optimized); |
| 544 // CHA should not be used for unoptimized code. |
| 545 ASSERT(optimized || !isolate->cha_used()); |
| 546 code.set_has_used_cha(isolate->cha_used()); |
543 graph_compiler.FinalizePcDescriptors(code); | 547 graph_compiler.FinalizePcDescriptors(code); |
544 graph_compiler.FinalizeDeoptInfo(code); | 548 graph_compiler.FinalizeDeoptInfo(code); |
545 graph_compiler.FinalizeStackmaps(code); | 549 graph_compiler.FinalizeStackmaps(code); |
546 graph_compiler.FinalizeVarDescriptors(code); | 550 graph_compiler.FinalizeVarDescriptors(code); |
547 graph_compiler.FinalizeExceptionHandlers(code); | 551 graph_compiler.FinalizeExceptionHandlers(code); |
548 graph_compiler.FinalizeComments(code); | 552 graph_compiler.FinalizeComments(code); |
549 graph_compiler.FinalizeStaticCallTargetsTable(code); | 553 graph_compiler.FinalizeStaticCallTargetsTable(code); |
550 | 554 |
551 if (optimized) { | 555 if (optimized) { |
552 if (osr_id == Isolate::kNoDeoptId) { | 556 if (osr_id == Isolate::kNoDeoptId) { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 const Object& result = | 943 const Object& result = |
940 Object::Handle(isolate->object_store()->sticky_error()); | 944 Object::Handle(isolate->object_store()->sticky_error()); |
941 isolate->object_store()->clear_sticky_error(); | 945 isolate->object_store()->clear_sticky_error(); |
942 return result.raw(); | 946 return result.raw(); |
943 } | 947 } |
944 UNREACHABLE(); | 948 UNREACHABLE(); |
945 return Object::null(); | 949 return Object::null(); |
946 } | 950 } |
947 | 951 |
948 } // namespace dart | 952 } // namespace dart |
OLD | NEW |