Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 12776006: Make allocation of Dart parameters and local variables architecture independent. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 AddInstruction(new ChainContextInstr(allocated_context)); 2869 AddInstruction(new ChainContextInstr(allocated_context));
2870 owner()->set_context_level(scope->context_level()); 2870 owner()->set_context_level(scope->context_level());
2871 2871
2872 // If this node_sequence is the body of the function being compiled, copy 2872 // If this node_sequence is the body of the function being compiled, copy
2873 // the captured parameters from the frame into the context. 2873 // the captured parameters from the frame into the context.
2874 if (node == owner()->parsed_function().node_sequence()) { 2874 if (node == owner()->parsed_function().node_sequence()) {
2875 ASSERT(scope->context_level() == 1); 2875 ASSERT(scope->context_level() == 1);
2876 const Function& function = owner()->parsed_function().function(); 2876 const Function& function = owner()->parsed_function().function();
2877 int num_params = function.NumParameters(); 2877 int num_params = function.NumParameters();
2878 int param_frame_index = (num_params == function.num_fixed_parameters()) ? 2878 int param_frame_index = (num_params == function.num_fixed_parameters()) ?
2879 (1 + num_params) : ParsedFunction::kFirstLocalSlotIndex; 2879 (kLastParamSlotIndex + num_params - 1) : kFirstLocalSlotIndex;
2880 // Handle the saved arguments descriptor as an additional parameter. 2880 // Handle the saved arguments descriptor as an additional parameter.
2881 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) { 2881 if (owner()->parsed_function().GetSavedArgumentsDescriptorVar() != NULL) {
2882 ASSERT(param_frame_index == ParsedFunction::kFirstLocalSlotIndex); 2882 ASSERT(param_frame_index == kFirstLocalSlotIndex);
2883 num_params++; 2883 num_params++;
2884 } 2884 }
2885 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { 2885 for (int pos = 0; pos < num_params; param_frame_index--, pos++) {
2886 const LocalVariable& parameter = *scope->VariableAt(pos); 2886 const LocalVariable& parameter = *scope->VariableAt(pos);
2887 ASSERT(parameter.owner() == scope); 2887 ASSERT(parameter.owner() == scope);
2888 if (parameter.is_captured()) { 2888 if (parameter.is_captured()) {
2889 // Create a temporary local describing the original position. 2889 // Create a temporary local describing the original position.
2890 const String& temp_name = String::ZoneHandle(String::Concat( 2890 const String& temp_name = String::ZoneHandle(String::Concat(
2891 parameter.name(), String::Handle(Symbols::New("-orig")))); 2891 parameter.name(), String::Handle(Symbols::New("-orig"))));
2892 LocalVariable* temp_local = new LocalVariable( 2892 LocalVariable* temp_local = new LocalVariable(
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3294 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3295 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3295 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3296 OS::SNPrint(chars, len, kFormat, function_name, reason); 3296 OS::SNPrint(chars, len, kFormat, function_name, reason);
3297 const Error& error = Error::Handle( 3297 const Error& error = Error::Handle(
3298 LanguageError::New(String::Handle(String::New(chars)))); 3298 LanguageError::New(String::Handle(String::New(chars))));
3299 Isolate::Current()->long_jump_base()->Jump(1, error); 3299 Isolate::Current()->long_jump_base()->Jump(1, error);
3300 } 3300 }
3301 3301
3302 3302
3303 } // namespace dart 3303 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698