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

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

Issue 12179020: Fix for issues 6080 - pass in the Isolate's top context into the stub for invoking dart code from n… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | « runtime/vm/stack_frame_x64.cc ('k') | runtime/vm/stub_code_x64.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 // compiled or runtime stub code. 738 // compiled or runtime stub code.
739 739
740 // Cache the new Context pointer into CTX while executing dart code. 740 // Cache the new Context pointer into CTX while executing dart code.
741 __ movl(CTX, Address(EBP, kNewContextOffset)); 741 __ movl(CTX, Address(EBP, kNewContextOffset));
742 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); 742 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
743 743
744 // Load Isolate pointer from Context structure into EDI. 744 // Load Isolate pointer from Context structure into EDI.
745 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); 745 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
746 746
747 // Save the top exit frame info. Use EDX as a temporary register. 747 // Save the top exit frame info. Use EDX as a temporary register.
748 // StackFrameIterator reads the top exit frame info saved in this frame.
749 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the
750 // code below: kExitLinkOffsetInEntryFrame = -4 * kWordSize.
748 __ movl(EDX, Address(EDI, Isolate::top_exit_frame_info_offset())); 751 __ movl(EDX, Address(EDI, Isolate::top_exit_frame_info_offset()));
749 __ pushl(EDX); 752 __ pushl(EDX);
750 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0)); 753 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0));
751 754
752 // StackFrameIterator reads the top exit frame info saved in this frame.
753 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the
754 // code above.
755
756 // Save the old Context pointer. Use ECX as a temporary register. 755 // Save the old Context pointer. Use ECX as a temporary register.
757 // Note that VisitObjectPointers will find this saved Context pointer during 756 // Note that VisitObjectPointers will find this saved Context pointer during
758 // GC marking, since it traverses any information between SP and 757 // GC marking, since it traverses any information between SP and
759 // FP - kExitLinkOffsetInEntryFrame. 758 // FP - kExitLinkOffsetInEntryFrame.
759 // EntryFrame::SavedContext reads the context saved in this frame.
760 // The constant kSavedContextOffsetInEntryFrame must be kept in sync with
761 // the code below: kSavedContextOffsetInEntryFrame = -5 * kWordSize.
760 __ movl(ECX, Address(EDI, Isolate::top_context_offset())); 762 __ movl(ECX, Address(EDI, Isolate::top_context_offset()));
761 __ pushl(ECX); 763 __ pushl(ECX);
762 764
763 // Load arguments descriptor array into EDX. 765 // Load arguments descriptor array into EDX.
764 __ movl(EDX, Address(EBP, kArgumentsDescOffset)); 766 __ movl(EDX, Address(EBP, kArgumentsDescOffset));
765 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); 767 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle));
766 768
767 // Load number of arguments into EBX. 769 // Load number of arguments into EBX.
768 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 770 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
769 __ SmiUntag(EBX); 771 __ SmiUntag(EBX);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 tags = RawObject::ClassIdTag::update(context_class.id(), tags); 1265 tags = RawObject::ClassIdTag::update(context_class.id(), tags);
1264 __ movl(Address(ECX, Context::tags_offset()), Immediate(tags)); 1266 __ movl(Address(ECX, Context::tags_offset()), Immediate(tags));
1265 1267
1266 // Set number of variables field to 1 (for captured receiver). 1268 // Set number of variables field to 1 (for captured receiver).
1267 __ movl(Address(ECX, Context::num_variables_offset()), Immediate(1)); 1269 __ movl(Address(ECX, Context::num_variables_offset()), Immediate(1));
1268 1270
1269 // Set isolate field to isolate of current context. 1271 // Set isolate field to isolate of current context.
1270 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset())); 1272 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset()));
1271 __ movl(Address(ECX, Context::isolate_offset()), EDX); 1273 __ movl(Address(ECX, Context::isolate_offset()), EDX);
1272 1274
1273 // Set the parent field to null. 1275 // Set the parent to null.
1274 __ movl(Address(ECX, Context::parent_offset()), raw_null); 1276 __ movl(Address(ECX, Context::parent_offset()), raw_null);
1275 1277
1276 // Initialize the context variable to the receiver. 1278 // Initialize the context variable to the receiver.
1277 __ movl(EDX, Address(ESP, kReceiverOffset)); 1279 __ movl(EDX, Address(ESP, kReceiverOffset));
1278 __ movl(Address(ECX, Context::variable_offset(0)), EDX); 1280 __ movl(Address(ECX, Context::variable_offset(0)), EDX);
1279 1281
1280 // Set the newly allocated context in the newly allocated closure. 1282 // Set the newly allocated context in the newly allocated closure.
1281 __ addl(ECX, Immediate(kHeapObjectTag)); 1283 __ addl(ECX, Immediate(kHeapObjectTag));
1282 __ movl(Address(EAX, Closure::context_offset()), ECX); 1284 __ movl(Address(EAX, Closure::context_offset()), ECX);
1283 } else { 1285 } else {
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 __ Bind(&done); 2124 __ Bind(&done);
2123 __ popl(temp); 2125 __ popl(temp);
2124 __ popl(right); 2126 __ popl(right);
2125 __ popl(left); 2127 __ popl(left);
2126 __ ret(); 2128 __ ret();
2127 } 2129 }
2128 2130
2129 } // namespace dart 2131 } // namespace dart
2130 2132
2131 #endif // defined TARGET_ARCH_IA32 2133 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame_x64.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698