| 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 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 new ChainContextComp(new UseVal(allocated_context)); | 1867 new ChainContextComp(new UseVal(allocated_context)); |
| 1868 AddInstruction(new DoInstr(chain_context)); | 1868 AddInstruction(new DoInstr(chain_context)); |
| 1869 owner()->set_context_level(scope->context_level()); | 1869 owner()->set_context_level(scope->context_level()); |
| 1870 | 1870 |
| 1871 // If this node_sequence is the body of the function being compiled, copy | 1871 // If this node_sequence is the body of the function being compiled, copy |
| 1872 // the captured parameters from the frame into the context. | 1872 // the captured parameters from the frame into the context. |
| 1873 if (node == owner()->parsed_function().node_sequence()) { | 1873 if (node == owner()->parsed_function().node_sequence()) { |
| 1874 ASSERT(scope->context_level() == 1); | 1874 ASSERT(scope->context_level() == 1); |
| 1875 const Function& function = owner()->parsed_function().function(); | 1875 const Function& function = owner()->parsed_function().function(); |
| 1876 const int num_params = function.NumberOfParameters(); | 1876 const int num_params = function.NumberOfParameters(); |
| 1877 int param_frame_index = | 1877 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
| 1878 (num_params == function.num_fixed_parameters()) ? 1 + num_params : -1; | 1878 (1 + num_params) : ParsedFunction::kFirstLocalSlotIndex; |
| 1879 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 1879 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 1880 const LocalVariable& parameter = *scope->VariableAt(pos); | 1880 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 1881 ASSERT(parameter.owner() == scope); | 1881 ASSERT(parameter.owner() == scope); |
| 1882 if (parameter.is_captured()) { | 1882 if (parameter.is_captured()) { |
| 1883 // Create a temporary local describing the original position. | 1883 // Create a temporary local describing the original position. |
| 1884 const String& temp_name = String::ZoneHandle(String::Concat( | 1884 const String& temp_name = String::ZoneHandle(String::Concat( |
| 1885 parameter.name(), String::Handle(String::NewSymbol("-orig")))); | 1885 parameter.name(), String::Handle(String::NewSymbol("-orig")))); |
| 1886 LocalVariable* temp_local = new LocalVariable( | 1886 LocalVariable* temp_local = new LocalVariable( |
| 1887 0, // Token index. | 1887 0, // Token index. |
| 1888 temp_name, | 1888 temp_name, |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 char* chars = reinterpret_cast<char*>( | 2235 char* chars = reinterpret_cast<char*>( |
| 2236 Isolate::Current()->current_zone()->Allocate(len)); | 2236 Isolate::Current()->current_zone()->Allocate(len)); |
| 2237 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2237 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2238 const Error& error = Error::Handle( | 2238 const Error& error = Error::Handle( |
| 2239 LanguageError::New(String::Handle(String::New(chars)))); | 2239 LanguageError::New(String::Handle(String::New(chars)))); |
| 2240 Isolate::Current()->long_jump_base()->Jump(1, error); | 2240 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 | 2243 |
| 2244 } // namespace dart | 2244 } // namespace dart |
| OLD | NEW |