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

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

Issue 17233003: Reapply "Initial implementation of on-stack replacement (OSR)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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.h ('k') | runtime/vm/assembler_x64.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_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
11 #include "vm/memory_region.h" 11 #include "vm/memory_region.h"
12 #include "vm/runtime_entry.h" 12 #include "vm/runtime_entry.h"
13 #include "vm/stack_frame.h"
13 #include "vm/stub_code.h" 14 #include "vm/stub_code.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); 18 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message.");
18 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); 19 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available");
19 DECLARE_FLAG(bool, inline_alloc); 20 DECLARE_FLAG(bool, inline_alloc);
20 21
21 22
22 bool CPUFeatures::sse2_supported_ = false; 23 bool CPUFeatures::sse2_supported_ = false;
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 ASSERT(cls.id() != kIllegalCid); 2182 ASSERT(cls.id() != kIllegalCid);
2182 tags = RawObject::ClassIdTag::update(cls.id(), tags); 2183 tags = RawObject::ClassIdTag::update(cls.id(), tags);
2183 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); 2184 movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags));
2184 } else { 2185 } else {
2185 jmp(failure); 2186 jmp(failure);
2186 } 2187 }
2187 } 2188 }
2188 2189
2189 2190
2190 void Assembler::EnterDartFrame(intptr_t frame_size) { 2191 void Assembler::EnterDartFrame(intptr_t frame_size) {
2191 const intptr_t offset = CodeSize();
2192 EnterFrame(0); 2192 EnterFrame(0);
2193 Label dart_entry; 2193 Label dart_entry;
2194 call(&dart_entry); 2194 call(&dart_entry);
2195 Bind(&dart_entry); 2195 Bind(&dart_entry);
2196 // Adjust saved PC for any intrinsic code that could have been generated 2196 // The runtime system assumes that the code marker address is
2197 // before a frame is created. 2197 // kEntryPointToPcMarkerOffset bytes from the entry. If there is any code
2198 // generated before entering the frame, the address needs to be adjusted.
2199 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize();
2198 if (offset != 0) { 2200 if (offset != 0) {
2199 addl(Address(ESP, 0), Immediate(-offset)); 2201 addl(Address(ESP, 0), Immediate(offset));
2200 } 2202 }
2201 if (frame_size != 0) { 2203 if (frame_size != 0) {
2202 subl(ESP, Immediate(frame_size)); 2204 subl(ESP, Immediate(frame_size));
2203 } 2205 }
2204 } 2206 }
2205 2207
2206 2208
2209 // On entry to a function compiled for OSR, the caller's frame pointer, the
2210 // stack locals, and any copied parameters are already in place. The frame
2211 // pointer is already set up. The PC marker is not correct for the
2212 // optimized function and there may be extra space for spill slots to
2213 // allocate.
2214 void Assembler::EnterOsrFrame(intptr_t extra_size) {
2215 Label dart_entry;
2216 call(&dart_entry);
2217 Bind(&dart_entry);
2218 // The runtime system assumes that the code marker address is
2219 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no
2220 // code to set up the frame pointer, the address needs to be adjusted.
2221 const intptr_t offset = kEntryPointToPcMarkerOffset - CodeSize();
2222 if (offset != 0) {
2223 addl(Address(ESP, 0), Immediate(offset));
2224 }
2225 popl(Address(EBP, kPcMarkerSlotFromFp * kWordSize));
2226 if (extra_size != 0) {
2227 subl(ESP, Immediate(extra_size));
2228 }
2229 }
2230
2231
2207 void Assembler::EnterStubFrame() { 2232 void Assembler::EnterStubFrame() {
2208 EnterFrame(0); 2233 EnterFrame(0);
2209 pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. 2234 pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames.
2210 } 2235 }
2211 2236
2212 2237
2213 void Assembler::Stop(const char* message) { 2238 void Assembler::Stop(const char* message) {
2214 if (FLAG_print_stop_message) { 2239 if (FLAG_print_stop_message) {
2215 pushl(EAX); // Preserve EAX. 2240 pushl(EAX); // Preserve EAX.
2216 movl(EAX, Immediate(reinterpret_cast<int32_t>(message))); 2241 movl(EAX, Immediate(reinterpret_cast<int32_t>(message)));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 2402
2378 const char* Assembler::FpuRegisterName(FpuRegister reg) { 2403 const char* Assembler::FpuRegisterName(FpuRegister reg) {
2379 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2404 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
2380 return xmm_reg_names[reg]; 2405 return xmm_reg_names[reg];
2381 } 2406 }
2382 2407
2383 2408
2384 } // namespace dart 2409 } // namespace dart
2385 2410
2386 #endif // defined TARGET_ARCH_IA32 2411 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698