| 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/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2956 AddInstruction(new ChainContextInstr(allocated_context)); | 2956 AddInstruction(new ChainContextInstr(allocated_context)); |
| 2957 owner()->set_context_level(scope->context_level()); | 2957 owner()->set_context_level(scope->context_level()); |
| 2958 | 2958 |
| 2959 // If this node_sequence is the body of the function being compiled, copy | 2959 // If this node_sequence is the body of the function being compiled, copy |
| 2960 // the captured parameters from the frame into the context. | 2960 // the captured parameters from the frame into the context. |
| 2961 if (node == owner()->parsed_function().node_sequence()) { | 2961 if (node == owner()->parsed_function().node_sequence()) { |
| 2962 ASSERT(scope->context_level() == 1); | 2962 ASSERT(scope->context_level() == 1); |
| 2963 const Function& function = owner()->parsed_function().function(); | 2963 const Function& function = owner()->parsed_function().function(); |
| 2964 int num_params = function.NumParameters(); | 2964 int num_params = function.NumParameters(); |
| 2965 int param_frame_index = (num_params == function.num_fixed_parameters()) ? | 2965 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
| 2966 (kLastParamSlotIndex + num_params - 1) : kFirstLocalSlotIndex; | 2966 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; |
| 2967 // Handle the saved arguments descriptor as an additional parameter. | 2967 // Handle the saved arguments descriptor as an additional parameter. |
| 2968 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) { | 2968 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) { |
| 2969 ASSERT(param_frame_index == kFirstLocalSlotIndex); | 2969 ASSERT(param_frame_index == kFirstLocalSlotFromFp); |
| 2970 num_params++; | 2970 num_params++; |
| 2971 } | 2971 } |
| 2972 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 2972 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 2973 const LocalVariable& parameter = *scope->VariableAt(pos); | 2973 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 2974 ASSERT(parameter.owner() == scope); | 2974 ASSERT(parameter.owner() == scope); |
| 2975 if (parameter.is_captured()) { | 2975 if (parameter.is_captured()) { |
| 2976 // Create a temporary local describing the original position. | 2976 // Create a temporary local describing the original position. |
| 2977 const String& temp_name = String::ZoneHandle(String::Concat( | 2977 const String& temp_name = String::ZoneHandle(String::Concat( |
| 2978 parameter.name(), String::Handle(Symbols::New("-orig")))); | 2978 parameter.name(), String::Handle(Symbols::New("-orig")))); |
| 2979 LocalVariable* temp_local = new LocalVariable( | 2979 LocalVariable* temp_local = new LocalVariable( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3382 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3382 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3383 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3383 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3384 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3384 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3385 const Error& error = Error::Handle( | 3385 const Error& error = Error::Handle( |
| 3386 LanguageError::New(String::Handle(String::New(chars)))); | 3386 LanguageError::New(String::Handle(String::New(chars)))); |
| 3387 Isolate::Current()->long_jump_base()->Jump(1, error); | 3387 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3388 } | 3388 } |
| 3389 | 3389 |
| 3390 | 3390 |
| 3391 } // namespace dart | 3391 } // namespace dart |
| OLD | NEW |