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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 // area below FP, deoptimization environment does not track them. | 52 // area below FP, deoptimization environment does not track them. |
| 53 const intptr_t num_args = | 53 const intptr_t num_args = |
| 54 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); | 54 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); |
| 55 const intptr_t fixed_parameter_count = | 55 const intptr_t fixed_parameter_count = |
| 56 deoptimization_env_->fixed_parameter_count(); | 56 deoptimization_env_->fixed_parameter_count(); |
| 57 DeoptInfoBuilder builder(compiler->object_table(), num_args); | 57 DeoptInfoBuilder builder(compiler->object_table(), num_args); |
| 58 | 58 |
| 59 intptr_t slot_ix = 0; | 59 intptr_t slot_ix = 0; |
| 60 BuildReturnAddress(&builder, function, slot_ix++); | 60 BuildReturnAddress(&builder, function, slot_ix++); |
| 61 | 61 |
| 62 // All locals between TOS and PC-marker. | |
| 63 const GrowableArray<Value*>& values = deoptimization_env_->values(); | |
| 64 | |
| 65 // Assign locations to values pushed above spill slots with PushArgument. | 62 // Assign locations to values pushed above spill slots with PushArgument. |
| 66 intptr_t height = compiler->StackSize(); | 63 intptr_t height = compiler->StackSize(); |
| 67 for (intptr_t i = 0; i < values.length(); i++) { | 64 for (intptr_t i = 0; i < deoptimization_env_->Length(); i++) { |
|
Kevin Millikin (Google)
2012/09/07 12:51:52
This also seems wrong. There can be pushed argume
zerny-google
2012/09/07 13:51:37
Yes. And this needs to be recursive (with a retn-a
| |
| 68 if (deoptimization_env_->LocationAt(i).IsInvalid()) { | 65 if (deoptimization_env_->LocationAt(i).IsInvalid()) { |
| 69 ASSERT(values[i]->definition()->IsPushArgument()); | 66 ASSERT(deoptimization_env_->ValueAt(i)->definition()->IsPushArgument()); |
| 70 *deoptimization_env_->LocationSlotAt(i) = Location::StackSlot(height++); | 67 *deoptimization_env_->LocationSlotAt(i) = Location::StackSlot(height++); |
| 71 } | 68 } |
| 72 } | 69 } |
| 73 | 70 |
| 74 for (intptr_t i = values.length() - 1; i >= fixed_parameter_count; i--) { | 71 for (intptr_t i = deoptimization_env_->Length() - 1; |
| 75 builder.AddCopy(deoptimization_env_->LocationAt(i), *values[i], slot_ix++); | 72 i >= fixed_parameter_count; |
| 73 i--) { | |
| 74 builder.AddCopy(deoptimization_env_->LocationAt(i), | |
| 75 *deoptimization_env_->ValueAt(i), | |
| 76 slot_ix++); | |
| 76 } | 77 } |
| 77 | 78 |
| 78 // PC marker, caller-fp, caller-pc. | 79 // PC marker, caller-fp, caller-pc. |
| 79 builder.AddPcMarker(function, slot_ix++); | 80 builder.AddPcMarker(function, slot_ix++); |
| 80 builder.AddCallerFp(slot_ix++); | 81 builder.AddCallerFp(slot_ix++); |
| 81 builder.AddCallerPc(slot_ix++); | 82 builder.AddCallerPc(slot_ix++); |
| 82 // Incoming arguments. | 83 // Incoming arguments. |
| 83 for (intptr_t i = fixed_parameter_count - 1; i >= 0; i--) { | 84 for (intptr_t i = fixed_parameter_count - 1; i >= 0; i--) { |
| 84 builder.AddCopy(deoptimization_env_->LocationAt(i), *values[i], slot_ix++); | 85 builder.AddCopy(deoptimization_env_->LocationAt(i), |
| 86 *deoptimization_env_->ValueAt(i), | |
| 87 slot_ix++); | |
| 85 } | 88 } |
| 86 | 89 |
| 87 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo()); | 90 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo()); |
| 88 return deopt_info.raw(); | 91 return deopt_info.raw(); |
| 89 } | 92 } |
| 90 | 93 |
| 91 | 94 |
| 92 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, | 95 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, |
| 93 const FlowGraph& flow_graph, | 96 const FlowGraph& flow_graph, |
| 94 bool is_optimizing, | 97 bool is_optimizing, |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 case ABOVE: return unsigned_left > unsigned_right; | 846 case ABOVE: return unsigned_left > unsigned_right; |
| 844 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; | 847 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; |
| 845 default: | 848 default: |
| 846 UNIMPLEMENTED(); | 849 UNIMPLEMENTED(); |
| 847 return false; | 850 return false; |
| 848 } | 851 } |
| 849 } | 852 } |
| 850 | 853 |
| 851 | 854 |
| 852 } // namespace dart | 855 } // namespace dart |
| OLD | NEW |