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/code_generator.h" | 10 #include "vm/code_generator.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 graph_compiler.FinalizeStaticCallTargetsTable(code); | 366 graph_compiler.FinalizeStaticCallTargetsTable(code); |
367 | 367 |
368 if (optimized) { | 368 if (optimized) { |
369 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); | 369 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); |
370 function.SetCode(code); | 370 function.SetCode(code); |
371 if (FLAG_trace_compiler) { | 371 if (FLAG_trace_compiler) { |
372 OS::Print("--> patching entry %#"Px"\n", | 372 OS::Print("--> patching entry %#"Px"\n", |
373 Code::Handle(function.unoptimized_code()).EntryPoint()); | 373 Code::Handle(function.unoptimized_code()).EntryPoint()); |
374 } | 374 } |
375 | 375 |
| 376 // If not yet present, allocate deoptimization history array. |
| 377 Array& deopt_history = Array::Handle(function.deopt_history()); |
| 378 if (deopt_history.IsNull()) { |
| 379 deopt_history = Array::New(FLAG_deoptimization_counter_threshold); |
| 380 function.set_deopt_history(deopt_history); |
| 381 } |
| 382 |
376 for (intptr_t i = 0; i < guarded_fields.length(); i++) { | 383 for (intptr_t i = 0; i < guarded_fields.length(); i++) { |
377 const Field& field = *guarded_fields[i]; | 384 const Field& field = *guarded_fields[i]; |
378 field.RegisterDependentCode(code); | 385 field.RegisterDependentCode(code); |
379 } | 386 } |
380 } else { | 387 } else { |
381 function.set_unoptimized_code(code); | 388 function.set_unoptimized_code(code); |
382 function.SetCode(code); | 389 function.SetCode(code); |
383 ASSERT(CodePatcher::CodeIsPatchable(code)); | 390 ASSERT(CodePatcher::CodeIsPatchable(code)); |
384 } | 391 } |
385 } | 392 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 Object::Handle(isolate->object_store()->sticky_error()); | 743 Object::Handle(isolate->object_store()->sticky_error()); |
737 isolate->object_store()->clear_sticky_error(); | 744 isolate->object_store()->clear_sticky_error(); |
738 isolate->set_long_jump_base(base); | 745 isolate->set_long_jump_base(base); |
739 return result.raw(); | 746 return result.raw(); |
740 } | 747 } |
741 UNREACHABLE(); | 748 UNREACHABLE(); |
742 return Object::null(); | 749 return Object::null(); |
743 } | 750 } |
744 | 751 |
745 } // namespace dart | 752 } // namespace dart |
OLD | NEW |