Commit c751e79e authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[crankshaft] Remove Crankshaft.

R=danno@chromium.org
BUG=v8:6408

Change-Id: I6613557e474f415293feb164a30c15485d81ff2c
Reviewed-on: https://chromium-review.googlesource.com/547717Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46212}
parent f0308387
......@@ -1455,63 +1455,6 @@ v8_source_set("v8_base") {
"src/counters-inl.h",
"src/counters.cc",
"src/counters.h",
"src/crankshaft/compilation-phase.cc",
"src/crankshaft/compilation-phase.h",
"src/crankshaft/hydrogen-alias-analysis.h",
"src/crankshaft/hydrogen-bce.cc",
"src/crankshaft/hydrogen-bce.h",
"src/crankshaft/hydrogen-canonicalize.cc",
"src/crankshaft/hydrogen-canonicalize.h",
"src/crankshaft/hydrogen-check-elimination.cc",
"src/crankshaft/hydrogen-check-elimination.h",
"src/crankshaft/hydrogen-dce.cc",
"src/crankshaft/hydrogen-dce.h",
"src/crankshaft/hydrogen-dehoist.cc",
"src/crankshaft/hydrogen-dehoist.h",
"src/crankshaft/hydrogen-environment-liveness.cc",
"src/crankshaft/hydrogen-environment-liveness.h",
"src/crankshaft/hydrogen-escape-analysis.cc",
"src/crankshaft/hydrogen-escape-analysis.h",
"src/crankshaft/hydrogen-flow-engine.h",
"src/crankshaft/hydrogen-gvn.cc",
"src/crankshaft/hydrogen-gvn.h",
"src/crankshaft/hydrogen-infer-representation.cc",
"src/crankshaft/hydrogen-infer-representation.h",
"src/crankshaft/hydrogen-infer-types.cc",
"src/crankshaft/hydrogen-infer-types.h",
"src/crankshaft/hydrogen-instructions.cc",
"src/crankshaft/hydrogen-instructions.h",
"src/crankshaft/hydrogen-load-elimination.cc",
"src/crankshaft/hydrogen-load-elimination.h",
"src/crankshaft/hydrogen-mark-unreachable.cc",
"src/crankshaft/hydrogen-mark-unreachable.h",
"src/crankshaft/hydrogen-range-analysis.cc",
"src/crankshaft/hydrogen-range-analysis.h",
"src/crankshaft/hydrogen-redundant-phi.cc",
"src/crankshaft/hydrogen-redundant-phi.h",
"src/crankshaft/hydrogen-removable-simulates.cc",
"src/crankshaft/hydrogen-removable-simulates.h",
"src/crankshaft/hydrogen-representation-changes.cc",
"src/crankshaft/hydrogen-representation-changes.h",
"src/crankshaft/hydrogen-sce.cc",
"src/crankshaft/hydrogen-sce.h",
"src/crankshaft/hydrogen-store-elimination.cc",
"src/crankshaft/hydrogen-store-elimination.h",
"src/crankshaft/hydrogen-types.cc",
"src/crankshaft/hydrogen-types.h",
"src/crankshaft/hydrogen-uint32-analysis.cc",
"src/crankshaft/hydrogen-uint32-analysis.h",
"src/crankshaft/hydrogen.cc",
"src/crankshaft/hydrogen.h",
"src/crankshaft/lithium-allocator-inl.h",
"src/crankshaft/lithium-allocator.cc",
"src/crankshaft/lithium-allocator.h",
"src/crankshaft/lithium-codegen.cc",
"src/crankshaft/lithium-codegen.h",
"src/crankshaft/lithium-inl.h",
"src/crankshaft/lithium.cc",
"src/crankshaft/lithium.h",
"src/crankshaft/unique.h",
"src/date.cc",
"src/date.h",
"src/dateparser-inl.h",
......@@ -2066,12 +2009,6 @@ v8_source_set("v8_base") {
"src/compiler/ia32/instruction-codes-ia32.h",
"src/compiler/ia32/instruction-scheduler-ia32.cc",
"src/compiler/ia32/instruction-selector-ia32.cc",
"src/crankshaft/ia32/lithium-codegen-ia32.cc",
"src/crankshaft/ia32/lithium-codegen-ia32.h",
"src/crankshaft/ia32/lithium-gap-resolver-ia32.cc",
"src/crankshaft/ia32/lithium-gap-resolver-ia32.h",
"src/crankshaft/ia32/lithium-ia32.cc",
"src/crankshaft/ia32/lithium-ia32.h",
"src/debug/ia32/debug-ia32.cc",
"src/full-codegen/ia32/full-codegen-ia32.cc",
"src/ia32/assembler-ia32-inl.h",
......@@ -2106,12 +2043,6 @@ v8_source_set("v8_base") {
"src/compiler/x64/instruction-selector-x64.cc",
"src/compiler/x64/unwinding-info-writer-x64.cc",
"src/compiler/x64/unwinding-info-writer-x64.h",
"src/crankshaft/x64/lithium-codegen-x64.cc",
"src/crankshaft/x64/lithium-codegen-x64.h",
"src/crankshaft/x64/lithium-gap-resolver-x64.cc",
"src/crankshaft/x64/lithium-gap-resolver-x64.h",
"src/crankshaft/x64/lithium-x64.cc",
"src/crankshaft/x64/lithium-x64.h",
"src/debug/x64/debug-x64.cc",
"src/full-codegen/x64/full-codegen-x64.cc",
"src/ic/x64/access-compiler-x64.cc",
......@@ -2172,12 +2103,6 @@ v8_source_set("v8_base") {
"src/compiler/arm/instruction-selector-arm.cc",
"src/compiler/arm/unwinding-info-writer-arm.cc",
"src/compiler/arm/unwinding-info-writer-arm.h",
"src/crankshaft/arm/lithium-arm.cc",
"src/crankshaft/arm/lithium-arm.h",
"src/crankshaft/arm/lithium-codegen-arm.cc",
"src/crankshaft/arm/lithium-codegen-arm.h",
"src/crankshaft/arm/lithium-gap-resolver-arm.cc",
"src/crankshaft/arm/lithium-gap-resolver-arm.h",
"src/debug/arm/debug-arm.cc",
"src/full-codegen/arm/full-codegen-arm.cc",
"src/ic/arm/access-compiler-arm.cc",
......@@ -2226,15 +2151,6 @@ v8_source_set("v8_base") {
"src/compiler/arm64/instruction-selector-arm64.cc",
"src/compiler/arm64/unwinding-info-writer-arm64.cc",
"src/compiler/arm64/unwinding-info-writer-arm64.h",
"src/crankshaft/arm64/delayed-masm-arm64-inl.h",
"src/crankshaft/arm64/delayed-masm-arm64.cc",
"src/crankshaft/arm64/delayed-masm-arm64.h",
"src/crankshaft/arm64/lithium-arm64.cc",
"src/crankshaft/arm64/lithium-arm64.h",
"src/crankshaft/arm64/lithium-codegen-arm64.cc",
"src/crankshaft/arm64/lithium-codegen-arm64.h",
"src/crankshaft/arm64/lithium-gap-resolver-arm64.cc",
"src/crankshaft/arm64/lithium-gap-resolver-arm64.h",
"src/debug/arm64/debug-arm64.cc",
"src/full-codegen/arm64/full-codegen-arm64.cc",
"src/ic/arm64/access-compiler-arm64.cc",
......@@ -2249,12 +2165,6 @@ v8_source_set("v8_base") {
"src/compiler/mips/instruction-codes-mips.h",
"src/compiler/mips/instruction-scheduler-mips.cc",
"src/compiler/mips/instruction-selector-mips.cc",
"src/crankshaft/mips/lithium-codegen-mips.cc",
"src/crankshaft/mips/lithium-codegen-mips.h",
"src/crankshaft/mips/lithium-gap-resolver-mips.cc",
"src/crankshaft/mips/lithium-gap-resolver-mips.h",
"src/crankshaft/mips/lithium-mips.cc",
"src/crankshaft/mips/lithium-mips.h",
"src/debug/mips/debug-mips.cc",
"src/full-codegen/mips/full-codegen-mips.cc",
"src/ic/mips/access-compiler-mips.cc",
......@@ -2288,12 +2198,6 @@ v8_source_set("v8_base") {
"src/compiler/mips64/instruction-codes-mips64.h",
"src/compiler/mips64/instruction-scheduler-mips64.cc",
"src/compiler/mips64/instruction-selector-mips64.cc",
"src/crankshaft/mips64/lithium-codegen-mips64.cc",
"src/crankshaft/mips64/lithium-codegen-mips64.h",
"src/crankshaft/mips64/lithium-gap-resolver-mips64.cc",
"src/crankshaft/mips64/lithium-gap-resolver-mips64.h",
"src/crankshaft/mips64/lithium-mips64.cc",
"src/crankshaft/mips64/lithium-mips64.h",
"src/debug/mips64/debug-mips64.cc",
"src/full-codegen/mips64/full-codegen-mips64.cc",
"src/ic/mips64/access-compiler-mips64.cc",
......@@ -2327,12 +2231,6 @@ v8_source_set("v8_base") {
"src/compiler/ppc/instruction-codes-ppc.h",
"src/compiler/ppc/instruction-scheduler-ppc.cc",
"src/compiler/ppc/instruction-selector-ppc.cc",
"src/crankshaft/ppc/lithium-codegen-ppc.cc",
"src/crankshaft/ppc/lithium-codegen-ppc.h",
"src/crankshaft/ppc/lithium-gap-resolver-ppc.cc",
"src/crankshaft/ppc/lithium-gap-resolver-ppc.h",
"src/crankshaft/ppc/lithium-ppc.cc",
"src/crankshaft/ppc/lithium-ppc.h",
"src/debug/ppc/debug-ppc.cc",
"src/full-codegen/ppc/full-codegen-ppc.cc",
"src/ic/ppc/access-compiler-ppc.cc",
......@@ -2366,12 +2264,6 @@ v8_source_set("v8_base") {
"src/compiler/s390/instruction-codes-s390.h",
"src/compiler/s390/instruction-scheduler-s390.cc",
"src/compiler/s390/instruction-selector-s390.cc",
"src/crankshaft/s390/lithium-codegen-s390.cc",
"src/crankshaft/s390/lithium-codegen-s390.h",
"src/crankshaft/s390/lithium-gap-resolver-s390.cc",
"src/crankshaft/s390/lithium-gap-resolver-s390.h",
"src/crankshaft/s390/lithium-s390.cc",
"src/crankshaft/s390/lithium-s390.h",
"src/debug/s390/debug-s390.cc",
"src/full-codegen/s390/full-codegen-s390.cc",
"src/ic/s390/access-compiler-s390.cc",
......@@ -2405,12 +2297,6 @@ v8_source_set("v8_base") {
"src/compiler/x87/instruction-codes-x87.h",
"src/compiler/x87/instruction-scheduler-x87.cc",
"src/compiler/x87/instruction-selector-x87.cc",
"src/crankshaft/x87/lithium-codegen-x87.cc",
"src/crankshaft/x87/lithium-codegen-x87.h",
"src/crankshaft/x87/lithium-gap-resolver-x87.cc",
"src/crankshaft/x87/lithium-gap-resolver-x87.h",
"src/crankshaft/x87/lithium-x87.cc",
"src/crankshaft/x87/lithium-x87.h",
"src/debug/x87/debug-x87.cc",
"src/full-codegen/x87/full-codegen-x87.cc",
"src/ic/x87/access-compiler-x87.cc",
......
......@@ -16,10 +16,10 @@
#include "src/bootstrapper.h"
#include "src/codegen.h"
#include "src/compilation-cache.h"
#include "src/compilation-info.h"
#include "src/compiler-dispatcher/compiler-dispatcher.h"
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
#include "src/compiler/pipeline.h"
#include "src/crankshaft/hydrogen.h"
#include "src/debug/debug.h"
#include "src/debug/liveedit.h"
#include "src/frames-inl.h"
......@@ -31,6 +31,7 @@
#include "src/log-inl.h"
#include "src/messages.h"
#include "src/objects/map.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
#include "src/parsing/rewriter.h"
#include "src/parsing/scanner-character-streams.h"
......@@ -203,11 +204,6 @@ void CompilationJob::RecordOptimizedCompilationStats() const {
PrintF("Compiled: %d functions with %d byte source size in %fms.\n",
compiled_functions, code_size, compilation_time);
}
if (FLAG_hydrogen_stats) {
isolate()->GetHStatistics()->IncrementSubtotals(time_taken_to_prepare_,
time_taken_to_execute_,
time_taken_to_finalize_);
}
}
Isolate* CompilationJob::isolate() const { return info()->isolate(); }
......
set noparent
bmeurer@chromium.org
danno@chromium.org
jarin@chromium.org
jkummerow@chromium.org
verwaest@chromium.org
# COMPONENT: Blink>JavaScript>Compiler
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2011 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_ARM_LITHIUM_GAP_RESOLVER_ARM_H_
#define V8_CRANKSHAFT_ARM_LITHIUM_GAP_RESOLVER_ARM_H_
#include "src/crankshaft/lithium.h"
namespace v8 {
namespace internal {
class LCodeGen;
class LGapResolver;
class LGapResolver final BASE_EMBEDDED {
public:
explicit LGapResolver(LCodeGen* owner);
// Resolve a set of parallel moves, emitting assembler instructions.
void Resolve(LParallelMove* parallel_move);
private:
// Build the initial list of moves.
void BuildInitialMoveList(LParallelMove* parallel_move);
// Perform the move at the moves_ index in question (possibly requiring
// other moves to satisfy dependencies).
void PerformMove(int index);
// If a cycle is found in the series of moves, save the blocking value to
// a scratch register. The cycle must be found by hitting the root of the
// depth-first search.
void BreakCycle(int index);
// After a cycle has been resolved, restore the value from the scratch
// register to its proper destination.
void RestoreValue();
// Emit a move and remove it from the move graph.
void EmitMove(int index);
// Verify the move list before performing moves.
void Verify();
LCodeGen* cgen_;
// List of moves not yet resolved.
ZoneList<LMoveOperands> moves_;
int root_index_;
bool in_cycle_;
LOperand* saved_destination_;
// We use the root register as a scratch in a few places. When that happens,
// this flag is set to indicate that it needs to be restored.
bool need_to_restore_root_;
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_ARM_LITHIUM_GAP_RESOLVER_ARM_H_
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_INL_H_
#define V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_INL_H_
#include "src/arm64/macro-assembler-arm64-inl.h"
#include "src/crankshaft/arm64/delayed-masm-arm64.h"
namespace v8 {
namespace internal {
#define __ ACCESS_MASM(masm_)
DelayedMasm::DelayedMasm(LCodeGen* owner, MacroAssembler* masm,
const Register& scratch_register)
: cgen_(owner),
masm_(masm),
scratch_register_(scratch_register),
scratch_register_used_(false),
pending_(kNone),
saved_value_(0) {
#ifdef DEBUG
pending_register_ = no_reg;
pending_value_ = 0;
pending_pc_ = 0;
scratch_register_acquired_ = false;
#endif
}
void DelayedMasm::EndDelayedUse() {
EmitPending();
DCHECK(!scratch_register_acquired_);
ResetSavedValue();
}
void DelayedMasm::Mov(const Register& rd,
const Operand& operand,
DiscardMoveMode discard_mode) {
EmitPending();
DCHECK(!IsScratchRegister(rd) || scratch_register_acquired_);
__ Mov(rd, operand, discard_mode);
}
void DelayedMasm::Fmov(VRegister fd, VRegister fn) {
EmitPending();
__ Fmov(fd, fn);
}
void DelayedMasm::Fmov(VRegister fd, double imm) {
EmitPending();
__ Fmov(fd, imm);
}
void DelayedMasm::LoadObject(Register result, Handle<Object> object) {
EmitPending();
DCHECK(!IsScratchRegister(result) || scratch_register_acquired_);
__ LoadObject(result, object);
}
void DelayedMasm::InitializeRootRegister() { masm_->InitializeRootRegister(); }
#undef __
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_INL_H_
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#if V8_TARGET_ARCH_ARM64
#include "src/crankshaft/arm64/delayed-masm-arm64.h"
#include "src/arm64/macro-assembler-arm64-inl.h"
#include "src/crankshaft/arm64/lithium-codegen-arm64.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
#define __ ACCESS_MASM(masm_)
void DelayedMasm::StackSlotMove(LOperand* src, LOperand* dst) {
DCHECK((src->IsStackSlot() && dst->IsStackSlot()) ||
(src->IsDoubleStackSlot() && dst->IsDoubleStackSlot()));
MemOperand src_operand = cgen_->ToMemOperand(src);
MemOperand dst_operand = cgen_->ToMemOperand(dst);
if (pending_ == kStackSlotMove) {
DCHECK(pending_pc_ == masm_->pc_offset());
UseScratchRegisterScope scope(masm_);
DoubleRegister temp1 = scope.AcquireD();
DoubleRegister temp2 = scope.AcquireD();
switch (MemOperand::AreConsistentForPair(pending_address_src_,
src_operand)) {
case MemOperand::kNotPair:
__ Ldr(temp1, pending_address_src_);
__ Ldr(temp2, src_operand);
break;
case MemOperand::kPairAB:
__ Ldp(temp1, temp2, pending_address_src_);
break;
case MemOperand::kPairBA:
__ Ldp(temp2, temp1, src_operand);
break;
}
switch (MemOperand::AreConsistentForPair(pending_address_dst_,
dst_operand)) {
case MemOperand::kNotPair:
__ Str(temp1, pending_address_dst_);
__ Str(temp2, dst_operand);
break;
case MemOperand::kPairAB:
__ Stp(temp1, temp2, pending_address_dst_);
break;
case MemOperand::kPairBA:
__ Stp(temp2, temp1, dst_operand);
break;
}
ResetPending();
return;
}
EmitPending();
pending_ = kStackSlotMove;
pending_address_src_ = src_operand;
pending_address_dst_ = dst_operand;
#ifdef DEBUG
pending_pc_ = masm_->pc_offset();
#endif
}
void DelayedMasm::StoreConstant(uint64_t value, const MemOperand& operand) {
DCHECK(!scratch_register_acquired_);
if ((pending_ == kStoreConstant) && (value == pending_value_)) {
MemOperand::PairResult result =
MemOperand::AreConsistentForPair(pending_address_dst_, operand);
if (result != MemOperand::kNotPair) {
const MemOperand& dst =
(result == MemOperand::kPairAB) ?
pending_address_dst_ :
operand;
DCHECK(pending_pc_ == masm_->pc_offset());
if (pending_value_ == 0) {
__ Stp(xzr, xzr, dst);
} else {
SetSavedValue(pending_value_);
__ Stp(ScratchRegister(), ScratchRegister(), dst);
}
ResetPending();
return;
}
}
EmitPending();
pending_ = kStoreConstant;
pending_address_dst_ = operand;
pending_value_ = value;
#ifdef DEBUG
pending_pc_ = masm_->pc_offset();
#endif
}
void DelayedMasm::Load(const CPURegister& rd, const MemOperand& operand) {
if ((pending_ == kLoad) &&
pending_register_.IsSameSizeAndType(rd)) {
switch (MemOperand::AreConsistentForPair(pending_address_src_, operand)) {
case MemOperand::kNotPair:
break;
case MemOperand::kPairAB:
DCHECK(pending_pc_ == masm_->pc_offset());
DCHECK(!IsScratchRegister(pending_register_) ||
scratch_register_acquired_);
DCHECK(!IsScratchRegister(rd) || scratch_register_acquired_);
__ Ldp(pending_register_, rd, pending_address_src_);
ResetPending();
return;
case MemOperand::kPairBA:
DCHECK(pending_pc_ == masm_->pc_offset());
DCHECK(!IsScratchRegister(pending_register_) ||
scratch_register_acquired_);
DCHECK(!IsScratchRegister(rd) || scratch_register_acquired_);
__ Ldp(rd, pending_register_, operand);
ResetPending();
return;
}
}
EmitPending();
pending_ = kLoad;
pending_register_ = rd;
pending_address_src_ = operand;
#ifdef DEBUG
pending_pc_ = masm_->pc_offset();
#endif
}
void DelayedMasm::Store(const CPURegister& rd, const MemOperand& operand) {
if ((pending_ == kStore) &&
pending_register_.IsSameSizeAndType(rd)) {
switch (MemOperand::AreConsistentForPair(pending_address_dst_, operand)) {
case MemOperand::kNotPair:
break;
case MemOperand::kPairAB:
DCHECK(pending_pc_ == masm_->pc_offset());
__ Stp(pending_register_, rd, pending_address_dst_);
ResetPending();
return;
case MemOperand::kPairBA:
DCHECK(pending_pc_ == masm_->pc_offset());
__ Stp(rd, pending_register_, operand);
ResetPending();
return;
}
}
EmitPending();
pending_ = kStore;
pending_register_ = rd;
pending_address_dst_ = operand;
#ifdef DEBUG
pending_pc_ = masm_->pc_offset();
#endif
}
void DelayedMasm::EmitPending() {
DCHECK((pending_ == kNone) || (pending_pc_ == masm_->pc_offset()));
switch (pending_) {
case kNone:
return;
case kStoreConstant:
if (pending_value_ == 0) {
__ Str(xzr, pending_address_dst_);
} else {
SetSavedValue(pending_value_);
__ Str(ScratchRegister(), pending_address_dst_);
}
break;
case kLoad:
DCHECK(!IsScratchRegister(pending_register_) ||
scratch_register_acquired_);
__ Ldr(pending_register_, pending_address_src_);
break;
case kStore:
__ Str(pending_register_, pending_address_dst_);
break;
case kStackSlotMove: {
UseScratchRegisterScope scope(masm_);
DoubleRegister temp = scope.AcquireD();
__ Ldr(temp, pending_address_src_);
__ Str(temp, pending_address_dst_);
break;
}
}
ResetPending();
}
} // namespace internal
} // namespace v8
#endif // V8_TARGET_ARCH_ARM64
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_H_
#define V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_H_
#include "src/crankshaft/lithium.h"
namespace v8 {
namespace internal {
class LCodeGen;
// This class delays the generation of some instructions. This way, we have a
// chance to merge two instructions in one (with load/store pair).
// Each instruction must either:
// - merge with the pending instruction and generate just one instruction.
// - emit the pending instruction and then generate the instruction (or set the
// pending instruction).
class DelayedMasm BASE_EMBEDDED {
public:
inline DelayedMasm(LCodeGen* owner, MacroAssembler* masm,
const Register& scratch_register);
~DelayedMasm() {
DCHECK(!scratch_register_acquired_);
DCHECK(!scratch_register_used_);
DCHECK(!pending());
}
inline void EndDelayedUse();
const Register& ScratchRegister() {
scratch_register_used_ = true;
return scratch_register_;
}
bool IsScratchRegister(const CPURegister& reg) {
return reg.Is(scratch_register_);
}
bool scratch_register_used() const { return scratch_register_used_; }
void reset_scratch_register_used() { scratch_register_used_ = false; }
// Acquire/Release scratch register for use outside this class.
void AcquireScratchRegister() {
EmitPending();
ResetSavedValue();
#ifdef DEBUG
DCHECK(!scratch_register_acquired_);
scratch_register_acquired_ = true;
#endif
}
void ReleaseScratchRegister() {
#ifdef DEBUG
DCHECK(scratch_register_acquired_);
scratch_register_acquired_ = false;
#endif
}
bool pending() { return pending_ != kNone; }
// Extra layer over the macro-assembler instructions (which emits the
// potential pending instruction).
inline void Mov(const Register& rd,
const Operand& operand,
DiscardMoveMode discard_mode = kDontDiscardForSameWReg);
inline void Fmov(VRegister fd, VRegister fn);
inline void Fmov(VRegister fd, double imm);
inline void LoadObject(Register result, Handle<Object> object);
// Instructions which try to merge which the pending instructions.
void StackSlotMove(LOperand* src, LOperand* dst);
// StoreConstant can only be used if the scratch register is not acquired.
void StoreConstant(uint64_t value, const MemOperand& operand);
void Load(const CPURegister& rd, const MemOperand& operand);
void Store(const CPURegister& rd, const MemOperand& operand);
// Emit the potential pending instruction.
void EmitPending();
// Reset the pending state.
void ResetPending() {
pending_ = kNone;
#ifdef DEBUG
pending_register_ = no_reg;
MemOperand tmp;
pending_address_src_ = tmp;
pending_address_dst_ = tmp;
pending_value_ = 0;
pending_pc_ = 0;
#endif
}
inline void InitializeRootRegister();
private:
// Set the saved value and load the ScratchRegister with it.
void SetSavedValue(uint64_t saved_value) {
DCHECK(saved_value != 0);
if (saved_value_ != saved_value) {
masm_->Mov(ScratchRegister(), saved_value);
saved_value_ = saved_value;
}
}
// Reset the saved value (i.e. the value of ScratchRegister is no longer
// known).
void ResetSavedValue() {
saved_value_ = 0;
}
LCodeGen* cgen_;
MacroAssembler* masm_;
// Register used to store a constant.
Register scratch_register_;
bool scratch_register_used_;
// Sometimes we store or load two values in two contiguous stack slots.
// In this case, we try to use the ldp/stp instructions to reduce code size.
// To be able to do that, instead of generating directly the instructions,
// we register with the following fields that an instruction needs to be
// generated. Then with the next instruction, if the instruction is
// consistent with the pending one for stp/ldp we generate ldp/stp. Else,
// if they are not consistent, we generate the pending instruction and we
// register the new instruction (which becomes pending).
// Enumeration of instructions which can be pending.
enum Pending {
kNone,
kStoreConstant,
kLoad, kStore,
kStackSlotMove
};
// The pending instruction.
Pending pending_;
// For kLoad, kStore: register which must be loaded/stored.
CPURegister pending_register_;
// For kLoad, kStackSlotMove: address of the load.
MemOperand pending_address_src_;
// For kStoreConstant, kStore, kStackSlotMove: address of the store.
MemOperand pending_address_dst_;
// For kStoreConstant: value to be stored.
uint64_t pending_value_;
// Value held into the ScratchRegister if the saved_value_ is not 0.
// For 0, we use xzr.
uint64_t saved_value_;
#ifdef DEBUG
// Address where the pending instruction must be generated. It's only used to
// check that nothing else has been generated since we set the pending
// instruction.
int pending_pc_;
// If true, the scratch register has been acquired outside this class. The
// scratch register can no longer be used for constants.
bool scratch_register_acquired_;
#endif
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_ARM64_DELAYED_MASM_ARM64_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_
#define V8_CRANKSHAFT_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_
#include "src/crankshaft/arm64/delayed-masm-arm64.h"
#include "src/crankshaft/lithium.h"
namespace v8 {
namespace internal {
class LCodeGen;
class LGapResolver;
class DelayedGapMasm : public DelayedMasm {
public:
DelayedGapMasm(LCodeGen* owner, MacroAssembler* masm);
~DelayedGapMasm();
void EndDelayedUse();
};
class LGapResolver BASE_EMBEDDED {
public:
explicit LGapResolver(LCodeGen* owner);
// Resolve a set of parallel moves, emitting assembler instructions.
void Resolve(LParallelMove* parallel_move);
private:
// Build the initial list of moves.
void BuildInitialMoveList(LParallelMove* parallel_move);
// Perform the move at the moves_ index in question (possibly requiring
// other moves to satisfy dependencies).
void PerformMove(int index);
// If a cycle is found in the series of moves, save the blocking value to
// a scratch register. The cycle must be found by hitting the root of the
// depth-first search.
void BreakCycle(int index);
// After a cycle has been resolved, restore the value from the scratch
// register to its proper destination.
void RestoreValue();
// Emit a move and remove it from the move graph.
void EmitMove(int index);
// Emit a move from one stack slot to another.
void EmitStackSlotMove(int index) {
masm_.StackSlotMove(moves_[index].source(), moves_[index].destination());
}
// Verify the move list before performing moves.
void Verify();
// Registers used to solve cycles.
const Register& SavedValueRegister() {
DCHECK(!RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode(
masm_.ScratchRegister().code()));
return masm_.ScratchRegister();
}
// The scratch register is used to break cycles and to store constant.
// These two methods switch from one mode to the other.
void AcquireSavedValueRegister() { masm_.AcquireScratchRegister(); }
void ReleaseSavedValueRegister() { masm_.ReleaseScratchRegister(); }
const VRegister& SavedFPValueRegister() {
// We use the Crankshaft floating-point scratch register to break a cycle
// involving double values as the MacroAssembler will not need it for the
// operations performed by the gap resolver.
DCHECK(!RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode(
crankshaft_fp_scratch.code()));
return crankshaft_fp_scratch;
}
LCodeGen* cgen_;
DelayedGapMasm masm_;
// List of moves not yet resolved.
ZoneList<LMoveOperands> moves_;
int root_index_;
bool in_cycle_;
LOperand* saved_destination_;
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/crankshaft/compilation-phase.h"
#include "src/crankshaft/hydrogen.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
: name_(name), info_(info), zone_(info->isolate()->allocator(), ZONE_NAME) {
if (FLAG_hydrogen_stats) {
info_zone_start_allocation_size_ = info->zone()->allocation_size();
timer_.Start();
}
}
CompilationPhase::~CompilationPhase() {
if (FLAG_hydrogen_stats) {
size_t size = zone()->allocation_size();
size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
isolate()->GetHStatistics()->SaveTiming(name_, timer_.Elapsed(), size);
}
}
bool CompilationPhase::ShouldProduceTraceOutput() const {
// Trace if the appropriate trace flag is set and the phase name's first
// character is in the FLAG_trace_phase command line parameter.
AllowHandleDereference allow_deref;
bool tracing_on =
info()->IsStub()
? FLAG_trace_hydrogen_stubs
: (FLAG_trace_hydrogen &&
info()->shared_info()->PassesFilter(FLAG_trace_hydrogen_filter));
return (tracing_on &&
base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) !=
NULL);
}
} // namespace internal
} // namespace v8
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_COMPILATION_PHASE_H_
#define V8_CRANKSHAFT_COMPILATION_PHASE_H_
#include "src/allocation.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/compilation-info.h"
#include "src/zone/zone.h"
namespace v8 {
namespace internal {
class CompilationPhase BASE_EMBEDDED {
public:
CompilationPhase(const char* name, CompilationInfo* info);
~CompilationPhase();
protected:
bool ShouldProduceTraceOutput() const;
const char* name() const { return name_; }
CompilationInfo* info() const { return info_; }
Isolate* isolate() const { return info()->isolate(); }
Zone* zone() { return &zone_; }
private:
const char* name_;
CompilationInfo* info_;
Zone zone_;
size_t info_zone_start_allocation_size_;
base::ElapsedTimer timer_;
DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_COMPILATION_PHASE_H_
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_HYDROGEN_ALIAS_ANALYSIS_H_
#define V8_CRANKSHAFT_HYDROGEN_ALIAS_ANALYSIS_H_
#include "src/crankshaft/hydrogen.h"
namespace v8 {
namespace internal {
enum HAliasing {
kMustAlias,
kMayAlias,
kNoAlias
};
// Defines the interface to alias analysis for the rest of the compiler.
// A simple implementation can use only local reasoning, but a more powerful
// analysis might employ points-to analysis.
class HAliasAnalyzer : public ZoneObject {
public:
// Simple alias analysis distinguishes allocations, parameters,
// and constants using only local reasoning.
HAliasing Query(HValue* a, HValue* b) {
// The same SSA value always references the same object.
if (a == b) return kMustAlias;
if (a->IsAllocate() || a->IsInnerAllocatedObject()) {
// Two non-identical allocations can never be aliases.
if (b->IsAllocate()) return kNoAlias;
if (b->IsInnerAllocatedObject()) return kNoAlias;
// An allocation can never alias a parameter or a constant.
if (b->IsParameter()) return kNoAlias;
if (b->IsConstant()) return kNoAlias;
}
if (b->IsAllocate() || b->IsInnerAllocatedObject()) {
// An allocation can never alias a parameter or a constant.
if (a->IsParameter()) return kNoAlias;
if (a->IsConstant()) return kNoAlias;
}
// Constant objects can be distinguished statically.
if (a->IsConstant() && b->IsConstant()) {
return a->Equals(b) ? kMustAlias : kNoAlias;
}
return kMayAlias;
}
// Checks whether the objects referred to by the given instructions may
// ever be aliases. Note that this is more conservative than checking
// {Query(a, b) == kMayAlias}, since this method considers kMustAlias
// objects to also be may-aliasing.
inline bool MayAlias(HValue* a, HValue* b) {
return Query(a, b) != kNoAlias;
}
inline bool MustAlias(HValue* a, HValue* b) {
return Query(a, b) == kMustAlias;
}
inline bool NoAlias(HValue* a, HValue* b) {
return Query(a, b) == kNoAlias;
}
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_HYDROGEN_ALIAS_ANALYSIS_H_
This diff is collapsed.
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_HYDROGEN_BCE_H_
#define V8_CRANKSHAFT_HYDROGEN_BCE_H_
#include "src/crankshaft/hydrogen.h"
namespace v8 {
namespace internal {
class BoundsCheckBbData;
class BoundsCheckKey;
class BoundsCheckTable : private CustomMatcherZoneHashMap {
public:
explicit BoundsCheckTable(Zone* zone);
INLINE(BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone));
INLINE(void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone));
INLINE(void Delete(BoundsCheckKey* key));
private:
DISALLOW_COPY_AND_ASSIGN(BoundsCheckTable);
};
class HBoundsCheckEliminationPhase : public HPhase {
public:
explicit HBoundsCheckEliminationPhase(HGraph* graph)
: HPhase("H_Bounds checks elimination", graph), table_(zone()) { }
void Run() {
EliminateRedundantBoundsChecks(graph()->entry_block());
}
private:
void EliminateRedundantBoundsChecks(HBasicBlock* bb);
BoundsCheckBbData* PreProcessBlock(HBasicBlock* bb);
void PostProcessBlock(HBasicBlock* bb, BoundsCheckBbData* data);
BoundsCheckTable table_;
DISALLOW_COPY_AND_ASSIGN(HBoundsCheckEliminationPhase);
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_HYDROGEN_BCE_H_
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/crankshaft/hydrogen-canonicalize.h"
#include "src/counters.h"
#include "src/crankshaft/hydrogen-redundant-phi.h"
#include "src/objects-inl.h"
namespace v8 {
namespace internal {
void HCanonicalizePhase::Run() {
const ZoneList<HBasicBlock*>* blocks(graph()->blocks());
// Before removing no-op instructions, save their semantic value.
// We must be careful not to set the flag unnecessarily, because GVN
// cannot identify two instructions when their flag value differs.
for (int i = 0; i < blocks->length(); ++i) {
for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
if (instr->IsArithmeticBinaryOperation()) {
if (instr->representation().IsInteger32()) {
if (instr->HasAtLeastOneUseWithFlagAndNoneWithout(
HInstruction::kTruncatingToInt32)) {
instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
}
} else if (instr->representation().IsSmi()) {
if (instr->HasAtLeastOneUseWithFlagAndNoneWithout(
HInstruction::kTruncatingToSmi)) {
instr->SetFlag(HInstruction::kAllUsesTruncatingToSmi);
} else if (instr->HasAtLeastOneUseWithFlagAndNoneWithout(
HInstruction::kTruncatingToInt32)) {
// Avoid redundant minus zero check
instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
}
}
}
}
}
// Perform actual Canonicalization pass.
HRedundantPhiEliminationPhase redundant_phi_eliminator(graph());
for (int i = 0; i < blocks->length(); ++i) {
// Eliminate redundant phis in the block first; changes to their inputs
// might have made them redundant, and eliminating them creates more
// opportunities for constant folding and strength reduction.
redundant_phi_eliminator.ProcessBlock(blocks->at(i));
// Now canonicalize each instruction.
for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
HValue* value = instr->Canonicalize();
if (value != instr) instr->DeleteAndReplaceWith(value);
}
}
}
} // namespace internal
} // namespace v8
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_HYDROGEN_CANONICALIZE_H_
#define V8_CRANKSHAFT_HYDROGEN_CANONICALIZE_H_
#include "src/crankshaft/hydrogen.h"
namespace v8 {
namespace internal {
class HCanonicalizePhase : public HPhase {
public:
explicit HCanonicalizePhase(HGraph* graph)
: HPhase("H_Canonicalize", graph) { }
void Run();
private:
DISALLOW_COPY_AND_ASSIGN(HCanonicalizePhase);
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_HYDROGEN_CANONICALIZE_H_
This diff is collapsed.
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
#define V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
#include "src/crankshaft/hydrogen.h"
#include "src/crankshaft/hydrogen-alias-analysis.h"
namespace v8 {
namespace internal {
// Remove CheckMaps instructions through flow- and branch-sensitive analysis.
class HCheckEliminationPhase : public HPhase {
public:
explicit HCheckEliminationPhase(HGraph* graph)
: HPhase("H_Check Elimination", graph), aliasing_(),
string_maps_(kStringMapsSize, zone()) {
// Compute the set of string maps.
#define ADD_STRING_MAP(type, size, name, Name) \
string_maps_.Add(Unique<Map>::CreateImmovable( \
graph->isolate()->factory()->name##_map()), zone());
STRING_TYPE_LIST(ADD_STRING_MAP)
#undef ADD_STRING_MAP
DCHECK_EQ(kStringMapsSize, string_maps_.size());
#ifdef DEBUG
redundant_ = 0;
removed_ = 0;
removed_cho_ = 0;
removed_cit_ = 0;
narrowed_ = 0;
loads_ = 0;
empty_ = 0;
compares_true_ = 0;
compares_false_ = 0;
transitions_ = 0;
#endif
}
void Run();
friend class HCheckTable;
private:
const UniqueSet<Map>* string_maps() const { return &string_maps_; }
void PrintStats();
HAliasAnalyzer* aliasing_;
#define COUNT(type, size, name, Name) + 1
static const int kStringMapsSize = 0 STRING_TYPE_LIST(COUNT);
#undef COUNT
UniqueSet<Map> string_maps_;
#ifdef DEBUG
int redundant_;
int removed_;
int removed_cho_;
int removed_cit_;
int narrowed_;
int loads_;
int empty_;
int compares_true_;
int compares_false_;
int transitions_;
#endif
};
} // namespace internal
} // namespace v8
#endif // V8_CRANKSHAFT_HYDROGEN_CHECK_ELIMINATION_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
ivica.bogosavljevic@imgtec.com
Miran.Karic@imgtec.com
dusan.simicic@imgtec.com
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
ivica.bogosavljevic@imgtec.com
Miran.Karic@imgtec.com
dusan.simicic@imgtec.com
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
jyan@ca.ibm.com
dstence@us.ibm.com
joransiu@ca.ibm.com
mbrandy@us.ibm.com
michael_dawson@ca.ibm.com
bjaideep@ca.ibm.com
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment