Chromium Code Reviews| 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 | |
|
Rico
2011/01/14 12:57:02
We might need to do this on ia32 as well?
Lasse Reichstein
2011/01/14 13:12:30
Will do it there as well.
| |
| 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 for (int offset = slots * kPointerSize - 4 * KB; | |
|
Rico
2011/01/14 12:57:02
Do we have a kPageSize constant somewhere?
Lasse Reichstein
2011/01/14 13:12:30
Sadly not, but I'll define a local constant.
It's
| |
| 126 offset > 0; | |
| 127 offset -= 4 * KB) { | |
| 128 __ moveq(Operand(rsp, offset), rax); | |
| 129 } | |
| 130 #endif | |
| 131 } | |
| 132 } | |
| 133 | |
| 134 // Trace the call. | |
| 135 if (FLAG_trace) { | |
| 136 __ CallRuntime(Runtime::kTraceEnter, 0); | |
| 137 } | |
| 138 return !is_aborted(); | |
| 96 } | 139 } |
| 97 | 140 |
| 98 | 141 |
| 99 bool LCodeGen::GenerateBody() { | 142 bool LCodeGen::GenerateBody() { |
| 100 ASSERT(is_generating()); | 143 ASSERT(is_generating()); |
| 101 bool emit_instructions = true; | 144 bool emit_instructions = true; |
| 102 for (current_instruction_ = 0; | 145 for (current_instruction_ = 0; |
| 103 !is_aborted() && current_instruction_ < instructions_->length(); | 146 !is_aborted() && current_instruction_ < instructions_->length(); |
| 104 current_instruction_++) { | 147 current_instruction_++) { |
| 105 LInstruction* instr = instructions_->at(current_instruction_); | 148 LInstruction* instr = instructions_->at(current_instruction_); |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1167 | 1210 |
| 1168 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 1211 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 1169 Abort("Unimplemented: %s", "DoOsrEntry"); | 1212 Abort("Unimplemented: %s", "DoOsrEntry"); |
| 1170 } | 1213 } |
| 1171 | 1214 |
| 1172 #undef __ | 1215 #undef __ |
| 1173 | 1216 |
| 1174 } } // namespace v8::internal | 1217 } } // namespace v8::internal |
| 1175 | 1218 |
| 1176 #endif // V8_TARGET_ARCH_X64 | 1219 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |