Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 __ LockCmpxchgl(FieldAddress(EDX, Object::tags_offset()), ECX); |
|
koda
2014/10/01 21:01:23
Consider reminding the reader that this compares w
Ivan Posva
2014/10/01 21:11:58
Added.
| |
| 1080 __ j(NOT_EQUAL, &reload); | |
|
koda
2014/10/01 21:01:23
This jump is currently never exercised, which is b
Ivan Posva
2014/10/01 21:11:58
Yes, too invasive. I'd rather make this not dead c
| |
| 1077 | 1081 |
| 1078 // Load the isolate. | 1082 // Load the isolate. |
| 1079 // Spilled: EDX, ECX | 1083 // Spilled: EAX, ECX |
| 1080 // EAX: Address being stored | 1084 // EDX: Address being stored |
| 1081 __ LoadIsolate(EDX); | 1085 __ LoadIsolate(EAX); |
| 1082 | 1086 |
| 1083 // Load the StoreBuffer block out of the isolate. Then load top_ out of the | 1087 // Load the StoreBuffer block out of the isolate. Then load top_ out of the |
| 1084 // StoreBufferBlock and add the address to the pointers_. | 1088 // StoreBufferBlock and add the address to the pointers_. |
| 1085 // Spilled: EDX, ECX | 1089 // Spilled: EAX, ECX |
| 1086 // EAX: Address being stored | 1090 // EDX: Address being stored |
| 1087 // EDX: Isolate | 1091 // EAX: Isolate |
| 1088 __ movl(EDX, Address(EDX, Isolate::store_buffer_offset())); | 1092 __ movl(EAX, Address(EAX, Isolate::store_buffer_offset())); |
| 1089 __ movl(ECX, Address(EDX, StoreBufferBlock::top_offset())); | 1093 __ movl(ECX, Address(EAX, StoreBufferBlock::top_offset())); |
| 1090 __ movl(Address(EDX, ECX, TIMES_4, StoreBufferBlock::pointers_offset()), EAX); | 1094 __ movl(Address(EAX, ECX, TIMES_4, StoreBufferBlock::pointers_offset()), EDX); |
| 1091 | 1095 |
| 1092 // Increment top_ and check for overflow. | 1096 // Increment top_ and check for overflow. |
| 1093 // Spilled: EDX, ECX | 1097 // Spilled: EAX, ECX |
| 1094 // ECX: top_ | 1098 // ECX: top_ |
| 1095 // EDX: StoreBufferBlock | 1099 // EAX: StoreBufferBlock |
| 1096 Label L; | 1100 Label L; |
| 1097 __ incl(ECX); | 1101 __ incl(ECX); |
| 1098 __ movl(Address(EDX, StoreBufferBlock::top_offset()), ECX); | 1102 __ movl(Address(EAX, StoreBufferBlock::top_offset()), ECX); |
| 1099 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize)); | 1103 __ cmpl(ECX, Immediate(StoreBufferBlock::kSize)); |
| 1100 // Restore values. | 1104 // Restore values. |
| 1101 // Spilled: EDX, ECX | 1105 // Spilled: EAX, ECX |
| 1102 __ popl(ECX); | 1106 __ popl(ECX); |
| 1103 __ popl(EDX); | 1107 __ popl(EAX); |
| 1104 __ j(EQUAL, &L, Assembler::kNearJump); | 1108 __ j(EQUAL, &L, Assembler::kNearJump); |
| 1105 __ ret(); | 1109 __ ret(); |
| 1106 | 1110 |
| 1107 // Handle overflow: Call the runtime leaf function. | 1111 // Handle overflow: Call the runtime leaf function. |
| 1108 __ Bind(&L); | 1112 __ Bind(&L); |
| 1109 // Setup frame, push callee-saved registers. | 1113 // Setup frame, push callee-saved registers. |
| 1110 | 1114 |
| 1111 __ EnterCallRuntimeFrame(1 * kWordSize); | 1115 __ EnterCallRuntimeFrame(1 * kWordSize); |
| 1112 __ LoadIsolate(EAX); | 1116 __ LoadIsolate(EDX); |
| 1113 __ movl(Address(ESP, 0), EAX); // Push the isolate as the only argument. | 1117 __ movl(Address(ESP, 0), EDX); // Push the isolate as the only argument. |
| 1114 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); | 1118 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
| 1115 // Restore callee-saved registers, tear down frame. | 1119 // Restore callee-saved registers, tear down frame. |
| 1116 __ LeaveCallRuntimeFrame(); | 1120 __ LeaveCallRuntimeFrame(); |
| 1117 __ ret(); | 1121 __ ret(); |
| 1118 } | 1122 } |
| 1119 | 1123 |
| 1120 | 1124 |
| 1121 // Called for inline allocation of objects. | 1125 // Called for inline allocation of objects. |
| 1122 // Input parameters: | 1126 // Input parameters: |
| 1123 // ESP + 4 : type arguments object (only if class is parameterized). | 1127 // ESP + 4 : type arguments object (only if class is parameterized). |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2085 const Register temp = ECX; | 2089 const Register temp = ECX; |
| 2086 __ movl(left, Address(ESP, 2 * kWordSize)); | 2090 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2087 __ movl(right, Address(ESP, 1 * kWordSize)); | 2091 __ movl(right, Address(ESP, 1 * kWordSize)); |
| 2088 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2092 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2089 __ ret(); | 2093 __ ret(); |
| 2090 } | 2094 } |
| 2091 | 2095 |
| 2092 } // namespace dart | 2096 } // namespace dart |
| 2093 | 2097 |
| 2094 #endif // defined TARGET_ARCH_IA32 | 2098 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |