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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 } | 2287 } |
2288 | 2288 |
2289 | 2289 |
2290 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { | 2290 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { |
2291 ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1)); | 2291 ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1)); |
2292 intptr_t index = GetCurrentTempLocalIndex(); | 2292 intptr_t index = GetCurrentTempLocalIndex(); |
2293 char name[64]; | 2293 char name[64]; |
2294 OS::SNPrint(name, 64, ":tmp_local%" Pd, index); | 2294 OS::SNPrint(name, 64, ":tmp_local%" Pd, index); |
2295 LocalVariable* var = | 2295 LocalVariable* var = |
2296 new(Z) LocalVariable(TokenPosition::kNoSource, | 2296 new(Z) LocalVariable(TokenPosition::kNoSource, |
| 2297 TokenPosition::kNoSource, |
2297 String::ZoneHandle(Z, Symbols::New(T, name)), | 2298 String::ZoneHandle(Z, Symbols::New(T, name)), |
2298 *value->Type()->ToAbstractType()); | 2299 *value->Type()->ToAbstractType()); |
2299 var->set_index(index); | 2300 var->set_index(index); |
2300 return var; | 2301 return var; |
2301 } | 2302 } |
2302 | 2303 |
2303 | 2304 |
2304 Definition* EffectGraphVisitor::ExitTempLocalScope(Value* value) { | 2305 Definition* EffectGraphVisitor::ExitTempLocalScope(Value* value) { |
2305 return new(Z) DropTempsInstr(0, value); | 2306 return new(Z) DropTempsInstr(0, value); |
2306 } | 2307 } |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4020 int param_frame_index = (num_params == function.num_fixed_parameters()) ? | 4021 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
4021 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; | 4022 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; |
4022 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 4023 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
4023 const LocalVariable& parameter = *scope->VariableAt(pos); | 4024 const LocalVariable& parameter = *scope->VariableAt(pos); |
4024 ASSERT(parameter.owner() == scope); | 4025 ASSERT(parameter.owner() == scope); |
4025 if (parameter.is_captured()) { | 4026 if (parameter.is_captured()) { |
4026 // Create a temporary local describing the original position. | 4027 // Create a temporary local describing the original position. |
4027 const String& temp_name = Symbols::TempParam(); | 4028 const String& temp_name = Symbols::TempParam(); |
4028 LocalVariable* temp_local = new(Z) LocalVariable( | 4029 LocalVariable* temp_local = new(Z) LocalVariable( |
4029 TokenPosition::kNoSource, // Token index. | 4030 TokenPosition::kNoSource, // Token index. |
| 4031 TokenPosition::kNoSource, // Token index. |
4030 temp_name, | 4032 temp_name, |
4031 Object::dynamic_type()); // Type. | 4033 Object::dynamic_type()); // Type. |
4032 temp_local->set_index(param_frame_index); | 4034 temp_local->set_index(param_frame_index); |
4033 | 4035 |
4034 // Mark this local as captured parameter so that the optimizer | 4036 // Mark this local as captured parameter so that the optimizer |
4035 // correctly handles these when compiling try-catch: Captured | 4037 // correctly handles these when compiling try-catch: Captured |
4036 // parameters are not in the stack environment, therefore they | 4038 // parameters are not in the stack environment, therefore they |
4037 // must be skipped when emitting sync-code in try-blocks. | 4039 // must be skipped when emitting sync-code in try-blocks. |
4038 temp_local->set_is_captured_parameter(true); | 4040 temp_local->set_is_captured_parameter(true); |
4039 | 4041 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4639 block_marks); | 4641 block_marks); |
4640 ASSERT(found); | 4642 ASSERT(found); |
4641 } | 4643 } |
4642 | 4644 |
4643 | 4645 |
4644 void FlowGraphBuilder::Bailout(const char* reason) const { | 4646 void FlowGraphBuilder::Bailout(const char* reason) const { |
4645 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4647 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4646 } | 4648 } |
4647 | 4649 |
4648 } // namespace dart | 4650 } // namespace dart |
OLD | NEW |