| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 // Copy the string before recording it in the assembler to avoid | 131 // Copy the string before recording it in the assembler to avoid |
| 132 // issues when the stack allocated buffer goes out of scope. | 132 // issues when the stack allocated buffer goes out of scope. |
| 133 size_t length = builder.position(); | 133 size_t length = builder.position(); |
| 134 Vector<char> copy = Vector<char>::New(length + 1); | 134 Vector<char> copy = Vector<char>::New(length + 1); |
| 135 OS::MemCopy(copy.start(), builder.Finalize(), copy.length()); | 135 OS::MemCopy(copy.start(), builder.Finalize(), copy.length()); |
| 136 masm()->RecordComment(copy.start()); | 136 masm()->RecordComment(copy.start()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 #ifdef _MSC_VER |
| 141 void LCodeGen::MakeSureStackPagesMapped(int offset) { |
| 142 const int kPageSize = 4 * KB; |
| 143 for (offset -= kPageSize; offset > 0; offset -= kPageSize) { |
| 144 __ mov(Operand(esp, offset), eax); |
| 145 } |
| 146 } |
| 147 #endif |
| 148 |
| 149 |
| 140 bool LCodeGen::GeneratePrologue() { | 150 bool LCodeGen::GeneratePrologue() { |
| 141 ASSERT(is_generating()); | 151 ASSERT(is_generating()); |
| 142 | 152 |
| 143 if (info()->IsOptimizing()) { | 153 if (info()->IsOptimizing()) { |
| 144 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 154 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 145 | 155 |
| 146 #ifdef DEBUG | 156 #ifdef DEBUG |
| 147 if (strlen(FLAG_stop_at) > 0 && | 157 if (strlen(FLAG_stop_at) > 0 && |
| 148 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 158 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 149 __ int3(); | 159 __ int3(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (slots > 0) { | 229 if (slots > 0) { |
| 220 if (slots == 1) { | 230 if (slots == 1) { |
| 221 if (dynamic_frame_alignment_) { | 231 if (dynamic_frame_alignment_) { |
| 222 __ push(edx); | 232 __ push(edx); |
| 223 } else { | 233 } else { |
| 224 __ push(Immediate(kNoAlignmentPadding)); | 234 __ push(Immediate(kNoAlignmentPadding)); |
| 225 } | 235 } |
| 226 } else { | 236 } else { |
| 227 if (FLAG_debug_code) { | 237 if (FLAG_debug_code) { |
| 228 __ sub(Operand(esp), Immediate(slots * kPointerSize)); | 238 __ sub(Operand(esp), Immediate(slots * kPointerSize)); |
| 239 #ifdef _MSC_VER |
| 240 MakeSureStackPagesMapped(slots * kPointerSize); |
| 241 #endif |
| 229 __ push(eax); | 242 __ push(eax); |
| 230 __ mov(Operand(eax), Immediate(slots)); | 243 __ mov(Operand(eax), Immediate(slots)); |
| 231 Label loop; | 244 Label loop; |
| 232 __ bind(&loop); | 245 __ bind(&loop); |
| 233 __ mov(MemOperand(esp, eax, times_4, 0), | 246 __ mov(MemOperand(esp, eax, times_4, 0), |
| 234 Immediate(kSlotsZapValue)); | 247 Immediate(kSlotsZapValue)); |
| 235 __ dec(eax); | 248 __ dec(eax); |
| 236 __ j(not_zero, &loop); | 249 __ j(not_zero, &loop); |
| 237 __ pop(eax); | 250 __ pop(eax); |
| 238 } else { | 251 } else { |
| 239 __ sub(Operand(esp), Immediate(slots * kPointerSize)); | 252 __ sub(Operand(esp), Immediate(slots * kPointerSize)); |
| 240 #ifdef _MSC_VER | 253 #ifdef _MSC_VER |
| 241 // On windows, you may not access the stack more than one page below | 254 MakeSureStackPagesMapped(slots * kPointerSize); |
| 242 // the most recently mapped page. To make the allocated area randomly | |
| 243 // accessible, we write to each page in turn (the value is irrelevant). | |
| 244 const int kPageSize = 4 * KB; | |
| 245 for (int offset = slots * kPointerSize - kPageSize; | |
| 246 offset > 0; | |
| 247 offset -= kPageSize) { | |
| 248 __ mov(Operand(esp, offset), eax); | |
| 249 } | |
| 250 #endif | 255 #endif |
| 251 } | 256 } |
| 252 | 257 |
| 253 if (support_aligned_spilled_doubles_) { | 258 if (support_aligned_spilled_doubles_) { |
| 254 Comment(";;; Store dynamic frame alignment tag for spilled doubles"); | 259 Comment(";;; Store dynamic frame alignment tag for spilled doubles"); |
| 255 // Store dynamic frame alignment state in the first local. | 260 // Store dynamic frame alignment state in the first local. |
| 256 int offset = JavaScriptFrameConstants::kDynamicAlignmentStateOffset; | 261 int offset = JavaScriptFrameConstants::kDynamicAlignmentStateOffset; |
| 257 if (dynamic_frame_alignment_) { | 262 if (dynamic_frame_alignment_) { |
| 258 __ mov(Operand(ebp, offset), edx); | 263 __ mov(Operand(ebp, offset), edx); |
| 259 } else { | 264 } else { |
| (...skipping 6246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 FixedArray::kHeaderSize - kPointerSize)); | 6511 FixedArray::kHeaderSize - kPointerSize)); |
| 6507 __ bind(&done); | 6512 __ bind(&done); |
| 6508 } | 6513 } |
| 6509 | 6514 |
| 6510 | 6515 |
| 6511 #undef __ | 6516 #undef __ |
| 6512 | 6517 |
| 6513 } } // namespace v8::internal | 6518 } } // namespace v8::internal |
| 6514 | 6519 |
| 6515 #endif // V8_TARGET_ARCH_IA32 | 6520 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |