summaryrefslogtreecommitdiff
path: root/deps/v8/src/codegen/ia32
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-11-08 15:39:11 +0100
committerMichaël Zasso <targos@protonmail.com>2019-11-08 15:46:25 +0100
commit6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch)
tree33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/src/codegen/ia32
parent1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff)
downloadnode-new-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/src/codegen/ia32')
-rw-r--r--deps/v8/src/codegen/ia32/assembler-ia32-inl.h14
-rw-r--r--deps/v8/src/codegen/ia32/assembler-ia32.cc151
-rw-r--r--deps/v8/src/codegen/ia32/assembler-ia32.h144
-rw-r--r--deps/v8/src/codegen/ia32/macro-assembler-ia32.cc116
-rw-r--r--deps/v8/src/codegen/ia32/macro-assembler-ia32.h44
5 files changed, 262 insertions, 207 deletions
diff --git a/deps/v8/src/codegen/ia32/assembler-ia32-inl.h b/deps/v8/src/codegen/ia32/assembler-ia32-inl.h
index e274b41fa3..174a483868 100644
--- a/deps/v8/src/codegen/ia32/assembler-ia32-inl.h
+++ b/deps/v8/src/codegen/ia32/assembler-ia32-inl.h
@@ -39,6 +39,7 @@
#include "src/codegen/ia32/assembler-ia32.h"
+#include "src/base/memory.h"
#include "src/codegen/assembler.h"
#include "src/debug/debug.h"
#include "src/objects/objects-inl.h"
@@ -58,12 +59,12 @@ void RelocInfo::apply(intptr_t delta) {
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY)));
if (IsRuntimeEntry(rmode_) || IsCodeTarget(rmode_) ||
IsOffHeapTarget(rmode_)) {
- int32_t* p = reinterpret_cast<int32_t*>(pc_);
- *p -= delta; // Relocate entry.
+ base::WriteUnalignedValue(pc_,
+ base::ReadUnalignedValue<int32_t>(pc_) - delta);
} else if (IsInternalReference(rmode_)) {
- // absolute code pointer inside code object moves with the code object.
- int32_t* p = reinterpret_cast<int32_t*>(pc_);
- *p += delta; // Relocate entry.
+ // Absolute code pointer inside code object moves with the code object.
+ base::WriteUnalignedValue(pc_,
+ base::ReadUnalignedValue<int32_t>(pc_) + delta);
}
}
@@ -103,7 +104,8 @@ void RelocInfo::set_target_object(Heap* heap, HeapObject target,
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
FlushInstructionCache(pc_, sizeof(Address));
}
- if (write_barrier_mode == UPDATE_WRITE_BARRIER && !host().is_null()) {
+ if (write_barrier_mode == UPDATE_WRITE_BARRIER && !host().is_null() &&
+ !FLAG_disable_write_barriers) {
WriteBarrierForCode(host(), this, target);
}
}
diff --git a/deps/v8/src/codegen/ia32/assembler-ia32.cc b/deps/v8/src/codegen/ia32/assembler-ia32.cc
index aefcab7299..405e4b7c55 100644
--- a/deps/v8/src/codegen/ia32/assembler-ia32.cc
+++ b/deps/v8/src/codegen/ia32/assembler-ia32.cc
@@ -272,8 +272,8 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) {
Handle<HeapObject> object;
switch (request.kind()) {
case HeapObjectRequest::kHeapNumber:
- object = isolate->factory()->NewHeapNumber(request.heap_number(),
- AllocationType::kOld);
+ object = isolate->factory()->NewHeapNumber<AllocationType::kOld>(
+ request.heap_number());
break;
case HeapObjectRequest::kStringConstant: {
const StringConstantBase* str = request.string();
@@ -2163,70 +2163,6 @@ void Assembler::divsd(XMMRegister dst, Operand src) {
emit_sse_operand(dst, src);
}
-void Assembler::xorpd(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x66);
- EMIT(0x0F);
- EMIT(0x57);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::andps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x54);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::andnps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x55);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::orps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x56);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::xorps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x57);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::addps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x58);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::subps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x5C);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::mulps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x59);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::divps(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x0F);
- EMIT(0x5E);
- emit_sse_operand(dst, src);
-}
-
void Assembler::rcpps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
@@ -2234,29 +2170,31 @@ void Assembler::rcpps(XMMRegister dst, Operand src) {
emit_sse_operand(dst, src);
}
-void Assembler::rsqrtps(XMMRegister dst, Operand src) {
+void Assembler::sqrtps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
- EMIT(0x52);
+ EMIT(0x51);
emit_sse_operand(dst, src);
}
-void Assembler::minps(XMMRegister dst, Operand src) {
+void Assembler::rsqrtps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
- EMIT(0x5D);
+ EMIT(0x52);
emit_sse_operand(dst, src);
}
-void Assembler::maxps(XMMRegister dst, Operand src) {
+void Assembler::cmpps(XMMRegister dst, Operand src, uint8_t cmp) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
- EMIT(0x5F);
+ EMIT(0xC2);
emit_sse_operand(dst, src);
+ EMIT(cmp);
}
-void Assembler::cmpps(XMMRegister dst, Operand src, uint8_t cmp) {
+void Assembler::cmppd(XMMRegister dst, Operand src, uint8_t cmp) {
EnsureSpace ensure_space(this);
+ EMIT(0x66);
EMIT(0x0F);
EMIT(0xC2);
emit_sse_operand(dst, src);
@@ -2280,22 +2218,6 @@ void Assembler::haddps(XMMRegister dst, Operand src) {
emit_sse_operand(dst, src);
}
-void Assembler::andpd(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x66);
- EMIT(0x0F);
- EMIT(0x54);
- emit_sse_operand(dst, src);
-}
-
-void Assembler::orpd(XMMRegister dst, Operand src) {
- EnsureSpace ensure_space(this);
- EMIT(0x66);
- EMIT(0x0F);
- EMIT(0x56);
- emit_sse_operand(dst, src);
-}
-
void Assembler::ucomisd(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x66);
@@ -2398,6 +2320,16 @@ void Assembler::shufps(XMMRegister dst, XMMRegister src, byte imm8) {
EMIT(imm8);
}
+void Assembler::shufpd(XMMRegister dst, XMMRegister src, byte imm8) {
+ DCHECK(is_uint8(imm8));
+ EnsureSpace ensure_space(this);
+ EMIT(0x66);
+ EMIT(0x0F);
+ EMIT(0xC6);
+ emit_sse_operand(dst, src);
+ EMIT(imm8);
+}
+
void Assembler::movdqa(Operand dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x66);
@@ -2776,6 +2708,23 @@ void Assembler::minss(XMMRegister dst, Operand src) {
emit_sse_operand(dst, src);
}
+// Packed single-precision floating-point SSE instructions.
+void Assembler::ps(byte opcode, XMMRegister dst, Operand src) {
+ EnsureSpace ensure_space(this);
+ EMIT(0x0F);
+ EMIT(opcode);
+ emit_sse_operand(dst, src);
+}
+
+// Packed double-precision floating-point SSE instructions.
+void Assembler::pd(byte opcode, XMMRegister dst, Operand src) {
+ EnsureSpace ensure_space(this);
+ EMIT(0x66);
+ EMIT(0x0F);
+ EMIT(opcode);
+ emit_sse_operand(dst, src);
+}
+
// AVX instructions
void Assembler::vfmasd(byte op, XMMRegister dst, XMMRegister src1,
Operand src2) {
@@ -2811,12 +2760,25 @@ void Assembler::vpd(byte op, XMMRegister dst, XMMRegister src1, Operand src2) {
vinstr(op, dst, src1, src2, k66, k0F, kWIG);
}
+void Assembler::vshufpd(XMMRegister dst, XMMRegister src1, Operand src2,
+ byte imm8) {
+ DCHECK(is_uint8(imm8));
+ vpd(0xC6, dst, src1, src2);
+ EMIT(imm8);
+}
+
void Assembler::vcmpps(XMMRegister dst, XMMRegister src1, Operand src2,
uint8_t cmp) {
vps(0xC2, dst, src1, src2);
EMIT(cmp);
}
+void Assembler::vcmppd(XMMRegister dst, XMMRegister src1, Operand src2,
+ uint8_t cmp) {
+ vpd(0xC2, dst, src1, src2);
+ EMIT(cmp);
+}
+
void Assembler::vshufps(XMMRegister dst, XMMRegister src1, Operand src2,
byte imm8) {
DCHECK(is_uint8(imm8));
@@ -2848,6 +2810,12 @@ void Assembler::vpsrld(XMMRegister dst, XMMRegister src, uint8_t imm8) {
EMIT(imm8);
}
+void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, uint8_t imm8) {
+ XMMRegister iop = XMMRegister::from_code(2);
+ vinstr(0x73, iop, dst, Operand(src), k66, k0F, kWIG);
+ EMIT(imm8);
+}
+
void Assembler::vpsraw(XMMRegister dst, XMMRegister src, uint8_t imm8) {
XMMRegister iop = XMMRegister::from_code(4);
vinstr(0x71, iop, dst, Operand(src), k66, k0F, kWIG);
@@ -3158,11 +3126,10 @@ void Assembler::emit_operand(int code, Operand adr) {
DCHECK_GT(length, 0);
// Emit updated ModRM byte containing the given register.
- pc_[0] = (adr.buf_[0] & ~0x38) | (code << 3);
+ EMIT((adr.buf_[0] & ~0x38) | (code << 3));
// Emit the rest of the encoded operand.
- for (unsigned i = 1; i < length; i++) pc_[i] = adr.buf_[i];
- pc_ += length;
+ for (unsigned i = 1; i < length; i++) EMIT(adr.buf_[i]);
// Emit relocation information if necessary.
if (length >= sizeof(int32_t) && !RelocInfo::IsNone(adr.rmode_)) {
diff --git a/deps/v8/src/codegen/ia32/assembler-ia32.h b/deps/v8/src/codegen/ia32/assembler-ia32.h
index 5225621276..8161ff8322 100644
--- a/deps/v8/src/codegen/ia32/assembler-ia32.h
+++ b/deps/v8/src/codegen/ia32/assembler-ia32.h
@@ -38,6 +38,7 @@
#define V8_CODEGEN_IA32_ASSEMBLER_IA32_H_
#include <deque>
+#include <memory>
#include "src/codegen/assembler.h"
#include "src/codegen/ia32/constants-ia32.h"
@@ -292,7 +293,7 @@ class V8_EXPORT_PRIVATE Operand {
// Only valid if len_ > 4.
RelocInfo::Mode rmode_ = RelocInfo::NONE;
- // TODO(clemensh): Get rid of this friendship, or make Operand immutable.
+ // TODO(clemensb): Get rid of this friendship, or make Operand immutable.
friend class Assembler;
};
ASSERT_TRIVIALLY_COPYABLE(Operand);
@@ -371,7 +372,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// own buffer. Otherwise it takes ownership of the provided buffer.
explicit Assembler(const AssemblerOptions&,
std::unique_ptr<AssemblerBuffer> = {});
- virtual ~Assembler() {}
// GetCode emits any pending (non-emitted) code and fills the descriptor desc.
static constexpr int kNoHandlerTable = 0;
@@ -512,6 +512,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void movzx_w(Register dst, Operand src);
void movq(XMMRegister dst, Operand src);
+
// Conditional moves
void cmov(Condition cc, Register dst, Register src) {
cmov(cc, dst, Operand(src));
@@ -849,56 +850,54 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void movups(XMMRegister dst, Operand src);
void movups(Operand dst, XMMRegister src);
void shufps(XMMRegister dst, XMMRegister src, byte imm8);
+ void shufpd(XMMRegister dst, XMMRegister src, byte imm8);
void maxss(XMMRegister dst, XMMRegister src) { maxss(dst, Operand(src)); }
void maxss(XMMRegister dst, Operand src);
void minss(XMMRegister dst, XMMRegister src) { minss(dst, Operand(src)); }
void minss(XMMRegister dst, Operand src);
- void andps(XMMRegister dst, Operand src);
- void andps(XMMRegister dst, XMMRegister src) { andps(dst, Operand(src)); }
- void andnps(XMMRegister dst, Operand src);
- void andnps(XMMRegister dst, XMMRegister src) { andnps(dst, Operand(src)); }
- void xorps(XMMRegister dst, Operand src);
- void xorps(XMMRegister dst, XMMRegister src) { xorps(dst, Operand(src)); }
- void orps(XMMRegister dst, Operand src);
- void orps(XMMRegister dst, XMMRegister src) { orps(dst, Operand(src)); }
-
- void addps(XMMRegister dst, Operand src);
- void addps(XMMRegister dst, XMMRegister src) { addps(dst, Operand(src)); }
- void subps(XMMRegister dst, Operand src);
- void subps(XMMRegister dst, XMMRegister src) { subps(dst, Operand(src)); }
- void mulps(XMMRegister dst, Operand src);
- void mulps(XMMRegister dst, XMMRegister src) { mulps(dst, Operand(src)); }
- void divps(XMMRegister dst, Operand src);
- void divps(XMMRegister dst, XMMRegister src) { divps(dst, Operand(src)); }
void rcpps(XMMRegister dst, Operand src);
void rcpps(XMMRegister dst, XMMRegister src) { rcpps(dst, Operand(src)); }
+ void sqrtps(XMMRegister dst, Operand src);
+ void sqrtps(XMMRegister dst, XMMRegister src) { sqrtps(dst, Operand(src)); }
void rsqrtps(XMMRegister dst, Operand src);
void rsqrtps(XMMRegister dst, XMMRegister src) { rsqrtps(dst, Operand(src)); }
void haddps(XMMRegister dst, Operand src);
void haddps(XMMRegister dst, XMMRegister src) { haddps(dst, Operand(src)); }
-
- void minps(XMMRegister dst, Operand src);
- void minps(XMMRegister dst, XMMRegister src) { minps(dst, Operand(src)); }
- void maxps(XMMRegister dst, Operand src);
- void maxps(XMMRegister dst, XMMRegister src) { maxps(dst, Operand(src)); }
+ void sqrtpd(XMMRegister dst, Operand src) {
+ sse2_instr(dst, src, 0x66, 0x0F, 0x51);
+ }
+ void sqrtpd(XMMRegister dst, XMMRegister src) { sqrtpd(dst, Operand(src)); }
void cmpps(XMMRegister dst, Operand src, uint8_t cmp);
void cmpps(XMMRegister dst, XMMRegister src, uint8_t cmp) {
cmpps(dst, Operand(src), cmp);
}
-#define SSE_CMP_P(instr, imm8) \
- void instr##ps(XMMRegister dst, XMMRegister src) { \
- cmpps(dst, Operand(src), imm8); \
- } \
- void instr##ps(XMMRegister dst, Operand src) { cmpps(dst, src, imm8); }
+ void cmppd(XMMRegister dst, Operand src, uint8_t cmp);
+ void cmppd(XMMRegister dst, XMMRegister src, uint8_t cmp) {
+ cmppd(dst, Operand(src), cmp);
+ }
+
+// Packed floating-point comparison operations.
+#define PACKED_CMP_LIST(V) \
+ V(cmpeq, 0x0) \
+ V(cmplt, 0x1) \
+ V(cmple, 0x2) \
+ V(cmpunord, 0x3) \
+ V(cmpneq, 0x4)
- SSE_CMP_P(cmpeq, 0x0)
- SSE_CMP_P(cmplt, 0x1)
- SSE_CMP_P(cmple, 0x2)
- SSE_CMP_P(cmpneq, 0x4)
+#define SSE_CMP_P(instr, imm8) \
+ void instr##ps(XMMRegister dst, XMMRegister src) { \
+ cmpps(dst, Operand(src), imm8); \
+ } \
+ void instr##ps(XMMRegister dst, Operand src) { cmpps(dst, src, imm8); } \
+ void instr##pd(XMMRegister dst, XMMRegister src) { \
+ cmppd(dst, Operand(src), imm8); \
+ } \
+ void instr##pd(XMMRegister dst, Operand src) { cmppd(dst, src, imm8); }
+ PACKED_CMP_LIST(SSE_CMP_P)
#undef SSE_CMP_P
// SSE2 instructions
@@ -941,22 +940,20 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void mulsd(XMMRegister dst, Operand src);
void divsd(XMMRegister dst, XMMRegister src) { divsd(dst, Operand(src)); }
void divsd(XMMRegister dst, Operand src);
- void xorpd(XMMRegister dst, XMMRegister src) { xorpd(dst, Operand(src)); }
- void xorpd(XMMRegister dst, Operand src);
void sqrtsd(XMMRegister dst, XMMRegister src) { sqrtsd(dst, Operand(src)); }
void sqrtsd(XMMRegister dst, Operand src);
- void andpd(XMMRegister dst, XMMRegister src) { andpd(dst, Operand(src)); }
- void andpd(XMMRegister dst, Operand src);
- void orpd(XMMRegister dst, XMMRegister src) { orpd(dst, Operand(src)); }
- void orpd(XMMRegister dst, Operand src);
-
void ucomisd(XMMRegister dst, XMMRegister src) { ucomisd(dst, Operand(src)); }
void ucomisd(XMMRegister dst, Operand src);
void roundss(XMMRegister dst, XMMRegister src, RoundingMode mode);
void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode);
+ void movapd(XMMRegister dst, XMMRegister src) { movapd(dst, Operand(src)); }
+ void movapd(XMMRegister dst, Operand src) {
+ sse2_instr(dst, src, 0x66, 0x0F, 0x28);
+ }
+
void movmskpd(Register dst, XMMRegister src);
void movmskps(Register dst, XMMRegister src);
@@ -1298,6 +1295,10 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void vrcpps(XMMRegister dst, Operand src) {
vinstr(0x53, dst, xmm0, src, kNone, k0F, kWIG);
}
+ void vsqrtps(XMMRegister dst, XMMRegister src) { vsqrtps(dst, Operand(src)); }
+ void vsqrtps(XMMRegister dst, Operand src) {
+ vinstr(0x51, dst, xmm0, src, kNone, k0F, kWIG);
+ }
void vrsqrtps(XMMRegister dst, XMMRegister src) {
vrsqrtps(dst, Operand(src));
}
@@ -1310,14 +1311,24 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void vhaddps(XMMRegister dst, XMMRegister src1, Operand src2) {
vinstr(0x7C, dst, src1, src2, kF2, k0F, kWIG);
}
+ void vsqrtpd(XMMRegister dst, XMMRegister src) { vsqrtpd(dst, Operand(src)); }
+ void vsqrtpd(XMMRegister dst, Operand src) {
+ vinstr(0x51, dst, xmm0, src, k66, k0F, kWIG);
+ }
void vmovaps(XMMRegister dst, XMMRegister src) { vmovaps(dst, Operand(src)); }
void vmovaps(XMMRegister dst, Operand src) { vps(0x28, dst, xmm0, src); }
+ void vmovapd(XMMRegister dst, XMMRegister src) { vmovapd(dst, Operand(src)); }
+ void vmovapd(XMMRegister dst, Operand src) { vpd(0x28, dst, xmm0, src); }
void vmovups(XMMRegister dst, XMMRegister src) { vmovups(dst, Operand(src)); }
void vmovups(XMMRegister dst, Operand src) { vps(0x10, dst, xmm0, src); }
void vshufps(XMMRegister dst, XMMRegister src1, XMMRegister src2, byte imm8) {
vshufps(dst, src1, Operand(src2), imm8);
}
void vshufps(XMMRegister dst, XMMRegister src1, Operand src2, byte imm8);
+ void vshufpd(XMMRegister dst, XMMRegister src1, XMMRegister src2, byte imm8) {
+ vshufpd(dst, src1, Operand(src2), imm8);
+ }
+ void vshufpd(XMMRegister dst, XMMRegister src1, Operand src2, byte imm8);
void vpsllw(XMMRegister dst, XMMRegister src, uint8_t imm8);
void vpslld(XMMRegister dst, XMMRegister src, uint8_t imm8);
@@ -1325,6 +1336,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void vpsrld(XMMRegister dst, XMMRegister src, uint8_t imm8);
void vpsraw(XMMRegister dst, XMMRegister src, uint8_t imm8);
void vpsrad(XMMRegister dst, XMMRegister src, uint8_t imm8);
+ void vpsrlq(XMMRegister dst, XMMRegister src, uint8_t imm8);
void vpshufhw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
vpshufhw(dst, Operand(src), shuffle);
@@ -1489,6 +1501,11 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
}
void rorx(Register dst, Operand src, byte imm8);
+ // Implementation of packed single-precision floating-point SSE instructions.
+ void ps(byte op, XMMRegister dst, Operand src);
+ // Implementation of packed double-precision floating-point SSE instructions.
+ void pd(byte op, XMMRegister dst, Operand src);
+
#define PACKED_OP_LIST(V) \
V(and, 0x54) \
V(andn, 0x55) \
@@ -1501,6 +1518,19 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
V(div, 0x5e) \
V(max, 0x5f)
+#define SSE_PACKED_OP_DECLARE(name, opcode) \
+ void name##ps(XMMRegister dst, XMMRegister src) { \
+ ps(opcode, dst, Operand(src)); \
+ } \
+ void name##ps(XMMRegister dst, Operand src) { ps(opcode, dst, src); } \
+ void name##pd(XMMRegister dst, XMMRegister src) { \
+ pd(opcode, dst, Operand(src)); \
+ } \
+ void name##pd(XMMRegister dst, Operand src) { pd(opcode, dst, src); }
+
+ PACKED_OP_LIST(SSE_PACKED_OP_DECLARE)
+#undef SSE_PACKED_OP_DECLARE
+
#define AVX_PACKED_OP_DECLARE(name, opcode) \
void v##name##ps(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \
vps(opcode, dst, src1, Operand(src2)); \
@@ -1516,24 +1546,32 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
}
PACKED_OP_LIST(AVX_PACKED_OP_DECLARE)
+#undef AVX_PACKED_OP_DECLARE
+#undef PACKED_OP_LIST
+
void vps(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
void vpd(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
void vcmpps(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t cmp);
-#define AVX_CMP_P(instr, imm8) \
- void instr##ps(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \
- vcmpps(dst, src1, Operand(src2), imm8); \
- } \
- void instr##ps(XMMRegister dst, XMMRegister src1, Operand src2) { \
- vcmpps(dst, src1, src2, imm8); \
- }
-
- AVX_CMP_P(vcmpeq, 0x0)
- AVX_CMP_P(vcmplt, 0x1)
- AVX_CMP_P(vcmple, 0x2)
- AVX_CMP_P(vcmpneq, 0x4)
-
+ void vcmppd(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t cmp);
+
+#define AVX_CMP_P(instr, imm8) \
+ void v##instr##ps(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \
+ vcmpps(dst, src1, Operand(src2), imm8); \
+ } \
+ void v##instr##ps(XMMRegister dst, XMMRegister src1, Operand src2) { \
+ vcmpps(dst, src1, src2, imm8); \
+ } \
+ void v##instr##pd(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \
+ vcmppd(dst, src1, Operand(src2), imm8); \
+ } \
+ void v##instr##pd(XMMRegister dst, XMMRegister src1, Operand src2) { \
+ vcmppd(dst, src1, src2, imm8); \
+ }
+
+ PACKED_CMP_LIST(AVX_CMP_P)
#undef AVX_CMP_P
+#undef PACKED_CMP_LIST
// Other SSE and AVX instructions
#define DECLARE_SSE2_INSTRUCTION(instruction, prefix, escape, opcode) \
diff --git a/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc b/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc
index 070f315977..dd11bc496e 100644
--- a/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc
+++ b/deps/v8/src/codegen/ia32/macro-assembler-ia32.cc
@@ -1168,57 +1168,44 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
}
}
-void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
- const ParameterCount& expected,
- const ParameterCount& actual) {
- Label skip_hook;
-
- ExternalReference debug_hook_active =
- ExternalReference::debug_hook_on_function_call_address(isolate());
- push(eax);
- cmpb(ExternalReferenceAsOperand(debug_hook_active, eax), Immediate(0));
- pop(eax);
- j(equal, &skip_hook);
-
- {
- FrameScope frame(this,
- has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
- if (expected.is_reg()) {
- SmiTag(expected.reg());
- Push(expected.reg());
- }
- if (actual.is_reg()) {
- SmiTag(actual.reg());
- Push(actual.reg());
- SmiUntag(actual.reg());
- }
- if (new_target.is_valid()) {
- Push(new_target);
- }
- Push(fun);
- Push(fun);
- Operand receiver_op =
- actual.is_reg()
- ? Operand(ebp, actual.reg(), times_system_pointer_size,
- kSystemPointerSize * 2)
- : Operand(ebp, actual.immediate() * times_system_pointer_size +
- kSystemPointerSize * 2);
- Push(receiver_op);
- CallRuntime(Runtime::kDebugOnFunctionCall);
- Pop(fun);
- if (new_target.is_valid()) {
- Pop(new_target);
- }
- if (actual.is_reg()) {
- Pop(actual.reg());
- SmiUntag(actual.reg());
- }
- if (expected.is_reg()) {
- Pop(expected.reg());
- SmiUntag(expected.reg());
- }
+void MacroAssembler::CallDebugOnFunctionCall(Register fun, Register new_target,
+ const ParameterCount& expected,
+ const ParameterCount& actual) {
+ FrameScope frame(this, has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
+ if (expected.is_reg()) {
+ SmiTag(expected.reg());
+ Push(expected.reg());
+ }
+ if (actual.is_reg()) {
+ SmiTag(actual.reg());
+ Push(actual.reg());
+ SmiUntag(actual.reg());
+ }
+ if (new_target.is_valid()) {
+ Push(new_target);
+ }
+ Push(fun);
+ Push(fun);
+ Operand receiver_op =
+ actual.is_reg()
+ ? Operand(ebp, actual.reg(), times_system_pointer_size,
+ kSystemPointerSize * 2)
+ : Operand(ebp, actual.immediate() * times_system_pointer_size +
+ kSystemPointerSize * 2);
+ Push(receiver_op);
+ CallRuntime(Runtime::kDebugOnFunctionCall);
+ Pop(fun);
+ if (new_target.is_valid()) {
+ Pop(new_target);
+ }
+ if (actual.is_reg()) {
+ Pop(actual.reg());
+ SmiUntag(actual.reg());
+ }
+ if (expected.is_reg()) {
+ Pop(expected.reg());
+ SmiUntag(expected.reg());
}
- bind(&skip_hook);
}
void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
@@ -1233,7 +1220,16 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
DCHECK_IMPLIES(actual.is_reg(), actual.reg() == eax);
// On function call, call into the debugger if necessary.
- CheckDebugHook(function, new_target, expected, actual);
+ Label debug_hook, continue_after_hook;
+ {
+ ExternalReference debug_hook_active =
+ ExternalReference::debug_hook_on_function_call_address(isolate());
+ push(eax);
+ cmpb(ExternalReferenceAsOperand(debug_hook_active, eax), Immediate(0));
+ pop(eax);
+ j(not_equal, &debug_hook, Label::kNear);
+ }
+ bind(&continue_after_hook);
// Clear the new.target register if not given.
if (!new_target.is_valid()) {
@@ -1256,8 +1252,15 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
DCHECK(flag == JUMP_FUNCTION);
JumpCodeObject(ecx);
}
- bind(&done);
}
+ jmp(&done, Label::kNear);
+
+ // Deferred debug hook.
+ bind(&debug_hook);
+ CallDebugOnFunctionCall(function, new_target, expected, actual);
+ jmp(&continue_after_hook, Label::kNear);
+
+ bind(&done);
}
void MacroAssembler::InvokeFunction(Register fun, Register new_target,
@@ -1479,6 +1482,15 @@ void TurboAssembler::Psrlw(XMMRegister dst, uint8_t shift) {
}
}
+void TurboAssembler::Psrlq(XMMRegister dst, uint8_t shift) {
+ if (CpuFeatures::IsSupported(AVX)) {
+ CpuFeatureScope scope(this, AVX);
+ vpsrlq(dst, dst, shift);
+ } else {
+ psrlq(dst, shift);
+ }
+}
+
void TurboAssembler::Psignb(XMMRegister dst, Operand src) {
if (CpuFeatures::IsSupported(AVX)) {
CpuFeatureScope scope(this, AVX);
diff --git a/deps/v8/src/codegen/ia32/macro-assembler-ia32.h b/deps/v8/src/codegen/ia32/macro-assembler-ia32.h
index c65871cfad..9e7774c55d 100644
--- a/deps/v8/src/codegen/ia32/macro-assembler-ia32.h
+++ b/deps/v8/src/codegen/ia32/macro-assembler-ia32.h
@@ -237,6 +237,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Pshufd(XMMRegister dst, Operand src, uint8_t shuffle);
void Psraw(XMMRegister dst, uint8_t shift);
void Psrlw(XMMRegister dst, uint8_t shift);
+ void Psrlq(XMMRegister dst, uint8_t shift);
// SSE/SSE2 instructions with AVX version.
#define AVX_OP2_WITH_TYPE(macro_name, name, dst_type, src_type) \
@@ -258,6 +259,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
AVX_OP2_WITH_TYPE(Movd, movd, Register, XMMRegister)
AVX_OP2_WITH_TYPE(Movd, movd, Operand, XMMRegister)
AVX_OP2_WITH_TYPE(Cvtdq2ps, cvtdq2ps, XMMRegister, Operand)
+ AVX_OP2_WITH_TYPE(Sqrtpd, sqrtpd, XMMRegister, const Operand&)
+ AVX_OP2_WITH_TYPE(Movapd, movapd, XMMRegister, XMMRegister)
+ AVX_OP2_WITH_TYPE(Movapd, movapd, XMMRegister, const Operand&)
#undef AVX_OP2_WITH_TYPE
@@ -278,6 +282,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
AVX_OP3_XO(Packsswb, packsswb)
AVX_OP3_XO(Packuswb, packuswb)
+ AVX_OP3_XO(Paddusb, paddusb)
AVX_OP3_XO(Pcmpeqb, pcmpeqb)
AVX_OP3_XO(Pcmpeqw, pcmpeqw)
AVX_OP3_XO(Pcmpeqd, pcmpeqd)
@@ -294,10 +299,41 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
AVX_OP3_XO(Xorpd, xorpd)
AVX_OP3_XO(Sqrtss, sqrtss)
AVX_OP3_XO(Sqrtsd, sqrtsd)
+ AVX_OP3_XO(Orpd, orpd)
+ AVX_OP3_XO(Andnpd, andnpd)
#undef AVX_OP3_XO
#undef AVX_OP3_WITH_TYPE
+// Only use this macro when dst and src1 is the same in SSE case.
+#define AVX_PACKED_OP3_WITH_TYPE(macro_name, name, dst_type, src_type) \
+ void macro_name(dst_type dst, dst_type src1, src_type src2) { \
+ if (CpuFeatures::IsSupported(AVX)) { \
+ CpuFeatureScope scope(this, AVX); \
+ v##name(dst, src1, src2); \
+ } else { \
+ DCHECK_EQ(dst, src1); \
+ name(dst, src2); \
+ } \
+ }
+#define AVX_PACKED_OP3(macro_name, name) \
+ AVX_PACKED_OP3_WITH_TYPE(macro_name, name, XMMRegister, XMMRegister) \
+ AVX_PACKED_OP3_WITH_TYPE(macro_name, name, XMMRegister, Operand)
+
+ AVX_PACKED_OP3(Addpd, addpd)
+ AVX_PACKED_OP3(Subpd, subpd)
+ AVX_PACKED_OP3(Mulpd, mulpd)
+ AVX_PACKED_OP3(Divpd, divpd)
+ AVX_PACKED_OP3(Cmpeqpd, cmpeqpd)
+ AVX_PACKED_OP3(Cmpneqpd, cmpneqpd)
+ AVX_PACKED_OP3(Cmpltpd, cmpltpd)
+ AVX_PACKED_OP3(Cmplepd, cmplepd)
+ AVX_PACKED_OP3(Minpd, minpd)
+ AVX_PACKED_OP3(Maxpd, maxpd)
+ AVX_PACKED_OP3(Cmpunordpd, cmpunordpd)
+#undef AVX_PACKED_OP3
+#undef AVX_PACKED_OP3_WITH_TYPE
+
// Non-SSE2 instructions.
#define AVX_OP2_WITH_TYPE_SCOPE(macro_name, name, dst_type, src_type, \
sse_scope) \
@@ -529,11 +565,11 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
const ParameterCount& expected,
const ParameterCount& actual, InvokeFlag flag);
- // On function call, call into the debugger if necessary.
+ // On function call, call into the debugger.
// This may clobber ecx.
- void CheckDebugHook(Register fun, Register new_target,
- const ParameterCount& expected,
- const ParameterCount& actual);
+ void CallDebugOnFunctionCall(Register fun, Register new_target,
+ const ParameterCount& expected,
+ const ParameterCount& actual);
// Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking.