Revert "[deoptimizer] Refactor GenerateDeoptimizationEntries"

This reverts commit f63a657ed9.

Reason for revert: breaks compile on lite mode:

https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket.appspot.com/8926535782549686576/+/steps/build/0/steps/compile/0/stdout


Original change's description:
> [deoptimizer] Refactor GenerateDeoptimizationEntries
> 
> This reduces preprocessor-expanded source size by 64,359 from
> 
> gen         (   21 files):    71,570 to    1,613,100 (   23x)
> src         (  624 files):   367,830 to   52,964,659 (  144x)
> test        (  392 files):   490,924 to   37,360,916 (   76x)
> third_party (  432 files):   239,085 to    9,547,902 (   40x)
> total       ( 1521 files): 1,184,093 to  102,461,098 (   87x)
> 
> to
> 
> gen         (   21 files):    71,570 to    1,613,100 (   23x)
> src         (  624 files):   367,837 to   52,919,005 (  144x)
> test        (  392 files):   490,924 to   37,342,211 (   76x)
> third_party (  432 files):   239,085 to    9,547,902 (   40x)
> total       ( 1521 files): 1,184,100 to  102,396,739 (   86x)
> 
> Bug: v8:8562
> Change-Id: Iee474e22ababa1e080b8d6359af4d0076903e59a
> Reviewed-on: https://chromium-review.googlesource.com/c/1384091
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58424}

TBR=ulan@chromium.org,jarin@chromium.org,sigurds@chromium.org

Change-Id: I06e6f95255a3cea6a428713e9e841781425dffe8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8562
Reviewed-on: https://chromium-review.googlesource.com/c/1387494
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58425}
This commit is contained in:
Sigurd Schneider 2018-12-21 10:56:46 +00:00 committed by Commit Bot
parent f63a657ed9
commit 4b4175d7ff
35 changed files with 190 additions and 209 deletions

View File

@ -31,7 +31,6 @@
#include "src/contexts.h"
#include "src/conversions-inl.h"
#include "src/counters.h"
#include "src/cpu-features.h"
#include "src/date.h"
#include "src/debug/debug-coverage.h"
#include "src/debug/debug-evaluate.h"

View File

