| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 PrintF("[forced deoptimization: "); | 118 PrintF("[forced deoptimization: "); |
| 119 function->PrintName(); | 119 function->PrintName(); |
| 120 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); | 120 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 | 124 |
| 125 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, | 125 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, |
| 126 Code* check_code, | 126 Code* check_code, |
| 127 Code* replacement_code) { | 127 Code* replacement_code) { |
| 128 UNIMPLEMENTED(); | 128 const int kInstrSize = Assembler::kInstrSize; |
| 129 // The call of the stack guard check has the following form: |
| 130 // e1 5d 00 0c cmp sp, <limit> |
| 131 // 2a 00 00 01 bcs ok |
| 132 // e5 9f c? ?? ldr ip, [pc, <stack guard address>] |
| 133 // e1 2f ff 3c blx ip |
| 134 ASSERT(Memory::int32_at(pc_after - kInstrSize) == |
| 135 (al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code())); |
| 136 ASSERT(Assembler::IsLdrPcImmediateOffset( |
| 137 Assembler::instr_at(pc_after - 2 * kInstrSize))); |
| 138 |
| 139 // We patch the code to the following form: |
| 140 // e1 5d 00 0c cmp sp, <limit> |
| 141 // e1 a0 00 00 mov r0, r0 (NOP) |
| 142 // e5 9f c? ?? ldr ip, [pc, <on-stack replacement address>] |
| 143 // e1 2f ff 3c blx ip |
| 144 // and overwrite the constant containing the |
| 145 // address of the stack check stub. |
| 146 |
| 147 // Replace conditional jump with NOP. |
| 148 CodePatcher patcher(pc_after - 3 * kInstrSize, 1); |
| 149 patcher.masm()->nop(); |
| 150 |
| 151 // Replace the stack check address in the constant pool |
| 152 // with the entry address of the replacement code. |
| 153 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - |
| 154 2 * kInstrSize) & 0xfff; |
| 155 Address stack_check_address_pointer = pc_after + stack_check_address_offset; |
| 156 ASSERT(Memory::uint32_at(stack_check_address_pointer) == |
| 157 reinterpret_cast<uint32_t>(check_code->entry())); |
| 158 Memory::uint32_at(stack_check_address_pointer) = |
| 159 reinterpret_cast<uint32_t>(replacement_code->entry()); |
| 129 } | 160 } |
| 130 | 161 |
| 131 | 162 |
| 132 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, | 163 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, |
| 133 Code* check_code, | 164 Code* check_code, |
| 134 Code* replacement_code) { | 165 Code* replacement_code) { |
| 135 UNIMPLEMENTED(); | 166 const int kInstrSize = Assembler::kInstrSize; |
| 167 ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c); |
| 168 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5); |
| 169 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f); |
| 170 |
| 171 // Replace NOP with conditional jump. |
| 172 CodePatcher patcher(pc_after - 3 * kInstrSize, 1); |
| 173 patcher.masm()->b(+4, cs); |
| 174 |
| 175 // Replace the stack check address in the constant pool |
| 176 // with the entry address of the replacement code. |
| 177 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - |
| 178 2 * kInstrSize) & 0xfff; |
| 179 Address stack_check_address_pointer = pc_after + stack_check_address_offset; |
| 180 ASSERT(Memory::uint32_at(stack_check_address_pointer) == |
| 181 reinterpret_cast<uint32_t>(replacement_code->entry())); |
| 182 Memory::uint32_at(stack_check_address_pointer) = |
| 183 reinterpret_cast<uint32_t>(check_code->entry()); |
| 184 } |
| 185 |
| 186 |
| 187 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { |
| 188 ByteArray* translations = data->TranslationByteArray(); |
| 189 int length = data->DeoptCount(); |
| 190 for (int i = 0; i < length; i++) { |
| 191 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { |
| 192 TranslationIterator it(translations, data->TranslationIndex(i)->value()); |
| 193 int value = it.Next(); |
| 194 ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value)); |
| 195 // Read the number of frames. |
| 196 value = it.Next(); |
| 197 if (value == 1) return i; |
| 198 } |
| 199 } |
| 200 UNREACHABLE(); |
| 201 return -1; |
| 136 } | 202 } |
| 137 | 203 |
| 138 | 204 |
| 139 void Deoptimizer::DoComputeOsrOutputFrame() { | 205 void Deoptimizer::DoComputeOsrOutputFrame() { |
| 140 UNIMPLEMENTED(); | 206 DeoptimizationInputData* data = DeoptimizationInputData::cast( |
| 141 } | 207 optimized_code_->deoptimization_data()); |
| 142 | 208 unsigned ast_id = data->OsrAstId()->value(); |
| 143 | 209 |
| 210 int bailout_id = LookupBailoutId(data, ast_id); |
| 211 unsigned translation_index = data->TranslationIndex(bailout_id)->value(); |
| 212 ByteArray* translations = data->TranslationByteArray(); |
| 213 |
| 214 TranslationIterator iterator(translations, translation_index); |
| 215 Translation::Opcode opcode = |
| 216 static_cast<Translation::Opcode>(iterator.Next()); |
| 217 ASSERT(Translation::BEGIN == opcode); |
| 218 USE(opcode); |
| 219 int count = iterator.Next(); |
| 220 ASSERT(count == 1); |
| 221 USE(count); |
| 222 |
| 223 opcode = static_cast<Translation::Opcode>(iterator.Next()); |
| 224 USE(opcode); |
| 225 ASSERT(Translation::FRAME == opcode); |
| 226 unsigned node_id = iterator.Next(); |
| 227 USE(node_id); |
| 228 ASSERT(node_id == ast_id); |
| 229 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator.Next())); |
| 230 USE(function); |
| 231 ASSERT(function == function_); |
| 232 unsigned height = iterator.Next(); |
| 233 unsigned height_in_bytes = height * kPointerSize; |
| 234 USE(height_in_bytes); |
| 235 |
| 236 unsigned fixed_size = ComputeFixedSize(function_); |
| 237 unsigned input_frame_size = input_->GetFrameSize(); |
| 238 ASSERT(fixed_size + height_in_bytes == input_frame_size); |
| 239 |
| 240 unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize; |
| 241 unsigned outgoing_height = data->ArgumentsStackHeight(bailout_id)->value(); |
| 242 unsigned outgoing_size = outgoing_height * kPointerSize; |
| 243 unsigned output_frame_size = fixed_size + stack_slot_size + outgoing_size; |
| 244 ASSERT(outgoing_size == 0); // OSR does not happen in the middle of a call. |
| 245 |
| 246 if (FLAG_trace_osr) { |
| 247 PrintF("[on-stack replacement: begin 0x%08" V8PRIxPTR " ", |
| 248 reinterpret_cast<intptr_t>(function_)); |
| 249 function_->PrintName(); |
| 250 PrintF(" => node=%u, frame=%d->%d]\n", |
| 251 ast_id, |
| 252 input_frame_size, |
| 253 output_frame_size); |
| 254 } |
| 255 |
| 256 // There's only one output frame in the OSR case. |
| 257 output_count_ = 1; |
| 258 output_ = new FrameDescription*[1]; |
| 259 output_[0] = new(output_frame_size) FrameDescription( |
| 260 output_frame_size, function_); |
| 261 |
| 262 // Clear the incoming parameters in the optimized frame to avoid |
| 263 // confusing the garbage collector. |
| 264 unsigned output_offset = output_frame_size - kPointerSize; |
| 265 int parameter_count = function_->shared()->formal_parameter_count() + 1; |
| 266 for (int i = 0; i < parameter_count; ++i) { |
| 267 output_[0]->SetFrameSlot(output_offset, 0); |
| 268 output_offset -= kPointerSize; |
| 269 } |
| 270 |
| 271 // Translate the incoming parameters. This may overwrite some of the |
| 272 // incoming argument slots we've just cleared. |
| 273 int input_offset = input_frame_size - kPointerSize; |
| 274 bool ok = true; |
| 275 int limit = input_offset - (parameter_count * kPointerSize); |
| 276 while (ok && input_offset > limit) { |
| 277 ok = DoOsrTranslateCommand(&iterator, &input_offset); |
| 278 } |
| 279 |
| 280 // There are no translation commands for the caller's pc and fp, the |
| 281 // context, and the function. Set them up explicitly. |
| 282 for (int i = 0; ok && i < 4; i++) { |
| 283 uint32_t input_value = input_->GetFrameSlot(input_offset); |
| 284 if (FLAG_trace_osr) { |
| 285 PrintF(" [sp + %d] <- 0x%08x ; [sp + %d] (fixed part)\n", |
| 286 output_offset, |
| 287 input_value, |
| 288 input_offset); |
| 289 } |
| 290 output_[0]->SetFrameSlot(output_offset, input_->GetFrameSlot(input_offset)); |
| 291 input_offset -= kPointerSize; |
| 292 output_offset -= kPointerSize; |
| 293 } |
| 294 |
| 295 // Translate the rest of the frame. |
| 296 while (ok && input_offset >= 0) { |
| 297 ok = DoOsrTranslateCommand(&iterator, &input_offset); |
| 298 } |
| 299 |
| 300 // If translation of any command failed, continue using the input frame. |
| 301 if (!ok) { |
| 302 delete output_[0]; |
| 303 output_[0] = input_; |
| 304 output_[0]->SetPc(reinterpret_cast<uint32_t>(from_)); |
| 305 } else { |
| 306 // Setup the frame pointer and the context pointer. |
| 307 output_[0]->SetRegister(fp.code(), input_->GetRegister(fp.code())); |
| 308 output_[0]->SetRegister(cp.code(), input_->GetRegister(cp.code())); |
| 309 |
| 310 unsigned pc_offset = data->OsrPcOffset()->value(); |
| 311 uint32_t pc = reinterpret_cast<uint32_t>( |
| 312 optimized_code_->entry() + pc_offset); |
| 313 output_[0]->SetPc(pc); |
| 314 } |
| 315 Code* continuation = Isolate::Current()->builtins()->builtin( |
| 316 Builtins::NotifyOSR); |
| 317 output_[0]->SetContinuation( |
| 318 reinterpret_cast<uint32_t>(continuation->entry())); |
| 319 |
| 320 if (FLAG_trace_osr) { |
| 321 PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ", |
| 322 ok ? "finished" : "aborted", |
| 323 reinterpret_cast<intptr_t>(function)); |
| 324 function->PrintName(); |
| 325 PrintF(" => pc=0x%0x]\n", output_[0]->GetPc()); |
| 326 } |
| 327 } |
| 328 |
| 329 |
| 144 // This code is very similar to ia32 code, but relies on register names (fp, sp) | 330 // This code is very similar to ia32 code, but relies on register names (fp, sp) |
| 145 // and how the frame is laid out. | 331 // and how the frame is laid out. |
| 146 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, | 332 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, |
| 147 int frame_index) { | 333 int frame_index) { |
| 148 // Read the ast node id, function, and frame height for this output frame. | 334 // Read the ast node id, function, and frame height for this output frame. |
| 149 Translation::Opcode opcode = | 335 Translation::Opcode opcode = |
| 150 static_cast<Translation::Opcode>(iterator->Next()); | 336 static_cast<Translation::Opcode>(iterator->Next()); |
| 151 USE(opcode); | 337 USE(opcode); |
| 152 ASSERT(Translation::FRAME == opcode); | 338 ASSERT(Translation::FRAME == opcode); |
| 153 int node_id = iterator->Next(); | 339 int node_id = iterator->Next(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 ASSERT(!is_bottommost || input_->GetRegister(fp.code()) == fp_value); | 424 ASSERT(!is_bottommost || input_->GetRegister(fp.code()) == fp_value); |
| 239 output_frame->SetFp(fp_value); | 425 output_frame->SetFp(fp_value); |
| 240 if (is_topmost) { | 426 if (is_topmost) { |
| 241 output_frame->SetRegister(fp.code(), fp_value); | 427 output_frame->SetRegister(fp.code(), fp_value); |
| 242 } | 428 } |
| 243 if (FLAG_trace_deopt) { | 429 if (FLAG_trace_deopt) { |
| 244 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n", | 430 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n", |
| 245 fp_value, output_offset, value); | 431 fp_value, output_offset, value); |
| 246 } | 432 } |
| 247 | 433 |
| 248 // The context can be gotten from the function so long as we don't | 434 // For the bottommost output frame the context can be gotten from the input |
| 249 // optimize functions that need local contexts. | 435 // frame. For all subsequent output frames it can be gotten from the function |
| 436 // so long as we don't inline functions that need local contexts. |
| 250 output_offset -= kPointerSize; | 437 output_offset -= kPointerSize; |
| 251 input_offset -= kPointerSize; | 438 input_offset -= kPointerSize; |
| 252 value = reinterpret_cast<intptr_t>(function->context()); | 439 if (is_bottommost) { |
| 253 // The context for the bottommost output frame should also agree with the | 440 value = input_->GetFrameSlot(input_offset); |
| 254 // input frame. | 441 } else { |
| 255 ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value); | 442 value = reinterpret_cast<intptr_t>(function->context()); |
| 443 } |
| 256 output_frame->SetFrameSlot(output_offset, value); | 444 output_frame->SetFrameSlot(output_offset, value); |
| 257 if (is_topmost) { | 445 if (is_topmost) { |
| 258 output_frame->SetRegister(cp.code(), value); | 446 output_frame->SetRegister(cp.code(), value); |
| 259 } | 447 } |
| 260 if (FLAG_trace_deopt) { | 448 if (FLAG_trace_deopt) { |
| 261 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n", | 449 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n", |
| 262 top_address + output_offset, output_offset, value); | 450 top_address + output_offset, output_offset, value); |
| 263 } | 451 } |
| 264 | 452 |
| 265 // The function was mentioned explicitly in the BEGIN_FRAME. | 453 // The function was mentioned explicitly in the BEGIN_FRAME. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 502 } |
| 315 | 503 |
| 316 | 504 |
| 317 #define __ masm()-> | 505 #define __ masm()-> |
| 318 | 506 |
| 319 | 507 |
| 320 // This code tries to be close to ia32 code so that any changes can be | 508 // This code tries to be close to ia32 code so that any changes can be |
| 321 // easily ported. | 509 // easily ported. |
| 322 void Deoptimizer::EntryGenerator::Generate() { | 510 void Deoptimizer::EntryGenerator::Generate() { |
| 323 GeneratePrologue(); | 511 GeneratePrologue(); |
| 324 // TOS: bailout-id; TOS+1: return address if not EAGER. | |
| 325 CpuFeatures::Scope scope(VFP3); | 512 CpuFeatures::Scope scope(VFP3); |
| 326 // Save all general purpose registers before messing with them. | 513 // Save all general purpose registers before messing with them. |
| 327 const int kNumberOfRegisters = Register::kNumRegisters; | 514 const int kNumberOfRegisters = Register::kNumRegisters; |
| 328 | 515 |
| 329 // Everything but pc, lr and ip which will be saved but not restored. | 516 // Everything but pc, lr and ip which will be saved but not restored. |
| 330 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); | 517 RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip.bit(); |
| 331 | 518 |
| 332 const int kDoubleRegsSize = | 519 const int kDoubleRegsSize = |
| 333 kDoubleSize * DwVfpRegister::kNumAllocatableRegisters; | 520 kDoubleSize * DwVfpRegister::kNumAllocatableRegisters; |
| 334 | 521 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 349 // Get the bailout id from the stack. | 536 // Get the bailout id from the stack. |
| 350 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); | 537 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); |
| 351 | 538 |
| 352 // Get the address of the location in the code object if possible (r3) (return | 539 // Get the address of the location in the code object if possible (r3) (return |
| 353 // address for lazy deoptimization) and compute the fp-to-sp delta in | 540 // address for lazy deoptimization) and compute the fp-to-sp delta in |
| 354 // register r4. | 541 // register r4. |
| 355 if (type() == EAGER) { | 542 if (type() == EAGER) { |
| 356 __ mov(r3, Operand(0)); | 543 __ mov(r3, Operand(0)); |
| 357 // Correct one word for bailout id. | 544 // Correct one word for bailout id. |
| 358 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 545 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 546 } else if (type() == OSR) { |
| 547 __ mov(r3, lr); |
| 548 // Correct one word for bailout id. |
| 549 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 359 } else { | 550 } else { |
| 360 __ mov(r3, lr); | 551 __ mov(r3, lr); |
| 361 // Correct two words for bailout id and return address. | 552 // Correct two words for bailout id and return address. |
| 362 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); | 553 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); |
| 363 } | 554 } |
| 364 __ sub(r4, fp, r4); | 555 __ sub(r4, fp, r4); |
| 365 | 556 |
| 366 // Allocate a new deoptimizer object. | 557 // Allocate a new deoptimizer object. |
| 367 // Pass four arguments in r0 to r3 and fifth argument on stack. | 558 // Pass four arguments in r0 to r3 and fifth argument on stack. |
| 368 __ PrepareCallCFunction(5, r5); | 559 __ PrepareCallCFunction(5, r5); |
| 369 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 560 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 370 __ mov(r1, Operand(type())); // bailout type, | 561 __ mov(r1, Operand(type())); // bailout type, |
| 371 // r2: bailout id already loaded. | 562 // r2: bailout id already loaded. |
| 372 // r3: code address or 0 already loaded. | 563 // r3: code address or 0 already loaded. |
| 373 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. | 564 __ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta. |
| 374 // Call Deoptimizer::New(). | 565 // Call Deoptimizer::New(). |
| 375 __ CallCFunction(ExternalReference::new_deoptimizer_function(), 5); | 566 __ CallCFunction(ExternalReference::new_deoptimizer_function(), 5); |
| 376 | 567 |
| 377 // Preserve "deoptimizer" object in register r0 and get the input | 568 // Preserve "deoptimizer" object in register r0 and get the input |
| 378 // frame descriptor pointer to r1 (deoptimizer->input_); | 569 // frame descriptor pointer to r1 (deoptimizer->input_); |
| 379 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); | 570 __ ldr(r1, MemOperand(r0, Deoptimizer::input_offset())); |
| 380 | 571 |
| 381 | |
| 382 // Copy core registers into FrameDescription::registers_[kNumRegisters]. | 572 // Copy core registers into FrameDescription::registers_[kNumRegisters]. |
| 383 ASSERT(Register::kNumRegisters == kNumberOfRegisters); | 573 ASSERT(Register::kNumRegisters == kNumberOfRegisters); |
| 384 for (int i = 0; i < kNumberOfRegisters; i++) { | 574 for (int i = 0; i < kNumberOfRegisters; i++) { |
| 385 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); | 575 int offset = (i * kPointerSize) + FrameDescription::registers_offset(); |
| 386 __ ldr(r2, MemOperand(sp, i * kPointerSize)); | 576 __ ldr(r2, MemOperand(sp, i * kPointerSize)); |
| 387 __ str(r2, MemOperand(r1, offset)); | 577 __ str(r2, MemOperand(r1, offset)); |
| 388 } | 578 } |
| 389 | 579 |
| 390 // Copy VFP registers to | 580 // Copy VFP registers to |
| 391 // double_registers_[DoubleRegister::kNumAllocatableRegisters] | 581 // double_registers_[DoubleRegister::kNumAllocatableRegisters] |
| 392 int double_regs_offset = FrameDescription::double_registers_offset(); | 582 int double_regs_offset = FrameDescription::double_registers_offset(); |
| 393 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; ++i) { | 583 for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; ++i) { |
| 394 int dst_offset = i * kDoubleSize + double_regs_offset; | 584 int dst_offset = i * kDoubleSize + double_regs_offset; |
| 395 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; | 585 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; |
| 396 __ vldr(d0, sp, src_offset); | 586 __ vldr(d0, sp, src_offset); |
| 397 __ vstr(d0, r1, dst_offset); | 587 __ vstr(d0, r1, dst_offset); |
| 398 } | 588 } |
| 399 | 589 |
| 400 // Remove the bailout id, eventually return address, and the saved registers | 590 // Remove the bailout id, eventually return address, and the saved registers |
| 401 // from the stack. | 591 // from the stack. |
| 402 if (type() == EAGER) { | 592 if (type() == EAGER || type() == OSR) { |
| 403 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 593 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 404 } else { | 594 } else { |
| 405 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); | 595 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); |
| 406 } | 596 } |
| 407 | 597 |
| 408 // Compute a pointer to the unwinding limit in register r2; that is | 598 // Compute a pointer to the unwinding limit in register r2; that is |
| 409 // the first stack slot not part of the input frame. | 599 // the first stack slot not part of the input frame. |
| 410 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); | 600 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); |
| 411 __ add(r2, r2, sp); | 601 __ add(r2, r2, sp); |
| 412 | 602 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // __ add(r6, r2, Operand(r3, LSL, 1)); | 636 // __ add(r6, r2, Operand(r3, LSL, 1)); |
| 447 __ add(r6, r2, Operand(r3)); | 637 __ add(r6, r2, Operand(r3)); |
| 448 __ ldr(r7, MemOperand(r6, FrameDescription::frame_content_offset())); | 638 __ ldr(r7, MemOperand(r6, FrameDescription::frame_content_offset())); |
| 449 __ push(r7); | 639 __ push(r7); |
| 450 __ cmp(r3, Operand(0)); | 640 __ cmp(r3, Operand(0)); |
| 451 __ b(ne, &inner_push_loop); // test for gt? | 641 __ b(ne, &inner_push_loop); // test for gt? |
| 452 __ add(r0, r0, Operand(kPointerSize)); | 642 __ add(r0, r0, Operand(kPointerSize)); |
| 453 __ cmp(r0, r1); | 643 __ cmp(r0, r1); |
| 454 __ b(lt, &outer_push_loop); | 644 __ b(lt, &outer_push_loop); |
| 455 | 645 |
| 456 // In case of OSR, we have to restore the XMM registers. | |
| 457 if (type() == OSR) { | |
| 458 UNIMPLEMENTED(); | |
| 459 } | |
| 460 | |
| 461 // Push state, pc, and continuation from the last output frame. | 646 // Push state, pc, and continuation from the last output frame. |
| 462 if (type() != OSR) { | 647 if (type() != OSR) { |
| 463 __ ldr(r6, MemOperand(r2, FrameDescription::state_offset())); | 648 __ ldr(r6, MemOperand(r2, FrameDescription::state_offset())); |
| 464 __ push(r6); | 649 __ push(r6); |
| 465 } | 650 } |
| 466 | 651 |
| 467 __ ldr(r6, MemOperand(r2, FrameDescription::pc_offset())); | 652 __ ldr(r6, MemOperand(r2, FrameDescription::pc_offset())); |
| 468 __ push(r6); | 653 __ push(r6); |
| 469 __ ldr(r6, MemOperand(r2, FrameDescription::continuation_offset())); | 654 __ ldr(r6, MemOperand(r2, FrameDescription::continuation_offset())); |
| 470 __ push(r6); | 655 __ push(r6); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 __ push(ip); | 695 __ push(ip); |
| 511 __ b(&done); | 696 __ b(&done); |
| 512 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 697 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
| 513 } | 698 } |
| 514 __ bind(&done); | 699 __ bind(&done); |
| 515 } | 700 } |
| 516 | 701 |
| 517 #undef __ | 702 #undef __ |
| 518 | 703 |
| 519 } } // namespace v8::internal | 704 } } // namespace v8::internal |
| OLD | NEW |