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

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

Issue 624473003: - Update the header word atomically on ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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/assembler_ia32.cc ('k') | no next file » | 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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 // EAX: new object 1043 // EAX: new object
1044 // Restore the frame pointer. 1044 // Restore the frame pointer.
1045 __ LeaveFrame(); 1045 __ LeaveFrame();
1046 __ ret(); 1046 __ ret();
1047 } 1047 }
1048 1048
1049 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); 1049 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate);
1050 1050
1051 // Helper stub to implement Assembler::StoreIntoObject. 1051 // Helper stub to implement Assembler::StoreIntoObject.
1052 // Input parameters: 1052 // Input parameters:
1053 // EAX: Address being stored 1053 // EDX: Address being stored
1054 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { 1054 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) {
1055 // Save values being destroyed. 1055 // Save values being destroyed.
1056 __ pushl(EDX); 1056 __ pushl(EAX);
1057 __ pushl(ECX); 1057 __ pushl(ECX);
1058 1058
1059 Label add_to_buffer; 1059 Label add_to_buffer;
1060 // Check whether this object has already been remembered. Skip adding to the 1060 // Check whether this object has already been remembered. Skip adding to the
1061 // store buffer if the object is in the store buffer already. 1061 // store buffer if the object is in the store buffer already.
1062 // Spilled: EDX, ECX 1062 // Spilled: EAX, ECX
1063 // EAX: Address being stored 1063 // EDX: Address being stored
1064 __ movl(ECX, FieldAddress(EAX, Object::tags_offset())); 1064 Label reload;
1065 __ testl(ECX, Immediate(1 << RawObject::kRememberedBit)); 1065 __ Bind(&reload);
1066 __ movl(EAX, FieldAddress(EDX, Object::tags_offset()));
1067 __ testl(EAX, Immediate(1 << RawObject::kRememberedBit));
1066 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump); 1068 __ j(EQUAL, &add_to_buffer, Assembler::kNearJump);
1067 __ popl(ECX); 1069 __ popl(ECX);
1068 __ popl(EDX); 1070 __ popl(EAX);
1069 __ ret(); 1071 __ ret();
1070 1072
1071 // Update the tags that this object has been remembered. 1073 // Update the tags that this object has been remembered.
1072 // EAX: Address being stored 1074 // EDX: Address being stored
1073 // ECX: Current tag value 1075 // EAX: Current tag value
1074 __ Bind(&add_to_buffer); 1076 __ Bind(&add_to_buffer);
1077 __ movl(ECX, EAX);
1075 __ orl(ECX, Immediate(1 << RawObject::kRememberedBit)); 1078 __ orl(ECX, Immediate(1 << RawObject::kRememberedBit));
1076 __ movl(FieldAddress(EAX, Object::tags_offset()), ECX); 1079 // Compare the tag word with EAX, update to ECX if unchanged.
1080 __ LockCmpxchgl(FieldAddress(EDX, Object::tags_offset()), ECX);
1081 __ j(NOT_EQUAL, &reload);
1077 1082
1078 // Load the isolate. 1083 // Load the isolate.
1079 // Spilled: EDX, ECX 1084 // Spilled: EAX, ECX
1080 // EAX: Address being stored 1085 // EDX: Address being stored
1081 __ LoadIsolate(EDX); 1086 __ LoadIsolate(EAX);
1082 1087
1083 // Load the StoreBuffer block out of the isolate. Then load top_ out of the 1088 // Load the StoreBuffer block out of the isolate. Then load top_ out of the
1084 // StoreBufferBlock and add the address to the pointers_. 1089 // StoreBufferBlock and add the address to the pointers_.
1085 // Spilled: EDX, ECX 1090 // Spilled: EAX, ECX
1086 // EAX: Address being stored 1091 // EDX: Address being stored
1087 // EDX: Isolate 1092 // EAX: Isolate
1088 __ movl(EDX, Address(EDX, Isolate::store_buffer_offset())); 1093 __ movl(EAX, Address(EAX, Isolate::store_buffer_offset()));
1089 __ movl(ECX, Address(EDX, StoreBufferBlock::top_offset())); 1094 __ movl(ECX, Address(EAX, StoreBufferBlock::top_offset()));
1090 __ movl(Address(EDX, ECX, TIMES_4, StoreBufferBlock::pointers_offset()), EAX); 1095 __ movl(Address(EAX, ECX, TIMES_4, StoreBufferBlock::pointers_offset()), EDX);
1091 1096
1092 // Increment top_ and check for overflow. 1097 // Increment top_ and check for overflow.
1093 // Spilled: EDX, ECX 1098 // Spilled: EAX, ECX
1094 // ECX: top_ 1099 // ECX: top_
1095 // EDX: StoreBufferBlock 1100 // EAX: StoreBufferBlock
1096 Label L; 1101 Label L;
1097 __ incl(ECX); 1102 __ incl(ECX);
1098 __ movl(Address(EDX, StoreBufferBlock::top_offset()), ECX); 1103 __ movl(Address(EAX, StoreBufferBlock::top_offset()), ECX);
1099 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize)); 1104 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize));
1100 // Restore values. 1105 // Restore values.
1101 // Spilled: EDX, ECX 1106 // Spilled: EAX, ECX
1102 __ popl(ECX); 1107 __ popl(ECX);
1103 __ popl(EDX); 1108 __ popl(EAX);
1104 __ j(EQUAL, &L, Assembler::kNearJump); 1109 __ j(EQUAL, &L, Assembler::kNearJump);
1105 __ ret(); 1110 __ ret();
1106 1111
1107 // Handle overflow: Call the runtime leaf function. 1112 // Handle overflow: Call the runtime leaf function.
1108 __ Bind(&L); 1113 __ Bind(&L);
1109 // Setup frame, push callee-saved registers. 1114 // Setup frame, push callee-saved registers.
1110 1115
1111 __ EnterCallRuntimeFrame(1 * kWordSize); 1116 __ EnterCallRuntimeFrame(1 * kWordSize);
1112 __ LoadIsolate(EAX); 1117 __ LoadIsolate(EDX);
1113 __ movl(Address(ESP, 0), EAX); // Push the isolate as the only argument. 1118 __ movl(Address(ESP, 0), EDX); // Push the isolate as the only argument.
1114 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); 1119 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
1115 // Restore callee-saved registers, tear down frame. 1120 // Restore callee-saved registers, tear down frame.
1116 __ LeaveCallRuntimeFrame(); 1121 __ LeaveCallRuntimeFrame();
1117 __ ret(); 1122 __ ret();
1118 } 1123 }
1119 1124
1120 1125
1121 // Called for inline allocation of objects. 1126 // Called for inline allocation of objects.
1122 // Input parameters: 1127 // Input parameters:
1123 // ESP + 4 : type arguments object (only if class is parameterized). 1128 // ESP + 4 : type arguments object (only if class is parameterized).
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 const Register temp = ECX; 2090 const Register temp = ECX;
2086 __ movl(left, Address(ESP, 2 * kWordSize)); 2091 __ movl(left, Address(ESP, 2 * kWordSize));
2087 __ movl(right, Address(ESP, 1 * kWordSize)); 2092 __ movl(right, Address(ESP, 1 * kWordSize));
2088 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2093 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2089 __ ret(); 2094 __ ret();
2090 } 2095 }
2091 2096
2092 } // namespace dart 2097 } // namespace dart
2093 2098
2094 #endif // defined TARGET_ARCH_IA32 2099 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698