blob: 7158e4f551f6a88b9d4d1a6ad9372ea4798c4ada [file] [log] [blame]
lrn@chromium.org7516f052011-03-30 08:52:27 +00001// Copyright 2011 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "v8.h"
29
30#include "codegen.h"
31#include "deoptimizer.h"
32#include "full-codegen.h"
33#include "safepoint-table.h"
34
lrn@chromium.org7516f052011-03-30 08:52:27 +000035namespace v8 {
36namespace internal {
37
38
lrn@chromium.org7516f052011-03-30 08:52:27 +000039int Deoptimizer::patch_size() {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000040 const int kCallInstructionSizeInWords = 4;
lrn@chromium.org7516f052011-03-30 08:52:27 +000041 return kCallInstructionSizeInWords * Assembler::kInstrSize;
42}
43
44
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +000045void Deoptimizer::DeoptimizeFunctionWithPreparedFunctionList(
46 JSFunction* function) {
47 Isolate* isolate = function->GetIsolate();
48 HandleScope scope(isolate);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000049 AssertNoAllocation no_allocation;
50
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +000051 ASSERT(function->IsOptimized());
52 ASSERT(function->FunctionsInFunctionListShareSameCode());
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000053
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +000054 // The optimized code is going to be patched, so we cannot use it
55 // any more. Play safe and reset the whole cache.
56 function->shared()->ClearOptimizedCodeMap();
57
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000058 // Get the optimized code.
59 Code* code = function->code();
erikcorry0ad885c2011-11-21 13:51:57 +000060 Address code_start_address = code->instruction_start();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000061
62 // Invalidate the relocation information, as it will become invalid by the
63 // code patching below, and is not needed any more.
64 code->InvalidateRelocation();
65
erikcorry0ad885c2011-11-21 13:51:57 +000066 // For each LLazyBailout instruction insert a call to the corresponding
67 // deoptimization entry.
68 DeoptimizationInputData* deopt_data =
69 DeoptimizationInputData::cast(code->deoptimization_data());
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000070#ifdef DEBUG
erikcorry0ad885c2011-11-21 13:51:57 +000071 Address prev_call_address = NULL;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000072#endif
erikcorry0ad885c2011-11-21 13:51:57 +000073 for (int i = 0; i < deopt_data->DeoptCount(); i++) {
74 if (deopt_data->Pc(i)->value() == -1) continue;
75 Address call_address = code_start_address + deopt_data->Pc(i)->value();
hpayer@chromium.org8432c912013-02-28 15:55:26 +000076 Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY);
erikcorry0ad885c2011-11-21 13:51:57 +000077 int call_size_in_bytes = MacroAssembler::CallSize(deopt_entry,
jkummerow@chromium.org59297c72013-01-09 16:32:23 +000078 RelocInfo::NONE32);
erikcorry0ad885c2011-11-21 13:51:57 +000079 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize;
80 ASSERT(call_size_in_bytes % Assembler::kInstrSize == 0);
81 ASSERT(call_size_in_bytes <= patch_size());
82 CodePatcher patcher(call_address, call_size_in_words);
jkummerow@chromium.org59297c72013-01-09 16:32:23 +000083 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32);
erikcorry0ad885c2011-11-21 13:51:57 +000084 ASSERT(prev_call_address == NULL ||
85 call_address >= prev_call_address + patch_size());
86 ASSERT(call_address + patch_size() <= code->instruction_end());
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000087
88#ifdef DEBUG
erikcorry0ad885c2011-11-21 13:51:57 +000089 prev_call_address = call_address;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000090#endif
erikcorry0ad885c2011-11-21 13:51:57 +000091 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000092
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000093 // Add the deoptimizing code to the list.
94 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
95 DeoptimizerData* data = isolate->deoptimizer_data();
96 node->set_next(data->deoptimizing_code_list_);
97 data->deoptimizing_code_list_ = node;
98
99 // We might be in the middle of incremental marking with compaction.
100 // Tell collector to treat this code object in a special way and
101 // ignore all slots that might have been recorded on it.
102 isolate->heap()->mark_compact_collector()->InvalidateCode(code);
103
rossberg@chromium.org89e18f52012-10-22 13:09:53 +0000104 ReplaceCodeForRelatedFunctions(function, code);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000105
106 if (FLAG_trace_deopt) {
107 PrintF("[forced deoptimization: ");
108 function->PrintName();
109 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
110#ifdef DEBUG
111 if (FLAG_print_code) {
112 code->PrintLn();
113 }
114#endif
115 }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000116}
117
118
rossberg@chromium.orgb4b2aa62011-10-13 09:49:59 +0000119void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
120 Address pc_after,
lrn@chromium.org7516f052011-03-30 08:52:27 +0000121 Code* check_code,
122 Code* replacement_code) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000123 const int kInstrSize = Assembler::kInstrSize;
rossberg@chromium.orgcddc71f2012-12-07 12:40:13 +0000124 // This structure comes from FullCodeGenerator::EmitBackEdgeBookkeeping.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000125 // The call of the stack guard check has the following form:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +0000126 // sltu at, sp, t0 / slt at, a3, zero_reg (in case of count based interrupts)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000127 // beq at, zero_reg, ok
128 // lui t9, <stack guard address> upper
129 // ori t9, <stack guard address> lower
130 // jalr t9
131 // nop
132 // ----- pc_after points here
133
134 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize)));
135
136 // Replace the sltu instruction with load-imm 1 to at, so beq is not taken.
137 CodePatcher patcher(pc_after - 6 * kInstrSize, 1);
138 patcher.masm()->addiu(at, zero_reg, 1);
139
140 // Replace the stack check address in the load-immediate (lui/ori pair)
141 // with the entry address of the replacement code.
142 ASSERT(reinterpret_cast<uint32_t>(
143 Assembler::target_address_at(pc_after - 4 * kInstrSize)) ==
144 reinterpret_cast<uint32_t>(check_code->entry()));
145 Assembler::set_target_address_at(pc_after - 4 * kInstrSize,
146 replacement_code->entry());
147
148 // We patched the code to the following form:
149 // addiu at, zero_reg, 1
150 // beq at, zero_reg, ok ;; Not changed
151 // lui t9, <on-stack replacement address> upper
152 // ori t9, <on-stack replacement address> lower
153 // jalr t9 ;; Not changed
154 // nop ;; Not changed
155 // ----- pc_after points here
156
157 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
158 unoptimized_code, pc_after - 4 * kInstrSize, replacement_code);
lrn@chromium.org7516f052011-03-30 08:52:27 +0000159}
160
161
erik.corry@gmail.com394dbcf2011-10-27 07:38:48 +0000162void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code,
163 Address pc_after,
lrn@chromium.org7516f052011-03-30 08:52:27 +0000164 Code* check_code,
165 Code* replacement_code) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000166 // Exact opposite of the function above.
167 const int kInstrSize = Assembler::kInstrSize;
168 ASSERT(Assembler::IsAddImmediate(
169 Assembler::instr_at(pc_after - 6 * kInstrSize)));
170 ASSERT(Assembler::IsBeq(Assembler::instr_at(pc_after - 5 * kInstrSize)));
171
172 // Restore the sltu instruction so beq can be taken again.
173 CodePatcher patcher(pc_after - 6 * kInstrSize, 1);
rossberg@chromium.orgcddc71f2012-12-07 12:40:13 +0000174 patcher.masm()->slt(at, a3, zero_reg);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000175
176 // Replace the on-stack replacement address in the load-immediate (lui/ori
177 // pair) with the entry address of the normal stack-check code.
178 ASSERT(reinterpret_cast<uint32_t>(
179 Assembler::target_address_at(pc_after - 4 * kInstrSize)) ==
180 reinterpret_cast<uint32_t>(replacement_code->entry()));
181 Assembler::set_target_address_at(pc_after - 4 * kInstrSize,
182 check_code->entry());
183
184 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
185 unoptimized_code, pc_after - 4 * kInstrSize, check_code);
186}
187
188
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000189static int LookupBailoutId(DeoptimizationInputData* data, BailoutId ast_id) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000190 ByteArray* translations = data->TranslationByteArray();
191 int length = data->DeoptCount();
192 for (int i = 0; i < length; i++) {
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000193 if (data->AstId(i) == ast_id) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000194 TranslationIterator it(translations, data->TranslationIndex(i)->value());
195 int value = it.Next();
196 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
197 // Read the number of frames.
198 value = it.Next();
199 if (value == 1) return i;
200 }
201 }
202 UNREACHABLE();
203 return -1;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000204}
205
206
207void Deoptimizer::DoComputeOsrOutputFrame() {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000208 DeoptimizationInputData* data = DeoptimizationInputData::cast(
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000209 compiled_code_->deoptimization_data());
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000210 unsigned ast_id = data->OsrAstId()->value();
211
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000212 int bailout_id = LookupBailoutId(data, BailoutId(ast_id));
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000213 unsigned translation_index = data->TranslationIndex(bailout_id)->value();
214 ByteArray* translations = data->TranslationByteArray();
215
216 TranslationIterator iterator(translations, translation_index);
217 Translation::Opcode opcode =
218 static_cast<Translation::Opcode>(iterator.Next());
219 ASSERT(Translation::BEGIN == opcode);
220 USE(opcode);
221 int count = iterator.Next();
danno@chromium.orgfa458e42012-02-01 10:48:36 +0000222 iterator.Skip(1); // Drop JS frame count.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000223 ASSERT(count == 1);
224 USE(count);
225
226 opcode = static_cast<Translation::Opcode>(iterator.Next());
227 USE(opcode);
danno@chromium.orgfa458e42012-02-01 10:48:36 +0000228 ASSERT(Translation::JS_FRAME == opcode);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000229 unsigned node_id = iterator.Next();
230 USE(node_id);
231 ASSERT(node_id == ast_id);
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +0000232 int closure_id = iterator.Next();
233 USE(closure_id);
234 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000235 unsigned height = iterator.Next();
236 unsigned height_in_bytes = height * kPointerSize;
237 USE(height_in_bytes);
238
239 unsigned fixed_size = ComputeFixedSize(function_);
240 unsigned input_frame_size = input_->GetFrameSize();
241 ASSERT(fixed_size + height_in_bytes == input_frame_size);
242
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000243 unsigned stack_slot_size = compiled_code_->stack_slots() * kPointerSize;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000244 unsigned outgoing_height = data->ArgumentsStackHeight(bailout_id)->value();
245 unsigned outgoing_size = outgoing_height * kPointerSize;
246 unsigned output_frame_size = fixed_size + stack_slot_size + outgoing_size;
247 ASSERT(outgoing_size == 0); // OSR does not happen in the middle of a call.
248
249 if (FLAG_trace_osr) {
250 PrintF("[on-stack replacement: begin 0x%08" V8PRIxPTR " ",
251 reinterpret_cast<intptr_t>(function_));
252 function_->PrintName();
253 PrintF(" => node=%u, frame=%d->%d]\n",
254 ast_id,
255 input_frame_size,
256 output_frame_size);
257 }
258
259 // There's only one output frame in the OSR case.
260 output_count_ = 1;
261 output_ = new FrameDescription*[1];
262 output_[0] = new(output_frame_size) FrameDescription(
263 output_frame_size, function_);
danno@chromium.orgfa458e42012-02-01 10:48:36 +0000264 output_[0]->SetFrameType(StackFrame::JAVA_SCRIPT);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000265
266 // Clear the incoming parameters in the optimized frame to avoid
267 // confusing the garbage collector.
268 unsigned output_offset = output_frame_size - kPointerSize;
269 int parameter_count = function_->shared()->formal_parameter_count() + 1;
270 for (int i = 0; i < parameter_count; ++i) {
271 output_[0]->SetFrameSlot(output_offset, 0);
272 output_offset -= kPointerSize;
273 }
274
275 // Translate the incoming parameters. This may overwrite some of the
276 // incoming argument slots we've just cleared.
277 int input_offset = input_frame_size - kPointerSize;
278 bool ok = true;
279 int limit = input_offset - (parameter_count * kPointerSize);
280 while (ok && input_offset > limit) {
281 ok = DoOsrTranslateCommand(&iterator, &input_offset);
282 }
283
284 // There are no translation commands for the caller's pc and fp, the
285 // context, and the function. Set them up explicitly.
286 for (int i = StandardFrameConstants::kCallerPCOffset;
287 ok && i >= StandardFrameConstants::kMarkerOffset;
288 i -= kPointerSize) {
289 uint32_t input_value = input_->GetFrameSlot(input_offset);
290 if (FLAG_trace_osr) {
291 const char* name = "UNKNOWN";
292 switch (i) {
293 case StandardFrameConstants::kCallerPCOffset:
294 name = "caller's pc";
295 break;
296 case StandardFrameConstants::kCallerFPOffset:
297 name = "fp";
298 break;
299 case StandardFrameConstants::kContextOffset:
300 name = "context";
301 break;
302 case StandardFrameConstants::kMarkerOffset:
303 name = "function";
304 break;
305 }
306 PrintF(" [sp + %d] <- 0x%08x ; [sp + %d] (fixed part - %s)\n",
307 output_offset,
308 input_value,
309 input_offset,
310 name);
311 }
312
313 output_[0]->SetFrameSlot(output_offset, input_->GetFrameSlot(input_offset));
314 input_offset -= kPointerSize;
315 output_offset -= kPointerSize;
316 }
317
318 // Translate the rest of the frame.
319 while (ok && input_offset >= 0) {
320 ok = DoOsrTranslateCommand(&iterator, &input_offset);
321 }
322
323 // If translation of any command failed, continue using the input frame.
324 if (!ok) {
325 delete output_[0];
326 output_[0] = input_;
327 output_[0]->SetPc(reinterpret_cast<uint32_t>(from_));
328 } else {
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000329 // Set up the frame pointer and the context pointer.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000330 output_[0]->SetRegister(fp.code(), input_->GetRegister(fp.code()));
331 output_[0]->SetRegister(cp.code(), input_->GetRegister(cp.code()));
332
333 unsigned pc_offset = data->OsrPcOffset()->value();
334 uint32_t pc = reinterpret_cast<uint32_t>(
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000335 compiled_code_->entry() + pc_offset);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000336 output_[0]->SetPc(pc);
337 }
338 Code* continuation = isolate_->builtins()->builtin(Builtins::kNotifyOSR);
339 output_[0]->SetContinuation(
340 reinterpret_cast<uint32_t>(continuation->entry()));
341
342 if (FLAG_trace_osr) {
343 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ",
344 ok ? "finished" : "aborted",
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +0000345 reinterpret_cast<intptr_t>(function_));
346 function_->PrintName();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000347 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc());
348 }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000349}
350
351
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000352// This code is very similar to ia32/arm code, but relies on register names
353// (fp, sp) and how the frame is laid out.
danno@chromium.orgfa458e42012-02-01 10:48:36 +0000354void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
355 int frame_index) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000356 // Read the ast node id, function, and frame height for this output frame.
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000357 BailoutId node_id = BailoutId(iterator->Next());
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +0000358 JSFunction* function;
359 if (frame_index != 0) {
360 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
361 } else {
362 int closure_id = iterator->Next();
363 USE(closure_id);
364 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
365 function = function_;
366 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000367 unsigned height = iterator->Next();
368 unsigned height_in_bytes = height * kPointerSize;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000369 if (trace_) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000370 PrintF(" translating ");
371 function->PrintName();
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000372 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000373 }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000374
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000375 // The 'fixed' part of the frame consists of the incoming parameters and
376 // the part described by JavaScriptFrameConstants.
377 unsigned fixed_frame_size = ComputeFixedSize(function);
378 unsigned input_frame_size = input_->GetFrameSize();
379 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
380
381 // Allocate and store the output frame description.
382 FrameDescription* output_frame =
383 new(output_frame_size) FrameDescription(output_frame_size, function);
danno@chromium.orgfa458e42012-02-01 10:48:36 +0000384 output_frame->SetFrameType(StackFrame::JAVA_SCRIPT);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000385
386 bool is_bottommost = (0 == frame_index);
387 bool is_topmost = (output_count_ - 1 == frame_index);
388 ASSERT(frame_index >= 0 && frame_index < output_count_);
389 ASSERT(output_[frame_index] == NULL);
390 output_[frame_index] = output_frame;
391
392 // The top address for the bottommost output frame can be computed from
393 // the input frame pointer and the output frame's height. For all
394 // subsequent output frames, it can be computed from the previous one's
395 // top address and the current frame's size.
396 uint32_t top_address;
397 if (is_bottommost) {
398 // 2 = context and function in the frame.
399 top_address =
400 input_->GetRegister(fp.code()) - (2 * kPointerSize) - height_in_bytes;
401 } else {
402 top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
403 }
404 output_frame->SetTop(top_address);
405
406 // Compute the incoming parameter translation.
407 int parameter_count = function->shared()->formal_parameter_count() + 1;
408 unsigned output_offset = output_frame_size;
409 unsigned input_offset = input_frame_size;
410 for (int i = 0; i < parameter_count; ++i) {
411 output_offset -= kPointerSize;
412 DoTranslateCommand(iterator, frame_index, output_offset);
413 }
414 input_offset -= (parameter_count * kPointerSize);
415
416 // There are no translation commands for the caller's pc and fp, the
417 // context, and the function. Synthesize their values and set them up
418 // explicitly.
419 //
420 // The caller's pc for the bottommost output frame is the same as in the
421 // input frame. For all subsequent output frames, it can be read from the
422 // previous one. This frame's pc can be computed from the non-optimized
423 // function code and AST id of the bailout.
424 output_offset -= kPointerSize;
425 input_offset -= kPointerSize;
426 intptr_t value;
427 if (is_bottommost) {
428 value = input_->GetFrameSlot(input_offset);
429 } else {
430 value = output_[frame_index - 1]->GetPc();
431 }
432 output_frame->SetFrameSlot(output_offset, value);
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000433 if (trace_) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000434 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n",
435 top_address + output_offset, output_offset, value);
436 }
437
438 // The caller's frame pointer for the bottommost output frame is the same
439 // as in the input frame. For all subsequent output frames, it can be
440 // read from the previous one. Also compute and set this frame's frame
441 // pointer.
442 output_offset -= kPointerSize;
443 input_offset -= kPointerSize;
444 if (is_bottommost) {
445 value = input_->GetFrameSlot(input_offset);
446 } else {
447 value = output_[frame_index - 1]->GetFp();
448 }
449 output_frame->SetFrameSlot(output_offset, value);
450 intptr_t fp_value = top_address + output_offset;
451 ASSERT(!is_bottommost || input_->GetRegister(fp.code()) == fp_value);
452 output_frame->SetFp(fp_value);
453 if (is_topmost) {
454 output_frame->SetRegister(fp.code(), fp_value);
455 }
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000456 if (trace_) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000457 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
458 fp_value, output_offset, value);
459 }
460
461 // For the bottommost output frame the context can be gotten from the input
462 // frame. For all subsequent output frames it can be gotten from the function
463 // so long as we don't inline functions that need local contexts.
464 output_offset -= kPointerSize;
465 input_offset -= kPointerSize;
466 if (is_bottommost) {
467 value = input_->GetFrameSlot(input_offset);
468 } else {
469 value = reinterpret_cast<intptr_t>(function->context());
470 }
471 output_frame->SetFrameSlot(output_offset, value);
ulan@chromium.org812308e2012-02-29 15:58:45 +0000472 output_frame->SetContext(value);
473 if (is_topmost) output_frame->SetRegister(cp.code(), value);
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000474 if (trace_) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000475 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
476 top_address + output_offset, output_offset, value);
477 }
478
479 // The function was mentioned explicitly in the BEGIN_FRAME.
480 output_offset -= kPointerSize;
481 input_offset -= kPointerSize;
482 value = reinterpret_cast<uint32_t>(function);
483 // The function for the bottommost output frame should also agree with the
484 // input frame.
485 ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
486 output_frame->SetFrameSlot(output_offset, value);
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000487 if (trace_) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000488 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function\n",
489 top_address + output_offset, output_offset, value);
490 }
491
492 // Translate the rest of the frame.
493 for (unsigned i = 0; i < height; ++i) {
494 output_offset -= kPointerSize;
495 DoTranslateCommand(iterator, frame_index, output_offset);
496 }
497 ASSERT(0 == output_offset);
498
499 // Compute this frame's PC, state, and continuation.
500 Code* non_optimized_code = function->shared()->code();
501 FixedArray* raw_data = non_optimized_code->deoptimization_data();
502 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data);
503 Address start = non_optimized_code->instruction_start();
504 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
505 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
506 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset);
507 output_frame->SetPc(pc_value);
508
509 FullCodeGenerator::State state =
510 FullCodeGenerator::StateField::decode(pc_and_state);
511 output_frame->SetState(Smi::FromInt(state));
512
513
514 // Set the continuation for the topmost frame.
515 if (is_topmost && bailout_type_ != DEBUGGER) {
516 Builtins* builtins = isolate_->builtins();
517 Code* continuation = (bailout_type_ == EAGER)
518 ? builtins->builtin(Builtins::kNotifyDeoptimized)
519 : builtins->builtin(Builtins::kNotifyLazyDeoptimized);
520 output_frame->SetContinuation(
521 reinterpret_cast<uint32_t>(continuation->entry()));
522 }
523}
lrn@chromium.org7516f052011-03-30 08:52:27 +0000524
ricow@chromium.org4f693d62011-07-04 14:01:31 +0000525void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000526 // Set the register values. The values are not important as there are no
527 // callee saved registers in JavaScript frames, so all registers are
528 // spilled. Registers fp and sp are set to the correct values though.
529
530 for (int i = 0; i < Register::kNumRegisters; i++) {
531 input_->SetRegister(i, i * 4);
532 }
533 input_->SetRegister(sp.code(), reinterpret_cast<intptr_t>(frame->sp()));
534 input_->SetRegister(fp.code(), reinterpret_cast<intptr_t>(frame->fp()));
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000535 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000536 input_->SetDoubleRegister(i, 0.0);
537 }
538
539 // Fill the frame content from the actual data on the frame.
540 for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
541 input_->SetFrameSlot(i, Memory::uint32_at(tos + i));
542 }
ricow@chromium.org4f693d62011-07-04 14:01:31 +0000543}
544
545
ulan@chromium.org6e196bf2013-03-13 09:38:22 +0000546void Deoptimizer::SetPlatformCompiledStubRegisters(
547 FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) {
548 ApiFunction function(descriptor->deoptimization_handler_);
549 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
550 intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
551 int params = descriptor->register_param_count_;
552 if (descriptor->stack_parameter_count_ != NULL) {
553 params++;
554 }
555 output_frame->SetRegister(s0.code(), params);
556 output_frame->SetRegister(s1.code(), (params - 1) * kPointerSize);
557 output_frame->SetRegister(s2.code(), handler);
558}
559
560
561void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) {
562 for (int i = 0; i < DoubleRegister::kMaxNumRegisters; ++i) {
563 double double_value = input_->GetDoubleRegister(i);
564 output_frame->SetDoubleRegister(i, double_value);
565 }
566}
567
568
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000569#define __ masm()->
570
571
572// This code tries to be close to ia32 code so that any changes can be
573// easily ported.
lrn@chromium.org7516f052011-03-30 08:52:27 +0000574void Deoptimizer::EntryGenerator::Generate() {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000575 GeneratePrologue();
576
577 Isolate* isolate = masm()->isolate();
578
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000579 // Unlike on ARM we don't save all the registers, just the useful ones.
580 // For the rest, there are gaps on the stack, so the offsets remain the same.
581 const int kNumberOfRegisters = Register::kNumRegisters;
582
583 RegList restored_regs = kJSCallerSaved | kCalleeSaved;
584 RegList saved_regs = restored_regs | sp.bit() | ra.bit();
585
586 const int kDoubleRegsSize =
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000587 kDoubleSize * FPURegister::kMaxNumAllocatableRegisters;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000588
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000589 if (CpuFeatures::IsSupported(FPU)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000590 CpuFeatureScope scope(masm(), FPU);
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000591 // Save all FPU registers before messing with them.
592 __ Subu(sp, sp, Operand(kDoubleRegsSize));
593 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) {
594 FPURegister fpu_reg = FPURegister::FromAllocationIndex(i);
595 int offset = i * kDoubleSize;
596 __ sdc1(fpu_reg, MemOperand(sp, offset));
597 }
598 } else {
599 __ Subu(sp, sp, Operand(kDoubleRegsSize));
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000600 }
601
602 // Push saved_regs (needed to populate FrameDescription::registers_).
603 // Leave gaps for other registers.
604 __ Subu(sp, sp, kNumberOfRegisters * kPointerSize);
605 for (int16_t i = kNumberOfRegisters - 1; i >= 0; i--) {
606 if ((saved_regs & (1 << i)) != 0) {
607 __ sw(ToRegister(i), MemOperand(sp, kPointerSize * i));
608 }
609 }
610
611 const int kSavedRegistersAreaSize =
612 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize;
613
614 // Get the bailout id from the stack.
615 __ lw(a2, MemOperand(sp, kSavedRegistersAreaSize));
616
617 // Get the address of the location in the code object if possible (a3) (return
618 // address for lazy deoptimization) and compute the fp-to-sp delta in
619 // register t0.
620 if (type() == EAGER) {
621 __ mov(a3, zero_reg);
622 // Correct one word for bailout id.
623 __ Addu(t0, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
624 } else if (type() == OSR) {
625 __ mov(a3, ra);
626 // Correct one word for bailout id.
627 __ Addu(t0, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
628 } else {
629 __ mov(a3, ra);
630 // Correct two words for bailout id and return address.
631 __ Addu(t0, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize)));
632 }
633
634 __ Subu(t0, fp, t0);
635
636 // Allocate a new deoptimizer object.
637 // Pass four arguments in a0 to a3 and fifth & sixth arguments on stack.
638 __ PrepareCallCFunction(6, t1);
639 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
640 __ li(a1, Operand(type())); // bailout type,
641 // a2: bailout id already loaded.
642 // a3: code address or 0 already loaded.
643 __ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
644 __ li(t1, Operand(ExternalReference::isolate_address()));
645 __ sw(t1, CFunctionArgumentOperand(6)); // Isolate.
646 // Call Deoptimizer::New().
647 {
648 AllowExternalCallThatCantCauseGC scope(masm());
649 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);
650 }
651
652 // Preserve "deoptimizer" object in register v0 and get the input
653 // frame descriptor pointer to a1 (deoptimizer->input_);
654 // Move deopt-obj to a0 for call to Deoptimizer::ComputeOutputFrames() below.
655 __ mov(a0, v0);
656 __ lw(a1, MemOperand(v0, Deoptimizer::input_offset()));
657
658 // Copy core registers into FrameDescription::registers_[kNumRegisters].
659 ASSERT(Register::kNumRegisters == kNumberOfRegisters);
660 for (int i = 0; i < kNumberOfRegisters; i++) {
661 int offset = (i * kPointerSize) + FrameDescription::registers_offset();
662 if ((saved_regs & (1 << i)) != 0) {
663 __ lw(a2, MemOperand(sp, i * kPointerSize));
664 __ sw(a2, MemOperand(a1, offset));
665 } else if (FLAG_debug_code) {
666 __ li(a2, kDebugZapValue);
667 __ sw(a2, MemOperand(a1, offset));
668 }
669 }
670
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000671 int double_regs_offset = FrameDescription::double_registers_offset();
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000672 if (CpuFeatures::IsSupported(FPU)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000673 CpuFeatureScope scope(masm(), FPU);
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000674 // Copy FPU registers to
675 // double_registers_[DoubleRegister::kNumAllocatableRegisters]
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000676 for (int i = 0; i < FPURegister::NumAllocatableRegisters(); ++i) {
677 int dst_offset = i * kDoubleSize + double_regs_offset;
678 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize;
679 __ ldc1(f0, MemOperand(sp, src_offset));
680 __ sdc1(f0, MemOperand(a1, dst_offset));
681 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000682 }
683
684 // Remove the bailout id, eventually return address, and the saved registers
685 // from the stack.
686 if (type() == EAGER || type() == OSR) {
687 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));
688 } else {
689 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize)));
690 }
691
692 // Compute a pointer to the unwinding limit in register a2; that is
693 // the first stack slot not part of the input frame.
694 __ lw(a2, MemOperand(a1, FrameDescription::frame_size_offset()));
695 __ Addu(a2, a2, sp);
696
697 // Unwind the stack down to - but not including - the unwinding
698 // limit and copy the contents of the activation frame to the input
699 // frame description.
700 __ Addu(a3, a1, Operand(FrameDescription::frame_content_offset()));
701 Label pop_loop;
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000702 Label pop_loop_header;
703 __ Branch(&pop_loop_header);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000704 __ bind(&pop_loop);
705 __ pop(t0);
706 __ sw(t0, MemOperand(a3, 0));
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000707 __ addiu(a3, a3, sizeof(uint32_t));
708 __ bind(&pop_loop_header);
709 __ Branch(&pop_loop, ne, a2, Operand(sp));
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000710
711 // Compute the output frame in the deoptimizer.
712 __ push(a0); // Preserve deoptimizer object across call.
713 // a0: deoptimizer object; a1: scratch.
714 __ PrepareCallCFunction(1, a1);
715 // Call Deoptimizer::ComputeOutputFrames().
716 {
717 AllowExternalCallThatCantCauseGC scope(masm());
718 __ CallCFunction(
719 ExternalReference::compute_output_frames_function(isolate), 1);
720 }
721 __ pop(a0); // Restore deoptimizer object (class Deoptimizer).
722
723 // Replace the current (input) frame with the output frames.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000724 Label outer_push_loop, inner_push_loop,
725 outer_loop_header, inner_loop_header;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000726 // Outer loop state: t0 = current "FrameDescription** output_",
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000727 // a1 = one past the last FrameDescription**.
728 __ lw(a1, MemOperand(a0, Deoptimizer::output_count_offset()));
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000729 __ lw(t0, MemOperand(a0, Deoptimizer::output_offset())); // t0 is output_.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000730 __ sll(a1, a1, kPointerSizeLog2); // Count to offset.
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000731 __ addu(a1, t0, a1); // a1 = one past the last FrameDescription**.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000732 __ jmp(&outer_loop_header);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000733 __ bind(&outer_push_loop);
734 // Inner loop state: a2 = current FrameDescription*, a3 = loop index.
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000735 __ lw(a2, MemOperand(t0, 0)); // output_[ix]
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000736 __ lw(a3, MemOperand(a2, FrameDescription::frame_size_offset()));
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000737 __ jmp(&inner_loop_header);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000738 __ bind(&inner_push_loop);
739 __ Subu(a3, a3, Operand(sizeof(uint32_t)));
740 __ Addu(t2, a2, Operand(a3));
741 __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset()));
742 __ push(t3);
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000743 __ bind(&inner_loop_header);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000744 __ Branch(&inner_push_loop, ne, a3, Operand(zero_reg));
745
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000746 __ Addu(t0, t0, Operand(kPointerSize));
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000747 __ bind(&outer_loop_header);
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000748 __ Branch(&outer_push_loop, lt, t0, Operand(a1));
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000749
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000750 if (CpuFeatures::IsSupported(FPU)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000751 CpuFeatureScope scope(masm(), FPU);
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000752
753 __ lw(a1, MemOperand(a0, Deoptimizer::input_offset()));
754 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) {
755 const FPURegister fpu_reg = FPURegister::FromAllocationIndex(i);
756 int src_offset = i * kDoubleSize + double_regs_offset;
757 __ ldc1(fpu_reg, MemOperand(a1, src_offset));
758 }
759 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000760
761 // Push state, pc, and continuation from the last output frame.
762 if (type() != OSR) {
763 __ lw(t2, MemOperand(a2, FrameDescription::state_offset()));
764 __ push(t2);
765 }
766
767 __ lw(t2, MemOperand(a2, FrameDescription::pc_offset()));
768 __ push(t2);
769 __ lw(t2, MemOperand(a2, FrameDescription::continuation_offset()));
770 __ push(t2);
771
772
773 // Technically restoring 'at' should work unless zero_reg is also restored
774 // but it's safer to check for this.
775 ASSERT(!(at.bit() & restored_regs));
776 // Restore the registers from the last output frame.
777 __ mov(at, a2);
778 for (int i = kNumberOfRegisters - 1; i >= 0; i--) {
779 int offset = (i * kPointerSize) + FrameDescription::registers_offset();
780 if ((restored_regs & (1 << i)) != 0) {
781 __ lw(ToRegister(i), MemOperand(at, offset));
782 }
783 }
784
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000785 __ InitializeRootRegister();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000786
787 __ pop(at); // Get continuation, leave pc on stack.
788 __ pop(ra);
789 __ Jump(at);
790 __ stop("Unreachable.");
lrn@chromium.org7516f052011-03-30 08:52:27 +0000791}
792
793
yangguo@chromium.org56454712012-02-16 15:33:53 +0000794// Maximum size of a table entry generated below.
erik.corry@gmail.combbceb572012-03-09 10:52:05 +0000795const int Deoptimizer::table_entry_size_ = 9 * Assembler::kInstrSize;
yangguo@chromium.org56454712012-02-16 15:33:53 +0000796
lrn@chromium.org7516f052011-03-30 08:52:27 +0000797void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000798 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm());
799
800 // Create a sequence of deoptimization entries. Note that any
801 // registers may be still live.
yangguo@chromium.org56454712012-02-16 15:33:53 +0000802 Label table_start;
803 __ bind(&table_start);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000804 for (int i = 0; i < count(); i++) {
yangguo@chromium.org56454712012-02-16 15:33:53 +0000805 Label start;
806 __ bind(&start);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000807 if (type() != EAGER) {
808 // Emulate ia32 like call by pushing return address to stack.
yangguo@chromium.org56454712012-02-16 15:33:53 +0000809 __ addiu(sp, sp, -2 * kPointerSize);
erik.corry@gmail.combbceb572012-03-09 10:52:05 +0000810 __ sw(ra, MemOperand(sp, 1 * kPointerSize));
811 } else {
812 __ addiu(sp, sp, -1 * kPointerSize);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000813 }
yangguo@chromium.org56454712012-02-16 15:33:53 +0000814 // Jump over the remaining deopt entries (including this one).
erik.corry@gmail.combbceb572012-03-09 10:52:05 +0000815 // This code is always reached by calling Jump, which puts the target (label
816 // start) into t9.
yangguo@chromium.org56454712012-02-16 15:33:53 +0000817 const int remaining_entries = (count() - i) * table_entry_size_;
erik.corry@gmail.combbceb572012-03-09 10:52:05 +0000818 __ Addu(t9, t9, remaining_entries);
819 // 'at' was clobbered so we can only load the current entry value here.
820 __ li(at, i);
821 __ jr(t9); // Expose delay slot.
822 __ sw(at, MemOperand(sp, 0 * kPointerSize)); // In the delay slot.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000823
824 // Pad the rest of the code.
yangguo@chromium.org56454712012-02-16 15:33:53 +0000825 while (table_entry_size_ > (masm()->SizeOfCodeGeneratedSince(&start))) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000826 __ nop();
827 }
828
yangguo@chromium.org56454712012-02-16 15:33:53 +0000829 ASSERT_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000830 }
yangguo@chromium.org56454712012-02-16 15:33:53 +0000831
832 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
833 count() * table_entry_size_);
lrn@chromium.org7516f052011-03-30 08:52:27 +0000834}
835
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000836#undef __
837
lrn@chromium.org7516f052011-03-30 08:52:27 +0000838
839} } // namespace v8::internal