blob: ae3a8242922c340b60b7ad63cf8670b3107f9a7f [file] [log] [blame]
yangguo@chromium.org659ceec2012-01-26 07:37:54 +00001// Copyright 2012 the V8 project authors. All rights reserved.
rossberg@chromium.org34849642014-04-29 16:30:47 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
kasperl@chromium.orga5551262010-12-07 12:49:48 +00004
machenbach@chromium.org196eb602014-06-04 00:06:13 +00005#include "src/v8.h"
kasperl@chromium.orga5551262010-12-07 12:49:48 +00006
jkummerow@chromium.org93a47f42013-07-02 14:43:41 +00007#if V8_TARGET_ARCH_X64
sgjesse@chromium.orgc6c57182011-01-17 12:24:25 +00008
machenbach@chromium.org196eb602014-06-04 00:06:13 +00009#include "src/codegen.h"
10#include "src/deoptimizer.h"
11#include "src/full-codegen.h"
12#include "src/safepoint-table.h"
kasperl@chromium.orga5551262010-12-07 12:49:48 +000013
14namespace v8 {
15namespace internal {
16
17
kmillikin@chromium.org7c2628c2011-08-10 11:27:35 +000018const int Deoptimizer::table_entry_size_ = 10;
kasperl@chromium.orga5551262010-12-07 12:49:48 +000019
kmillikin@chromium.org31b12772011-02-02 16:08:26 +000020
21int Deoptimizer::patch_size() {
danno@chromium.org59400602013-08-13 17:09:37 +000022 return Assembler::kCallSequenceLength;
fschneider@chromium.org7979bbb2011-03-28 10:47:03 +000023}
24
25
jkummerow@chromium.orgfb732b12013-07-26 10:27:09 +000026void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) {
ager@chromium.org0ee099b2011-01-25 14:06:47 +000027 // Invalidate the relocation information, as it will become invalid by the
28 // code patching below, and is not needed any more.
29 code->InvalidateRelocation();
30
titzer@chromium.orgf5a24542014-03-04 09:06:17 +000031 if (FLAG_zap_code_space) {
32 // Fail hard and early if we enter this code object again.
33 byte* pointer = code->FindCodeAgeSequence();
34 if (pointer != NULL) {
35 pointer += kNoCodeAgeSequenceLength;
36 } else {
37 pointer = code->instruction_start();
38 }
39 CodePatcher patcher(pointer, 1);
40 patcher.masm()->int3();
41
42 DeoptimizationInputData* data =
43 DeoptimizationInputData::cast(code->deoptimization_data());
44 int osr_offset = data->OsrPcOffset()->value();
45 if (osr_offset > 0) {
46 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1);
47 osr_patcher.masm()->int3();
48 }
49 }
50
ricow@chromium.org27bf2882011-11-17 08:34:43 +000051 // For each LLazyBailout instruction insert a absolute call to the
ricow@chromium.org83aa5492011-02-07 12:42:56 +000052 // corresponding deoptimization entry, or a short call to an absolute
53 // jump if space is short. The absolute jumps are put in a table just
54 // before the safepoint table (space was allocated there when the Code
55 // object was created, if necessary).
56
jkummerow@chromium.orgfb732b12013-07-26 10:27:09 +000057 Address instruction_start = code->instruction_start();
rossberg@chromium.org717967f2011-07-20 13:44:42 +000058#ifdef DEBUG
ricow@chromium.org27bf2882011-11-17 08:34:43 +000059 Address prev_call_address = NULL;
rossberg@chromium.org717967f2011-07-20 13:44:42 +000060#endif
ricow@chromium.org27bf2882011-11-17 08:34:43 +000061 DeoptimizationInputData* deopt_data =
62 DeoptimizationInputData::cast(code->deoptimization_data());
titzer@chromium.orgf5a24542014-03-04 09:06:17 +000063 SharedFunctionInfo* shared =
64 SharedFunctionInfo::cast(deopt_data->SharedFunctionInfo());
65 shared->EvictFromOptimizedCodeMap(code, "deoptimized code");
66 deopt_data->SetSharedFunctionInfo(Smi::FromInt(0));
67 // For each LLazyBailout instruction insert a call to the corresponding
68 // deoptimization entry.
ricow@chromium.org27bf2882011-11-17 08:34:43 +000069 for (int i = 0; i < deopt_data->DeoptCount(); i++) {
70 if (deopt_data->Pc(i)->value() == -1) continue;
ricow@chromium.org83aa5492011-02-07 12:42:56 +000071 // Position where Call will be patched in.
ricow@chromium.org27bf2882011-11-17 08:34:43 +000072 Address call_address = instruction_start + deopt_data->Pc(i)->value();
73 // There is room enough to write a long call instruction because we pad
74 // LLazyBailout instructions with nops if necessary.
danno@chromium.org59400602013-08-13 17:09:37 +000075 CodePatcher patcher(call_address, Assembler::kCallSequenceLength);
hpayer@chromium.org8432c912013-02-28 15:55:26 +000076 patcher.masm()->Call(GetDeoptimizationEntry(isolate, i, LAZY),
machenbach@chromium.orgaf4fba32014-01-27 01:05:32 +000077 Assembler::RelocInfoNone());
ricow@chromium.org27bf2882011-11-17 08:34:43 +000078 ASSERT(prev_call_address == NULL ||
79 call_address >= prev_call_address + patch_size());
80 ASSERT(call_address + patch_size() <= code->instruction_end());
rossberg@chromium.org717967f2011-07-20 13:44:42 +000081#ifdef DEBUG
ricow@chromium.org27bf2882011-11-17 08:34:43 +000082 prev_call_address = call_address;
rossberg@chromium.org717967f2011-07-20 13:44:42 +000083#endif
ager@chromium.org0ee099b2011-01-25 14:06:47 +000084 }
kasperl@chromium.orga5551262010-12-07 12:49:48 +000085}
86
87
ricow@chromium.org4f693d62011-07-04 14:01:31 +000088void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
89 // Set the register values. The values are not important as there are no
90 // callee saved registers in JavaScript frames, so all registers are
91 // spilled. Registers rbp and rsp are set to the correct values though.
92 for (int i = 0; i < Register::kNumRegisters; i++) {
93 input_->SetRegister(i, i * 4);
94 }
95 input_->SetRegister(rsp.code(), reinterpret_cast<intptr_t>(frame->sp()));
96 input_->SetRegister(rbp.code(), reinterpret_cast<intptr_t>(frame->fp()));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +000097 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) {
ricow@chromium.org4f693d62011-07-04 14:01:31 +000098 input_->SetDoubleRegister(i, 0.0);
99 }
100
101 // Fill the frame content from the actual data on the frame.
102 for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
bmeurer@chromium.org25530ce2014-02-07 09:11:16 +0000103 input_->SetFrameSlot(i, Memory::uintptr_at(tos + i));
ricow@chromium.org4f693d62011-07-04 14:01:31 +0000104 }
105}
106
107
ulan@chromium.org6e196bf2013-03-13 09:38:22 +0000108void Deoptimizer::SetPlatformCompiledStubRegisters(
109 FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) {
110 intptr_t handler =
111 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
machenbach@chromium.org0cc09502013-11-13 12:20:55 +0000112 int params = descriptor->GetHandlerParameterCount();
ulan@chromium.org6e196bf2013-03-13 09:38:22 +0000113 output_frame->SetRegister(rax.code(), params);
114 output_frame->SetRegister(rbx.code(), handler);
115}
116
117
118void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) {
119 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
120 double double_value = input_->GetDoubleRegister(i);
121 output_frame->SetDoubleRegister(i, double_value);
122 }
123}
124
125
jkummerow@chromium.org4e308cf2013-05-17 13:39:16 +0000126bool Deoptimizer::HasAlignmentPadding(JSFunction* function) {
127 // There is no dynamic alignment padding on x64 in the input frame.
128 return false;
129}
130
131
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000132#define __ masm()->
133
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000134void Deoptimizer::EntryGenerator::Generate() {
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000135 GeneratePrologue();
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000136
137 // Save all general purpose registers before messing with them.
138 const int kNumberOfRegisters = Register::kNumRegisters;
139
140 const int kDoubleRegsSize = kDoubleSize *
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000141 XMMRegister::NumAllocatableRegisters();
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000142 __ subp(rsp, Immediate(kDoubleRegsSize));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000143
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000144 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000145 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
146 int offset = i * kDoubleSize;
147 __ movsd(Operand(rsp, offset), xmm_reg);
148 }
149
150 // We push all registers onto the stack, even though we do not need
151 // to restore all later.
152 for (int i = 0; i < kNumberOfRegisters; i++) {
svenpanne@chromium.org84bcc552011-07-18 09:50:57 +0000153 Register r = Register::from_code(i);
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000154 __ pushq(r);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000155 }
156
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000157 const int kSavedRegistersAreaSize = kNumberOfRegisters * kRegisterSize +
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000158 kDoubleRegsSize;
159
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000160 // We use this to keep the value of the fifth argument temporarily.
161 // Unfortunately we can't store it directly in r8 (used for passing
162 // this on linux), since it is another parameter passing register on windows.
163 Register arg5 = r11;
164
165 // Get the bailout id from the stack.
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000166 __ movp(arg_reg_3, Operand(rsp, kSavedRegistersAreaSize));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000167
danno@chromium.org169691d2013-07-15 08:01:13 +0000168 // Get the address of the location in the code object
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000169 // and compute the fp-to-sp delta in register arg5.
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000170 __ movp(arg_reg_4, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize));
machenbach@chromium.org895f00d2014-03-27 01:04:43 +0000171 __ leap(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize +
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000172 kPCOnStackSize));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000173
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000174 __ subp(arg5, rbp);
machenbach@chromium.org7a1bfbe2014-03-26 12:42:48 +0000175 __ negp(arg5);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000176
177 // Allocate a new deoptimizer object.
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000178 __ PrepareCallCFunction(6);
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000179 __ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
180 __ movp(arg_reg_1, rax);
danno@chromium.orgca29dd82013-04-26 11:59:48 +0000181 __ Set(arg_reg_2, type());
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000182 // Args 3 and 4 are already in the right registers.
183
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000184 // On windows put the arguments on the stack (PrepareCallCFunction
185 // has created space for this). On linux pass the arguments in r8 and r9.
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000186#ifdef _WIN64
machenbach@chromium.orgaf4fba32014-01-27 01:05:32 +0000187 __ movq(Operand(rsp, 4 * kRegisterSize), arg5);
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000188 __ LoadAddress(arg5, ExternalReference::isolate_address(isolate()));
machenbach@chromium.orgaf4fba32014-01-27 01:05:32 +0000189 __ movq(Operand(rsp, 5 * kRegisterSize), arg5);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000190#else
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000191 __ movp(r8, arg5);
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000192 __ LoadAddress(r9, ExternalReference::isolate_address(isolate()));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000193#endif
194
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000195 { AllowExternalCallThatCantCauseGC scope(masm());
196 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000197 }
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000198 // Preserve deoptimizer object in register rax and get the input
199 // frame descriptor pointer.
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000200 __ movp(rbx, Operand(rax, Deoptimizer::input_offset()));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000201
202 // Fill in the input registers.
203 for (int i = kNumberOfRegisters -1; i >= 0; i--) {
204 int offset = (i * kPointerSize) + FrameDescription::registers_offset();
machenbach@chromium.orga86d4162014-05-01 00:05:11 +0000205 __ PopQuad(Operand(rbx, offset));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000206 }
207
ricow@chromium.org83aa5492011-02-07 12:42:56 +0000208 // Fill in the double input registers.
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000209 int double_regs_offset = FrameDescription::double_registers_offset();
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000210 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000211 int dst_offset = i * kDoubleSize + double_regs_offset;
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000212 __ popq(Operand(rbx, dst_offset));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000213 }
214
danno@chromium.org169691d2013-07-15 08:01:13 +0000215 // Remove the bailout id and return address from the stack.
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000216 __ addp(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000217
ricow@chromium.org83aa5492011-02-07 12:42:56 +0000218 // Compute a pointer to the unwinding limit in register rcx; that is
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000219 // the first stack slot not part of the input frame.
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000220 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000221 __ addp(rcx, rsp);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000222
223 // Unwind the stack down to - but not including - the unwinding
224 // limit and copy the contents of the activation frame to the input
225 // frame description.
machenbach@chromium.org895f00d2014-03-27 01:04:43 +0000226 __ leap(rdx, Operand(rbx, FrameDescription::frame_content_offset()));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000227 Label pop_loop_header;
228 __ jmp(&pop_loop_header);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000229 Label pop_loop;
230 __ bind(&pop_loop);
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000231 __ Pop(Operand(rdx, 0));
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000232 __ addp(rdx, Immediate(sizeof(intptr_t)));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000233 __ bind(&pop_loop_header);
machenbach@chromium.org7a1bfbe2014-03-26 12:42:48 +0000234 __ cmpp(rcx, rsp);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000235 __ j(not_equal, &pop_loop);
236
237 // Compute the output frame in the deoptimizer.
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000238 __ pushq(rax);
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000239 __ PrepareCallCFunction(2);
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000240 __ movp(arg_reg_1, rax);
danno@chromium.orgca29dd82013-04-26 11:59:48 +0000241 __ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate()));
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000242 {
243 AllowExternalCallThatCantCauseGC scope(masm());
244 __ CallCFunction(
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000245 ExternalReference::compute_output_frames_function(isolate()), 2);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000246 }
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000247 __ popq(rax);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000248
249 // Replace the current frame with the output frames.
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000250 Label outer_push_loop, inner_push_loop,
251 outer_loop_header, inner_loop_header;
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000252 // Outer loop state: rax = current FrameDescription**, rdx = one past the
253 // last FrameDescription**.
254 __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset()));
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000255 __ movp(rax, Operand(rax, Deoptimizer::output_offset()));
machenbach@chromium.org895f00d2014-03-27 01:04:43 +0000256 __ leap(rdx, Operand(rax, rdx, times_pointer_size, 0));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000257 __ jmp(&outer_loop_header);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000258 __ bind(&outer_push_loop);
259 // Inner loop state: rbx = current FrameDescription*, rcx = loop index.
machenbach@chromium.org43c51e52014-01-20 07:57:28 +0000260 __ movp(rbx, Operand(rax, 0));
261 __ movp(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000262 __ jmp(&inner_loop_header);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000263 __ bind(&inner_push_loop);
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000264 __ subp(rcx, Immediate(sizeof(intptr_t)));
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000265 __ Push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000266 __ bind(&inner_loop_header);
machenbach@chromium.org7a1bfbe2014-03-26 12:42:48 +0000267 __ testp(rcx, rcx);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000268 __ j(not_zero, &inner_push_loop);
machenbach@chromium.orgfa0c3c62014-03-24 08:11:09 +0000269 __ addp(rax, Immediate(kPointerSize));
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000270 __ bind(&outer_loop_header);
machenbach@chromium.org7a1bfbe2014-03-26 12:42:48 +0000271 __ cmpp(rax, rdx);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000272 __ j(below, &outer_push_loop);
273
danno@chromium.org94b0d6f2013-02-04 13:33:20 +0000274 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
275 XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
276 int src_offset = i * kDoubleSize + double_regs_offset;
277 __ movsd(xmm_reg, Operand(rbx, src_offset));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000278 }
279
280 // Push state, pc, and continuation from the last output frame.
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000281 __ Push(Operand(rbx, FrameDescription::state_offset()));
machenbach@chromium.orga86d4162014-05-01 00:05:11 +0000282 __ PushQuad(Operand(rbx, FrameDescription::pc_offset()));
283 __ PushQuad(Operand(rbx, FrameDescription::continuation_offset()));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000284
285 // Push the registers from the last output frame.
286 for (int i = 0; i < kNumberOfRegisters; i++) {
287 int offset = (i * kPointerSize) + FrameDescription::registers_offset();
machenbach@chromium.orga86d4162014-05-01 00:05:11 +0000288 __ PushQuad(Operand(rbx, offset));
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000289 }
290
291 // Restore the registers from the stack.
292 for (int i = kNumberOfRegisters - 1; i >= 0 ; i--) {
svenpanne@chromium.org84bcc552011-07-18 09:50:57 +0000293 Register r = Register::from_code(i);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000294 // Do not restore rsp, simply pop the value into the next register
295 // and overwrite this afterwards.
296 if (r.is(rsp)) {
297 ASSERT(i > 0);
svenpanne@chromium.org84bcc552011-07-18 09:50:57 +0000298 r = Register::from_code(i - 1);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000299 }
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000300 __ popq(r);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000301 }
302
303 // Set up the roots register.
karlklose@chromium.org8f806e82011-03-07 14:06:08 +0000304 __ InitializeRootRegister();
305 __ InitializeSmiConstantRegister();
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000306
307 // Return to the continuation point.
308 __ ret(0);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000309}
310
311
312void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000313 // Create a sequence of deoptimization entries.
314 Label done;
315 for (int i = 0; i < count(); i++) {
316 int start = masm()->pc_offset();
317 USE(start);
machenbach@chromium.org763da4c2014-03-19 10:48:37 +0000318 __ pushq_imm32(i);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000319 __ jmp(&done);
320 ASSERT(masm()->pc_offset() - start == table_entry_size_);
321 }
322 __ bind(&done);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000323}
324
yangguo@chromium.orgc73d55b2013-07-24 08:18:28 +0000325
326void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
machenbach@chromium.orga86d4162014-05-01 00:05:11 +0000327 if (kPCOnStackSize == 2 * kPointerSize) {
328 // Zero out the high-32 bit of PC for x32 port.
329 SetFrameSlot(offset + kPointerSize, 0);
330 }
yangguo@chromium.orgc73d55b2013-07-24 08:18:28 +0000331 SetFrameSlot(offset, value);
332}
333
334
335void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) {
machenbach@chromium.orga86d4162014-05-01 00:05:11 +0000336 if (kFPOnStackSize == 2 * kPointerSize) {
337 // Zero out the high-32 bit of FP for x32 port.
338 SetFrameSlot(offset + kPointerSize, 0);
339 }
yangguo@chromium.orgc73d55b2013-07-24 08:18:28 +0000340 SetFrameSlot(offset, value);
341}
342
343
dslomov@chromium.org6b6df382014-03-14 16:14:53 +0000344void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) {
345 // No out-of-line constant pool support.
346 UNREACHABLE();
347}
348
349
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000350#undef __
351
352
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000353} } // namespace v8::internal
sgjesse@chromium.orgc6c57182011-01-17 12:24:25 +0000354
355#endif // V8_TARGET_ARCH_X64