Chromium Code Reviews| 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 | 779 |
| 780 for (intptr_t i = 0; | 780 for (intptr_t i = 0; |
| 781 i < flow_graph->guarded_fields()->length(); | 781 i < flow_graph->guarded_fields()->length(); |
| 782 i++) { | 782 i++) { |
| 783 const Field* field = (*flow_graph->guarded_fields())[i]; | 783 const Field* field = (*flow_graph->guarded_fields())[i]; |
| 784 field->RegisterDependentCode(code); | 784 field->RegisterDependentCode(code); |
| 785 } | 785 } |
| 786 } else { // not optimized. | 786 } else { // not optimized. |
| 787 if (!Compiler::always_optimize() && | 787 if (!Compiler::always_optimize() && |
| 788 (function.ic_data_array() == Array::null())) { | 788 (function.ic_data_array() == Array::null())) { |
| 789 function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data()); | 789 function.SaveICDataMap( |
| 790 graph_compiler.deopt_id_to_ic_data(), | |
| 791 Array::Handle(graph_compiler.edge_counters_array())); | |
|
srdjan
2015/09/23 19:24:43
zone,
Florian Schneider
2015/09/28 09:19:43
Done.
| |
| 790 } | 792 } |
| 791 function.set_unoptimized_code(code); | 793 function.set_unoptimized_code(code); |
| 792 function.AttachCode(code); | 794 function.AttachCode(code); |
| 793 ASSERT(CodePatcher::CodeIsPatchable(code)); | 795 ASSERT(CodePatcher::CodeIsPatchable(code)); |
| 794 } | 796 } |
| 795 if (parsed_function->HasDeferredPrefixes()) { | 797 if (parsed_function->HasDeferredPrefixes()) { |
| 796 ASSERT(!FLAG_load_deferred_eagerly); | 798 ASSERT(!FLAG_load_deferred_eagerly); |
| 797 ZoneGrowableArray<const LibraryPrefix*>* prefixes = | 799 ZoneGrowableArray<const LibraryPrefix*>* prefixes = |
| 798 parsed_function->deferred_prefixes(); | 800 parsed_function->deferred_prefixes(); |
| 799 for (intptr_t i = 0; i < prefixes->length(); i++) { | 801 for (intptr_t i = 0; i < prefixes->length(); i++) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1018 LongJumpScope jump; | 1020 LongJumpScope jump; |
| 1019 if (setjmp(*jump.Set()) == 0) { | 1021 if (setjmp(*jump.Set()) == 0) { |
| 1020 Thread* const thread = Thread::Current(); | 1022 Thread* const thread = Thread::Current(); |
| 1021 Isolate* const isolate = thread->isolate(); | 1023 Isolate* const isolate = thread->isolate(); |
| 1022 StackZone stack_zone(thread); | 1024 StackZone stack_zone(thread); |
| 1023 Zone* const zone = stack_zone.GetZone(); | 1025 Zone* const zone = stack_zone.GetZone(); |
| 1024 TIMERSCOPE(thread, time_compilation); | 1026 TIMERSCOPE(thread, time_compilation); |
| 1025 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 1027 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); |
| 1026 per_compile_timer.Start(); | 1028 per_compile_timer.Start(); |
| 1027 | 1029 |
| 1028 // Restore unoptimized code if needed. | |
| 1029 if (optimized) { | |
| 1030 if (!Compiler::always_optimize()) { | |
| 1031 const Error& error = Error::Handle( | |
| 1032 zone, Compiler::EnsureUnoptimizedCode(Thread::Current(), function)); | |
| 1033 if (!error.IsNull()) { | |
| 1034 return error.raw(); | |
| 1035 } | |
| 1036 } | |
| 1037 } | |
| 1038 | |
| 1039 ParsedFunction* parsed_function = new(zone) ParsedFunction( | 1030 ParsedFunction* parsed_function = new(zone) ParsedFunction( |
| 1040 thread, Function::ZoneHandle(zone, function.raw())); | 1031 thread, Function::ZoneHandle(zone, function.raw())); |
| 1041 if (FLAG_trace_compiler) { | 1032 if (FLAG_trace_compiler) { |
| 1042 THR_Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 1033 THR_Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", |
| 1043 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 1034 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), |
| 1044 (optimized ? "optimized " : ""), | 1035 (optimized ? "optimized " : ""), |
| 1045 function.ToFullyQualifiedCString(), | 1036 function.ToFullyQualifiedCString(), |
| 1046 function.token_pos(), | 1037 function.token_pos(), |
| 1047 (function.end_token_pos() - function.token_pos())); | 1038 (function.end_token_pos() - function.token_pos())); |
| 1048 } | 1039 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 const Object& result = | 1410 const Object& result = |
| 1420 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1411 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
| 1421 isolate->object_store()->clear_sticky_error(); | 1412 isolate->object_store()->clear_sticky_error(); |
| 1422 return result.raw(); | 1413 return result.raw(); |
| 1423 } | 1414 } |
| 1424 UNREACHABLE(); | 1415 UNREACHABLE(); |
| 1425 return Object::null(); | 1416 return Object::null(); |
| 1426 } | 1417 } |
| 1427 | 1418 |
| 1428 } // namespace dart | 1419 } // namespace dart |
| OLD | NEW |