| 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 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 } | 2346 } |
| 2347 | 2347 |
| 2348 Do(new ChainContextInstr(allocated_context)); | 2348 Do(new ChainContextInstr(allocated_context)); |
| 2349 owner()->set_context_level(scope->context_level()); | 2349 owner()->set_context_level(scope->context_level()); |
| 2350 | 2350 |
| 2351 // If this node_sequence is the body of the function being compiled, copy | 2351 // If this node_sequence is the body of the function being compiled, copy |
| 2352 // the captured parameters from the frame into the context. | 2352 // the captured parameters from the frame into the context. |
| 2353 if (node == owner()->parsed_function().node_sequence()) { | 2353 if (node == owner()->parsed_function().node_sequence()) { |
| 2354 ASSERT(scope->context_level() == 1); | 2354 ASSERT(scope->context_level() == 1); |
| 2355 const Function& function = owner()->parsed_function().function(); | 2355 const Function& function = owner()->parsed_function().function(); |
| 2356 int num_params = function.NumberOfParameters(); | 2356 int num_params = function.NumParameters(); |
| 2357 int param_frame_index = (num_params == function.num_fixed_parameters()) ? | 2357 int param_frame_index = (num_params == function.num_fixed_parameters()) ? |
| 2358 (1 + num_params) : ParsedFunction::kFirstLocalSlotIndex; | 2358 (1 + num_params) : ParsedFunction::kFirstLocalSlotIndex; |
| 2359 // Handle the saved arguments descriptor as an additional parameter. | 2359 // Handle the saved arguments descriptor as an additional parameter. |
| 2360 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) { | 2360 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) { |
| 2361 ASSERT(param_frame_index == ParsedFunction::kFirstLocalSlotIndex); | 2361 ASSERT(param_frame_index == ParsedFunction::kFirstLocalSlotIndex); |
| 2362 num_params++; | 2362 num_params++; |
| 2363 } | 2363 } |
| 2364 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { | 2364 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { |
| 2365 const LocalVariable& parameter = *scope->VariableAt(pos); | 2365 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 2366 ASSERT(parameter.owner() == scope); | 2366 ASSERT(parameter.owner() == scope); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2384 Bind(new ConstantInstr(Object::ZoneHandle())); | 2384 Bind(new ConstantInstr(Object::ZoneHandle())); |
| 2385 Do(BuildStoreLocal(*temp_local, null_constant, kResultNotNeeded)); | 2385 Do(BuildStoreLocal(*temp_local, null_constant, kResultNotNeeded)); |
| 2386 } | 2386 } |
| 2387 } | 2387 } |
| 2388 } | 2388 } |
| 2389 } | 2389 } |
| 2390 | 2390 |
| 2391 if (FLAG_enable_type_checks && | 2391 if (FLAG_enable_type_checks && |
| 2392 (node == owner()->parsed_function().node_sequence())) { | 2392 (node == owner()->parsed_function().node_sequence())) { |
| 2393 const Function& function = owner()->parsed_function().function(); | 2393 const Function& function = owner()->parsed_function().function(); |
| 2394 const int num_params = function.NumberOfParameters(); | 2394 const int num_params = function.NumParameters(); |
| 2395 int pos = 0; | 2395 int pos = 0; |
| 2396 if (function.IsConstructor()) { | 2396 if (function.IsConstructor()) { |
| 2397 // Skip type checking of receiver and phase for constructor functions. | 2397 // Skip type checking of receiver and phase for constructor functions. |
| 2398 pos = 2; | 2398 pos = 2; |
| 2399 } else if (function.IsFactory() || function.IsDynamicFunction()) { | 2399 } else if (function.IsFactory() || function.IsDynamicFunction()) { |
| 2400 // Skip type checking of type arguments for factory functions. | 2400 // Skip type checking of type arguments for factory functions. |
| 2401 // Skip type checking of receiver for instance functions. | 2401 // Skip type checking of receiver for instance functions. |
| 2402 pos = 1; | 2402 pos = 1; |
| 2403 } | 2403 } |
| 2404 while (pos < num_params) { | 2404 while (pos < num_params) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2633 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2634 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2634 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2635 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2635 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2636 const Error& error = Error::Handle( | 2636 const Error& error = Error::Handle( |
| 2637 LanguageError::New(String::Handle(String::New(chars)))); | 2637 LanguageError::New(String::Handle(String::New(chars)))); |
| 2638 Isolate::Current()->long_jump_base()->Jump(1, error); | 2638 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 | 2641 |
| 2642 } // namespace dart | 2642 } // namespace dart |
| OLD | NEW |