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

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
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(EAX); // result: cloned context.
914 // Set new context as current context.
915 __ movl(CTX, EAX);
916 }
917
918
906 void CodeGenerator::VisitSequenceNode(SequenceNode* node_sequence) { 919 void CodeGenerator::VisitSequenceNode(SequenceNode* node_sequence) {
907 CodeGeneratorState codegen_state(this); 920 CodeGeneratorState codegen_state(this);
908 LocalScope* scope = node_sequence->scope(); 921 LocalScope* scope = node_sequence->scope();
909 ASSERT(scope != NULL); 922 ASSERT(scope != NULL);
910 intptr_t num_context_variables = scope->num_context_variables(); 923 intptr_t num_context_variables = scope->num_context_variables();
911 if (num_context_variables > 0) { 924 if (num_context_variables > 0) {
912 // The loop local scope declares variables that are captured. 925 // The loop local scope declares variables that are captured.
913 // Allocate and chain a new context. 926 // Allocate and chain a new context.
914 __ movl(EDX, Immediate(num_context_variables)); 927 __ movl(EDX, Immediate(num_context_variables));
915 const ExternalLabel label("alloc_context", 928 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()); 2681 const Class& cls = Class::Handle(parsed_function_.function().owner());
2669 const Script& script = Script::Handle(cls.script()); 2682 const Script& script = Script::Handle(cls.script());
2670 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args); 2683 Parser::ReportMsg(script, token_index, "Error", error_msg, format, args);
2671 Isolate::Current()->long_jump_base()->Jump(1, error_msg); 2684 Isolate::Current()->long_jump_base()->Jump(1, error_msg);
2672 UNREACHABLE(); 2685 UNREACHABLE();
2673 } 2686 }
2674 2687
2675 } // namespace dart 2688 } // namespace dart
2676 2689
2677 #endif // defined TARGET_ARCH_IA32 2690 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698