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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 200693002: Set VMTag from stubs when transitioning between Dart and Native (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stack_frame_ia32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 525e8cec7ab9c49fc56008ae3656beaf2d2f6491..8bac543f5508007c17fa1b8d7d8cdd9c6cf276ab 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -16,6 +16,7 @@
#include "vm/scavenger.h"
#include "vm/stack_frame.h"
#include "vm/stub_code.h"
+#include "vm/tags.h"
#define __ assembler->
@@ -58,6 +59,9 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
// Cache Isolate pointer into CTX while executing runtime code.
__ movl(CTX, EAX);
+ // Mark that the isolate is executing VM code.
siva 2014/03/14 20:45:39 #if defined(DEBUG) check that the vm_tag was kSc
+ __ movl(Address(CTX, Isolate::vm_tag_offset()), Immediate(VMTag::kVMTagId));
+
// Reserve space for arguments and align frame before entering C++ world.
__ AddImmediate(ESP, Immediate(-sizeof(NativeArguments)));
if (OS::ActivationFrameAlignment() > 1) {
@@ -75,6 +79,10 @@ void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
__ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments.
__ call(ECX);
+ // Mark that the isolate is executing Dart code.
+ __ movl(Address(CTX, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kScriptTagId));
+
// Reset exit frame information in Isolate structure.
__ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0));
@@ -148,6 +156,10 @@ void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
// Cache Isolate pointer into CTX while executing native code.
__ movl(CTX, EDI);
+ // Mark that the isolate is executing Native code.
siva 2014/03/14 20:45:39 Ditto debug assertion here.
+ __ movl(Address(CTX, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kRuntimeNativeTagId));
+
// Reserve space for the native arguments structure, the outgoing parameters
// (pointer to the native arguments structure, the C function entry point)
// and align frame before entering the C++ world.
@@ -177,6 +189,10 @@ void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
__ call(ECX);
__ Bind(&done);
+ // Mark that the isolate is executing Dart code.
+ __ movl(Address(CTX, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kScriptTagId));
+
// Reset exit frame information in Isolate structure.
__ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0));
@@ -229,6 +245,10 @@ void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
// Cache Isolate pointer into CTX while executing native code.
__ movl(CTX, EDI);
+ // Mark that the isolate is executing Native code.
siva 2014/03/14 20:45:39 Ditto debug assertion here.
+ __ movl(Address(CTX, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kRuntimeNativeTagId));
+
// Reserve space for the native arguments structure, the outgoing parameter
// (pointer to the native arguments structure) and align frame before
// entering the C++ world.
@@ -247,6 +267,10 @@ void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
__ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments.
__ call(ECX);
+ // Mark that the isolate is executing Dart code.
+ __ movl(Address(CTX, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kScriptTagId));
+
// Reset exit frame information in Isolate structure.
__ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0));
@@ -836,6 +860,15 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
__ movl(ECX, Address(EDI, Isolate::top_context_offset()));
__ pushl(ECX);
+ // Save the current VMTag on the stack.
+ ASSERT(kSavedVMTagSlotFromEntryFp == -6);
+ __ movl(ECX, Address(EDI, Isolate::vm_tag_offset()));
+ __ pushl(ECX);
siva 2014/03/14 20:45:39 As discussed offline you would have to flip this s
Cutch 2014/03/17 15:46:01 Done. We now push in the following order: vmtag
+
+ // Mark that the isolate is executing Dart code.
+ __ movl(Address(EDI, Isolate::vm_tag_offset()),
+ Immediate(VMTag::kScriptTagId));
+
// Load arguments descriptor array into EDX.
__ movl(EDX, Address(EBP, kArgumentsDescOffset));
__ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle));
@@ -882,6 +915,10 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
// Load Isolate pointer from Context structure into CTX. Drop Context.
__ movl(CTX, FieldAddress(CTX, Context::isolate_offset()));
+ // Restore the current VMTag from the stack.
+ __ popl(ECX);
+ __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX);
+
// Restore the saved Context pointer into the Isolate structure.
// Uses ECX as a temporary register for this.
__ popl(ECX);
« no previous file with comments | « runtime/vm/stack_frame_ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698