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

Side by Side Diff: vm/flow_graph_builder.cc

Issue 12207023: Rename the accessor functions saved_context_var and set_saved_context_var to saved_entry_context_va… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | vm/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 owner()->parsed_function().function().result_type()); 685 owner()->parsed_function().function().result_type());
686 return_value = BuildAssignableValue(node->value()->token_pos(), 686 return_value = BuildAssignableValue(node->value()->token_pos(),
687 return_value, 687 return_value,
688 dst_type, 688 dst_type,
689 Symbols::FunctionResult()); 689 Symbols::FunctionResult());
690 } 690 }
691 } 691 }
692 692
693 intptr_t current_context_level = owner()->context_level(); 693 intptr_t current_context_level = owner()->context_level();
694 ASSERT(current_context_level >= 0); 694 ASSERT(current_context_level >= 0);
695 if (owner()->parsed_function().saved_context_var() != NULL) { 695 if (owner()->parsed_function().saved_entry_context_var() != NULL) {
696 // CTX on entry was saved, but not linked as context parent. 696 // CTX on entry was saved, but not linked as context parent.
697 BuildLoadContext(*owner()->parsed_function().saved_context_var()); 697 BuildLoadContext(*owner()->parsed_function().saved_entry_context_var());
698 } else { 698 } else {
699 while (current_context_level-- > 0) { 699 while (current_context_level-- > 0) {
700 UnchainContext(); 700 UnchainContext();
701 } 701 }
702 } 702 }
703 703
704 AddReturnExit(node->token_pos(), return_value); 704 AddReturnExit(node->token_pos(), return_value);
705 } 705 }
706 706
707 707
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 } 2756 }
2757 2757
2758 2758
2759 void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) { 2759 void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) {
2760 ReturnDefinition(BuildStoreIndexedValues(node, kResultNeeded)); 2760 ReturnDefinition(BuildStoreIndexedValues(node, kResultNeeded));
2761 } 2761 }
2762 2762
2763 2763
2764 bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const { 2764 bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const {
2765 return (node == owner()->parsed_function().node_sequence()) && 2765 return (node == owner()->parsed_function().node_sequence()) &&
2766 (owner()->parsed_function().saved_context_var() != NULL); 2766 (owner()->parsed_function().saved_entry_context_var() != NULL);
2767 } 2767 }
2768 2768
2769 2769
2770 void EffectGraphVisitor::UnchainContext() { 2770 void EffectGraphVisitor::UnchainContext() {
2771 InlineBailout("EffectGraphVisitor::UnchainContext (context)"); 2771 InlineBailout("EffectGraphVisitor::UnchainContext (context)");
2772 Value* context = Bind(new CurrentContextInstr()); 2772 Value* context = Bind(new CurrentContextInstr());
2773 Value* parent = Bind( 2773 Value* parent = Bind(
2774 new LoadFieldInstr(context, 2774 new LoadFieldInstr(context,
2775 Context::parent_offset(), 2775 Context::parent_offset(),
2776 Type::ZoneHandle())); // Not an instance, no type. 2776 Type::ZoneHandle())); // Not an instance, no type.
(...skipping 19 matching lines...) Expand all
2796 num_context_variables)); 2796 num_context_variables));
2797 2797
2798 // If this node_sequence is the body of the function being compiled, and if 2798 // If this node_sequence is the body of the function being compiled, and if
2799 // this function allocates context variables, but none of its enclosing 2799 // this function allocates context variables, but none of its enclosing
2800 // functions do, the context on entry is not linked as parent of the 2800 // functions do, the context on entry is not linked as parent of the
2801 // allocated context but saved on entry and restored on exit as to prevent 2801 // allocated context but saved on entry and restored on exit as to prevent
2802 // memory leaks. 2802 // memory leaks.
2803 // In this case, the parser pre-allocates a variable to save the context. 2803 // In this case, the parser pre-allocates a variable to save the context.
2804 if (MustSaveRestoreContext(node)) { 2804 if (MustSaveRestoreContext(node)) {
2805 Value* current_context = Bind(new CurrentContextInstr()); 2805 Value* current_context = Bind(new CurrentContextInstr());
2806 Do(BuildStoreTemp(*owner()->parsed_function().saved_context_var(), 2806 Do(BuildStoreTemp(*owner()->parsed_function().saved_entry_context_var(),
2807 current_context)); 2807 current_context));
2808 Value* null_context = Bind(new ConstantInstr(Object::ZoneHandle())); 2808 Value* null_context = Bind(new ConstantInstr(Object::ZoneHandle()));
2809 AddInstruction(new StoreContextInstr(null_context)); 2809 AddInstruction(new StoreContextInstr(null_context));
2810 } 2810 }
2811 2811
2812 AddInstruction(new ChainContextInstr(allocated_context)); 2812 AddInstruction(new ChainContextInstr(allocated_context));
2813 owner()->set_context_level(scope->context_level()); 2813 owner()->set_context_level(scope->context_level());
2814 2814
2815 // If this node_sequence is the body of the function being compiled, copy 2815 // If this node_sequence is the body of the function being compiled, copy
2816 // the captured parameters from the frame into the context. 2816 // the captured parameters from the frame into the context.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 Append(for_effect); 2895 Append(for_effect);
2896 if (!is_open()) { 2896 if (!is_open()) {
2897 // E.g., because of a JumpNode. 2897 // E.g., because of a JumpNode.
2898 break; 2898 break;
2899 } 2899 }
2900 } 2900 }
2901 2901
2902 if (is_open()) { 2902 if (is_open()) {
2903 if (MustSaveRestoreContext(node)) { 2903 if (MustSaveRestoreContext(node)) {
2904 ASSERT(num_context_variables > 0); 2904 ASSERT(num_context_variables > 0);
2905 BuildLoadContext(*owner()->parsed_function().saved_context_var()); 2905 BuildLoadContext(*owner()->parsed_function().saved_entry_context_var());
2906 } else if (num_context_variables > 0) { 2906 } else if (num_context_variables > 0) {
2907 UnchainContext(); 2907 UnchainContext();
2908 } 2908 }
2909 } 2909 }
2910 2910
2911 // No continue on sequence allowed. 2911 // No continue on sequence allowed.
2912 ASSERT((node->label() == NULL) || 2912 ASSERT((node->label() == NULL) ||
2913 (node->label()->join_for_continue() == NULL)); 2913 (node->label()->join_for_continue() == NULL));
2914 // If this node sequence is labeled, a break out of the sequence will have 2914 // If this node sequence is labeled, a break out of the sequence will have
2915 // taken care of unchaining the context. 2915 // taken care of unchaining the context.
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3229 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3230 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3230 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3231 OS::SNPrint(chars, len, kFormat, function_name, reason); 3231 OS::SNPrint(chars, len, kFormat, function_name, reason);
3232 const Error& error = Error::Handle( 3232 const Error& error = Error::Handle(
3233 LanguageError::New(String::Handle(String::New(chars)))); 3233 LanguageError::New(String::Handle(String::New(chars))));
3234 Isolate::Current()->long_jump_base()->Jump(1, error); 3234 Isolate::Current()->long_jump_base()->Jump(1, error);
3235 } 3235 }
3236 3236
3237 3237
3238 } // namespace dart 3238 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698