OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Copy the string before recording it in the assembler to avoid | 84 // Copy the string before recording it in the assembler to avoid |
85 // issues when the stack allocated buffer goes out of scope. | 85 // issues when the stack allocated buffer goes out of scope. |
86 size_t length = builder.position(); | 86 size_t length = builder.position(); |
87 Vector<char> copy = Vector<char>::New(length + 1); | 87 Vector<char> copy = Vector<char>::New(length + 1); |
88 memcpy(copy.start(), builder.Finalize(), copy.length()); | 88 memcpy(copy.start(), builder.Finalize(), copy.length()); |
89 masm()->RecordComment(copy.start()); | 89 masm()->RecordComment(copy.start()); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 bool LCodeGen::GeneratePrologue() { | 93 bool LCodeGen::GeneratePrologue() { |
94 Abort("Unimplemented: %s", "GeneratePrologue"); | 94 ASSERT(is_generating()); |
95 return false; | 95 |
| 96 #ifdef DEBUG |
| 97 if (strlen(FLAG_stop_at) > 0 && |
| 98 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 99 __ int3(); |
| 100 } |
| 101 #endif |
| 102 |
| 103 __ push(rbp); // Caller's frame pointer. |
| 104 __ movq(rbp, rsp); |
| 105 __ push(rsi); // Callee's context. |
| 106 __ push(rdi); // Callee's JS function. |
| 107 |
| 108 // Reserve space for the stack slots needed by the code. |
| 109 int slots = StackSlotCount(); |
| 110 if (slots > 0) { |
| 111 if (FLAG_debug_code) { |
| 112 __ movl(rax, Immediate(slots)); |
| 113 __ movq(kScratchRegister, kSlotsZapValue, RelocInfo::NONE); |
| 114 Label loop; |
| 115 __ bind(&loop); |
| 116 __ push(kScratchRegister); |
| 117 __ decl(rax); |
| 118 __ j(not_zero, &loop); |
| 119 } else { |
| 120 __ subq(rsp, Immediate(slots * kPointerSize)); |
| 121 #ifdef _MSC_VER |
| 122 // On windows, you may not access the stack more than one page below |
| 123 // the most recently mapped page. To make the allocated area randomly |
| 124 // accessible, we write to each page in turn (the value is irrelevant). |
| 125 const int kPageSize = 4 * KB; |
| 126 for (int offset = slots * kPointerSize - kPageSize; |
| 127 offset > 0; |
| 128 offset -= kPageSize) { |
| 129 __ moveq(Operand(rsp, offset), rax); |
| 130 } |
| 131 #endif |
| 132 } |
| 133 } |
| 134 |
| 135 // Trace the call. |
| 136 if (FLAG_trace) { |
| 137 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 138 } |
| 139 return !is_aborted(); |
96 } | 140 } |
97 | 141 |
98 | 142 |
99 bool LCodeGen::GenerateBody() { | 143 bool LCodeGen::GenerateBody() { |
100 ASSERT(is_generating()); | 144 ASSERT(is_generating()); |
101 bool emit_instructions = true; | 145 bool emit_instructions = true; |
102 for (current_instruction_ = 0; | 146 for (current_instruction_ = 0; |
103 !is_aborted() && current_instruction_ < instructions_->length(); | 147 !is_aborted() && current_instruction_ < instructions_->length(); |
104 current_instruction_++) { | 148 current_instruction_++) { |
105 LInstruction* instr = instructions_->at(current_instruction_); | 149 LInstruction* instr = instructions_->at(current_instruction_); |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 | 1211 |
1168 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 1212 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
1169 Abort("Unimplemented: %s", "DoOsrEntry"); | 1213 Abort("Unimplemented: %s", "DoOsrEntry"); |
1170 } | 1214 } |
1171 | 1215 |
1172 #undef __ | 1216 #undef __ |
1173 | 1217 |
1174 } } // namespace v8::internal | 1218 } } // namespace v8::internal |
1175 | 1219 |
1176 #endif // V8_TARGET_ARCH_X64 | 1220 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |