OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 Address entry = table_entry->address; | 330 Address entry = table_entry->address; |
331 DeoptComment(table_entry->deopt_info); | 331 DeoptComment(table_entry->deopt_info); |
332 | 332 |
333 // Second-level deopt table entries are contiguous and small, so instead | 333 // Second-level deopt table entries are contiguous and small, so instead |
334 // of loading the full, absolute address of each one, load an immediate | 334 // of loading the full, absolute address of each one, load an immediate |
335 // offset which will be added to the base address later. | 335 // offset which will be added to the base address later. |
336 __ mov(entry_offset, Operand(entry - base)); | 336 __ mov(entry_offset, Operand(entry - base)); |
337 | 337 |
338 if (table_entry->needs_frame) { | 338 if (table_entry->needs_frame) { |
339 DCHECK(!info()->saves_caller_doubles()); | 339 DCHECK(!info()->saves_caller_doubles()); |
340 if (needs_frame.is_bound()) { | 340 Comment(";;; call deopt with frame"); |
341 __ b(&needs_frame); | 341 __ PushFixedFrame(); |
342 } else { | 342 __ b(&needs_frame, SetLK); |
343 __ bind(&needs_frame); | |
344 Comment(";;; call deopt with frame"); | |
345 // This variant of deopt can only be used with stubs. Since we don't | |
346 // have a function pointer to install in the stack frame that we're | |
347 // building, install a special marker there instead. | |
348 DCHECK(info()->IsStub()); | |
349 __ LoadSmiLiteral(ip, Smi::FromInt(StackFrame::STUB)); | |
350 __ PushFixedFrame(ip); | |
351 __ addi(fp, sp, | |
352 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | |
353 __ bind(&call_deopt_entry); | |
354 // Add the base address to the offset previously loaded in | |
355 // entry_offset. | |
356 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(base))); | |
357 __ add(ip, entry_offset, ip); | |
358 __ Call(ip); | |
359 } | |
360 } else { | 343 } else { |
361 // The last entry can fall through into `call_deopt_entry`, avoiding a | 344 __ b(&call_deopt_entry, SetLK); |
362 // branch. | |
363 bool need_branch = ((i + 1) != length) || call_deopt_entry.is_bound(); | |
364 | |
365 if (need_branch) __ b(&call_deopt_entry); | |
366 } | 345 } |
367 } | 346 } |
368 | 347 |
369 if (!call_deopt_entry.is_bound()) { | 348 if (needs_frame.is_linked()) { |
370 Comment(";;; call deopt"); | 349 __ bind(&needs_frame); |
371 __ bind(&call_deopt_entry); | 350 // This variant of deopt can only be used with stubs. Since we don't |
| 351 // have a function pointer to install in the stack frame that we're |
| 352 // building, install a special marker there instead. |
| 353 DCHECK(info()->IsStub()); |
| 354 __ LoadSmiLiteral(ip, Smi::FromInt(StackFrame::STUB)); |
| 355 __ push(ip); |
| 356 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 357 } |
372 | 358 |
373 if (info()->saves_caller_doubles()) { | 359 Comment(";;; call deopt"); |
374 DCHECK(info()->IsStub()); | 360 __ bind(&call_deopt_entry); |
375 RestoreCallerDoubles(); | |
376 } | |
377 | 361 |
378 // Add the base address to the offset previously loaded in entry_offset. | 362 if (info()->saves_caller_doubles()) { |
379 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(base))); | 363 DCHECK(info()->IsStub()); |
380 __ add(ip, entry_offset, ip); | 364 RestoreCallerDoubles(); |
381 __ Call(ip); | |
382 } | 365 } |
| 366 |
| 367 // Add the base address to the offset previously loaded in entry_offset. |
| 368 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(base))); |
| 369 __ add(ip, entry_offset, ip); |
| 370 __ Jump(ip); |
383 } | 371 } |
384 | 372 |
385 // The deoptimization jump table is the last part of the instruction | 373 // The deoptimization jump table is the last part of the instruction |
386 // sequence. Mark the generated code as done unless we bailed out. | 374 // sequence. Mark the generated code as done unless we bailed out. |
387 if (!is_aborted()) status_ = DONE; | 375 if (!is_aborted()) status_ = DONE; |
388 return !is_aborted(); | 376 return !is_aborted(); |
389 } | 377 } |
390 | 378 |
391 | 379 |
392 bool LCodeGen::GenerateSafepointTable() { | 380 bool LCodeGen::GenerateSafepointTable() { |
(...skipping 5851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6244 __ Push(scope_info); | 6232 __ Push(scope_info); |
6245 __ push(ToRegister(instr->function())); | 6233 __ push(ToRegister(instr->function())); |
6246 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6234 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6247 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6235 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6248 } | 6236 } |
6249 | 6237 |
6250 | 6238 |
6251 #undef __ | 6239 #undef __ |
6252 } | 6240 } |
6253 } // namespace v8::internal | 6241 } // namespace v8::internal |
OLD | NEW |