OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Copy the string before recording it in the assembler to avoid | 114 // Copy the string before recording it in the assembler to avoid |
115 // issues when the stack allocated buffer goes out of scope. | 115 // issues when the stack allocated buffer goes out of scope. |
116 int length = builder.position(); | 116 int length = builder.position(); |
117 Vector<char> copy = Vector<char>::New(length + 1); | 117 Vector<char> copy = Vector<char>::New(length + 1); |
118 OS::MemCopy(copy.start(), builder.Finalize(), copy.length()); | 118 OS::MemCopy(copy.start(), builder.Finalize(), copy.length()); |
119 masm()->RecordComment(copy.start()); | 119 masm()->RecordComment(copy.start()); |
120 } | 120 } |
121 | 121 |
122 | 122 |
| 123 #ifdef _MSC_VER |
| 124 void LCodeGen::MakeSureStackPagesMapped(int offset) { |
| 125 const int kPageSize = 4 * KB; |
| 126 for (offset -= kPageSize; offset > 0; offset -= kPageSize) { |
| 127 __ movq(Operand(rsp, offset), rax); |
| 128 } |
| 129 } |
| 130 #endif |
| 131 |
| 132 |
123 bool LCodeGen::GeneratePrologue() { | 133 bool LCodeGen::GeneratePrologue() { |
124 ASSERT(is_generating()); | 134 ASSERT(is_generating()); |
125 | 135 |
126 if (info()->IsOptimizing()) { | 136 if (info()->IsOptimizing()) { |
127 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 137 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
128 | 138 |
129 #ifdef DEBUG | 139 #ifdef DEBUG |
130 if (strlen(FLAG_stop_at) > 0 && | 140 if (strlen(FLAG_stop_at) > 0 && |
131 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 141 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
132 __ int3(); | 142 __ int3(); |
(...skipping 29 matching lines...) Expand all Loading... |
162 __ push(rdi); // Callee's JS function. | 172 __ push(rdi); // Callee's JS function. |
163 } | 173 } |
164 info()->AddNoFrameRange(0, masm_->pc_offset()); | 174 info()->AddNoFrameRange(0, masm_->pc_offset()); |
165 } | 175 } |
166 | 176 |
167 // Reserve space for the stack slots needed by the code. | 177 // Reserve space for the stack slots needed by the code. |
168 int slots = GetStackSlotCount(); | 178 int slots = GetStackSlotCount(); |
169 if (slots > 0) { | 179 if (slots > 0) { |
170 if (FLAG_debug_code) { | 180 if (FLAG_debug_code) { |
171 __ subq(rsp, Immediate(slots * kPointerSize)); | 181 __ subq(rsp, Immediate(slots * kPointerSize)); |
| 182 #ifdef _MSC_VER |
| 183 MakeSureStackPagesMapped(slots * kPointerSize); |
| 184 #endif |
172 __ push(rax); | 185 __ push(rax); |
173 __ Set(rax, slots); | 186 __ Set(rax, slots); |
174 __ movq(kScratchRegister, kSlotsZapValue, RelocInfo::NONE64); | 187 __ movq(kScratchRegister, kSlotsZapValue, RelocInfo::NONE64); |
175 Label loop; | 188 Label loop; |
176 __ bind(&loop); | 189 __ bind(&loop); |
177 __ movq(MemOperand(rsp, rax, times_pointer_size, 0), | 190 __ movq(MemOperand(rsp, rax, times_pointer_size, 0), |
178 kScratchRegister); | 191 kScratchRegister); |
179 __ decl(rax); | 192 __ decl(rax); |
180 __ j(not_zero, &loop); | 193 __ j(not_zero, &loop); |
181 __ pop(rax); | 194 __ pop(rax); |
182 } else { | 195 } else { |
183 __ subq(rsp, Immediate(slots * kPointerSize)); | 196 __ subq(rsp, Immediate(slots * kPointerSize)); |
184 #ifdef _MSC_VER | 197 #ifdef _MSC_VER |
185 // On windows, you may not access the stack more than one page below | 198 MakeSureStackPagesMapped(slots * kPointerSize); |
186 // the most recently mapped page. To make the allocated area randomly | |
187 // accessible, we write to each page in turn (the value is irrelevant). | |
188 const int kPageSize = 4 * KB; | |
189 for (int offset = slots * kPointerSize - kPageSize; | |
190 offset > 0; | |
191 offset -= kPageSize) { | |
192 __ movq(Operand(rsp, offset), rax); | |
193 } | |
194 #endif | 199 #endif |
195 } | 200 } |
196 | 201 |
197 if (info()->saves_caller_doubles()) { | 202 if (info()->saves_caller_doubles()) { |
198 Comment(";;; Save clobbered callee double registers"); | 203 Comment(";;; Save clobbered callee double registers"); |
199 int count = 0; | 204 int count = 0; |
200 BitVector* doubles = chunk()->allocated_double_registers(); | 205 BitVector* doubles = chunk()->allocated_double_registers(); |
201 BitVector::Iterator save_iterator(doubles); | 206 BitVector::Iterator save_iterator(doubles); |
202 while (!save_iterator.Done()) { | 207 while (!save_iterator.Done()) { |
203 __ movsd(MemOperand(rsp, count * kDoubleSize), | 208 __ movsd(MemOperand(rsp, count * kDoubleSize), |
(...skipping 5355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5559 FixedArray::kHeaderSize - kPointerSize)); | 5564 FixedArray::kHeaderSize - kPointerSize)); |
5560 __ bind(&done); | 5565 __ bind(&done); |
5561 } | 5566 } |
5562 | 5567 |
5563 | 5568 |
5564 #undef __ | 5569 #undef __ |
5565 | 5570 |
5566 } } // namespace v8::internal | 5571 } } // namespace v8::internal |
5567 | 5572 |
5568 #endif // V8_TARGET_ARCH_X64 | 5573 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |