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

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

Issue 8490019: Capturing for loop variables correctly (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/parser.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 896 }
897 897
898 898
899 void CodeGenerator::VisitPrimaryNode(PrimaryNode* node) { 899 void CodeGenerator::VisitPrimaryNode(PrimaryNode* node) {
900 // PrimaryNodes are temporary during parsing. 900 // PrimaryNodes are temporary during parsing.
901 ErrorMsg(node->token_index(), 901 ErrorMsg(node->token_index(),
902 "Unexpected primary node: %s", node->primary().ToCString()); 902 "Unexpected primary node: %s", node->primary().ToCString());
903 } 903 }
904 904
905 905
906 void CodeGenerator::VisitCloneContextNode(CloneContextNode *node) {
907 const Context& result = Context::ZoneHandle();
908 __ PushObject(result);
909 __ pushl(CTX);
910 GenerateCallRuntime(node->id(),
911 node->token_index(), kCloneContextRuntimeEntry);
912 __ popl(EAX);
913 __ popl(CTX); // result: cloned context. Set as current context.
914 }
915
916
906 void CodeGenerator::VisitSequenceNode(SequenceNode* node_sequence) { 917 void CodeGenerator::VisitSequenceNode(SequenceNode* node_sequence) {
907 CodeGeneratorState codegen_state(this); 918 CodeGeneratorState codegen_state(this);
908 LocalScope* scope = node_sequence->scope(); 919 LocalScope* scope = node_sequence->scope();
909 ASSERT(scope != NULL); 920 ASSERT(scope != NULL);
910 intptr_t num_context_variables = scope->num_context_variables(); 921 intptr_t num_context_variables = scope->num_context_variables();
911 if (num_context_variables > 0) { 922 if (num_context_variables > 0) {
912 // The loop local scope declares variables that are captured. 923 // The loop local scope declares variables that are captured.
913 // Allocate and chain a new context. 924 // Allocate and chain a new context.
914 __ movl(EDX, Immediate(num_context_variables)); 925 __ movl(EDX, Immediate(num_context_variables));
915 const ExternalLabel label("alloc_context", 926 const ExternalLabel label("alloc_context",
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 const Class& cls = Class::Handle(parsed_function_.function().owner()); 2679 const Class& cls = Class::Handle(parsed_function_.function().owner());
2669 const Script& script = Script::Handle(cls.script()); 2680 const Script& script = Script::Handle(cls.script());
2670 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); 2681 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args);
2671 Isolate::Current()->long_jump_base()->Jump(1, error_msg); 2682 Isolate::Current()->long_jump_base()->Jump(1, error_msg);
2672 UNREACHABLE(); 2683 UNREACHABLE();
2673 } 2684 }
2674 2685
2675 } // namespace dart 2686 } // namespace dart
2676 2687
2677 #endif // defined TARGET_ARCH_IA32 2688 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698