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

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

Issue 10035006: Share intrinsification framework across architectures, started on instrinsification in the new comp… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 "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"
11 #include "vm/intermediate_language.h" 11 #include "vm/intermediate_language.h"
12 #include "vm/longjump.h" 12 #include "vm/longjump.h"
13 #include "vm/object_store.h" 13 #include "vm/object_store.h"
14 #include "vm/os.h" 14 #include "vm/os.h"
15 #include "vm/parser.h" 15 #include "vm/parser.h"
16 #include "vm/resolver.h" 16 #include "vm/resolver.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 18
19 namespace dart { 19 namespace dart {
20 20
21 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); 21 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph.");
22 DECLARE_FLAG(bool, enable_type_checks); 22 DECLARE_FLAG(bool, enable_type_checks);
23 DECLARE_FLAG(bool, print_ast); 23 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree.");
24 24
25 25
26 FlowGraphBuilder::FlowGraphBuilder(const ParsedFunction& parsed_function) 26 FlowGraphBuilder::FlowGraphBuilder(const ParsedFunction& parsed_function)
27 : parsed_function_(parsed_function), 27 : parsed_function_(parsed_function),
28 preorder_block_entries_(), 28 preorder_block_entries_(),
29 postorder_block_entries_(), 29 postorder_block_entries_(),
30 context_level_(0), 30 context_level_(0),
31 last_used_try_index_(CatchClauseNode::kInvalidTryIndex), 31 last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
32 try_index_(CatchClauseNode::kInvalidTryIndex), 32 try_index_(CatchClauseNode::kInvalidTryIndex),
33 catch_entries_() {} 33 catch_entries_() {}
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 1959
1960 ChainContextComp* chain_context = new ChainContextComp( 1960 ChainContextComp* chain_context = new ChainContextComp(
1961 allocated_context_value); 1961 allocated_context_value);
1962 AddInstruction(new DoInstr(chain_context)); 1962 AddInstruction(new DoInstr(chain_context));
1963 owner()->set_context_level(scope->context_level()); 1963 owner()->set_context_level(scope->context_level());
1964 1964
1965 // If this node_sequence is the body of the function being compiled, copy 1965 // If this node_sequence is the body of the function being compiled, copy
1966 // the captured parameters from the frame into the context. 1966 // the captured parameters from the frame into the context.
1967 if (node == owner()->parsed_function().node_sequence()) { 1967 if (node == owner()->parsed_function().node_sequence()) {
1968 ASSERT(scope->context_level() == 1); 1968 ASSERT(scope->context_level() == 1);
1969 const Immediate raw_null =
1970 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1971 const Function& function = owner()->parsed_function().function(); 1969 const Function& function = owner()->parsed_function().function();
1972 const int num_params = function.NumberOfParameters(); 1970 const int num_params = function.NumberOfParameters();
1973 int param_frame_index = 1971 int param_frame_index =
1974 (num_params == function.num_fixed_parameters()) ? 1 + num_params : -1; 1972 (num_params == function.num_fixed_parameters()) ? 1 + num_params : -1;
1975 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { 1973 for (int pos = 0; pos < num_params; param_frame_index--, pos++) {
1976 const LocalVariable& parameter = *scope->VariableAt(pos); 1974 const LocalVariable& parameter = *scope->VariableAt(pos);
1977 ASSERT(parameter.owner() == scope); 1975 ASSERT(parameter.owner() == scope);
1978 if (parameter.is_captured()) { 1976 if (parameter.is_captured()) {
1979 // Create a temporary local describing the original position. 1977 // Create a temporary local describing the original position.
1980 const String& temp_name = String::ZoneHandle(String::Concat( 1978 const String& temp_name = String::ZoneHandle(String::Concat(
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 char* chars = reinterpret_cast<char*>( 2732 char* chars = reinterpret_cast<char*>(
2735 Isolate::Current()->current_zone()->Allocate(len)); 2733 Isolate::Current()->current_zone()->Allocate(len));
2736 OS::SNPrint(chars, len, kFormat, function_name, reason); 2734 OS::SNPrint(chars, len, kFormat, function_name, reason);
2737 const Error& error = Error::Handle( 2735 const Error& error = Error::Handle(
2738 LanguageError::New(String::Handle(String::New(chars)))); 2736 LanguageError::New(String::Handle(String::New(chars))));
2739 Isolate::Current()->long_jump_base()->Jump(1, error); 2737 Isolate::Current()->long_jump_base()->Jump(1, error);
2740 } 2738 }
2741 2739
2742 2740
2743 } // namespace dart 2741 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698