| 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 "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 new ChainContextComp(new UseVal(allocated_context)); | 1829 new ChainContextComp(new UseVal(allocated_context)); |
| 1830 AddInstruction(new DoInstr(chain_context)); | 1830 AddInstruction(new DoInstr(chain_context)); |
| 1831 owner()->set_context_level(scope->context_level()); | 1831 owner()->set_context_level(scope->context_level()); |
| 1832 | 1832 |
| 1833 // If this node_sequence is the body of the function being compiled, copy | 1833 // If this node_sequence is the body of the function being compiled, copy |
| 1834 // the captured parameters from the frame into the context. | 1834 // the captured parameters from the frame into the context. |
| 1835 if (node == owner()->parsed_function().node_sequence()) { | 1835 if (node == owner()->parsed_function().node_sequence()) { |
| 1836 ASSERT(scope->context_level() == 1); | 1836 ASSERT(scope->context_level() == 1); |
| 1837 const Function& function = owner()->parsed_function().function(); | 1837 const Function& function = owner()->parsed_function().function(); |
| 1838 const int num_params = function.NumberOfParameters(); | 1838 const int num_params = function.NumberOfParameters(); |
| 1839 int param_frame_index = | 1839 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
| 1840 (num_params == function.num_fixed_parameters()) ? 1 + num_params : -1; | 1840 (1 + num_params) : ParsedFunction::kFirstStackSlotIndex; |
| 1841 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 1841 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 1842 const LocalVariable& parameter = *scope->VariableAt(pos); | 1842 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 1843 ASSERT(parameter.owner() == scope); | 1843 ASSERT(parameter.owner() == scope); |
| 1844 if (parameter.is_captured()) { | 1844 if (parameter.is_captured()) { |
| 1845 // Create a temporary local describing the original position. | 1845 // Create a temporary local describing the original position. |
| 1846 const String& temp_name = String::ZoneHandle(String::Concat( | 1846 const String& temp_name = String::ZoneHandle(String::Concat( |
| 1847 parameter.name(), String::Handle(String::NewSymbol("-orig")))); | 1847 parameter.name(), String::Handle(String::NewSymbol("-orig")))); |
| 1848 LocalVariable* temp_local = new LocalVariable( | 1848 LocalVariable* temp_local = new LocalVariable( |
| 1849 0, // Token index. | 1849 0, // Token index. |
| 1850 temp_name, | 1850 temp_name, |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 char* chars = reinterpret_cast<char*>( | 2619 char* chars = reinterpret_cast<char*>( |
| 2620 Isolate::Current()->current_zone()->Allocate(len)); | 2620 Isolate::Current()->current_zone()->Allocate(len)); |
| 2621 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2621 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2622 const Error& error = Error::Handle( | 2622 const Error& error = Error::Handle( |
| 2623 LanguageError::New(String::Handle(String::New(chars)))); | 2623 LanguageError::New(String::Handle(String::New(chars)))); |
| 2624 Isolate::Current()->long_jump_base()->Jump(1, error); | 2624 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2625 } | 2625 } |
| 2626 | 2626 |
| 2627 | 2627 |
| 2628 } // namespace dart | 2628 } // namespace dart |
| OLD | NEW |