@ -4,7 +4,6 @@
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
@ -14,15 +13,12 @@ namespace internal {
const int Deoptimizer::table_entry_size_ = 8;
#define __ masm->
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
// easily ported.
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Save all general purpose registers before messing with them.
const int kNumberOfRegisters = Register::kNumRegisters;
@ -36,9 +32,9 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// Save all allocatable VFP registers before messing with them.
{
// We use a run-time check for VFP32DREGS.
CpuFeatureScope scope(masm, VFP32DREGS,
CpuFeatureScope scope(masm(), VFP32DREGS,
CpuFeatureScope::kDontCheckSupported);
UseScratchRegisterScope temps(masm);
UseScratchRegisterScope temps(masm());
Register scratch = temps.Acquire();
// Check CPU flags for number of registers, setting the Z condition flag.
@ -60,10 +56,10 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stm(db_w, sp, restored_regs | sp.bit() | lr.bit() | pc.bit());
{
UseScratchRegisterScope temps(masm);
UseScratchRegisterScope temps(masm());
Register scratch = temps.Acquire();
__ mov(scratch, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ str(fp, MemOperand(scratch));
}
@ -90,15 +86,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(r1, &context_check);
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ mov(r1, Operand(static_cast<int>(deopt_kind)));
__ mov(r1, Operand(static_cast<int>(deopt_kind())));
// r2: bailout id already loaded.
// r3: code address or 0 already loaded.
__ str(r4, MemOperand(sp, 0 * kPointerSize)); // Fp-to-sp delta.
__ mov(r5, Operand(ExternalReference::isolate_address(isolate)));
__ mov(r5, Operand(ExternalReference::isolate_address(isolate())));
__ str(r5, MemOperand(sp, 1 * kPointerSize)); // Isolate.
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -167,7 +163,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1);
// Call Deoptimizer::ComputeOutputFrames().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(r0); // Restore deoptimizer object (class Deoptimizer).
@ -228,7 +224,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// Remove sp, lr and pc.
__ Drop(3);
{
UseScratchRegisterScope temps(masm);
UseScratchRegisterScope temps(masm());
Register scratch = temps.Acquire();
__ pop(scratch); // get continuation, leave pc on stack
__ pop(lr);
@ -237,8 +233,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop("Unreachable.");
}
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
// Create a sequence of deoptimization entries.
// Note that registers are still live when jumping to an entry.
@ -246,17 +242,17 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
// ARMv7, we can use movw (with a maximum immediate of 0xFFFF). On ARMv6, we
// need two instructions.
STATIC_ASSERT((kMaxNumberOfEntries - 1) <= 0xFFFF);
UseScratchRegisterScope temps(masm);
UseScratchRegisterScope temps(masm());
Register scratch = temps.Acquire();
if (CpuFeatures::IsSupported(ARMv7)) {
CpuFeatureScope scope(masm, ARMv7);
CpuFeatureScope scope(masm(), ARMv7);
Label done;
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ movw(scratch, i);
__ b(&done);
DCHECK_EQ(table_entry_size_, masm->pc_offset() - start);
DCHECK_EQ(table_entry_size_, masm()->pc_offset() - start);
}
__ bind(&done);
} else {
@ -265,14 +261,14 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
// this, we set the low byte in the main table, and then set the high byte
// in a separate table if necessary.
Label high_fixes[256];
int high_fix_max = (count - 1) >> 8;
int high_fix_max = (count() - 1) >> 8;
DCHECK_GT(arraysize(high_fixes), static_cast<size_t>(high_fix_max));
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ mov(scratch, Operand(i & 0xFF)); // Set the low byte.
__ b(&high_fixes[i >> 8]); // Jump to the secondary table.
DCHECK_EQ(table_entry_size_, masm->pc_offset() - start);
DCHECK_EQ(table_entry_size_, masm()->pc_offset() - start);
}
// Generate the secondary table, to set the high byte.
for (int high = 1; high <= high_fix_max; high++) {

View File

@ -10,10 +10,11 @@
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
namespace v8 {
namespace internal {
#define __ masm->
#define __ masm()->
namespace {
@ -99,11 +100,8 @@ void RestoreRegList(MacroAssembler* masm, const CPURegList& reg_list,
}
} // namespace
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// TODO(all): This code needs to be revisited. We probably only need to save
// caller-saved registers here. Callee-saved registers can be stored directly
@ -131,7 +129,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PushCPURegList(saved_registers);
__ Mov(x3, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ Str(fp, MemOperand(x3));
const int kSavedRegistersAreaSize =
@ -170,16 +168,16 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ Tst(x1, kSmiTagMask);
__ CzeroX(x0, eq);
__ Mov(x1, static_cast<int>(deopt_kind));
__ Mov(x1, static_cast<int>(deopt_kind()));
// Following arguments are already loaded:
// - x2: bailout id
// - x3: code object address
// - x4: fp-to-sp delta
__ Mov(x5, ExternalReference::isolate_address(isolate));
__ Mov(x5, ExternalReference::isolate_address(isolate()));
{
// Call Deoptimizer::New().
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -190,17 +188,17 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ Ldr(x1, MemOperand(deoptimizer, Deoptimizer::input_offset()));
// Copy core registers into the input frame.
CopyRegListToFrame(masm, x1, FrameDescription::registers_offset(),
CopyRegListToFrame(masm(), x1, FrameDescription::registers_offset(),
saved_registers, x2, x3);
// Copy double registers to the input frame.
CopyRegListToFrame(masm, x1, FrameDescription::double_registers_offset(),
CopyRegListToFrame(masm(), x1, FrameDescription::double_registers_offset(),
saved_double_registers, x2, x3, kDoubleRegistersOffset);
// Copy float registers to the input frame.
// TODO(arm): these are the lower 32-bits of the double registers stored
// above, so we shouldn't need to store them again.
CopyRegListToFrame(masm, x1, FrameDescription::float_registers_offset(),
CopyRegListToFrame(masm(), x1, FrameDescription::float_registers_offset(),
saved_float_registers, w2, w3, kFloatRegistersOffset);
// Remove the padding, bailout id and the saved registers from the stack.
@ -226,13 +224,13 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ Push(padreg, x0); // Preserve deoptimizer object across call.
{
// Call Deoptimizer::ComputeOutputFrames().
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ Pop(x4, padreg); // Restore deoptimizer object (class Deoptimizer).
{
UseScratchRegisterScope temps(masm);
UseScratchRegisterScope temps(masm());
Register scratch = temps.AcquireX();
__ Ldr(scratch, MemOperand(x4, Deoptimizer::caller_frame_top_offset()));
__ Mov(sp, scratch);
@ -263,7 +261,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ B(lt, &outer_push_loop);
__ Ldr(x1, MemOperand(x4, Deoptimizer::input_offset()));
RestoreRegList(masm, saved_double_registers, x1,
RestoreRegList(masm(), saved_double_registers, x1,
FrameDescription::double_registers_offset());
// TODO(all): ARM copies a lot (if not all) of the last output frame onto the
@ -279,7 +277,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Register last_output_frame = lr;
__ Mov(last_output_frame, current_frame);
RestoreRegList(masm, saved_registers, last_output_frame,
RestoreRegList(masm(), saved_registers, last_output_frame,
FrameDescription::registers_offset());
Register continuation = x7;
@ -293,9 +291,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// a table for ARM64, the size is zero.
const int Deoptimizer::table_entry_size_ = 0 * kInstrSize;
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
UseScratchRegisterScope temps(masm);
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
UseScratchRegisterScope temps(masm());
// The MacroAssembler will have put the deoptimization id in x16, the first
// temp register allocated. We can't assert that the id is in there, but we
// can check that x16 the first allocated temp and that the value it contains
@ -306,7 +303,7 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
if (__ emit_debug_code()) {
// Ensure the entry_id looks sensible, ie. 0 <= entry_id < count().
__ Cmp(entry_id, count);
__ Cmp(entry_id, count());
__ Check(lo, AbortReason::kOffsetOutOfRange);
}
}

View File

@ -5,13 +5,13 @@
#if V8_TARGET_ARCH_ARM
#include "src/api-arguments.h"
#include "src/assembler-inl.h"
#include "src/code-factory.h"
#include "src/counters.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"

View File

@ -5,13 +5,13 @@
#if V8_TARGET_ARCH_ARM64
#include "src/api-arguments.h"
#include "src/arm64/macro-assembler-arm64-inl.h"
#include "src/code-factory.h"
#include "src/counters.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"

View File

@ -12,7 +12,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"

View File

@ -11,7 +11,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/mips/constants-mips.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"

View File

@ -11,7 +11,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/mips64/constants-mips64.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"

View File

@ -5,6 +5,7 @@
#if V8_TARGET_ARCH_PPC
#include "src/api-arguments.h"
#include "src/assembler-inl.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/counters.h"
@ -12,7 +13,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"
#include "src/objects/heap-number.h"

View File

@ -5,6 +5,7 @@
#if V8_TARGET_ARCH_S390
#include "src/api-arguments.h"
#include "src/assembler-inl.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/counters.h"
@ -12,7 +13,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects/cell.h"
#include "src/objects/foreign.h"
#include "src/objects/heap-number.h"

View File

@ -11,7 +11,6 @@
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
#include "src/objects/cell.h"
#include "src/objects/debug-objects.h"

View File

@ -6,7 +6,6 @@
#define V8_COMPILER_BACKEND_ARM_UNWINDING_INFO_WRITER_ARM_H_
#include "src/eh-frame.h"
#include "src/flags.h"
namespace v8 {
namespace internal {

View File

@ -6,7 +6,6 @@
#define V8_COMPILER_BACKEND_ARM64_UNWINDING_INFO_WRITER_ARM64_H_
#include "src/eh-frame.h"
#include "src/flags.h"
namespace v8 {
namespace internal {

View File

@ -11,7 +11,6 @@
#include "src/compiler/backend/unwinding-info-writer.h"
#include "src/compiler/osr.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/safepoint-table.h"
#include "src/source-position-table.h"
#include "src/trap-handler/trap-handler.h"

View File

@ -5,8 +5,6 @@
#ifndef V8_COMPILER_BACKEND_UNWINDING_INFO_WRITER_H_
#define V8_COMPILER_BACKEND_UNWINDING_INFO_WRITER_H_
#include "src/flags.h"
#if V8_TARGET_ARCH_ARM
#include "src/compiler/backend/arm/unwinding-info-writer-arm.h"
#elif V8_TARGET_ARCH_ARM64

View File

@ -6,7 +6,6 @@
#define V8_COMPILER_BACKEND_X64_UNWINDING_INFO_WRITER_X64_H_
#include "src/eh-frame.h"
#include "src/flags.h"
namespace v8 {
namespace internal {

View File

@ -227,6 +227,13 @@ DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame(
return info;
}
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, int count,
DeoptimizeKind kind) {
NoRootArrayScope no_root_array(masm);
TableEntryGenerator generator(masm, kind, count);
generator.Generate();
}
namespace {
class ActivationsFinder : public ThreadVisitor {
public:
@ -1849,8 +1856,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
MacroAssembler masm(isolate, nullptr, 16 * KB, CodeObjectRequired::kYes);
masm.set_emit_debug_code(false);
GenerateDeoptimizationEntries(&masm, masm.isolate(), kMaxNumberOfEntries,
kind);
GenerateDeoptimizationEntries(&masm, kMaxNumberOfEntries, kind);
CodeDesc desc;
masm.GetCode(isolate, &desc);
DCHECK(!RelocInfo::RequiresRelocationAfterCodegen(desc));

View File

@ -15,12 +15,10 @@
#include "src/deoptimize-reason.h"
#include "src/feedback-vector.h"
#include "src/frame-constants.h"
#include "src/frames.h"
#include "src/globals.h"
#include "src/isolate.h"
#include "src/label.h"
#include "src/macro-assembler.h"
#include "src/objects/shared-function-info.h"
#include "src/register-arch.h"
#include "src/source-position.h"
#include "src/zone/zone-chunk-list.h"
@ -32,7 +30,6 @@ class TranslationIterator;
class DeoptimizedFrameInfo;
class TranslatedState;
class RegisterValues;
class MacroAssembler;
class TranslatedValue {
public:
@ -517,6 +514,29 @@ class Deoptimizer : public Malloced {
static const int kNotDeoptimizationEntry = -1;
// Generators for the deoptimization entry code.
class TableEntryGenerator {
public:
TableEntryGenerator(MacroAssembler* masm, DeoptimizeKind kind, int count)
: masm_(masm), deopt_kind_(kind), count_(count) {}
void Generate();
protected:
MacroAssembler* masm() const { return masm_; }
DeoptimizeKind deopt_kind() const { return deopt_kind_; }
Isolate* isolate() const { return masm_->isolate(); }
void GeneratePrologue();
private:
int count() const { return count_; }
MacroAssembler* masm_;
DeoptimizeKind deopt_kind_;
int count_;
};
static void EnsureCodeForDeoptimizationEntry(Isolate* isolate,
DeoptimizeKind kind);
static void EnsureCodeForMaxDeoptimizationEntries(Isolate* isolate);
@ -572,11 +592,8 @@ class Deoptimizer : public Malloced {
static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo shared);
static unsigned ComputeOutgoingArgumentSize(Code code, unsigned bailout_id);
static void GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
static void GenerateDeoptimizationEntries(MacroAssembler* masm, int count,
DeoptimizeKind kind);
static void GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count);
// Marks all the code in the given context for deoptimization.
static void MarkAllCodeForContext(Context native_context);

View File

@ -5,10 +5,9 @@
#ifndef V8_EH_FRAME_H_
#define V8_EH_FRAME_H_
#include "src/assembler-arch.h"
#include "src/base/compiler-specific.h"
#include "src/globals.h"
#include "src/register-arch.h"
#include "src/v8memory.h"
#include "src/zone/zone-containers.h"
namespace v8 {

View File

@ -11,7 +11,6 @@
#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/ic/ic-stats.h"
#include "src/macro-assembler.h"
#include "src/objects/code.h"
#include "src/objects/slots.h"
#include "src/objects/smi.h"

View File

@ -5,7 +5,6 @@
#ifndef V8_HEAP_MARK_COMPACT_INL_H_
#define V8_HEAP_MARK_COMPACT_INL_H_
#include "src/assembler-inl.h"
#include "src/base/bits.h"
#include "src/heap/mark-compact.h"
#include "src/heap/objects-visiting-inl.h"

View File

@ -4,9 +4,9 @@
#if V8_TARGET_ARCH_IA32
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/frame-constants.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
@ -15,13 +15,10 @@ namespace internal {
const int Deoptimizer::table_entry_size_ = 10;
#define __ masm->
#define __ masm()->
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Save all general purpose registers before messing with them.
const int kNumberOfRegisters = Register::kNumRegisters;
@ -49,8 +46,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ pushad();
ExternalReference c_entry_fp_address =
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate);
__ mov(masm->ExternalReferenceAsOperand(c_entry_fp_address, esi), ebp);
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate());
__ mov(masm()->ExternalReferenceAsOperand(c_entry_fp_address, esi), ebp);
const int kSavedRegistersAreaSize =
kNumberOfRegisters * kPointerSize + kDoubleRegsSize + kFloatRegsSize;
@ -76,14 +73,14 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ bind(&context_check);
__ mov(Operand(esp, 0 * kPointerSize), eax); // Function.
__ mov(Operand(esp, 1 * kPointerSize),
Immediate(static_cast<int>(deopt_kind)));
Immediate(static_cast<int>(deopt_kind())));
__ mov(Operand(esp, 2 * kPointerSize), esi); // Bailout id.
__ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0.
__ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta.
__ mov(Operand(esp, 5 * kPointerSize),
Immediate(ExternalReference::isolate_address(isolate)));
Immediate(ExternalReference::isolate_address(isolate())));
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -146,7 +143,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1, esi);
__ mov(Operand(esp, 0 * kPointerSize), eax);
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(eax);
@ -206,16 +203,16 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ ret(0);
}
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
// Create a sequence of deoptimization entries.
Label done;
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ push_imm32(i);
__ jmp(&done);
DCHECK(masm->pc_offset() - start == table_entry_size_);
DCHECK(masm()->pc_offset() - start == table_entry_size_);
}
__ bind(&done);
}

View File

@ -5,7 +5,6 @@
#ifndef V8_MACRO_ASSEMBLER_INL_H_
#define V8_MACRO_ASSEMBLER_INL_H_
#include "src/assembler-inl.h"
#include "src/macro-assembler.h"
#if V8_TARGET_ARCH_ARM64

View File

@ -2,23 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
namespace v8 {
namespace internal {
#define __ masm->
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
// easily ported.
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Unlike on ARM we don't save all the registers, just the useful ones.
// For the rest, there are gaps on the stack, so the offsets remain the same.
@ -58,7 +57,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
}
__ li(a2, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ sw(fp, MemOperand(a2));
const int kSavedRegistersAreaSize =
@ -85,15 +84,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(a1, &context_check);
__ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ li(a1, Operand(static_cast<int>(deopt_kind)));
__ li(a1, Operand(static_cast<int>(deopt_kind())));
// a2: bailout id already loaded.
// a3: code address or 0 already loaded.
__ sw(t0, CFunctionArgumentOperand(5)); // Fp-to-sp delta.
__ li(t1, Operand(ExternalReference::isolate_address(isolate)));
__ li(t1, Operand(ExternalReference::isolate_address(isolate())));
__ sw(t1, CFunctionArgumentOperand(6)); // Isolate.
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -167,7 +166,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1, a1);
// Call Deoptimizer::ComputeOutputFrames().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(a0); // Restore deoptimizer object (class Deoptimizer).
@ -233,6 +232,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop("Unreachable.");
}
// Maximum size of a table entry generated below.
#ifdef _MIPS_ARCH_MIPS32R6
const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
@ -240,9 +240,8 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
const int Deoptimizer::table_entry_size_ = 3 * kInstrSize;
#endif
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm());
// Create a sequence of deoptimization entries.
// Note that registers are still live when jumping to an entry.
@ -257,9 +256,9 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
(1 << (kImm16Bits - 2)) / (table_entry_size_ / kInstrSize);
#endif
if (count <= kMaxEntriesBranchReach) {
if (count() <= kMaxEntriesBranchReach) {
// Common case.
for (int i = 0; i < count; i++) {
for (int i = 0; i < count(); i++) {
Label start;
__ bind(&start);
DCHECK(is_int16(i));
@ -271,18 +270,18 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
__ li(kScratchReg, i); // In the delay slot.
__ nop();
}
DCHECK_EQ(table_entry_size_, masm->SizeOfCodeGeneratedSince(&start));
DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
}
DCHECK_EQ(masm->SizeOfCodeGeneratedSince(&table_start),
count * table_entry_size_);
DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
count() * table_entry_size_);
__ bind(&done);
__ Push(kScratchReg);
} else {
DCHECK(!IsMipsArchVariant(kMips32r6));
// Uncommon case, the branch cannot reach.
// Create mini trampoline to reach the end of the table
for (int i = 0, j = 0; i < count; i++, j++) {
for (int i = 0, j = 0; i < count(); i++, j++) {
Label start;
__ bind(&start);
DCHECK(is_int16(i));
@ -298,11 +297,11 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
__ li(kScratchReg, i); // In the delay slot.
__ nop();
}
DCHECK_EQ(table_entry_size_, masm->SizeOfCodeGeneratedSince(&start));
DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
}
DCHECK_EQ(masm->SizeOfCodeGeneratedSince(&table_start),
count * table_entry_size_);
DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
count() * table_entry_size_);
__ bind(&trampoline_jump);
__ Push(kScratchReg);
}

View File

@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
namespace v8 {
namespace internal {
#define __ masm->
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
// easily ported.
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Unlike on ARM we don't save all the registers, just the useful ones.
// For the rest, there are gaps on the stack, so the offsets remain the same.
@ -59,7 +57,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
}
__ li(a2, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ Sd(fp, MemOperand(a2));
const int kSavedRegistersAreaSize =
@ -86,15 +84,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(a1, &context_check);
__ Ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ li(a1, Operand(static_cast<int>(deopt_kind)));
__ li(a1, Operand(static_cast<int>(deopt_kind())));
// a2: bailout id already loaded.
// a3: code address or 0 already loaded.
// a4: already has fp-to-sp delta.
__ li(a5, Operand(ExternalReference::isolate_address(isolate)));
__ li(a5, Operand(ExternalReference::isolate_address(isolate())));
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -167,7 +165,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1, a1);
// Call Deoptimizer::ComputeOutputFrames().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(a0); // Restore deoptimizer object (class Deoptimizer).
@ -232,6 +230,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop("Unreachable.");
}
// Maximum size of a table entry generated below.
#ifdef _MIPS_ARCH_MIPS64R6
const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
@ -239,9 +238,8 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
const int Deoptimizer::table_entry_size_ = 3 * kInstrSize;
#endif
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm());
// Create a sequence of deoptimization entries.
// Note that registers are still live when jumping to an entry.
@ -255,9 +253,9 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
(1 << (kImm16Bits - 2)) / (table_entry_size_ / kInstrSize);
#endif
if (count <= kMaxEntriesBranchReach) {
if (count() <= kMaxEntriesBranchReach) {
// Common case.
for (int i = 0; i < count; i++) {
for (int i = 0; i < count(); i++) {
Label start;
__ bind(&start);
DCHECK(is_int16(i));
@ -270,18 +268,18 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
__ nop();
}
DCHECK_EQ(table_entry_size_, masm->SizeOfCodeGeneratedSince(&start));
DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
}
DCHECK_EQ(masm->SizeOfCodeGeneratedSince(&table_start),
count * table_entry_size_);
DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
count() * table_entry_size_);
__ bind(&done);
__ Push(kScratchReg);
} else {
DCHECK_NE(kArchVariant, kMips64r6);
// Uncommon case, the branch cannot reach.
// Create mini trampoline to reach the end of the table
for (int i = 0, j = 0; i < count; i++, j++) {
for (int i = 0, j = 0; i < count(); i++, j++) {
Label start;
__ bind(&start);
DCHECK(is_int16(i));
@ -297,11 +295,11 @@ void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
__ li(kScratchReg, i); // In the delay slot.
__ nop();
}
DCHECK_EQ(table_entry_size_, masm->SizeOfCodeGeneratedSince(&start));
DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
}
DCHECK_EQ(masm->SizeOfCodeGeneratedSince(&table_start),
count * table_entry_size_);
DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
count() * table_entry_size_);
__ bind(&trampoline_jump);
__ Push(kScratchReg);
}

View File

@ -5,6 +5,7 @@
#ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
#define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
#include "src/assembler-inl.h"
#include "src/feedback-vector.h"
#include "src/objects-body-descriptors.h"
#include "src/objects/cell.h"
@ -14,7 +15,6 @@
#include "src/objects/js-weak-refs.h"
#include "src/objects/oddball.h"
#include "src/objects/slots.h"
#include "src/reloc-info.h"
#include "src/transitions.h"
#include "src/wasm/wasm-objects-inl.h"

View File

@ -19,7 +19,6 @@
#include "src/api-natives.h"
#include "src/api.h"
#include "src/arguments.h"
#include "src/assembler-inl.h"
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/base/bits.h"
@ -48,6 +47,7 @@
#include "src/keys.h"
#include "src/log.h"
#include "src/lookup-inl.h"
#include "src/macro-assembler.h"
#include "src/map-updater.h"
#include "src/message-template.h"
#include "src/microtask-queue.h"
@ -85,7 +85,6 @@
#include "src/objects/js-segment-iterator.h"
#include "src/objects/js-segmenter.h"
#endif // V8_INTL_SUPPORT
#include "src/code-comments.h"
#include "src/objects/js-weak-refs-inl.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/map.h"
@ -14640,7 +14639,7 @@ void Code::Relocate(intptr_t delta) {
for (RelocIterator it(*this, RelocInfo::kApplyMask); !it.done(); it.next()) {
it.rinfo()->apply(delta);
}
FlushICache();
Assembler::FlushICache(raw_instruction_start(), raw_instruction_size());
}
void Code::FlushICache() const {

View File

@ -4,7 +4,6 @@
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
@ -13,15 +12,12 @@ namespace internal {
const int Deoptimizer::table_entry_size_ = 8;
#define __ masm->
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
// easily ported.
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Unlike on ARM we don't save all the registers, just the useful ones.
// For the rest, there are gaps on the stack, so the offsets remain the same.
@ -61,7 +57,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
}
__ mov(ip, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ StoreP(fp, MemOperand(ip));
const int kSavedRegistersAreaSize =
@ -87,14 +83,14 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(r4, &context_check);
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ li(r4, Operand(static_cast<int>(deopt_kind)));
__ li(r4, Operand(static_cast<int>(deopt_kind())));
// r5: bailout id already loaded.
// r6: code address or 0 already loaded.
// r7: Fp-to-sp delta.
__ mov(r8, Operand(ExternalReference::isolate_address(isolate)));
__ mov(r8, Operand(ExternalReference::isolate_address(isolate())));
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -160,7 +156,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1, r4);
// Call Deoptimizer::ComputeOutputFrames().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(r3); // Restore deoptimizer object (class Deoptimizer).
@ -229,19 +225,19 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop("Unreachable.");
}
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm());
// Create a sequence of deoptimization entries.
// Note that registers are still live when jumping to an entry.
Label done;
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ li(ip, Operand(i));
__ b(&done);
DCHECK(masm->pc_offset() - start == table_entry_size_);
DCHECK(masm()->pc_offset() - start == table_entry_size_);
}
__ bind(&done);
__ push(ip);

View File

@ -8,7 +8,6 @@
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/profiler/profile-generator-inl.h"
#include "src/reloc-info.h"
#include "src/snapshot/embedded-data.h"
#include "src/source-position-table.h"
#include "src/wasm/wasm-code-manager.h"

View File

@ -23,7 +23,7 @@
#elif V8_TARGET_ARCH_MIPS64
#include "src/mips64/register-mips64.h"
#elif V8_TARGET_ARCH_S390
#include "src/s390/register-s390.h"
#include "src/s360/register-s360.h"
#else
#error Unknown architecture.
#endif

View File

@ -55,7 +55,6 @@
#include "src/label.h"
#include "src/objects/smi.h"
#include "src/s390/constants-s390.h"
#include "src/s390/register-s390.h"
#define ABI_USES_FUNCTION_DESCRIPTORS 0

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/assembler-inl.h"
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
@ -13,16 +13,12 @@ namespace internal {
// LAY + LGHI/LHI + BRCL
const int Deoptimizer::table_entry_size_ = 16;
#define __ masm->
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
// easily ported.
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
Label deopt_table_entry;
GenerateDeoptimizationEntriesPrologue(masm, count);
void Deoptimizer::TableEntryGenerator::Generate() {
GeneratePrologue();
// Save all the registers onto the stack
const int kNumberOfRegisters = Register::kNumRegisters;
@ -55,7 +51,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ StoreMultipleP(r0, sp, MemOperand(sp)); // Save all 16 registers
__ mov(ip, Operand(ExternalReference::Create(
IsolateAddressId::kCEntryFPAddress, isolate)));
IsolateAddressId::kCEntryFPAddress, isolate())));
__ StoreP(fp, MemOperand(ip));
const int kSavedRegistersAreaSize =
@ -83,17 +79,17 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(r3, &context_check);
__ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ LoadImmP(r3, Operand(static_cast<int>(deopt_kind)));
__ LoadImmP(r3, Operand(static_cast<int>(deopt_kind())));
// r4: bailout id already loaded.
// r5: code address or 0 already loaded.
// r6: Fp-to-sp delta.
// Parm6: isolate is passed on the stack.
__ mov(r7, Operand(ExternalReference::isolate_address(isolate)));
__ mov(r7, Operand(ExternalReference::isolate_address(isolate())));
__ StoreP(r7, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize));
// Call Deoptimizer::New().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
@ -167,7 +163,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ PrepareCallCFunction(1, r3);
// Call Deoptimizer::ComputeOutputFrames().
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
}
__ pop(r2); // Restore deoptimizer object (class Deoptimizer).
@ -234,20 +230,19 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop("Unreachable.");
}
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
// Create a sequence of deoptimization entries. Note that any
// registers may be still live.
Label done;
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ lay(sp, MemOperand(sp, -kPointerSize));
__ LoadImmP(ip, Operand(i));
__ b(&done);
int end = masm->pc_offset();
int end = masm()->pc_offset();
USE(end);
DCHECK(masm->pc_offset() - start == table_entry_size_);
DCHECK(masm()->pc_offset() - start == table_entry_size_);
}
__ bind(&done);
__ StoreP(ip, MemOperand(sp));

View File

@ -11,7 +11,6 @@
#include "src/base/once.h"
#include "src/base/platform/platform.h"
#include "src/bootstrapper.h"
#include "src/cpu-features.h"
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/elements.h"

View File

@ -5,7 +5,6 @@
#if V8_TARGET_ARCH_X64
#include "src/deoptimizer.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
@ -15,16 +14,13 @@ namespace internal {
const int Deoptimizer::table_entry_size_ = 5;
#define __ masm->
#define __ masm()->
void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
Isolate* isolate, int count,
DeoptimizeKind deopt_kind) {
NoRootArrayScope no_root_array(masm);
void Deoptimizer::TableEntryGenerator::Generate() {
Label deopt_table_entry;
__ bind(&deopt_table_entry);
GenerateDeoptimizationEntriesPrologue(masm, count);
GeneratePrologue();
// Save all general purpose registers before messing with them.
const int kNumberOfRegisters = Register::kNumRegisters;
@ -61,7 +57,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
kNumberOfRegisters * kRegisterSize + kDoubleRegsSize + kFloatRegsSize;
__ Store(
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate),
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate()),
rbp);
// We use this to keep the value of the fifth argument temporarily.
@ -105,22 +101,21 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ movp(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check);
__ movp(arg_reg_1, rax);
__ Set(arg_reg_2, static_cast<int>(deopt_kind));
__ Set(arg_reg_2, static_cast<int>(deopt_kind()));
// Args 3 and 4 are already in the right registers.
// On windows put the arguments on the stack (PrepareCallCFunction
// has created space for this). On linux pass the arguments in r8 and r9.
#ifdef _WIN64
__ movq(Operand(rsp, 4 * kRegisterSize), arg5);
__ LoadAddress(arg5, ExternalReference::isolate_address(isolate));
__ LoadAddress(arg5, ExternalReference::isolate_address(isolate()));
__ movq(Operand(rsp, 5 * kRegisterSize), arg5);
#else
__ movp(r8, arg5);
__ LoadAddress(r9, ExternalReference::isolate_address(isolate));
__ LoadAddress(r9, ExternalReference::isolate_address(isolate()));
#endif
{
AllowExternalCallThatCantCauseGC scope(masm);
{ AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
}
// Preserve deoptimizer object in register rax and get the input
@ -176,9 +171,9 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ pushq(rax);
__ PrepareCallCFunction(2);
__ movp(arg_reg_1, rax);
__ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate));
__ LoadAddress(arg_reg_2, ExternalReference::isolate_address(isolate()));
{
AllowExternalCallThatCantCauseGC scope(masm);
AllowExternalCallThatCantCauseGC scope(masm());
__ CallCFunction(ExternalReference::compute_output_frames_function(), 2);
}
__ popq(rax);
@ -243,15 +238,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ ret(0);
}
void Deoptimizer::GenerateDeoptimizationEntriesPrologue(MacroAssembler* masm,
int count) {
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
// Create a sequence of deoptimization entries.
Label done;
for (int i = 0; i < count; i++) {
int start = masm->pc_offset();
for (int i = 0; i < count(); i++) {
int start = masm()->pc_offset();
USE(start);
__ call(&done);
DCHECK(masm->pc_offset() - start == table_entry_size_);
DCHECK(masm()->pc_offset() - start == table_entry_size_);
}
__ bind(&done);
}

View File

@ -339,11 +339,15 @@ v8_source_set("cctest_sources") {
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ ### gcmole(arch:ppc) ###
"test-assembler-ppc.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-ppc.cc",
]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [ ### gcmole(arch:s390) ###
"test-assembler-s390.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-s390.cc",
]
}