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

Side by Side Diff: runtime/vm/stub_code_x64.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/stub_code_ia32.cc ('k') | runtime/vm/symbols.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) 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_X64) 6 #if defined(TARGET_ARCH_X64)
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // done. The assumption is that this register will never be clobbered by 728 // done. The assumption is that this register will never be clobbered by
729 // compiled or runtime stub code. 729 // compiled or runtime stub code.
730 730
731 // Cache the new Context pointer into CTX while executing Dart code. 731 // Cache the new Context pointer into CTX while executing Dart code.
732 __ movq(CTX, Address(RCX, VMHandles::kOffsetOfRawPtrInHandle)); 732 __ movq(CTX, Address(RCX, VMHandles::kOffsetOfRawPtrInHandle));
733 733
734 // Load Isolate pointer from Context structure into R8. 734 // Load Isolate pointer from Context structure into R8.
735 __ movq(R8, FieldAddress(CTX, Context::isolate_offset())); 735 __ movq(R8, FieldAddress(CTX, Context::isolate_offset()));
736 736
737 // Save the top exit frame info. Use RAX as a temporary register. 737 // Save the top exit frame info. Use RAX as a temporary register.
738 // StackFrameIterator reads the top exit frame info saved in this frame.
739 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the
740 // code below: kExitLinkOffsetInEntryFrame = -8 * kWordSize.
738 __ movq(RAX, Address(R8, Isolate::top_exit_frame_info_offset())); 741 __ movq(RAX, Address(R8, Isolate::top_exit_frame_info_offset()));
739 __ pushq(RAX); 742 __ pushq(RAX);
740 __ movq(Address(R8, Isolate::top_exit_frame_info_offset()), Immediate(0)); 743 __ movq(Address(R8, Isolate::top_exit_frame_info_offset()), Immediate(0));
741 744
742 // StackFrameIterator reads the top exit frame info saved in this frame.
743 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the
744 // code above: kExitLinkOffsetInEntryFrame = -8 * kWordSize.
745
746 // Save the old Context pointer. Use RAX as a temporary register. 745 // Save the old Context pointer. Use RAX as a temporary register.
747 // Note that VisitObjectPointers will find this saved Context pointer during 746 // Note that VisitObjectPointers will find this saved Context pointer during
748 // GC marking, since it traverses any information between SP and 747 // GC marking, since it traverses any information between SP and
749 // FP - kExitLinkOffsetInEntryFrame. 748 // FP - kExitLinkOffsetInEntryFrame.
749 // EntryFrame::SavedContext reads the context saved in this frame.
750 // The constant kSavedContextOffsetInEntryFrame must be kept in sync with
751 // the code below: kSavedContextOffsetInEntryFrame = -9 * kWordSize.
750 __ movq(RAX, Address(R8, Isolate::top_context_offset())); 752 __ movq(RAX, Address(R8, Isolate::top_context_offset()));
751 __ pushq(RAX); 753 __ pushq(RAX);
752 754
753 // Load arguments descriptor array into R10, which is passed to Dart code. 755 // Load arguments descriptor array into R10, which is passed to Dart code.
754 __ movq(R10, Address(RSI, VMHandles::kOffsetOfRawPtrInHandle)); 756 __ movq(R10, Address(RSI, VMHandles::kOffsetOfRawPtrInHandle));
755 757
756 // Load number of arguments into RBX. 758 // Load number of arguments into RBX.
757 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 759 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
758 __ SmiUntag(RBX); 760 __ SmiUntag(RBX);
759 761
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 tags = RawObject::ClassIdTag::update(context_class.id(), tags); 1253 tags = RawObject::ClassIdTag::update(context_class.id(), tags);
1252 __ movq(Address(RBX, Context::tags_offset()), Immediate(tags)); 1254 __ movq(Address(RBX, Context::tags_offset()), Immediate(tags));
1253 1255
1254 // Set number of variables field to 1 (for captured receiver). 1256 // Set number of variables field to 1 (for captured receiver).
1255 __ movq(Address(RBX, Context::num_variables_offset()), Immediate(1)); 1257 __ movq(Address(RBX, Context::num_variables_offset()), Immediate(1));
1256 1258
1257 // Set isolate field to isolate of current context. 1259 // Set isolate field to isolate of current context.
1258 __ movq(R10, FieldAddress(CTX, Context::isolate_offset())); 1260 __ movq(R10, FieldAddress(CTX, Context::isolate_offset()));
1259 __ movq(Address(RBX, Context::isolate_offset()), R10); 1261 __ movq(Address(RBX, Context::isolate_offset()), R10);
1260 1262
1261 // Set the parent field to null. 1263 // Set the parent to null.
1262 __ movq(Address(RBX, Context::parent_offset()), raw_null); 1264 __ movq(Address(RBX, Context::parent_offset()), raw_null);
1263 1265
1264 // Initialize the context variable to the receiver. 1266 // Initialize the context variable to the receiver.
1265 __ movq(R10, Address(RSP, kReceiverOffset)); 1267 __ movq(R10, Address(RSP, kReceiverOffset));
1266 __ movq(Address(RBX, Context::variable_offset(0)), R10); 1268 __ movq(Address(RBX, Context::variable_offset(0)), R10);
1267 1269
1268 // Set the newly allocated context in the newly allocated closure. 1270 // Set the newly allocated context in the newly allocated closure.
1269 __ addq(RBX, Immediate(kHeapObjectTag)); 1271 __ addq(RBX, Immediate(kHeapObjectTag));
1270 __ movq(Address(RAX, Closure::context_offset()), RBX); 1272 __ movq(Address(RAX, Closure::context_offset()), RBX);
1271 } else { 1273 } else {
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 __ cmpq(left, right); 2078 __ cmpq(left, right);
2077 __ Bind(&done); 2079 __ Bind(&done);
2078 __ popq(right); 2080 __ popq(right);
2079 __ popq(left); 2081 __ popq(left);
2080 __ ret(); 2082 __ ret();
2081 } 2083 }
2082 2084
2083 } // namespace dart 2085 } // namespace dart
2084 2086
2085 #endif // defined TARGET_ARCH_X64 2087 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698