Reland of "Remove ExternalArray, derived types, and element kinds"
Original issue's description: > Remove ExternalArray, derived types, and element kinds > > BUG=v8:3996 > R=jarin@chromium.org, mvstanton@chromium.org, bmeurer@chromium.org > LOG=y > > Committed: https://crrev.com/607ef7c6009a24ebf195b4cab7b0b436c5afd21c > Cr-Commit-Position: refs/heads/master@{#29872} BUG=v8:3996 R=bmeurer@chromium.org LOG=y Review URL: https://codereview.chromium.org/1262583002 Cr-Commit-Position: refs/heads/master@{#29893}
This commit is contained in:
parent
029ca8ca6b
commit
fded08f694
@ -6946,7 +6946,7 @@ class Internals {
|
|||||||
static const int kNodeIsIndependentShift = 3;
|
static const int kNodeIsIndependentShift = 3;
|
||||||
static const int kNodeIsPartiallyDependentShift = 4;
|
static const int kNodeIsPartiallyDependentShift = 4;
|
||||||
|
|
||||||
static const int kJSObjectType = 0xbf;
|
static const int kJSObjectType = 0xb6;
|
||||||
static const int kFirstNonstringType = 0x80;
|
static const int kFirstNonstringType = 0x80;
|
||||||
static const int kOddballType = 0x83;
|
static const int kOddballType = 0x83;
|
||||||
static const int kForeignType = 0x87;
|
static const int kForeignType = 0x87;
|
||||||
|
@ -2237,7 +2237,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = NULL;
|
LOperand* obj = NULL;
|
||||||
if (instr->representation().IsDouble()) {
|
if (instr->representation().IsDouble()) {
|
||||||
obj = UseRegister(instr->elements());
|
obj = UseRegister(instr->elements());
|
||||||
@ -2257,10 +2257,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2295,7 +2294,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
||||||
LOperand* object = NULL;
|
LOperand* object = NULL;
|
||||||
|
@ -1647,15 +1647,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
ElementsKind elements_kind() const {
|
ElementsKind elements_kind() const {
|
||||||
return hydrogen()->elements_kind();
|
return hydrogen()->elements_kind();
|
||||||
}
|
}
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -2253,13 +2247,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = value;
|
inputs_[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -3187,17 +3187,13 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
DwVfpRegister result = ToDoubleRegister(instr->result());
|
DwVfpRegister result = ToDoubleRegister(instr->result());
|
||||||
Operand operand = key_is_constant
|
Operand operand = key_is_constant
|
||||||
? Operand(constant_key << element_size_shift)
|
? Operand(constant_key << element_size_shift)
|
||||||
: Operand(key, LSL, shift_size);
|
: Operand(key, LSL, shift_size);
|
||||||
__ add(scratch0(), external_pointer, operand);
|
__ add(scratch0(), external_pointer, operand);
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ vldr(double_scratch0().low(), scratch0(), base_offset);
|
__ vldr(double_scratch0().low(), scratch0(), base_offset);
|
||||||
__ vcvt_f64_f32(result, double_scratch0().low());
|
__ vcvt_f64_f32(result, double_scratch0().low());
|
||||||
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
||||||
@ -3209,29 +3205,22 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
key, external_pointer, key_is_constant, constant_key,
|
key, external_pointer, key_is_constant, constant_key,
|
||||||
element_size_shift, shift_size, base_offset);
|
element_size_shift, shift_size, base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ ldrsb(result, mem_operand);
|
__ ldrsb(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ ldrb(result, mem_operand);
|
__ ldrb(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ ldrsh(result, mem_operand);
|
__ ldrsh(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ ldrh(result, mem_operand);
|
__ ldrh(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ ldr(result, mem_operand);
|
__ ldr(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ ldr(result, mem_operand);
|
__ ldr(result, mem_operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3241,8 +3230,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||||
case FAST_HOLEY_ELEMENTS:
|
case FAST_HOLEY_ELEMENTS:
|
||||||
case FAST_HOLEY_SMI_ELEMENTS:
|
case FAST_HOLEY_SMI_ELEMENTS:
|
||||||
@ -3352,7 +3339,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4311,10 +4298,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
Register address = scratch0();
|
Register address = scratch0();
|
||||||
DwVfpRegister value(ToDoubleRegister(instr->value()));
|
DwVfpRegister value(ToDoubleRegister(instr->value()));
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4327,8 +4311,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
} else {
|
} else {
|
||||||
__ add(address, external_pointer, Operand(key, LSL, shift_size));
|
__ add(address, external_pointer, Operand(key, LSL, shift_size));
|
||||||
}
|
}
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ vcvt_f32_f64(double_scratch0().low(), value);
|
__ vcvt_f32_f64(double_scratch0().low(), value);
|
||||||
__ vstr(double_scratch0().low(), address, base_offset);
|
__ vstr(double_scratch0().low(), address, base_offset);
|
||||||
} else { // Storing doubles, not floats.
|
} else { // Storing doubles, not floats.
|
||||||
@ -4341,30 +4324,21 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
element_size_shift, shift_size,
|
element_size_shift, shift_size,
|
||||||
base_offset);
|
base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ strb(value, mem_operand);
|
__ strb(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ strh(value, mem_operand);
|
__ strh(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ str(value, mem_operand);
|
__ str(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4470,7 +4444,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases: external, fast double
|
// By cases: external, fast double
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -1728,7 +1728,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* elements = UseRegister(instr->elements());
|
LOperand* elements = UseRegister(instr->elements());
|
||||||
LOperand* key = UseRegisterOrConstant(instr->key());
|
LOperand* key = UseRegisterOrConstant(instr->key());
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
if (instr->representation().IsDouble()) {
|
if (instr->representation().IsDouble()) {
|
||||||
LOperand* temp = (!instr->key()->IsConstant() ||
|
LOperand* temp = (!instr->key()->IsConstant() ||
|
||||||
instr->RequiresHoleCheck())
|
instr->RequiresHoleCheck())
|
||||||
@ -1762,8 +1762,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister();
|
LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister();
|
||||||
LInstruction* result = DefineAsRegister(
|
LInstruction* result = DefineAsRegister(
|
||||||
new(zone()) LLoadKeyedExternal(elements, key, temp));
|
new(zone()) LLoadKeyedExternal(elements, key, temp));
|
||||||
if ((elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
if (elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32)) {
|
!instr->CheckFlag(HInstruction::kUint32)) {
|
||||||
result = AssignEnvironment(result);
|
result = AssignEnvironment(result);
|
||||||
}
|
}
|
||||||
@ -2367,7 +2366,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
|||||||
LOperand* elements = NULL;
|
LOperand* elements = NULL;
|
||||||
LOperand* val = NULL;
|
LOperand* val = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements() &&
|
if (!instr->is_fixed_typed_array() &&
|
||||||
instr->value()->representation().IsTagged() &&
|
instr->value()->representation().IsTagged() &&
|
||||||
instr->NeedsWriteBarrier()) {
|
instr->NeedsWriteBarrier()) {
|
||||||
// RecordWrite() will clobber all registers.
|
// RecordWrite() will clobber all registers.
|
||||||
@ -2380,7 +2379,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
|||||||
temp = instr->key()->IsConstant() ? NULL : TempRegister();
|
temp = instr->key()->IsConstant() ? NULL : TempRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DCHECK((instr->value()->representation().IsInteger32() &&
|
DCHECK((instr->value()->representation().IsInteger32() &&
|
||||||
!IsDoubleOrFloatElementsKind(instr->elements_kind())) ||
|
!IsDoubleOrFloatElementsKind(instr->elements_kind())) ||
|
||||||
(instr->value()->representation().IsDouble() &&
|
(instr->value()->representation().IsDouble() &&
|
||||||
|
@ -3455,42 +3455,33 @@ void LCodeGen::DoLoadKeyedExternal(LLoadKeyedExternal* instr) {
|
|||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset());
|
instr->base_offset());
|
||||||
|
|
||||||
if ((elements_kind == EXTERNAL_FLOAT32_ELEMENTS) ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
(elements_kind == FLOAT32_ELEMENTS)) {
|
|
||||||
DoubleRegister result = ToDoubleRegister(instr->result());
|
DoubleRegister result = ToDoubleRegister(instr->result());
|
||||||
__ Ldr(result.S(), mem_op);
|
__ Ldr(result.S(), mem_op);
|
||||||
__ Fcvt(result, result.S());
|
__ Fcvt(result, result.S());
|
||||||
} else if ((elements_kind == EXTERNAL_FLOAT64_ELEMENTS) ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
(elements_kind == FLOAT64_ELEMENTS)) {
|
|
||||||
DoubleRegister result = ToDoubleRegister(instr->result());
|
DoubleRegister result = ToDoubleRegister(instr->result());
|
||||||
__ Ldr(result, mem_op);
|
__ Ldr(result, mem_op);
|
||||||
} else {
|
} else {
|
||||||
Register result = ToRegister(instr->result());
|
Register result = ToRegister(instr->result());
|
||||||
|
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ Ldrsb(result, mem_op);
|
__ Ldrsb(result, mem_op);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ Ldrb(result, mem_op);
|
__ Ldrb(result, mem_op);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ Ldrsh(result, mem_op);
|
__ Ldrsh(result, mem_op);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ Ldrh(result, mem_op);
|
__ Ldrh(result, mem_op);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ Ldrsw(result, mem_op);
|
__ Ldrsw(result, mem_op);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ Ldr(result.W(), mem_op);
|
__ Ldr(result.W(), mem_op);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3501,8 +3492,6 @@ void LCodeGen::DoLoadKeyedExternal(LLoadKeyedExternal* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||||
case FAST_HOLEY_ELEMENTS:
|
case FAST_HOLEY_ELEMENTS:
|
||||||
case FAST_HOLEY_SMI_ELEMENTS:
|
case FAST_HOLEY_SMI_ELEMENTS:
|
||||||
@ -5177,44 +5166,33 @@ void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) {
|
|||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset());
|
instr->base_offset());
|
||||||
|
|
||||||
if ((elements_kind == EXTERNAL_FLOAT32_ELEMENTS) ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
(elements_kind == FLOAT32_ELEMENTS)) {
|
|
||||||
DoubleRegister value = ToDoubleRegister(instr->value());
|
DoubleRegister value = ToDoubleRegister(instr->value());
|
||||||
DoubleRegister dbl_scratch = double_scratch();
|
DoubleRegister dbl_scratch = double_scratch();
|
||||||
__ Fcvt(dbl_scratch.S(), value);
|
__ Fcvt(dbl_scratch.S(), value);
|
||||||
__ Str(dbl_scratch.S(), dst);
|
__ Str(dbl_scratch.S(), dst);
|
||||||
} else if ((elements_kind == EXTERNAL_FLOAT64_ELEMENTS) ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
(elements_kind == FLOAT64_ELEMENTS)) {
|
|
||||||
DoubleRegister value = ToDoubleRegister(instr->value());
|
DoubleRegister value = ToDoubleRegister(instr->value());
|
||||||
__ Str(value, dst);
|
__ Str(value, dst);
|
||||||
} else {
|
} else {
|
||||||
Register value = ToRegister(instr->value());
|
Register value = ToRegister(instr->value());
|
||||||
|
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ Strb(value, dst);
|
__ Strb(value, dst);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ Strh(value, dst);
|
__ Strh(value, dst);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ Str(value.W(), dst);
|
__ Str(value.W(), dst);
|
||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
|
@ -235,11 +235,8 @@ class Genesis BASE_EMBEDDED {
|
|||||||
ElementsKind elements_kind);
|
ElementsKind elements_kind);
|
||||||
bool InstallNatives(ContextType context_type);
|
bool InstallNatives(ContextType context_type);
|
||||||
|
|
||||||
void InstallTypedArray(
|
void InstallTypedArray(const char* name, ElementsKind elements_kind,
|
||||||
const char* name,
|
Handle<JSFunction>* fun);
|
||||||
ElementsKind elements_kind,
|
|
||||||
Handle<JSFunction>* fun,
|
|
||||||
Handle<Map>* external_map);
|
|
||||||
bool InstallExperimentalNatives();
|
bool InstallExperimentalNatives();
|
||||||
bool InstallExtraNatives();
|
bool InstallExtraNatives();
|
||||||
void InstallBuiltinFunctionIds();
|
void InstallBuiltinFunctionIds();
|
||||||
@ -1284,17 +1281,12 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ // -- T y p e d A r r a y s
|
{ // -- T y p e d A r r a y s
|
||||||
#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
||||||
{ \
|
{ \
|
||||||
Handle<JSFunction> fun; \
|
Handle<JSFunction> fun; \
|
||||||
Handle<Map> external_map; \
|
InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \
|
||||||
InstallTypedArray(#Type "Array", \
|
native_context()->set_##type##_array_fun(*fun); \
|
||||||
TYPE##_ELEMENTS, \
|
}
|
||||||
&fun, \
|
|
||||||
&external_map); \
|
|
||||||
native_context()->set_##type##_array_fun(*fun); \
|
|
||||||
native_context()->set_##type##_array_external_map(*external_map); \
|
|
||||||
}
|
|
||||||
TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
|
TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
|
||||||
#undef INSTALL_TYPED_ARRAY
|
#undef INSTALL_TYPED_ARRAY
|
||||||
|
|
||||||
@ -1505,11 +1497,8 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Genesis::InstallTypedArray(
|
void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind,
|
||||||
const char* name,
|
Handle<JSFunction>* fun) {
|
||||||
ElementsKind elements_kind,
|
|
||||||
Handle<JSFunction>* fun,
|
|
||||||
Handle<Map>* external_map) {
|
|
||||||
Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
|
Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
|
||||||
Handle<JSFunction> result = InstallFunction(
|
Handle<JSFunction> result = InstallFunction(
|
||||||
global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize,
|
global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize,
|
||||||
@ -1522,9 +1511,6 @@ void Genesis::InstallTypedArray(
|
|||||||
JSFunction::SetInitialMap(result, initial_map,
|
JSFunction::SetInitialMap(result, initial_map,
|
||||||
handle(initial_map->prototype(), isolate()));
|
handle(initial_map->prototype(), isolate()));
|
||||||
*fun = result;
|
*fun = result;
|
||||||
|
|
||||||
ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind);
|
|
||||||
*external_map = Map::AsElementsKind(initial_map, external_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1987,13 +1987,6 @@ class CodeStubGraphBuilder<KeyedLoadGenericStub>
|
|||||||
HValue* bit_field2,
|
HValue* bit_field2,
|
||||||
ElementsKind kind);
|
ElementsKind kind);
|
||||||
|
|
||||||
void BuildExternalElementLoad(HGraphBuilder::IfBuilder* if_builder,
|
|
||||||
HValue* receiver,
|
|
||||||
HValue* key,
|
|
||||||
HValue* instance_type,
|
|
||||||
HValue* bit_field2,
|
|
||||||
ElementsKind kind);
|
|
||||||
|
|
||||||
KeyedLoadGenericStub* casted_stub() {
|
KeyedLoadGenericStub* casted_stub() {
|
||||||
return static_cast<KeyedLoadGenericStub*>(stub());
|
return static_cast<KeyedLoadGenericStub*>(stub());
|
||||||
}
|
}
|
||||||
@ -2015,8 +2008,6 @@ void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildElementsKindLimitCheck(
|
|||||||
void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
|
void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
|
||||||
HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
|
HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
|
||||||
HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
|
HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
|
||||||
DCHECK(!IsExternalArrayElementsKind(kind));
|
|
||||||
|
|
||||||
BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
|
BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
|
||||||
|
|
||||||
IfBuilder js_array_check(this);
|
IfBuilder js_array_check(this);
|
||||||
@ -2036,20 +2027,6 @@ void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildExternalElementLoad(
|
|
||||||
HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
|
|
||||||
HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
|
|
||||||
DCHECK(IsExternalArrayElementsKind(kind));
|
|
||||||
|
|
||||||
BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
|
|
||||||
|
|
||||||
Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
|
|
||||||
false, kind,
|
|
||||||
LOAD, NEVER_RETURN_HOLE,
|
|
||||||
STANDARD_STORE));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
|
HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
|
||||||
HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
|
HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
|
||||||
HValue* key = GetParameter(LoadDescriptor::kNameIndex);
|
HValue* key = GetParameter(LoadDescriptor::kNameIndex);
|
||||||
@ -2111,42 +2088,6 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
|
|||||||
Deoptimizer::EAGER);
|
Deoptimizer::EAGER);
|
||||||
Push(graph()->GetConstant0());
|
Push(graph()->GetConstant0());
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_INT8_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_UINT8_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_INT16_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_UINT16_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_INT32_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_UINT32_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_FLOAT32_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_FLOAT64_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.Else();
|
|
||||||
BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
|
|
||||||
EXTERNAL_UINT8_CLAMPED_ELEMENTS);
|
|
||||||
|
|
||||||
kind_if.ElseDeopt(
|
kind_if.ElseDeopt(
|
||||||
Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub);
|
Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub);
|
||||||
|
|
||||||
@ -2234,7 +2175,7 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
|
|||||||
index->ClearFlag(HValue::kCanOverflow);
|
index->ClearFlag(HValue::kCanOverflow);
|
||||||
HValue* property_index =
|
HValue* property_index =
|
||||||
Add<HLoadKeyed>(cache_field_offsets, index, nullptr,
|
Add<HLoadKeyed>(cache_field_offsets, index, nullptr,
|
||||||
EXTERNAL_INT32_ELEMENTS, NEVER_RETURN_HOLE, 0);
|
INT32_ELEMENTS, NEVER_RETURN_HOLE, 0);
|
||||||
Push(property_index);
|
Push(property_index);
|
||||||
}
|
}
|
||||||
lookup_if->Else();
|
lookup_if->Else();
|
||||||
|
@ -807,7 +807,6 @@ void StoreElementStub::Generate(MacroAssembler* masm) {
|
|||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS:
|
case TYPE##_ELEMENTS:
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
|
@ -80,14 +80,6 @@ FieldAccess AccessBuilder::ForFixedArrayLength() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
|
||||||
FieldAccess AccessBuilder::ForExternalArrayPointer() {
|
|
||||||
FieldAccess access = {kTaggedBase, ExternalArray::kExternalPointerOffset,
|
|
||||||
MaybeHandle<Name>(), Type::UntaggedPointer(), kMachPtr};
|
|
||||||
return access;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() {
|
FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() {
|
||||||
FieldAccess access = {kTaggedBase, DescriptorArray::kEnumCacheOffset,
|
FieldAccess access = {kTaggedBase, DescriptorArray::kEnumCacheOffset,
|
||||||
|
@ -43,9 +43,6 @@ class AccessBuilder final : public AllStatic {
|
|||||||
// Provides access to FixedArray::length() field.
|
// Provides access to FixedArray::length() field.
|
||||||
static FieldAccess ForFixedArrayLength();
|
static FieldAccess ForFixedArrayLength();
|
||||||
|
|
||||||
// Provides access to ExternalArray::external_pointer() field.
|
|
||||||
static FieldAccess ForExternalArrayPointer();
|
|
||||||
|
|
||||||
// Provides access to DescriptorArray::enum_cache() field.
|
// Provides access to DescriptorArray::enum_cache() field.
|
||||||
static FieldAccess ForDescriptorArrayEnumCache();
|
static FieldAccess ForDescriptorArrayEnumCache();
|
||||||
|
|
||||||
|
@ -832,11 +832,10 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
|
|||||||
size_t const k = ElementSizeLog2Of(access.machine_type());
|
size_t const k = ElementSizeLog2Of(access.machine_type());
|
||||||
double const byte_length = array->byte_length()->Number();
|
double const byte_length = array->byte_length()->Number();
|
||||||
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
||||||
if (IsExternalArrayElementsKind(array->map()->elements_kind()) &&
|
if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
|
||||||
key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
|
|
||||||
// JSLoadProperty(typed-array, int32)
|
// JSLoadProperty(typed-array, int32)
|
||||||
Handle<ExternalArray> elements =
|
Handle<FixedTypedArrayBase> elements =
|
||||||
Handle<ExternalArray>::cast(handle(array->elements()));
|
Handle<FixedTypedArrayBase>::cast(handle(array->elements()));
|
||||||
Node* buffer = jsgraph()->PointerConstant(elements->external_pointer());
|
Node* buffer = jsgraph()->PointerConstant(elements->external_pointer());
|
||||||
Node* length = jsgraph()->Constant(byte_length);
|
Node* length = jsgraph()->Constant(byte_length);
|
||||||
Node* effect = NodeProperties::GetEffectInput(node);
|
Node* effect = NodeProperties::GetEffectInput(node);
|
||||||
@ -879,12 +878,11 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
|
|||||||
size_t const k = ElementSizeLog2Of(access.machine_type());
|
size_t const k = ElementSizeLog2Of(access.machine_type());
|
||||||
double const byte_length = array->byte_length()->Number();
|
double const byte_length = array->byte_length()->Number();
|
||||||
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
||||||
if (IsExternalArrayElementsKind(array->map()->elements_kind()) &&
|
if (access.external_array_type() != kExternalUint8ClampedArray &&
|
||||||
access.external_array_type() != kExternalUint8ClampedArray &&
|
|
||||||
key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
|
key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
|
||||||
// JSLoadProperty(typed-array, int32)
|
// JSLoadProperty(typed-array, int32)
|
||||||
Handle<ExternalArray> elements =
|
Handle<FixedTypedArrayBase> elements =
|
||||||
Handle<ExternalArray>::cast(handle(array->elements()));
|
Handle<FixedTypedArrayBase>::cast(handle(array->elements()));
|
||||||
Node* buffer = jsgraph()->PointerConstant(elements->external_pointer());
|
Node* buffer = jsgraph()->PointerConstant(elements->external_pointer());
|
||||||
Node* length = jsgraph()->Constant(byte_length);
|
Node* length = jsgraph()->Constant(byte_length);
|
||||||
Node* context = NodeProperties::GetContextInput(node);
|
Node* context = NodeProperties::GetContextInput(node);
|
||||||
|
@ -115,16 +115,6 @@ enum BindingFlags {
|
|||||||
V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
|
V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
|
||||||
V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
|
V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
|
||||||
V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
|
V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
|
||||||
V(INT8_ARRAY_EXTERNAL_MAP_INDEX, Map, int8_array_external_map) \
|
|
||||||
V(UINT8_ARRAY_EXTERNAL_MAP_INDEX, Map, uint8_array_external_map) \
|
|
||||||
V(INT16_ARRAY_EXTERNAL_MAP_INDEX, Map, int16_array_external_map) \
|
|
||||||
V(UINT16_ARRAY_EXTERNAL_MAP_INDEX, Map, uint16_array_external_map) \
|
|
||||||
V(INT32_ARRAY_EXTERNAL_MAP_INDEX, Map, int32_array_external_map) \
|
|
||||||
V(UINT32_ARRAY_EXTERNAL_MAP_INDEX, Map, uint32_array_external_map) \
|
|
||||||
V(FLOAT32_ARRAY_EXTERNAL_MAP_INDEX, Map, float32_array_external_map) \
|
|
||||||
V(FLOAT64_ARRAY_EXTERNAL_MAP_INDEX, Map, float64_array_external_map) \
|
|
||||||
V(UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX, Map, \
|
|
||||||
uint8_clamped_array_external_map) \
|
|
||||||
V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
|
V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
|
||||||
V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
|
V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
|
||||||
V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
|
V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
|
||||||
|
@ -15,26 +15,17 @@ namespace internal {
|
|||||||
|
|
||||||
int ElementsKindToShiftSize(ElementsKind elements_kind) {
|
int ElementsKindToShiftSize(ElementsKind elements_kind) {
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
return 0;
|
return 0;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
return 1;
|
return 1;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
return 2;
|
return 2;
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
@ -53,16 +44,10 @@ int ElementsKindToShiftSize(ElementsKind elements_kind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool IsTypedArrayElementsKind(ElementsKind elements_kind) {
|
|
||||||
return IsFixedTypedArrayElementsKind(elements_kind) ||
|
|
||||||
IsExternalArrayElementsKind(elements_kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) {
|
int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) {
|
||||||
STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize);
|
STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize);
|
||||||
|
|
||||||
if (IsTypedArrayElementsKind(elements_kind)) {
|
if (IsFixedTypedArrayElementsKind(elements_kind)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return FixedArray::kHeaderSize - kHeapObjectTag;
|
return FixedArray::kHeaderSize - kHeapObjectTag;
|
||||||
@ -125,17 +110,8 @@ int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind) {
|
|||||||
|
|
||||||
|
|
||||||
ElementsKind GetNextTransitionElementsKind(ElementsKind kind) {
|
ElementsKind GetNextTransitionElementsKind(ElementsKind kind) {
|
||||||
switch (kind) {
|
int index = GetSequenceIndexFromFastElementsKind(kind);
|
||||||
#define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
return GetFastElementsKindFromSequenceIndex(index + 1);
|
||||||
case TYPE##_ELEMENTS: return EXTERNAL_##TYPE##_ELEMENTS;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE)
|
|
||||||
#undef FIXED_TYPED_ARRAY_CASE
|
|
||||||
default: {
|
|
||||||
int index = GetSequenceIndexFromFastElementsKind(kind);
|
|
||||||
return GetFastElementsKindFromSequenceIndex(index + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,18 +122,9 @@ static inline bool IsFastTransitionTarget(ElementsKind elements_kind) {
|
|||||||
|
|
||||||
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
|
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
|
||||||
ElementsKind to_kind) {
|
ElementsKind to_kind) {
|
||||||
if (IsTypedArrayElementsKind(from_kind) ||
|
if (IsFixedTypedArrayElementsKind(from_kind) ||
|
||||||
IsTypedArrayElementsKind(to_kind)) {
|
IsFixedTypedArrayElementsKind(to_kind)) {
|
||||||
switch (from_kind) {
|
return false;
|
||||||
#define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
|
||||||
case TYPE##_ELEMENTS: \
|
|
||||||
return to_kind == EXTERNAL_##TYPE##_ELEMENTS;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE);
|
|
||||||
#undef FIXED_TYPED_ARRAY_CASE
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (IsFastElementsKind(from_kind) && IsFastTransitionTarget(to_kind)) {
|
if (IsFastElementsKind(from_kind) && IsFastTransitionTarget(to_kind)) {
|
||||||
switch (from_kind) {
|
switch (from_kind) {
|
||||||
|
@ -33,17 +33,6 @@ enum ElementsKind {
|
|||||||
FAST_SLOPPY_ARGUMENTS_ELEMENTS,
|
FAST_SLOPPY_ARGUMENTS_ELEMENTS,
|
||||||
SLOW_SLOPPY_ARGUMENTS_ELEMENTS,
|
SLOW_SLOPPY_ARGUMENTS_ELEMENTS,
|
||||||
|
|
||||||
// The "fast" kind for external arrays
|
|
||||||
EXTERNAL_INT8_ELEMENTS,
|
|
||||||
EXTERNAL_UINT8_ELEMENTS,
|
|
||||||
EXTERNAL_INT16_ELEMENTS,
|
|
||||||
EXTERNAL_UINT16_ELEMENTS,
|
|
||||||
EXTERNAL_INT32_ELEMENTS,
|
|
||||||
EXTERNAL_UINT32_ELEMENTS,
|
|
||||||
EXTERNAL_FLOAT32_ELEMENTS,
|
|
||||||
EXTERNAL_FLOAT64_ELEMENTS,
|
|
||||||
EXTERNAL_UINT8_CLAMPED_ELEMENTS,
|
|
||||||
|
|
||||||
// Fixed typed arrays
|
// Fixed typed arrays
|
||||||
UINT8_ELEMENTS,
|
UINT8_ELEMENTS,
|
||||||
INT8_ELEMENTS,
|
INT8_ELEMENTS,
|
||||||
@ -60,8 +49,6 @@ enum ElementsKind {
|
|||||||
LAST_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
LAST_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
||||||
FIRST_FAST_ELEMENTS_KIND = FAST_SMI_ELEMENTS,
|
FIRST_FAST_ELEMENTS_KIND = FAST_SMI_ELEMENTS,
|
||||||
LAST_FAST_ELEMENTS_KIND = FAST_HOLEY_DOUBLE_ELEMENTS,
|
LAST_FAST_ELEMENTS_KIND = FAST_HOLEY_DOUBLE_ELEMENTS,
|
||||||
FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_INT8_ELEMENTS,
|
|
||||||
LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_UINT8_CLAMPED_ELEMENTS,
|
|
||||||
FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_ELEMENTS,
|
FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_ELEMENTS,
|
||||||
LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND = UINT8_CLAMPED_ELEMENTS,
|
||||||
TERMINAL_FAST_ELEMENTS_KIND = FAST_HOLEY_ELEMENTS
|
TERMINAL_FAST_ELEMENTS_KIND = FAST_HOLEY_ELEMENTS
|
||||||
@ -97,21 +84,15 @@ inline bool IsSloppyArgumentsElements(ElementsKind kind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool IsExternalArrayElementsKind(ElementsKind kind) {
|
inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) {
|
||||||
return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
|
return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
|
||||||
kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND;
|
kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool IsTerminalElementsKind(ElementsKind kind) {
|
inline bool IsTerminalElementsKind(ElementsKind kind) {
|
||||||
return kind == TERMINAL_FAST_ELEMENTS_KIND ||
|
return kind == TERMINAL_FAST_ELEMENTS_KIND ||
|
||||||
IsExternalArrayElementsKind(kind);
|
IsFixedTypedArrayElementsKind(kind);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) {
|
|
||||||
return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
|
|
||||||
kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,21 +114,13 @@ inline bool IsFastDoubleElementsKind(ElementsKind kind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) {
|
|
||||||
return kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
kind == EXTERNAL_FLOAT32_ELEMENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool IsFixedFloatElementsKind(ElementsKind kind) {
|
inline bool IsFixedFloatElementsKind(ElementsKind kind) {
|
||||||
return kind == FLOAT32_ELEMENTS || kind == FLOAT64_ELEMENTS;
|
return kind == FLOAT32_ELEMENTS || kind == FLOAT64_ELEMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool IsDoubleOrFloatElementsKind(ElementsKind kind) {
|
inline bool IsDoubleOrFloatElementsKind(ElementsKind kind) {
|
||||||
return IsFastDoubleElementsKind(kind) ||
|
return IsFastDoubleElementsKind(kind) || IsFixedFloatElementsKind(kind);
|
||||||
IsExternalFloatOrDoubleElementsKind(kind) ||
|
|
||||||
IsFixedFloatElementsKind(kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,15 +27,6 @@
|
|||||||
// - FastPackedDoubleElementsAccessor
|
// - FastPackedDoubleElementsAccessor
|
||||||
// - FastHoleyDoubleElementsAccessor
|
// - FastHoleyDoubleElementsAccessor
|
||||||
// - TypedElementsAccessor: template, with instantiations:
|
// - TypedElementsAccessor: template, with instantiations:
|
||||||
// - ExternalInt8ElementsAccessor
|
|
||||||
// - ExternalUint8ElementsAccessor
|
|
||||||
// - ExternalInt16ElementsAccessor
|
|
||||||
// - ExternalUint16ElementsAccessor
|
|
||||||
// - ExternalInt32ElementsAccessor
|
|
||||||
// - ExternalUint32ElementsAccessor
|
|
||||||
// - ExternalFloat32ElementsAccessor
|
|
||||||
// - ExternalFloat64ElementsAccessor
|
|
||||||
// - ExternalUint8ClampedElementsAccessor
|
|
||||||
// - FixedUint8ElementsAccessor
|
// - FixedUint8ElementsAccessor
|
||||||
// - FixedInt8ElementsAccessor
|
// - FixedInt8ElementsAccessor
|
||||||
// - FixedUint16ElementsAccessor
|
// - FixedUint16ElementsAccessor
|
||||||
@ -79,23 +70,6 @@ static const int kPackedSizeNotKnown = -1;
|
|||||||
FixedArray) \
|
FixedArray) \
|
||||||
V(SlowSloppyArgumentsElementsAccessor, SLOW_SLOPPY_ARGUMENTS_ELEMENTS, \
|
V(SlowSloppyArgumentsElementsAccessor, SLOW_SLOPPY_ARGUMENTS_ELEMENTS, \
|
||||||
FixedArray) \
|
FixedArray) \
|
||||||
V(ExternalInt8ElementsAccessor, EXTERNAL_INT8_ELEMENTS, ExternalInt8Array) \
|
|
||||||
V(ExternalUint8ElementsAccessor, EXTERNAL_UINT8_ELEMENTS, \
|
|
||||||
ExternalUint8Array) \
|
|
||||||
V(ExternalInt16ElementsAccessor, EXTERNAL_INT16_ELEMENTS, \
|
|
||||||
ExternalInt16Array) \
|
|
||||||
V(ExternalUint16ElementsAccessor, EXTERNAL_UINT16_ELEMENTS, \
|
|
||||||
ExternalUint16Array) \
|
|
||||||
V(ExternalInt32ElementsAccessor, EXTERNAL_INT32_ELEMENTS, \
|
|
||||||
ExternalInt32Array) \
|
|
||||||
V(ExternalUint32ElementsAccessor, EXTERNAL_UINT32_ELEMENTS, \
|
|
||||||
ExternalUint32Array) \
|
|
||||||
V(ExternalFloat32ElementsAccessor, EXTERNAL_FLOAT32_ELEMENTS, \
|
|
||||||
ExternalFloat32Array) \
|
|
||||||
V(ExternalFloat64ElementsAccessor, EXTERNAL_FLOAT64_ELEMENTS, \
|
|
||||||
ExternalFloat64Array) \
|
|
||||||
V(ExternalUint8ClampedElementsAccessor, EXTERNAL_UINT8_CLAMPED_ELEMENTS, \
|
|
||||||
ExternalUint8ClampedArray) \
|
|
||||||
V(FixedUint8ElementsAccessor, UINT8_ELEMENTS, FixedUint8Array) \
|
V(FixedUint8ElementsAccessor, UINT8_ELEMENTS, FixedUint8Array) \
|
||||||
V(FixedInt8ElementsAccessor, INT8_ELEMENTS, FixedInt8Array) \
|
V(FixedInt8ElementsAccessor, INT8_ELEMENTS, FixedInt8Array) \
|
||||||
V(FixedUint16ElementsAccessor, UINT16_ELEMENTS, FixedUint16Array) \
|
V(FixedUint16ElementsAccessor, UINT16_ELEMENTS, FixedUint16Array) \
|
||||||
@ -1218,7 +1192,6 @@ class FastSmiOrObjectElementsAccessor
|
|||||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -1315,7 +1288,6 @@ class FastDoubleElementsAccessor
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -1406,13 +1378,6 @@ class TypedElementsAccessor
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
|
|
||||||
typedef TypedElementsAccessor<EXTERNAL_##TYPE##_ELEMENTS> \
|
|
||||||
External##Type##ElementsAccessor;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(EXTERNAL_ELEMENTS_ACCESSOR)
|
|
||||||
#undef EXTERNAL_ELEMENTS_ACCESSOR
|
|
||||||
|
|
||||||
#define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
|
#define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
|
||||||
typedef TypedElementsAccessor<TYPE##_ELEMENTS > \
|
typedef TypedElementsAccessor<TYPE##_ELEMENTS > \
|
||||||
Fixed##Type##ElementsAccessor;
|
Fixed##Type##ElementsAccessor;
|
||||||
|
@ -883,18 +883,14 @@ Handle<BytecodeArray> Factory::NewBytecodeArray(int length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<ExternalArray> Factory::NewExternalArray(int length,
|
Handle<FixedTypedArrayBase> Factory::NewFixedTypedArrayWithExternalPointer(
|
||||||
ExternalArrayType array_type,
|
int length, ExternalArrayType array_type, void* external_pointer,
|
||||||
void* external_pointer,
|
PretenureFlag pretenure) {
|
||||||
PretenureFlag pretenure) {
|
|
||||||
DCHECK(0 <= length && length <= Smi::kMaxValue);
|
DCHECK(0 <= length && length <= Smi::kMaxValue);
|
||||||
CALL_HEAP_FUNCTION(
|
CALL_HEAP_FUNCTION(
|
||||||
isolate(),
|
isolate(), isolate()->heap()->AllocateFixedTypedArrayWithExternalPointer(
|
||||||
isolate()->heap()->AllocateExternalArray(length,
|
length, array_type, external_pointer, pretenure),
|
||||||
array_type,
|
FixedTypedArrayBase);
|
||||||
external_pointer,
|
|
||||||
pretenure),
|
|
||||||
ExternalArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1765,11 +1761,11 @@ ElementsKind GetExternalArrayElementsKind(ExternalArrayType type) {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case kExternal##Type##Array: \
|
case kExternal##Type##Array: \
|
||||||
return EXTERNAL_##TYPE##_ELEMENTS;
|
return TYPE##_ELEMENTS;
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND;
|
return FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND;
|
||||||
#undef TYPED_ARRAY_CASE
|
#undef TYPED_ARRAY_CASE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1911,7 +1907,7 @@ Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
|
|||||||
Handle<Object> length_object = NewNumberFromSize(length);
|
Handle<Object> length_object = NewNumberFromSize(length);
|
||||||
obj->set_length(*length_object);
|
obj->set_length(*length_object);
|
||||||
|
|
||||||
Handle<ExternalArray> elements = NewExternalArray(
|
Handle<FixedTypedArrayBase> elements = NewFixedTypedArrayWithExternalPointer(
|
||||||
static_cast<int>(length), type,
|
static_cast<int>(length), type,
|
||||||
static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
|
static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
|
||||||
Handle<Map> map = JSObject::GetElementsTransitionMap(obj, elements_kind);
|
Handle<Map> map = JSObject::GetElementsTransitionMap(obj, elements_kind);
|
||||||
|
@ -286,10 +286,8 @@ class Factory final {
|
|||||||
Handle<BytecodeArray> NewBytecodeArray(int length, const byte* raw_bytecodes,
|
Handle<BytecodeArray> NewBytecodeArray(int length, const byte* raw_bytecodes,
|
||||||
int frame_size);
|
int frame_size);
|
||||||
|
|
||||||
Handle<ExternalArray> NewExternalArray(
|
Handle<FixedTypedArrayBase> NewFixedTypedArrayWithExternalPointer(
|
||||||
int length,
|
int length, ExternalArrayType array_type, void* external_pointer,
|
||||||
ExternalArrayType array_type,
|
|
||||||
void* external_pointer,
|
|
||||||
PretenureFlag pretenure = NOT_TENURED);
|
PretenureFlag pretenure = NOT_TENURED);
|
||||||
|
|
||||||
Handle<FixedTypedArrayBase> NewFixedTypedArray(
|
Handle<FixedTypedArrayBase> NewFixedTypedArray(
|
||||||
|
@ -856,10 +856,8 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object) {
|
|||||||
return AddEntry(object, HeapEntry::kHidden, "system / NativeContext");
|
return AddEntry(object, HeapEntry::kHidden, "system / NativeContext");
|
||||||
} else if (object->IsContext()) {
|
} else if (object->IsContext()) {
|
||||||
return AddEntry(object, HeapEntry::kObject, "system / Context");
|
return AddEntry(object, HeapEntry::kObject, "system / Context");
|
||||||
} else if (object->IsFixedArray() ||
|
} else if (object->IsFixedArray() || object->IsFixedDoubleArray() ||
|
||||||
object->IsFixedDoubleArray() ||
|
object->IsByteArray()) {
|
||||||
object->IsByteArray() ||
|
|
||||||
object->IsExternalArray()) {
|
|
||||||
return AddEntry(object, HeapEntry::kArray, "");
|
return AddEntry(object, HeapEntry::kArray, "");
|
||||||
} else if (object->IsHeapNumber()) {
|
} else if (object->IsHeapNumber()) {
|
||||||
return AddEntry(object, HeapEntry::kHeapNumber, "number");
|
return AddEntry(object, HeapEntry::kHeapNumber, "number");
|
||||||
|
@ -2500,7 +2500,8 @@ class ScavengingVisitor : public StaticVisitorBase {
|
|||||||
DCHECK(map_word.IsForwardingAddress());
|
DCHECK(map_word.IsForwardingAddress());
|
||||||
FixedTypedArrayBase* target =
|
FixedTypedArrayBase* target =
|
||||||
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
|
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
|
||||||
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
|
if (target->base_pointer() != Smi::FromInt(0))
|
||||||
|
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2513,7 +2514,8 @@ class ScavengingVisitor : public StaticVisitorBase {
|
|||||||
DCHECK(map_word.IsForwardingAddress());
|
DCHECK(map_word.IsForwardingAddress());
|
||||||
FixedTypedArrayBase* target =
|
FixedTypedArrayBase* target =
|
||||||
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
|
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
|
||||||
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
|
if (target->base_pointer() != Smi::FromInt(0))
|
||||||
|
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3004,13 +3006,6 @@ bool Heap::CreateInitialMaps() {
|
|||||||
ALLOCATE_VARSIZE_MAP(BYTECODE_ARRAY_TYPE, bytecode_array)
|
ALLOCATE_VARSIZE_MAP(BYTECODE_ARRAY_TYPE, bytecode_array)
|
||||||
ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
|
ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
|
||||||
|
|
||||||
#define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \
|
|
||||||
ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kSize, \
|
|
||||||
external_##type##_array)
|
|
||||||
|
|
||||||
TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP)
|
|
||||||
#undef ALLOCATE_EXTERNAL_ARRAY_MAP
|
|
||||||
|
|
||||||
#define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \
|
#define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \
|
||||||
ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)
|
ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)
|
||||||
|
|
||||||
@ -3076,17 +3071,6 @@ bool Heap::CreateInitialMaps() {
|
|||||||
set_empty_bytecode_array(bytecode_array);
|
set_empty_bytecode_array(bytecode_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
|
|
||||||
{ \
|
|
||||||
ExternalArray* obj; \
|
|
||||||
if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \
|
|
||||||
return false; \
|
|
||||||
set_empty_external_##type##_array(obj); \
|
|
||||||
}
|
|
||||||
|
|
||||||
TYPED_ARRAYS(ALLOCATE_EMPTY_EXTERNAL_ARRAY)
|
|
||||||
#undef ALLOCATE_EMPTY_EXTERNAL_ARRAY
|
|
||||||
|
|
||||||
#define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
#define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
||||||
{ \
|
{ \
|
||||||
FixedTypedArrayBase* obj; \
|
FixedTypedArrayBase* obj; \
|
||||||
@ -3702,27 +3686,6 @@ void Heap::AddAllocationSiteToScratchpad(AllocationSite* site,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) {
|
|
||||||
return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Heap::RootListIndex Heap::RootIndexForExternalArrayType(
|
|
||||||
ExternalArrayType array_type) {
|
|
||||||
switch (array_type) {
|
|
||||||
#define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
|
|
||||||
case kExternal##Type##Array: \
|
|
||||||
return kExternal##Type##ArrayMapRootIndex;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
|
|
||||||
#undef ARRAY_TYPE_TO_ROOT_INDEX
|
|
||||||
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return kUndefinedValueRootIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) {
|
Map* Heap::MapForFixedTypedArray(ExternalArrayType array_type) {
|
||||||
return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]);
|
return Map::cast(roots_[RootIndexForFixedTypedArray(array_type)]);
|
||||||
@ -3746,23 +3709,6 @@ Heap::RootListIndex Heap::RootIndexForFixedTypedArray(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Heap::RootListIndex Heap::RootIndexForEmptyExternalArray(
|
|
||||||
ElementsKind elementsKind) {
|
|
||||||
switch (elementsKind) {
|
|
||||||
#define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype, size) \
|
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
return kEmptyExternal##Type##ArrayRootIndex;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
|
|
||||||
#undef ELEMENT_KIND_TO_ROOT_INDEX
|
|
||||||
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return kUndefinedValueRootIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray(
|
Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray(
|
||||||
ElementsKind elementsKind) {
|
ElementsKind elementsKind) {
|
||||||
switch (elementsKind) {
|
switch (elementsKind) {
|
||||||
@ -3779,12 +3725,6 @@ Heap::RootListIndex Heap::RootIndexForEmptyFixedTypedArray(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) {
|
|
||||||
return ExternalArray::cast(
|
|
||||||
roots_[RootIndexForEmptyExternalArray(map->elements_kind())]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) {
|
FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) {
|
||||||
return FixedTypedArrayBase::cast(
|
return FixedTypedArrayBase::cast(
|
||||||
roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]);
|
roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]);
|
||||||
@ -4005,11 +3945,10 @@ void Heap::RightTrimFixedArray(FixedArrayBase* object, int elements_to_trim) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AllocationResult Heap::AllocateExternalArray(int length,
|
AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer(
|
||||||
ExternalArrayType array_type,
|
int length, ExternalArrayType array_type, void* external_pointer,
|
||||||
void* external_pointer,
|
PretenureFlag pretenure) {
|
||||||
PretenureFlag pretenure) {
|
int size = FixedTypedArrayBase::kHeaderSize;
|
||||||
int size = ExternalArray::kSize;
|
|
||||||
AllocationSpace space = SelectSpace(size, pretenure);
|
AllocationSpace space = SelectSpace(size, pretenure);
|
||||||
HeapObject* result;
|
HeapObject* result;
|
||||||
{
|
{
|
||||||
@ -4017,10 +3956,12 @@ AllocationResult Heap::AllocateExternalArray(int length,
|
|||||||
if (!allocation.To(&result)) return allocation;
|
if (!allocation.To(&result)) return allocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
result->set_map_no_write_barrier(MapForExternalArrayType(array_type));
|
result->set_map_no_write_barrier(MapForFixedTypedArray(array_type));
|
||||||
ExternalArray::cast(result)->set_length(length);
|
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result);
|
||||||
ExternalArray::cast(result)->set_external_pointer(external_pointer);
|
elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER);
|
||||||
return result;
|
elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER);
|
||||||
|
elements->set_length(length);
|
||||||
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size,
|
static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size,
|
||||||
@ -4060,7 +4001,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
|
|||||||
array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned);
|
array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned);
|
||||||
if (!allocation.To(&object)) return allocation;
|
if (!allocation.To(&object)) return allocation;
|
||||||
|
|
||||||
object->set_map(MapForFixedTypedArray(array_type));
|
object->set_map_no_write_barrier(MapForFixedTypedArray(array_type));
|
||||||
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
|
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
|
||||||
elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
|
elements->set_base_pointer(elements, SKIP_WRITE_BARRIER);
|
||||||
elements->set_external_pointer(
|
elements->set_external_pointer(
|
||||||
@ -4275,8 +4216,7 @@ AllocationResult Heap::AllocateJSObjectFromMap(
|
|||||||
|
|
||||||
// Initialize the JSObject.
|
// Initialize the JSObject.
|
||||||
InitializeJSObjectFromMap(js_obj, properties, map);
|
InitializeJSObjectFromMap(js_obj, properties, map);
|
||||||
DCHECK(js_obj->HasFastElements() || js_obj->HasExternalArrayElements() ||
|
DCHECK(js_obj->HasFastElements() || js_obj->HasFixedTypedArrayElements());
|
||||||
js_obj->HasFixedTypedArrayElements());
|
|
||||||
return js_obj;
|
return js_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4568,12 +4508,6 @@ AllocationResult Heap::AllocateEmptyFixedArray() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AllocationResult Heap::AllocateEmptyExternalArray(
|
|
||||||
ExternalArrayType array_type) {
|
|
||||||
return AllocateExternalArray(0, array_type, NULL, TENURED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) {
|
AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) {
|
||||||
if (!InNewSpace(src)) {
|
if (!InNewSpace(src)) {
|
||||||
return src;
|
return src;
|
||||||
|
@ -105,25 +105,6 @@ namespace internal {
|
|||||||
V(Map, short_external_one_byte_internalized_string_map, \
|
V(Map, short_external_one_byte_internalized_string_map, \
|
||||||
ShortExternalOneByteInternalizedStringMap) \
|
ShortExternalOneByteInternalizedStringMap) \
|
||||||
V(Map, short_external_one_byte_string_map, ShortExternalOneByteStringMap) \
|
V(Map, short_external_one_byte_string_map, ShortExternalOneByteStringMap) \
|
||||||
V(Map, external_int8_array_map, ExternalInt8ArrayMap) \
|
|
||||||
V(Map, external_uint8_array_map, ExternalUint8ArrayMap) \
|
|
||||||
V(Map, external_int16_array_map, ExternalInt16ArrayMap) \
|
|
||||||
V(Map, external_uint16_array_map, ExternalUint16ArrayMap) \
|
|
||||||
V(Map, external_int32_array_map, ExternalInt32ArrayMap) \
|
|
||||||
V(Map, external_uint32_array_map, ExternalUint32ArrayMap) \
|
|
||||||
V(Map, external_float32_array_map, ExternalFloat32ArrayMap) \
|
|
||||||
V(Map, external_float64_array_map, ExternalFloat64ArrayMap) \
|
|
||||||
V(Map, external_uint8_clamped_array_map, ExternalUint8ClampedArrayMap) \
|
|
||||||
V(ExternalArray, empty_external_int8_array, EmptyExternalInt8Array) \
|
|
||||||
V(ExternalArray, empty_external_uint8_array, EmptyExternalUint8Array) \
|
|
||||||
V(ExternalArray, empty_external_int16_array, EmptyExternalInt16Array) \
|
|
||||||
V(ExternalArray, empty_external_uint16_array, EmptyExternalUint16Array) \
|
|
||||||
V(ExternalArray, empty_external_int32_array, EmptyExternalInt32Array) \
|
|
||||||
V(ExternalArray, empty_external_uint32_array, EmptyExternalUint32Array) \
|
|
||||||
V(ExternalArray, empty_external_float32_array, EmptyExternalFloat32Array) \
|
|
||||||
V(ExternalArray, empty_external_float64_array, EmptyExternalFloat64Array) \
|
|
||||||
V(ExternalArray, empty_external_uint8_clamped_array, \
|
|
||||||
EmptyExternalUint8ClampedArray) \
|
|
||||||
V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \
|
V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \
|
||||||
V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \
|
V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \
|
||||||
V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \
|
V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \
|
||||||
@ -1269,12 +1250,7 @@ class Heap {
|
|||||||
Map* MapForFixedTypedArray(ExternalArrayType array_type);
|
Map* MapForFixedTypedArray(ExternalArrayType array_type);
|
||||||
RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type);
|
RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type);
|
||||||
|
|
||||||
Map* MapForExternalArrayType(ExternalArrayType array_type);
|
|
||||||
RootListIndex RootIndexForExternalArrayType(ExternalArrayType array_type);
|
|
||||||
|
|
||||||
RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind);
|
|
||||||
RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind);
|
RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind);
|
||||||
ExternalArray* EmptyExternalArrayForMap(Map* map);
|
|
||||||
FixedTypedArrayBase* EmptyFixedTypedArrayForMap(Map* map);
|
FixedTypedArrayBase* EmptyFixedTypedArrayForMap(Map* map);
|
||||||
|
|
||||||
void RecordStats(HeapStats* stats, bool take_snapshot = false);
|
void RecordStats(HeapStats* stats, bool take_snapshot = false);
|
||||||
@ -2046,9 +2022,9 @@ class Heap {
|
|||||||
MUST_USE_RESULT AllocationResult AllocateSymbol();
|
MUST_USE_RESULT AllocationResult AllocateSymbol();
|
||||||
|
|
||||||
// Allocates an external array of the specified length and type.
|
// Allocates an external array of the specified length and type.
|
||||||
MUST_USE_RESULT AllocationResult
|
MUST_USE_RESULT AllocationResult AllocateFixedTypedArrayWithExternalPointer(
|
||||||
AllocateExternalArray(int length, ExternalArrayType array_type,
|
int length, ExternalArrayType array_type, void* external_pointer,
|
||||||
void* external_pointer, PretenureFlag pretenure);
|
PretenureFlag pretenure);
|
||||||
|
|
||||||
// Allocates a fixed typed array of the specified length and type.
|
// Allocates a fixed typed array of the specified length and type.
|
||||||
MUST_USE_RESULT AllocationResult
|
MUST_USE_RESULT AllocationResult
|
||||||
@ -2076,10 +2052,6 @@ class Heap {
|
|||||||
// Allocate empty fixed array.
|
// Allocate empty fixed array.
|
||||||
MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray();
|
MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray();
|
||||||
|
|
||||||
// Allocate empty external array of given type.
|
|
||||||
MUST_USE_RESULT AllocationResult
|
|
||||||
AllocateEmptyExternalArray(ExternalArrayType array_type);
|
|
||||||
|
|
||||||
// Allocate empty fixed typed array of given type.
|
// Allocate empty fixed typed array of given type.
|
||||||
MUST_USE_RESULT AllocationResult
|
MUST_USE_RESULT AllocationResult
|
||||||
AllocateEmptyFixedTypedArray(ExternalArrayType array_type);
|
AllocateEmptyFixedTypedArray(ExternalArrayType array_type);
|
||||||
|
@ -139,13 +139,8 @@ StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
|
|||||||
case HEAP_NUMBER_TYPE:
|
case HEAP_NUMBER_TYPE:
|
||||||
case MUTABLE_HEAP_NUMBER_TYPE:
|
case MUTABLE_HEAP_NUMBER_TYPE:
|
||||||
case FLOAT32X4_TYPE:
|
case FLOAT32X4_TYPE:
|
||||||
#define EXTERNAL_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE:
|
|
||||||
|
|
||||||
TYPED_ARRAYS(EXTERNAL_ARRAY_CASE)
|
|
||||||
return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric,
|
return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric,
|
||||||
instance_size, has_unboxed_fields);
|
instance_size, has_unboxed_fields);
|
||||||
#undef EXTERNAL_ARRAY_CASE
|
|
||||||
|
|
||||||
case FIXED_UINT8_ARRAY_TYPE:
|
case FIXED_UINT8_ARRAY_TYPE:
|
||||||
case FIXED_INT8_ARRAY_TYPE:
|
case FIXED_INT8_ARRAY_TYPE:
|
||||||
|
@ -3207,18 +3207,13 @@ Range* HLoadNamedField::InferRange(Zone* zone) {
|
|||||||
|
|
||||||
Range* HLoadKeyed::InferRange(Zone* zone) {
|
Range* HLoadKeyed::InferRange(Zone* zone) {
|
||||||
switch (elements_kind()) {
|
switch (elements_kind()) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
return new(zone) Range(kMinInt8, kMaxInt8);
|
return new(zone) Range(kMinInt8, kMaxInt8);
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
return new(zone) Range(kMinUInt8, kMaxUInt8);
|
return new(zone) Range(kMinUInt8, kMaxUInt8);
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
return new(zone) Range(kMinInt16, kMaxInt16);
|
return new(zone) Range(kMinInt16, kMaxInt16);
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
return new(zone) Range(kMinUInt16, kMaxUInt16);
|
return new(zone) Range(kMinUInt16, kMaxUInt16);
|
||||||
default:
|
default:
|
||||||
@ -3461,11 +3456,11 @@ std::ostream& HLoadNamedGeneric::PrintDataTo(
|
|||||||
|
|
||||||
|
|
||||||
std::ostream& HLoadKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
|
std::ostream& HLoadKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
|
||||||
if (!is_external()) {
|
if (!is_fixed_typed_array()) {
|
||||||
os << NameOf(elements());
|
os << NameOf(elements());
|
||||||
} else {
|
} else {
|
||||||
DCHECK(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
|
DCHECK(elements_kind() >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
|
||||||
elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND);
|
elements_kind() <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND);
|
||||||
os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
|
os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3500,7 +3495,7 @@ bool HLoadKeyed::UsesMustHandleHole() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsExternalArrayElementsKind(elements_kind())) {
|
if (IsFixedTypedArrayElementsKind(elements_kind())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3540,7 +3535,7 @@ bool HLoadKeyed::RequiresHoleCheck() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsExternalArrayElementsKind(elements_kind())) {
|
if (IsFixedTypedArrayElementsKind(elements_kind())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3615,11 +3610,11 @@ std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT
|
|||||||
|
|
||||||
|
|
||||||
std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
|
std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT
|
||||||
if (!is_external()) {
|
if (!is_fixed_typed_array()) {
|
||||||
os << NameOf(elements());
|
os << NameOf(elements());
|
||||||
} else {
|
} else {
|
||||||
DCHECK(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
|
DCHECK(elements_kind() >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND &&
|
||||||
elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND);
|
elements_kind() <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND);
|
||||||
os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
|
os << NameOf(elements()) << "." << ElementsKindToString(elements_kind());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3982,8 +3977,7 @@ bool HStoreKeyed::NeedsCanonicalization() {
|
|||||||
switch (value()->opcode()) {
|
switch (value()->opcode()) {
|
||||||
case kLoadKeyed: {
|
case kLoadKeyed: {
|
||||||
ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind();
|
ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind();
|
||||||
return IsExternalFloatOrDoubleElementsKind(load_kind) ||
|
return IsFixedFloatElementsKind(load_kind);
|
||||||
IsFixedFloatElementsKind(load_kind);
|
|
||||||
}
|
}
|
||||||
case kChange: {
|
case kChange: {
|
||||||
Representation from = HChange::cast(value())->from();
|
Representation from = HChange::cast(value())->from();
|
||||||
|
@ -6244,11 +6244,6 @@ class HObjectAccess final {
|
|||||||
JSArrayBuffer::kBitFieldSlot, Representation::Smi());
|
JSArrayBuffer::kBitFieldSlot, Representation::Smi());
|
||||||
}
|
}
|
||||||
|
|
||||||
static HObjectAccess ForExternalArrayExternalPointer() {
|
|
||||||
return HObjectAccess::ForObservableJSObjectOffset(
|
|
||||||
ExternalArray::kExternalPointerOffset, Representation::External());
|
|
||||||
}
|
|
||||||
|
|
||||||
static HObjectAccess ForJSArrayBufferViewBuffer() {
|
static HObjectAccess ForJSArrayBufferViewBuffer() {
|
||||||
return HObjectAccess::ForObservableJSObjectOffset(
|
return HObjectAccess::ForObservableJSObjectOffset(
|
||||||
JSArrayBufferView::kBufferOffset);
|
JSArrayBufferView::kBufferOffset);
|
||||||
@ -6618,15 +6613,9 @@ class HLoadKeyed final : public HTemplateInstruction<3>,
|
|||||||
DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*,
|
DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*,
|
||||||
ElementsKind, LoadKeyedHoleMode, int);
|
ElementsKind, LoadKeyedHoleMode, int);
|
||||||
|
|
||||||
bool is_external() const {
|
|
||||||
return IsExternalArrayElementsKind(elements_kind());
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return IsFixedTypedArrayElementsKind(elements_kind());
|
return IsFixedTypedArrayElementsKind(elements_kind());
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
HValue* elements() const { return OperandAt(0); }
|
HValue* elements() const { return OperandAt(0); }
|
||||||
HValue* key() const { return OperandAt(1); }
|
HValue* key() const { return OperandAt(1); }
|
||||||
HValue* dependency() const {
|
HValue* dependency() const {
|
||||||
@ -6657,8 +6646,8 @@ class HLoadKeyed final : public HTemplateInstruction<3>,
|
|||||||
// kind_fixed_typed_array: external[int32] (none)
|
// kind_fixed_typed_array: external[int32] (none)
|
||||||
// kind_external: external[int32] (none)
|
// kind_external: external[int32] (none)
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return is_typed_elements() ? Representation::External()
|
return is_fixed_typed_array() ? Representation::External()
|
||||||
: Representation::Tagged();
|
: Representation::Tagged();
|
||||||
}
|
}
|
||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
return ArrayInstructionInterface::KeyedAccessIndexRequirement(
|
return ArrayInstructionInterface::KeyedAccessIndexRequirement(
|
||||||
@ -6707,7 +6696,7 @@ class HLoadKeyed final : public HTemplateInstruction<3>,
|
|||||||
SetOperandAt(1, key);
|
SetOperandAt(1, key);
|
||||||
SetOperandAt(2, dependency != NULL ? dependency : obj);
|
SetOperandAt(2, dependency != NULL ? dependency : obj);
|
||||||
|
|
||||||
if (!is_typed_elements()) {
|
if (!is_fixed_typed_array()) {
|
||||||
// I can detect the case between storing double (holey and fast) and
|
// I can detect the case between storing double (holey and fast) and
|
||||||
// smi/object by looking at elements_kind_.
|
// smi/object by looking at elements_kind_.
|
||||||
DCHECK(IsFastSmiOrObjectElementsKind(elements_kind) ||
|
DCHECK(IsFastSmiOrObjectElementsKind(elements_kind) ||
|
||||||
@ -6733,18 +6722,15 @@ class HLoadKeyed final : public HTemplateInstruction<3>,
|
|||||||
SetDependsOnFlag(kDoubleArrayElements);
|
SetDependsOnFlag(kDoubleArrayElements);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS ||
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
elements_kind == FLOAT64_ELEMENTS) {
|
||||||
set_representation(Representation::Double());
|
set_representation(Representation::Double());
|
||||||
} else {
|
} else {
|
||||||
set_representation(Representation::Integer32());
|
set_representation(Representation::Integer32());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_external()) {
|
if (is_fixed_typed_array()) {
|
||||||
SetDependsOnFlag(kExternalMemory);
|
SetDependsOnFlag(kExternalMemory);
|
||||||
} else if (is_fixed_typed_array()) {
|
|
||||||
SetDependsOnFlag(kTypedArrayElements);
|
SetDependsOnFlag(kTypedArrayElements);
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -7113,8 +7099,8 @@ class HStoreKeyed final : public HTemplateInstruction<3>,
|
|||||||
// kind_fixed_typed_array: tagged[int32] = (double | int32)
|
// kind_fixed_typed_array: tagged[int32] = (double | int32)
|
||||||
// kind_external: external[int32] = (double | int32)
|
// kind_external: external[int32] = (double | int32)
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return is_typed_elements() ? Representation::External()
|
return is_fixed_typed_array() ? Representation::External()
|
||||||
: Representation::Tagged();
|
: Representation::Tagged();
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
return ArrayInstructionInterface::KeyedAccessIndexRequirement(
|
return ArrayInstructionInterface::KeyedAccessIndexRequirement(
|
||||||
OperandAt(1)->representation());
|
OperandAt(1)->representation());
|
||||||
@ -7139,24 +7125,16 @@ class HStoreKeyed final : public HTemplateInstruction<3>,
|
|||||||
return Representation::Smi();
|
return Representation::Smi();
|
||||||
}
|
}
|
||||||
|
|
||||||
return IsExternalArrayElementsKind(kind) ||
|
if (IsFixedTypedArrayElementsKind(kind)) {
|
||||||
IsFixedTypedArrayElementsKind(kind)
|
return Representation::Integer32();
|
||||||
? Representation::Integer32()
|
}
|
||||||
: Representation::Tagged();
|
return Representation::Tagged();
|
||||||
}
|
|
||||||
|
|
||||||
bool is_external() const {
|
|
||||||
return IsExternalArrayElementsKind(elements_kind());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return IsFixedTypedArrayElementsKind(elements_kind());
|
return IsFixedTypedArrayElementsKind(elements_kind());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
Representation observed_input_representation(int index) override {
|
Representation observed_input_representation(int index) override {
|
||||||
if (index < 2) return RequiredInputRepresentation(index);
|
if (index < 2) return RequiredInputRepresentation(index);
|
||||||
if (IsUninitialized()) {
|
if (IsUninitialized()) {
|
||||||
@ -7246,25 +7224,20 @@ class HStoreKeyed final : public HTemplateInstruction<3>,
|
|||||||
SetFlag(kTrackSideEffectDominators);
|
SetFlag(kTrackSideEffectDominators);
|
||||||
SetDependsOnFlag(kNewSpacePromotion);
|
SetDependsOnFlag(kNewSpacePromotion);
|
||||||
}
|
}
|
||||||
if (is_external()) {
|
if (IsFastDoubleElementsKind(elements_kind)) {
|
||||||
SetChangesFlag(kExternalMemory);
|
|
||||||
SetFlag(kAllowUndefinedAsNaN);
|
|
||||||
} else if (IsFastDoubleElementsKind(elements_kind)) {
|
|
||||||
SetChangesFlag(kDoubleArrayElements);
|
SetChangesFlag(kDoubleArrayElements);
|
||||||
} else if (IsFastSmiElementsKind(elements_kind)) {
|
} else if (IsFastSmiElementsKind(elements_kind)) {
|
||||||
SetChangesFlag(kArrayElements);
|
SetChangesFlag(kArrayElements);
|
||||||
} else if (is_fixed_typed_array()) {
|
} else if (is_fixed_typed_array()) {
|
||||||
SetChangesFlag(kTypedArrayElements);
|
SetChangesFlag(kTypedArrayElements);
|
||||||
|
SetChangesFlag(kExternalMemory);
|
||||||
SetFlag(kAllowUndefinedAsNaN);
|
SetFlag(kAllowUndefinedAsNaN);
|
||||||
} else {
|
} else {
|
||||||
SetChangesFlag(kArrayElements);
|
SetChangesFlag(kArrayElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
|
// {UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
|
||||||
if ((elements_kind >= EXTERNAL_INT8_ELEMENTS &&
|
if (elements_kind >= UINT8_ELEMENTS && elements_kind <= INT32_ELEMENTS) {
|
||||||
elements_kind <= EXTERNAL_UINT32_ELEMENTS) ||
|
|
||||||
(elements_kind >= UINT8_ELEMENTS &&
|
|
||||||
elements_kind <= INT32_ELEMENTS)) {
|
|
||||||
SetFlag(kTruncatingToInt32);
|
SetFlag(kTruncatingToInt32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ namespace internal {
|
|||||||
|
|
||||||
static bool IsUnsignedLoad(HLoadKeyed* instr) {
|
static bool IsUnsignedLoad(HLoadKeyed* instr) {
|
||||||
switch (instr->elements_kind()) {
|
switch (instr->elements_kind()) {
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
@ -50,14 +46,14 @@ bool HUint32AnalysisPhase::IsSafeUint32Use(HValue* val, HValue* use) {
|
|||||||
return true;
|
return true;
|
||||||
} else if (use->IsStoreKeyed()) {
|
} else if (use->IsStoreKeyed()) {
|
||||||
HStoreKeyed* store = HStoreKeyed::cast(use);
|
HStoreKeyed* store = HStoreKeyed::cast(use);
|
||||||
if (store->is_external()) {
|
if (store->is_fixed_typed_array()) {
|
||||||
// Storing a value into an external integer array is a bit level
|
// Storing a value into an external integer array is a bit level
|
||||||
// operation.
|
// operation.
|
||||||
if (store->value() == val) {
|
if (store->value() == val) {
|
||||||
// Clamping or a conversion to double should have beed inserted.
|
// Clamping or a conversion to double should have beed inserted.
|
||||||
DCHECK(store->elements_kind() != EXTERNAL_UINT8_CLAMPED_ELEMENTS);
|
DCHECK(store->elements_kind() != UINT8_CLAMPED_ELEMENTS);
|
||||||
DCHECK(store->elements_kind() != EXTERNAL_FLOAT32_ELEMENTS);
|
DCHECK(store->elements_kind() != FLOAT32_ELEMENTS);
|
||||||
DCHECK(store->elements_kind() != EXTERNAL_FLOAT64_ELEMENTS);
|
DCHECK(store->elements_kind() != FLOAT64_ELEMENTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2416,9 +2416,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
|
|||||||
KeyedAccessStoreMode store_mode) {
|
KeyedAccessStoreMode store_mode) {
|
||||||
DCHECK(top_info()->IsStub() || checked_object->IsCompareMap() ||
|
DCHECK(top_info()->IsStub() || checked_object->IsCompareMap() ||
|
||||||
checked_object->IsCheckMaps());
|
checked_object->IsCheckMaps());
|
||||||
DCHECK((!IsExternalArrayElementsKind(elements_kind) &&
|
DCHECK(!IsFixedTypedArrayElementsKind(elements_kind) || !is_js_array);
|
||||||
!IsFixedTypedArrayElementsKind(elements_kind)) ||
|
|
||||||
!is_js_array);
|
|
||||||
// No GVNFlag is necessary for ElementsKind if there is an explicit dependency
|
// No GVNFlag is necessary for ElementsKind if there is an explicit dependency
|
||||||
// on a HElementsTransition instruction. The flag can also be removed if the
|
// on a HElementsTransition instruction. The flag can also be removed if the
|
||||||
// map to check has FAST_HOLEY_ELEMENTS, since there can be no further
|
// map to check has FAST_HOLEY_ELEMENTS, since there can be no further
|
||||||
@ -2449,24 +2447,17 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
|
|||||||
}
|
}
|
||||||
length->set_type(HType::Smi());
|
length->set_type(HType::Smi());
|
||||||
HValue* checked_key = NULL;
|
HValue* checked_key = NULL;
|
||||||
if (IsExternalArrayElementsKind(elements_kind) ||
|
if (IsFixedTypedArrayElementsKind(elements_kind)) {
|
||||||
IsFixedTypedArrayElementsKind(elements_kind)) {
|
|
||||||
checked_object = Add<HCheckArrayBufferNotNeutered>(checked_object);
|
checked_object = Add<HCheckArrayBufferNotNeutered>(checked_object);
|
||||||
|
|
||||||
HValue* backing_store;
|
HValue* external_pointer = Add<HLoadNamedField>(
|
||||||
if (IsExternalArrayElementsKind(elements_kind)) {
|
elements, nullptr,
|
||||||
backing_store = Add<HLoadNamedField>(
|
HObjectAccess::ForFixedTypedArrayBaseExternalPointer());
|
||||||
elements, nullptr, HObjectAccess::ForExternalArrayExternalPointer());
|
HValue* base_pointer = Add<HLoadNamedField>(
|
||||||
} else {
|
elements, nullptr, HObjectAccess::ForFixedTypedArrayBaseBasePointer());
|
||||||
HValue* external_pointer = Add<HLoadNamedField>(
|
HValue* backing_store = AddUncasted<HAdd>(
|
||||||
elements, nullptr,
|
external_pointer, base_pointer, Strength::WEAK, AddOfExternalAndTagged);
|
||||||
HObjectAccess::ForFixedTypedArrayBaseExternalPointer());
|
|
||||||
HValue* base_pointer = Add<HLoadNamedField>(
|
|
||||||
elements, nullptr,
|
|
||||||
HObjectAccess::ForFixedTypedArrayBaseBasePointer());
|
|
||||||
backing_store = AddUncasted<HAdd>(external_pointer, base_pointer,
|
|
||||||
Strength::WEAK, AddOfExternalAndTagged);
|
|
||||||
}
|
|
||||||
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
|
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
|
||||||
NoObservableSideEffectsScope no_effects(this);
|
NoObservableSideEffectsScope no_effects(this);
|
||||||
IfBuilder length_checker(this);
|
IfBuilder length_checker(this);
|
||||||
@ -2698,8 +2689,7 @@ HInstruction* HGraphBuilder::AddElementAccess(
|
|||||||
LoadKeyedHoleMode load_mode) {
|
LoadKeyedHoleMode load_mode) {
|
||||||
if (access_type == STORE) {
|
if (access_type == STORE) {
|
||||||
DCHECK(val != NULL);
|
DCHECK(val != NULL);
|
||||||
if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
if (elements_kind == UINT8_CLAMPED_ELEMENTS) {
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS) {
|
|
||||||
val = Add<HClampToUint8>(val);
|
val = Add<HClampToUint8>(val);
|
||||||
}
|
}
|
||||||
return Add<HStoreKeyed>(elements, checked_key, val, elements_kind,
|
return Add<HStoreKeyed>(elements, checked_key, val, elements_kind,
|
||||||
@ -2710,8 +2700,7 @@ HInstruction* HGraphBuilder::AddElementAccess(
|
|||||||
DCHECK(val == NULL);
|
DCHECK(val == NULL);
|
||||||
HLoadKeyed* load = Add<HLoadKeyed>(
|
HLoadKeyed* load = Add<HLoadKeyed>(
|
||||||
elements, checked_key, dependency, elements_kind, load_mode);
|
elements, checked_key, dependency, elements_kind, load_mode);
|
||||||
if (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
if (elements_kind == UINT32_ELEMENTS) {
|
||||||
elements_kind == UINT32_ELEMENTS) {
|
|
||||||
graph()->RecordUint32Instruction(load);
|
graph()->RecordUint32Instruction(load);
|
||||||
}
|
}
|
||||||
return load;
|
return load;
|
||||||
@ -7411,7 +7400,6 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
|
|||||||
val));
|
val));
|
||||||
} else {
|
} else {
|
||||||
DCHECK(IsFastElementsKind(elements_kind) ||
|
DCHECK(IsFastElementsKind(elements_kind) ||
|
||||||
IsExternalArrayElementsKind(elements_kind) ||
|
|
||||||
IsFixedTypedArrayElementsKind(elements_kind));
|
IsFixedTypedArrayElementsKind(elements_kind));
|
||||||
LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map);
|
LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map);
|
||||||
// Happily, mapcompare is a checked object.
|
// Happily, mapcompare is a checked object.
|
||||||
@ -9946,14 +9934,14 @@ HValue* HOptimizedGraphBuilder::BuildAllocateExternalElements(
|
|||||||
bool is_zero_byte_offset,
|
bool is_zero_byte_offset,
|
||||||
HValue* buffer, HValue* byte_offset, HValue* length) {
|
HValue* buffer, HValue* byte_offset, HValue* length) {
|
||||||
Handle<Map> external_array_map(
|
Handle<Map> external_array_map(
|
||||||
isolate()->heap()->MapForExternalArrayType(array_type));
|
isolate()->heap()->MapForFixedTypedArray(array_type));
|
||||||
|
|
||||||
// The HForceRepresentation is to prevent possible deopt on int-smi
|
// The HForceRepresentation is to prevent possible deopt on int-smi
|
||||||
// conversion after allocation but before the new object fields are set.
|
// conversion after allocation but before the new object fields are set.
|
||||||
length = AddUncasted<HForceRepresentation>(length, Representation::Smi());
|
length = AddUncasted<HForceRepresentation>(length, Representation::Smi());
|
||||||
HValue* elements =
|
HValue* elements = Add<HAllocate>(
|
||||||
Add<HAllocate>(Add<HConstant>(ExternalArray::kSize), HType::HeapObject(),
|
Add<HConstant>(FixedTypedArrayBase::kHeaderSize), HType::HeapObject(),
|
||||||
NOT_TENURED, external_array_map->instance_type());
|
NOT_TENURED, external_array_map->instance_type());
|
||||||
|
|
||||||
AddStoreMapConstant(elements, external_array_map);
|
AddStoreMapConstant(elements, external_array_map);
|
||||||
Add<HStoreNamedField>(elements,
|
Add<HStoreNamedField>(elements,
|
||||||
@ -9975,8 +9963,11 @@ HValue* HOptimizedGraphBuilder::BuildAllocateExternalElements(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Add<HStoreNamedField>(elements,
|
Add<HStoreNamedField>(elements,
|
||||||
HObjectAccess::ForExternalArrayExternalPointer(),
|
HObjectAccess::ForFixedTypedArrayBaseBasePointer(),
|
||||||
typed_array_start);
|
graph()->GetConstant0());
|
||||||
|
Add<HStoreNamedField>(elements,
|
||||||
|
HObjectAccess::ForFixedTypedArrayBaseExternalPointer(),
|
||||||
|
typed_array_start);
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
@ -10123,13 +10114,10 @@ void HOptimizedGraphBuilder::GenerateTypedArrayInitialize(
|
|||||||
ExternalArrayType array_type =
|
ExternalArrayType array_type =
|
||||||
kExternalInt8Array; // Bogus initialization.
|
kExternalInt8Array; // Bogus initialization.
|
||||||
size_t element_size = 1; // Bogus initialization.
|
size_t element_size = 1; // Bogus initialization.
|
||||||
ElementsKind external_elements_kind = // Bogus initialization.
|
|
||||||
EXTERNAL_INT8_ELEMENTS;
|
|
||||||
ElementsKind fixed_elements_kind = // Bogus initialization.
|
ElementsKind fixed_elements_kind = // Bogus initialization.
|
||||||
INT8_ELEMENTS;
|
INT8_ELEMENTS;
|
||||||
Runtime::ArrayIdToTypeAndSize(array_id,
|
Runtime::ArrayIdToTypeAndSize(array_id,
|
||||||
&array_type,
|
&array_type,
|
||||||
&external_elements_kind,
|
|
||||||
&fixed_elements_kind,
|
&fixed_elements_kind,
|
||||||
&element_size);
|
&element_size);
|
||||||
|
|
||||||
@ -10154,8 +10142,8 @@ void HOptimizedGraphBuilder::GenerateTypedArrayInitialize(
|
|||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
elements = BuildAllocateExternalElements(
|
elements = BuildAllocateExternalElements(
|
||||||
array_type, is_zero_byte_offset, buffer, byte_offset, length);
|
array_type, is_zero_byte_offset, buffer, byte_offset, length);
|
||||||
Handle<Map> obj_map = TypedArrayMap(
|
Handle<Map> obj_map =
|
||||||
isolate(), array_type, external_elements_kind);
|
TypedArrayMap(isolate(), array_type, fixed_elements_kind);
|
||||||
AddStoreMapConstant(obj, obj_map);
|
AddStoreMapConstant(obj, obj_map);
|
||||||
} else {
|
} else {
|
||||||
DCHECK(is_zero_byte_offset);
|
DCHECK(is_zero_byte_offset);
|
||||||
|
@ -3068,40 +3068,31 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
instr->hydrogen()->key()->representation(),
|
instr->hydrogen()->key()->representation(),
|
||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
XMMRegister result(ToDoubleRegister(instr->result()));
|
XMMRegister result(ToDoubleRegister(instr->result()));
|
||||||
__ movss(result, operand);
|
__ movss(result, operand);
|
||||||
__ cvtss2sd(result, result);
|
__ cvtss2sd(result, result);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
__ movsd(ToDoubleRegister(instr->result()), operand);
|
__ movsd(ToDoubleRegister(instr->result()), operand);
|
||||||
} else {
|
} else {
|
||||||
Register result(ToRegister(instr->result()));
|
Register result(ToRegister(instr->result()));
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ movsx_b(result, operand);
|
__ movsx_b(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ movzx_b(result, operand);
|
__ movzx_b(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ movsx_w(result, operand);
|
__ movsx_w(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ movzx_w(result, operand);
|
__ movzx_w(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ mov(result, operand);
|
__ mov(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ mov(result, operand);
|
__ mov(result, operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3109,8 +3100,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -3190,7 +3179,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4203,39 +4192,28 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
instr->hydrogen()->key()->representation(),
|
instr->hydrogen()->key()->representation(),
|
||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
XMMRegister xmm_scratch = double_scratch0();
|
XMMRegister xmm_scratch = double_scratch0();
|
||||||
__ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value()));
|
__ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value()));
|
||||||
__ movss(operand, xmm_scratch);
|
__ movss(operand, xmm_scratch);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
__ movsd(operand, ToDoubleRegister(instr->value()));
|
__ movsd(operand, ToDoubleRegister(instr->value()));
|
||||||
} else {
|
} else {
|
||||||
Register value = ToRegister(instr->value());
|
Register value = ToRegister(instr->value());
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ mov_b(operand, value);
|
__ mov_b(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ mov_w(operand, value);
|
__ mov_w(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ mov(operand, value);
|
__ mov(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4321,7 +4299,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases...external, fast-double, fast
|
// By cases...external, fast-double, fast
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2239,7 +2239,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
: UseRegisterOrConstantAtStart(instr->key());
|
: UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = UseRegisterAtStart(instr->elements());
|
LOperand* obj = UseRegisterAtStart(instr->elements());
|
||||||
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
||||||
} else {
|
} else {
|
||||||
@ -2253,10 +2253,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2293,9 +2292,6 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
|
|||||||
|
|
||||||
// Determine if we need a byte register in this case for the value.
|
// Determine if we need a byte register in this case for the value.
|
||||||
bool val_is_fixed_register =
|
bool val_is_fixed_register =
|
||||||
elements_kind == EXTERNAL_INT8_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_UINT8_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_ELEMENTS ||
|
elements_kind == UINT8_ELEMENTS ||
|
||||||
elements_kind == INT8_ELEMENTS ||
|
elements_kind == INT8_ELEMENTS ||
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS;
|
elements_kind == UINT8_CLAMPED_ELEMENTS;
|
||||||
@ -2308,7 +2304,7 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
DCHECK(instr->key()->representation().IsInteger32() ||
|
DCHECK(instr->key()->representation().IsInteger32() ||
|
||||||
instr->key()->representation().IsSmi());
|
instr->key()->representation().IsSmi());
|
||||||
|
@ -1641,15 +1641,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
ElementsKind elements_kind() const {
|
ElementsKind elements_kind() const {
|
||||||
return hydrogen()->elements_kind();
|
return hydrogen()->elements_kind();
|
||||||
}
|
}
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -1669,12 +1663,8 @@ inline static bool ExternalArrayOpRequiresTemp(
|
|||||||
// an index cannot fold the scale operation into a load and need an extra
|
// an index cannot fold the scale operation into a load and need an extra
|
||||||
// temp register to do the work.
|
// temp register to do the work.
|
||||||
return key_representation.IsSmi() &&
|
return key_representation.IsSmi() &&
|
||||||
(elements_kind == EXTERNAL_INT8_ELEMENTS ||
|
(elements_kind == UINT8_ELEMENTS || elements_kind == INT8_ELEMENTS ||
|
||||||
elements_kind == EXTERNAL_UINT8_ELEMENTS ||
|
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_ELEMENTS ||
|
|
||||||
elements_kind == INT8_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2257,13 +2247,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = val;
|
inputs_[2] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -577,7 +577,6 @@ void ElementHandlerCompiler::CompileElementHandlers(
|
|||||||
} else if (IsSloppyArgumentsElements(elements_kind)) {
|
} else if (IsSloppyArgumentsElements(elements_kind)) {
|
||||||
cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode();
|
cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode();
|
||||||
} else if (IsFastElementsKind(elements_kind) ||
|
} else if (IsFastElementsKind(elements_kind) ||
|
||||||
IsExternalArrayElementsKind(elements_kind) ||
|
|
||||||
IsFixedTypedArrayElementsKind(elements_kind)) {
|
IsFixedTypedArrayElementsKind(elements_kind)) {
|
||||||
cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind,
|
cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind,
|
||||||
convert_hole_to_undefined).GetCode();
|
convert_hole_to_undefined).GetCode();
|
||||||
|
@ -109,7 +109,6 @@ Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(
|
|||||||
} else if (receiver_map->has_sloppy_arguments_elements()) {
|
} else if (receiver_map->has_sloppy_arguments_elements()) {
|
||||||
stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode();
|
stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode();
|
||||||
} else if (receiver_map->has_fast_elements() ||
|
} else if (receiver_map->has_fast_elements() ||
|
||||||
receiver_map->has_external_array_elements() ||
|
|
||||||
receiver_map->has_fixed_typed_array_elements()) {
|
receiver_map->has_fixed_typed_array_elements()) {
|
||||||
stub = LoadFastElementStub(isolate, is_js_array, elements_kind,
|
stub = LoadFastElementStub(isolate, is_js_array, elements_kind,
|
||||||
convert_hole_to_undefined).GetCode();
|
convert_hole_to_undefined).GetCode();
|
||||||
@ -369,7 +368,6 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
|
|||||||
if (IsSloppyArgumentsElements(elements_kind)) {
|
if (IsSloppyArgumentsElements(elements_kind)) {
|
||||||
cached_stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode();
|
cached_stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode();
|
||||||
} else if (receiver_map->has_fast_elements() ||
|
} else if (receiver_map->has_fast_elements() ||
|
||||||
receiver_map->has_external_array_elements() ||
|
|
||||||
receiver_map->has_fixed_typed_array_elements()) {
|
receiver_map->has_fixed_typed_array_elements()) {
|
||||||
cached_stub = StoreFastElementStub(isolate(), is_js_array,
|
cached_stub = StoreFastElementStub(isolate(), is_js_array,
|
||||||
elements_kind, store_mode).GetCode();
|
elements_kind, store_mode).GetCode();
|
||||||
@ -401,7 +399,6 @@ Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic(
|
|||||||
if (receiver_map->has_sloppy_arguments_elements()) {
|
if (receiver_map->has_sloppy_arguments_elements()) {
|
||||||
stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode();
|
stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode();
|
||||||
} else if (receiver_map->has_fast_elements() ||
|
} else if (receiver_map->has_fast_elements() ||
|
||||||
receiver_map->has_external_array_elements() ||
|
|
||||||
receiver_map->has_fixed_typed_array_elements()) {
|
receiver_map->has_fixed_typed_array_elements()) {
|
||||||
stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind,
|
stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind,
|
||||||
store_mode).GetCode();
|
store_mode).GetCode();
|
||||||
|
@ -1953,8 +1953,7 @@ Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
|
|||||||
if (store_mode != STANDARD_STORE) {
|
if (store_mode != STANDARD_STORE) {
|
||||||
int external_arrays = 0;
|
int external_arrays = 0;
|
||||||
for (int i = 0; i < target_receiver_maps.length(); ++i) {
|
for (int i = 0; i < target_receiver_maps.length(); ++i) {
|
||||||
if (target_receiver_maps[i]->has_external_array_elements() ||
|
if (target_receiver_maps[i]->has_fixed_typed_array_elements()) {
|
||||||
target_receiver_maps[i]->has_fixed_typed_array_elements()) {
|
|
||||||
external_arrays++;
|
external_arrays++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1991,7 +1990,7 @@ Handle<Map> KeyedStoreIC::ComputeTransitionedMap(
|
|||||||
case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE:
|
case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE:
|
||||||
return Map::TransitionElementsTo(map, FAST_HOLEY_DOUBLE_ELEMENTS);
|
return Map::TransitionElementsTo(map, FAST_HOLEY_DOUBLE_ELEMENTS);
|
||||||
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
|
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
|
||||||
DCHECK(map->has_external_array_elements());
|
DCHECK(map->has_fixed_typed_array_elements());
|
||||||
// Fall through
|
// Fall through
|
||||||
case STORE_NO_TRANSITION_HANDLE_COW:
|
case STORE_NO_TRANSITION_HANDLE_COW:
|
||||||
case STANDARD_STORE:
|
case STANDARD_STORE:
|
||||||
@ -2074,7 +2073,7 @@ static KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!FLAG_trace_external_array_abuse &&
|
if (!FLAG_trace_external_array_abuse &&
|
||||||
receiver->map()->has_external_array_elements() && oob_access) {
|
receiver->map()->has_fixed_typed_array_elements() && oob_access) {
|
||||||
return STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS;
|
return STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS;
|
||||||
}
|
}
|
||||||
Heap* heap = receiver->GetHeap();
|
Heap* heap = receiver->GetHeap();
|
||||||
|
@ -117,8 +117,7 @@ void LookupIterator::ReloadPropertyInformation() {
|
|||||||
void LookupIterator::ReloadHolderMap() {
|
void LookupIterator::ReloadHolderMap() {
|
||||||
DCHECK_EQ(DATA, state_);
|
DCHECK_EQ(DATA, state_);
|
||||||
DCHECK(IsElement());
|
DCHECK(IsElement());
|
||||||
DCHECK(JSObject::cast(*holder_)->HasExternalArrayElements() ||
|
DCHECK(JSObject::cast(*holder_)->HasFixedTypedArrayElements());
|
||||||
JSObject::cast(*holder_)->HasFixedTypedArrayElements());
|
|
||||||
if (*holder_map_ != holder_->map()) {
|
if (*holder_map_ != holder_->map()) {
|
||||||
holder_map_ = handle(holder_->map(), isolate_);
|
holder_map_ = handle(holder_->map(), isolate_);
|
||||||
}
|
}
|
||||||
@ -161,7 +160,6 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
|
|||||||
DCHECK(HolderIsReceiverOrHiddenPrototype());
|
DCHECK(HolderIsReceiverOrHiddenPrototype());
|
||||||
Handle<JSObject> holder = GetHolder<JSObject>();
|
Handle<JSObject> holder = GetHolder<JSObject>();
|
||||||
if (IsElement()) {
|
if (IsElement()) {
|
||||||
DCHECK(!holder->HasExternalArrayElements());
|
|
||||||
DCHECK(!holder->HasFixedTypedArrayElements());
|
DCHECK(!holder->HasFixedTypedArrayElements());
|
||||||
DCHECK(attributes != NONE || !holder->HasFastElements());
|
DCHECK(attributes != NONE || !holder->HasFastElements());
|
||||||
Handle<FixedArrayBase> elements(holder->elements());
|
Handle<FixedArrayBase> elements(holder->elements());
|
||||||
|
@ -3111,10 +3111,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
FPURegister result = ToDoubleRegister(instr->result());
|
FPURegister result = ToDoubleRegister(instr->result());
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ Addu(scratch0(), external_pointer, constant_key << element_size_shift);
|
__ Addu(scratch0(), external_pointer, constant_key << element_size_shift);
|
||||||
@ -3122,8 +3119,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ sll(scratch0(), key, shift_size);
|
__ sll(scratch0(), key, shift_size);
|
||||||
__ Addu(scratch0(), scratch0(), external_pointer);
|
__ Addu(scratch0(), scratch0(), external_pointer);
|
||||||
}
|
}
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ lwc1(result, MemOperand(scratch0(), base_offset));
|
__ lwc1(result, MemOperand(scratch0(), base_offset));
|
||||||
__ cvt_d_s(result, result);
|
__ cvt_d_s(result, result);
|
||||||
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
||||||
@ -3135,29 +3131,22 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
key, external_pointer, key_is_constant, constant_key,
|
key, external_pointer, key_is_constant, constant_key,
|
||||||
element_size_shift, shift_size, base_offset);
|
element_size_shift, shift_size, base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ lb(result, mem_operand);
|
__ lb(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ lbu(result, mem_operand);
|
__ lbu(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ lh(result, mem_operand);
|
__ lh(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ lhu(result, mem_operand);
|
__ lhu(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ lw(result, mem_operand);
|
__ lw(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ lw(result, mem_operand);
|
__ lw(result, mem_operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3167,8 +3156,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -3280,7 +3267,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4272,10 +4259,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
? (element_size_shift - kSmiTagSize) : element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
Register address = scratch0();
|
Register address = scratch0();
|
||||||
FPURegister value(ToDoubleRegister(instr->value()));
|
FPURegister value(ToDoubleRegister(instr->value()));
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4290,8 +4274,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
__ Addu(address, external_pointer, address);
|
__ Addu(address, external_pointer, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ cvt_s_d(double_scratch0(), value);
|
__ cvt_s_d(double_scratch0(), value);
|
||||||
__ swc1(double_scratch0(), MemOperand(address, base_offset));
|
__ swc1(double_scratch0(), MemOperand(address, base_offset));
|
||||||
} else { // Storing doubles, not floats.
|
} else { // Storing doubles, not floats.
|
||||||
@ -4304,30 +4287,21 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
element_size_shift, shift_size,
|
element_size_shift, shift_size,
|
||||||
base_offset);
|
base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ sb(value, mem_operand);
|
__ sb(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ sh(value, mem_operand);
|
__ sh(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ sw(value, mem_operand);
|
__ sw(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4441,7 +4415,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases: external, fast double
|
// By cases: external, fast double
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2184,7 +2184,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = NULL;
|
LOperand* obj = NULL;
|
||||||
if (instr->representation().IsDouble()) {
|
if (instr->representation().IsDouble()) {
|
||||||
obj = UseRegister(instr->elements());
|
obj = UseRegister(instr->elements());
|
||||||
@ -2204,10 +2204,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2242,7 +2241,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
||||||
LOperand* object = NULL;
|
LOperand* object = NULL;
|
||||||
|
@ -1610,15 +1610,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
ElementsKind elements_kind() const {
|
ElementsKind elements_kind() const {
|
||||||
return hydrogen()->elements_kind();
|
return hydrogen()->elements_kind();
|
||||||
}
|
}
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -2216,13 +2210,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = value;
|
inputs_[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -3231,10 +3231,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
: element_size_shift;
|
: element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
FPURegister result = ToDoubleRegister(instr->result());
|
FPURegister result = ToDoubleRegister(instr->result());
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ Daddu(scratch0(), external_pointer,
|
__ Daddu(scratch0(), external_pointer,
|
||||||
@ -3251,8 +3248,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
__ Daddu(scratch0(), scratch0(), external_pointer);
|
__ Daddu(scratch0(), scratch0(), external_pointer);
|
||||||
}
|
}
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ lwc1(result, MemOperand(scratch0(), base_offset));
|
__ lwc1(result, MemOperand(scratch0(), base_offset));
|
||||||
__ cvt_d_s(result, result);
|
__ cvt_d_s(result, result);
|
||||||
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
||||||
@ -3264,29 +3260,22 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
key, external_pointer, key_is_constant, constant_key,
|
key, external_pointer, key_is_constant, constant_key,
|
||||||
element_size_shift, shift_size, base_offset);
|
element_size_shift, shift_size, base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ lb(result, mem_operand);
|
__ lb(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ lbu(result, mem_operand);
|
__ lbu(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ lh(result, mem_operand);
|
__ lh(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ lhu(result, mem_operand);
|
__ lhu(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ lw(result, mem_operand);
|
__ lw(result, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ lw(result, mem_operand);
|
__ lw(result, mem_operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3296,8 +3285,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -3435,7 +3422,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4466,10 +4453,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
: element_size_shift;
|
: element_size_shift;
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
Register address = scratch0();
|
Register address = scratch0();
|
||||||
FPURegister value(ToDoubleRegister(instr->value()));
|
FPURegister value(ToDoubleRegister(instr->value()));
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4492,8 +4476,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
__ Daddu(address, external_pointer, address);
|
__ Daddu(address, external_pointer, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ cvt_s_d(double_scratch0(), value);
|
__ cvt_s_d(double_scratch0(), value);
|
||||||
__ swc1(double_scratch0(), MemOperand(address, base_offset));
|
__ swc1(double_scratch0(), MemOperand(address, base_offset));
|
||||||
} else { // Storing doubles, not floats.
|
} else { // Storing doubles, not floats.
|
||||||
@ -4506,30 +4489,21 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
element_size_shift, shift_size,
|
element_size_shift, shift_size,
|
||||||
base_offset);
|
base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ sb(value, mem_operand);
|
__ sb(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ sh(value, mem_operand);
|
__ sh(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ sw(value, mem_operand);
|
__ sw(value, mem_operand);
|
||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4656,7 +4630,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases: external, fast double
|
// By cases: external, fast double
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2187,7 +2187,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = NULL;
|
LOperand* obj = NULL;
|
||||||
if (instr->representation().IsDouble()) {
|
if (instr->representation().IsDouble()) {
|
||||||
obj = UseRegister(instr->elements());
|
obj = UseRegister(instr->elements());
|
||||||
@ -2208,10 +2208,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2246,7 +2245,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
||||||
LOperand* object = NULL;
|
LOperand* object = NULL;
|
||||||
|
@ -1672,15 +1672,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
ElementsKind elements_kind() const {
|
ElementsKind elements_kind() const {
|
||||||
return hydrogen()->elements_kind();
|
return hydrogen()->elements_kind();
|
||||||
}
|
}
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -2262,13 +2256,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = value;
|
inputs_[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -78,9 +78,6 @@ void HeapObject::HeapObjectVerify() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
#define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
|
||||||
External##Type##Array::cast(this)->External##Type##ArrayVerify(); \
|
|
||||||
break; \
|
|
||||||
case FIXED_##TYPE##_ARRAY_TYPE: \
|
case FIXED_##TYPE##_ARRAY_TYPE: \
|
||||||
Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \
|
Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \
|
||||||
break;
|
break;
|
||||||
@ -236,21 +233,17 @@ void FreeSpace::FreeSpaceVerify() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define EXTERNAL_ARRAY_VERIFY(Type, type, TYPE, ctype, size) \
|
|
||||||
void External##Type##Array::External##Type##ArrayVerify() { \
|
|
||||||
CHECK(IsExternal##Type##Array()); \
|
|
||||||
}
|
|
||||||
|
|
||||||
TYPED_ARRAYS(EXTERNAL_ARRAY_VERIFY)
|
|
||||||
#undef EXTERNAL_ARRAY_VERIFY
|
|
||||||
|
|
||||||
|
|
||||||
template <class Traits>
|
template <class Traits>
|
||||||
void FixedTypedArray<Traits>::FixedTypedArrayVerify() {
|
void FixedTypedArray<Traits>::FixedTypedArrayVerify() {
|
||||||
CHECK(IsHeapObject() &&
|
CHECK(IsHeapObject() &&
|
||||||
HeapObject::cast(this)->map()->instance_type() ==
|
HeapObject::cast(this)->map()->instance_type() ==
|
||||||
Traits::kInstanceType);
|
Traits::kInstanceType);
|
||||||
CHECK(base_pointer() == this);
|
if (base_pointer() == this) {
|
||||||
|
CHECK(external_pointer() ==
|
||||||
|
ExternalReference::fixed_typed_array_base_data_offset().address());
|
||||||
|
} else {
|
||||||
|
CHECK(base_pointer() == nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1096,7 +1089,6 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS:
|
case TYPE##_ELEMENTS:
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
|
@ -141,8 +141,7 @@ int PropertyDetails::field_width_in_words() const {
|
|||||||
|
|
||||||
|
|
||||||
bool Object::IsFixedArrayBase() const {
|
bool Object::IsFixedArrayBase() const {
|
||||||
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase() ||
|
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase();
|
||||||
IsExternalArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,8 +269,7 @@ bool Object::IsExternalTwoByteString() const {
|
|||||||
|
|
||||||
bool Object::HasValidElements() {
|
bool Object::HasValidElements() {
|
||||||
// Dictionary is covered under FixedArray.
|
// Dictionary is covered under FixedArray.
|
||||||
return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() ||
|
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase();
|
||||||
IsFixedTypedArrayBase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -659,18 +657,8 @@ bool Object::IsFiller() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Object::IsExternalArray() const {
|
|
||||||
if (!Object::IsHeapObject())
|
|
||||||
return false;
|
|
||||||
InstanceType instance_type =
|
|
||||||
HeapObject::cast(this)->map()->instance_type();
|
|
||||||
return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE &&
|
|
||||||
instance_type <= LAST_EXTERNAL_ARRAY_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \
|
||||||
TYPE_CHECKER(External##Type##Array, EXTERNAL_##TYPE##_ARRAY_TYPE) \
|
|
||||||
TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE)
|
TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE)
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
|
TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
|
||||||
@ -2643,10 +2631,6 @@ FixedArrayBase* Map::GetInitialElements() {
|
|||||||
has_fast_double_elements()) {
|
has_fast_double_elements()) {
|
||||||
DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
|
DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
|
||||||
return GetHeap()->empty_fixed_array();
|
return GetHeap()->empty_fixed_array();
|
||||||
} else if (has_external_array_elements()) {
|
|
||||||
ExternalArray* empty_array = GetHeap()->EmptyExternalArrayForMap(this);
|
|
||||||
DCHECK(!GetHeap()->InNewSpace(empty_array));
|
|
||||||
return empty_array;
|
|
||||||
} else if (has_fixed_typed_array_elements()) {
|
} else if (has_fixed_typed_array_elements()) {
|
||||||
FixedTypedArrayBase* empty_array =
|
FixedTypedArrayBase* empty_array =
|
||||||
GetHeap()->EmptyFixedTypedArrayForMap(this);
|
GetHeap()->EmptyFixedTypedArrayForMap(this);
|
||||||
@ -2935,19 +2919,9 @@ CAST_ACCESSOR(DeoptimizationInputData)
|
|||||||
CAST_ACCESSOR(DeoptimizationOutputData)
|
CAST_ACCESSOR(DeoptimizationOutputData)
|
||||||
CAST_ACCESSOR(DependentCode)
|
CAST_ACCESSOR(DependentCode)
|
||||||
CAST_ACCESSOR(DescriptorArray)
|
CAST_ACCESSOR(DescriptorArray)
|
||||||
CAST_ACCESSOR(ExternalArray)
|
|
||||||
CAST_ACCESSOR(ExternalOneByteString)
|
CAST_ACCESSOR(ExternalOneByteString)
|
||||||
CAST_ACCESSOR(ExternalFloat32Array)
|
|
||||||
CAST_ACCESSOR(ExternalFloat64Array)
|
|
||||||
CAST_ACCESSOR(ExternalInt16Array)
|
|
||||||
CAST_ACCESSOR(ExternalInt32Array)
|
|
||||||
CAST_ACCESSOR(ExternalInt8Array)
|
|
||||||
CAST_ACCESSOR(ExternalString)
|
CAST_ACCESSOR(ExternalString)
|
||||||
CAST_ACCESSOR(ExternalTwoByteString)
|
CAST_ACCESSOR(ExternalTwoByteString)
|
||||||
CAST_ACCESSOR(ExternalUint16Array)
|
|
||||||
CAST_ACCESSOR(ExternalUint32Array)
|
|
||||||
CAST_ACCESSOR(ExternalUint8Array)
|
|
||||||
CAST_ACCESSOR(ExternalUint8ClampedArray)
|
|
||||||
CAST_ACCESSOR(FixedArray)
|
CAST_ACCESSOR(FixedArray)
|
||||||
CAST_ACCESSOR(FixedArrayBase)
|
CAST_ACCESSOR(FixedArrayBase)
|
||||||
CAST_ACCESSOR(FixedDoubleArray)
|
CAST_ACCESSOR(FixedDoubleArray)
|
||||||
@ -3657,211 +3631,6 @@ Address BytecodeArray::GetFirstBytecodeAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() {
|
|
||||||
return reinterpret_cast<uint8_t*>(external_pointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t ExternalUint8ClampedArray::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint8_t* ptr = external_uint8_clamped_pointer();
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalUint8ClampedArray::get(
|
|
||||||
Handle<ExternalUint8ClampedArray> array,
|
|
||||||
int index) {
|
|
||||||
return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
|
|
||||||
array->GetIsolate());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint8ClampedArray::set(int index, uint8_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint8_t* ptr = external_uint8_clamped_pointer();
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void* ExternalArray::external_pointer() const {
|
|
||||||
intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
|
|
||||||
return reinterpret_cast<void*>(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) {
|
|
||||||
intptr_t ptr = reinterpret_cast<intptr_t>(value);
|
|
||||||
WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int8_t ExternalInt8Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int8_t* ptr = static_cast<int8_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalInt8Array::get(Handle<ExternalInt8Array> array,
|
|
||||||
int index) {
|
|
||||||
return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
|
|
||||||
array->GetIsolate());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt8Array::set(int index, int8_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int8_t* ptr = static_cast<int8_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t ExternalUint8Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalUint8Array::get(Handle<ExternalUint8Array> array,
|
|
||||||
int index) {
|
|
||||||
return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
|
|
||||||
array->GetIsolate());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint8Array::set(int index, uint8_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int16_t ExternalInt16Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int16_t* ptr = static_cast<int16_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalInt16Array::get(Handle<ExternalInt16Array> array,
|
|
||||||
int index) {
|
|
||||||
return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
|
|
||||||
array->GetIsolate());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt16Array::set(int index, int16_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int16_t* ptr = static_cast<int16_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t ExternalUint16Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalUint16Array::get(Handle<ExternalUint16Array> array,
|
|
||||||
int index) {
|
|
||||||
return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
|
|
||||||
array->GetIsolate());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint16Array::set(int index, uint16_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ExternalInt32Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int32_t* ptr = static_cast<int32_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalInt32Array::get(Handle<ExternalInt32Array> array,
|
|
||||||
int index) {
|
|
||||||
return array->GetIsolate()->factory()->
|
|
||||||
NewNumberFromInt(array->get_scalar(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt32Array::set(int index, int32_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
int32_t* ptr = static_cast<int32_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t ExternalUint32Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalUint32Array::get(Handle<ExternalUint32Array> array,
|
|
||||||
int index) {
|
|
||||||
return array->GetIsolate()->factory()->
|
|
||||||
NewNumberFromUint(array->get_scalar(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint32Array::set(int index, uint32_t value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float ExternalFloat32Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
float* ptr = static_cast<float*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalFloat32Array::get(Handle<ExternalFloat32Array> array,
|
|
||||||
int index) {
|
|
||||||
return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalFloat32Array::set(int index, float value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
float* ptr = static_cast<float*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double ExternalFloat64Array::get_scalar(int index) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
double* ptr = static_cast<double*>(external_pointer());
|
|
||||||
return ptr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> ExternalFloat64Array::get(Handle<ExternalFloat64Array> array,
|
|
||||||
int index) {
|
|
||||||
return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalFloat64Array::set(int index, double value) {
|
|
||||||
DCHECK((index >= 0) && (index < this->length()));
|
|
||||||
double* ptr = static_cast<double*>(external_pointer());
|
|
||||||
ptr[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset)
|
ACCESSORS(FixedTypedArrayBase, base_pointer, Object, kBasePointerOffset)
|
||||||
|
|
||||||
|
|
||||||
@ -3904,6 +3673,7 @@ int FixedTypedArrayBase::ElementSize(InstanceType type) {
|
|||||||
|
|
||||||
|
|
||||||
int FixedTypedArrayBase::DataSize(InstanceType type) {
|
int FixedTypedArrayBase::DataSize(InstanceType type) {
|
||||||
|
if (base_pointer() == Smi::FromInt(0)) return 0;
|
||||||
return length() * ElementSize(type);
|
return length() * ElementSize(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6311,27 +6081,6 @@ bool JSObject::HasSloppyArgumentsElements() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool JSObject::HasExternalArrayElements() {
|
|
||||||
HeapObject* array = elements();
|
|
||||||
DCHECK(array != NULL);
|
|
||||||
return array->IsExternalArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define EXTERNAL_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
|
|
||||||
bool JSObject::HasExternal##Type##Elements() { \
|
|
||||||
HeapObject* array = elements(); \
|
|
||||||
DCHECK(array != NULL); \
|
|
||||||
if (!array->IsHeapObject()) \
|
|
||||||
return false; \
|
|
||||||
return array->map()->instance_type() == EXTERNAL_##TYPE##_ARRAY_TYPE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
TYPED_ARRAYS(EXTERNAL_ELEMENTS_CHECK)
|
|
||||||
|
|
||||||
#undef EXTERNAL_ELEMENTS_CHECK
|
|
||||||
|
|
||||||
|
|
||||||
bool JSObject::HasFixedTypedArrayElements() {
|
bool JSObject::HasFixedTypedArrayElements() {
|
||||||
HeapObject* array = elements();
|
HeapObject* array = elements();
|
||||||
DCHECK(array != NULL);
|
DCHECK(array != NULL);
|
||||||
@ -7003,7 +6752,7 @@ bool JSArray::SetLengthWouldNormalize(Heap* heap, uint32_t new_length) {
|
|||||||
|
|
||||||
bool JSArray::AllowsSetLength() {
|
bool JSArray::AllowsSetLength() {
|
||||||
bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
|
bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
|
||||||
DCHECK(result == !HasExternalArrayElements());
|
DCHECK(result == !HasFixedTypedArrayElements());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +80,6 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
|
|||||||
FreeSpace::cast(this)->FreeSpacePrint(os);
|
FreeSpace::cast(this)->FreeSpacePrint(os);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
|
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
|
||||||
External##Type##Array::cast(this)->External##Type##ArrayPrint(os); \
|
|
||||||
break;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
|
|
||||||
#undef PRINT_EXTERNAL_ARRAY
|
|
||||||
|
|
||||||
#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
||||||
case Fixed##Type##Array::kInstanceType: \
|
case Fixed##Type##Array::kInstanceType: \
|
||||||
Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(os); \
|
Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(os); \
|
||||||
@ -215,16 +207,6 @@ void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
|
|
||||||
void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \
|
|
||||||
os << "external " #type " array"; \
|
|
||||||
}
|
|
||||||
|
|
||||||
TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
|
|
||||||
|
|
||||||
#undef EXTERNAL_ARRAY_PRINTER
|
|
||||||
|
|
||||||
|
|
||||||
template <class Traits>
|
template <class Traits>
|
||||||
void FixedTypedArray<Traits>::FixedTypedArrayPrint(
|
void FixedTypedArray<Traits>::FixedTypedArrayPrint(
|
||||||
std::ostream& os) { // NOLINT
|
std::ostream& os) { // NOLINT
|
||||||
@ -321,19 +303,6 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
|
|||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
|
|
||||||
ExternalUint8Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
|
|
||||||
ExternalUint16Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
|
|
||||||
ExternalUint32Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
|
|
||||||
PRINT_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
|
|
||||||
|
|
||||||
PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
|
PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
|
||||||
PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
|
PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
|
||||||
PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
|
PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
|
||||||
|
219
src/objects.cc
219
src/objects.cc
@ -1281,10 +1281,6 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
|
|||||||
os << "<FreeSpace[" << FreeSpace::cast(this)->Size() << "]>";
|
os << "<FreeSpace[" << FreeSpace::cast(this)->Size() << "]>";
|
||||||
break;
|
break;
|
||||||
#define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
|
||||||
os << "<External" #Type "Array[" \
|
|
||||||
<< External##Type##Array::cast(this)->length() << "]>"; \
|
|
||||||
break; \
|
|
||||||
case FIXED_##TYPE##_ARRAY_TYPE: \
|
case FIXED_##TYPE##_ARRAY_TYPE: \
|
||||||
os << "<Fixed" #Type "Array[" << Fixed##Type##Array::cast(this)->length() \
|
os << "<Fixed" #Type "Array[" << Fixed##Type##Array::cast(this)->length() \
|
||||||
<< "]>"; \
|
<< "]>"; \
|
||||||
@ -1508,9 +1504,6 @@ void HeapObject::IterateBody(InstanceType type, int object_size,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
|
||||||
break; \
|
|
||||||
\
|
|
||||||
case FIXED_##TYPE##_ARRAY_TYPE: \
|
case FIXED_##TYPE##_ARRAY_TYPE: \
|
||||||
reinterpret_cast<FixedTypedArrayBase*>(this) \
|
reinterpret_cast<FixedTypedArrayBase*>(this) \
|
||||||
->FixedTypedArrayBaseIterateBody(v); \
|
->FixedTypedArrayBaseIterateBody(v); \
|
||||||
@ -3318,8 +3311,7 @@ MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it,
|
|||||||
|
|
||||||
Handle<Object> to_assign = value;
|
Handle<Object> to_assign = value;
|
||||||
// Convert the incoming value to a number for storing into typed arrays.
|
// Convert the incoming value to a number for storing into typed arrays.
|
||||||
if (it->IsElement() && (receiver->HasExternalArrayElements() ||
|
if (it->IsElement() && receiver->HasFixedTypedArrayElements()) {
|
||||||
receiver->HasFixedTypedArrayElements())) {
|
|
||||||
if (!value->IsNumber() && !value->IsUndefined()) {
|
if (!value->IsNumber() && !value->IsUndefined()) {
|
||||||
ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), to_assign,
|
ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), to_assign,
|
||||||
Execution::ToNumber(it->isolate(), value),
|
Execution::ToNumber(it->isolate(), value),
|
||||||
@ -3431,13 +3423,11 @@ MaybeHandle<Object> Object::AddDataProperty(LookupIterator* it,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_trace_external_array_abuse &&
|
if (FLAG_trace_external_array_abuse &&
|
||||||
(array->HasExternalArrayElements() ||
|
array->HasFixedTypedArrayElements()) {
|
||||||
array->HasFixedTypedArrayElements())) {
|
|
||||||
CheckArrayAbuse(array, "typed elements write", it->index(), true);
|
CheckArrayAbuse(array, "typed elements write", it->index(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_trace_js_array_abuse && !array->HasExternalArrayElements() &&
|
if (FLAG_trace_js_array_abuse && !array->HasFixedTypedArrayElements()) {
|
||||||
!array->HasFixedTypedArrayElements()) {
|
|
||||||
CheckArrayAbuse(array, "elements write", it->index(), false);
|
CheckArrayAbuse(array, "elements write", it->index(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4266,8 +4256,7 @@ MaybeHandle<Object> JSObject::DefineOwnPropertyIgnoreAttributes(
|
|||||||
|
|
||||||
// Special case: properties of typed arrays cannot be reconfigured to
|
// Special case: properties of typed arrays cannot be reconfigured to
|
||||||
// non-writable nor to non-enumerable.
|
// non-writable nor to non-enumerable.
|
||||||
if (it->IsElement() && (object->HasExternalArrayElements() ||
|
if (it->IsElement() && object->HasFixedTypedArrayElements()) {
|
||||||
object->HasFixedTypedArrayElements())) {
|
|
||||||
return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
|
return RedefineNonconfigurableProperty(it->isolate(), it->GetName(),
|
||||||
value, STRICT);
|
value, STRICT);
|
||||||
}
|
}
|
||||||
@ -4850,8 +4839,7 @@ Handle<SeededNumberDictionary> JSObject::GetNormalizedElementDictionary(
|
|||||||
|
|
||||||
Handle<SeededNumberDictionary> JSObject::NormalizeElements(
|
Handle<SeededNumberDictionary> JSObject::NormalizeElements(
|
||||||
Handle<JSObject> object) {
|
Handle<JSObject> object) {
|
||||||
DCHECK(!object->HasExternalArrayElements() &&
|
DCHECK(!object->HasFixedTypedArrayElements());
|
||||||
!object->HasFixedTypedArrayElements());
|
|
||||||
Isolate* isolate = object->GetIsolate();
|
Isolate* isolate = object->GetIsolate();
|
||||||
|
|
||||||
// Find the backing store.
|
// Find the backing store.
|
||||||
@ -5356,7 +5344,6 @@ bool JSObject::ReferencesObject(Object* obj) {
|
|||||||
// Raw pixels and external arrays do not reference other
|
// Raw pixels and external arrays do not reference other
|
||||||
// objects.
|
// objects.
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5466,8 +5453,7 @@ MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It's not possible to seal objects with external array elements
|
// It's not possible to seal objects with external array elements
|
||||||
if (object->HasExternalArrayElements() ||
|
if (object->HasFixedTypedArrayElements()) {
|
||||||
object->HasFixedTypedArrayElements()) {
|
|
||||||
THROW_NEW_ERROR(
|
THROW_NEW_ERROR(
|
||||||
isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
|
isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
|
||||||
Object);
|
Object);
|
||||||
@ -5560,8 +5546,7 @@ MaybeHandle<Object> JSObject::PreventExtensionsWithTransition(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It's not possible to seal or freeze objects with external array elements
|
// It's not possible to seal or freeze objects with external array elements
|
||||||
if (object->HasExternalArrayElements() ||
|
if (object->HasFixedTypedArrayElements()) {
|
||||||
object->HasFixedTypedArrayElements()) {
|
|
||||||
THROW_NEW_ERROR(
|
THROW_NEW_ERROR(
|
||||||
isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
|
isolate, NewTypeError(MessageTemplate::kCannotPreventExtExternalArray),
|
||||||
Object);
|
Object);
|
||||||
@ -5830,7 +5815,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
|||||||
|
|
||||||
// Deep copy own elements.
|
// Deep copy own elements.
|
||||||
// Pixel elements cannot be created using an object literal.
|
// Pixel elements cannot be created using an object literal.
|
||||||
DCHECK(!copy->HasExternalArrayElements());
|
DCHECK(!copy->HasFixedTypedArrayElements());
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
@ -5892,7 +5877,6 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
|||||||
|
|
||||||
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -6295,8 +6279,7 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ignore accessors on typed arrays.
|
// Ignore accessors on typed arrays.
|
||||||
if (it.IsElement() && (object->HasFixedTypedArrayElements() ||
|
if (it.IsElement() && object->HasFixedTypedArrayElements()) {
|
||||||
object->HasExternalArrayElements())) {
|
|
||||||
return it.factory()->undefined_value();
|
return it.factory()->undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6359,8 +6342,7 @@ MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ignore accessors on typed arrays.
|
// Ignore accessors on typed arrays.
|
||||||
if (it.IsElement() && (object->HasFixedTypedArrayElements() ||
|
if (it.IsElement() && object->HasFixedTypedArrayElements()) {
|
||||||
object->HasExternalArrayElements())) {
|
|
||||||
return it.factory()->undefined_value();
|
return it.factory()->undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6777,13 +6759,10 @@ Handle<Map> Map::CopyAsElementsKind(Handle<Map> map, ElementsKind kind,
|
|||||||
Map* maybe_elements_transition_map = NULL;
|
Map* maybe_elements_transition_map = NULL;
|
||||||
if (flag == INSERT_TRANSITION) {
|
if (flag == INSERT_TRANSITION) {
|
||||||
maybe_elements_transition_map = map->ElementsTransitionMap();
|
maybe_elements_transition_map = map->ElementsTransitionMap();
|
||||||
DCHECK(
|
DCHECK(maybe_elements_transition_map == NULL ||
|
||||||
maybe_elements_transition_map == NULL ||
|
(maybe_elements_transition_map->elements_kind() ==
|
||||||
((maybe_elements_transition_map->elements_kind() ==
|
DICTIONARY_ELEMENTS &&
|
||||||
DICTIONARY_ELEMENTS ||
|
kind == DICTIONARY_ELEMENTS));
|
||||||
IsExternalArrayElementsKind(
|
|
||||||
maybe_elements_transition_map->elements_kind())) &&
|
|
||||||
(kind == DICTIONARY_ELEMENTS || IsExternalArrayElementsKind(kind))));
|
|
||||||
DCHECK(!IsFastElementsKind(kind) ||
|
DCHECK(!IsFastElementsKind(kind) ||
|
||||||
IsMoreGeneralElementsKindTransition(map->elements_kind(), kind));
|
IsMoreGeneralElementsKindTransition(map->elements_kind(), kind));
|
||||||
DCHECK(kind != map->elements_kind());
|
DCHECK(kind != map->elements_kind());
|
||||||
@ -12599,7 +12578,6 @@ int JSObject::GetFastElementsUsage() {
|
|||||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||||
case DICTIONARY_ELEMENTS:
|
case DICTIONARY_ELEMENTS:
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -13033,7 +13011,6 @@ int JSObject::GetOwnElementKeys(FixedArray* storage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -13855,8 +13832,7 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
|
|||||||
JSObject::ValidateElements(object);
|
JSObject::ValidateElements(object);
|
||||||
|
|
||||||
JSObject::SetMapAndElements(object, new_map, fast_elements);
|
JSObject::SetMapAndElements(object, new_map, fast_elements);
|
||||||
} else if (object->HasExternalArrayElements() ||
|
} else if (object->HasFixedTypedArrayElements()) {
|
||||||
object->HasFixedTypedArrayElements()) {
|
|
||||||
// Typed arrays cannot have holes or undefined elements.
|
// Typed arrays cannot have holes or undefined elements.
|
||||||
return handle(Smi::FromInt(
|
return handle(Smi::FromInt(
|
||||||
FixedArrayBase::cast(object->elements())->length()), isolate);
|
FixedArrayBase::cast(object->elements())->length()), isolate);
|
||||||
@ -13959,7 +13935,6 @@ Handle<Object> JSObject::PrepareElementsForSort(Handle<JSObject> object,
|
|||||||
ExternalArrayType JSTypedArray::type() {
|
ExternalArrayType JSTypedArray::type() {
|
||||||
switch (elements()->map()->instance_type()) {
|
switch (elements()->map()->instance_type()) {
|
||||||
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
|
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
|
||||||
case FIXED_##TYPE##_ARRAY_TYPE: \
|
case FIXED_##TYPE##_ARRAY_TYPE: \
|
||||||
return kExternal##Type##Array;
|
return kExternal##Type##Array;
|
||||||
|
|
||||||
@ -13975,9 +13950,9 @@ ExternalArrayType JSTypedArray::type() {
|
|||||||
|
|
||||||
size_t JSTypedArray::element_size() {
|
size_t JSTypedArray::element_size() {
|
||||||
switch (elements()->map()->instance_type()) {
|
switch (elements()->map()->instance_type()) {
|
||||||
#define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size) \
|
#define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ARRAY_TYPE: \
|
case FIXED_##TYPE##_ARRAY_TYPE: \
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE)
|
TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE)
|
||||||
#undef INSTANCE_TYPE_TO_ELEMENT_SIZE
|
#undef INSTANCE_TYPE_TO_ELEMENT_SIZE
|
||||||
@ -13995,131 +13970,6 @@ void FixedArray::SetValue(uint32_t index, Object* value) { set(index, value); }
|
|||||||
void FixedDoubleArray::SetValue(uint32_t index, Object* value) {
|
void FixedDoubleArray::SetValue(uint32_t index, Object* value) {
|
||||||
set(index, value->Number());
|
set(index, value->Number());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint8ClampedArray::SetValue(uint32_t index, Object* value) {
|
|
||||||
uint8_t clamped_value = 0;
|
|
||||||
if (value->IsSmi()) {
|
|
||||||
int int_value = Smi::cast(value)->value();
|
|
||||||
if (int_value < 0) {
|
|
||||||
clamped_value = 0;
|
|
||||||
} else if (int_value > 255) {
|
|
||||||
clamped_value = 255;
|
|
||||||
} else {
|
|
||||||
clamped_value = static_cast<uint8_t>(int_value);
|
|
||||||
}
|
|
||||||
} else if (value->IsHeapNumber()) {
|
|
||||||
double double_value = HeapNumber::cast(value)->value();
|
|
||||||
if (!(double_value > 0)) {
|
|
||||||
// NaN and less than zero clamp to zero.
|
|
||||||
clamped_value = 0;
|
|
||||||
} else if (double_value > 255) {
|
|
||||||
// Greater than 255 clamp to 255.
|
|
||||||
clamped_value = 255;
|
|
||||||
} else {
|
|
||||||
// Other doubles are rounded to the nearest integer.
|
|
||||||
clamped_value = static_cast<uint8_t>(lrint(double_value));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Clamp undefined to zero (default). All other types have been
|
|
||||||
// converted to a number type further up in the call chain.
|
|
||||||
DCHECK(value->IsUndefined());
|
|
||||||
}
|
|
||||||
set(index, clamped_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <typename ExternalArrayClass, typename ValueType>
|
|
||||||
static void ExternalArrayIntSetter(ExternalArrayClass* receiver, uint32_t index,
|
|
||||||
Object* value) {
|
|
||||||
ValueType cast_value = 0;
|
|
||||||
if (value->IsSmi()) {
|
|
||||||
int int_value = Smi::cast(value)->value();
|
|
||||||
cast_value = static_cast<ValueType>(int_value);
|
|
||||||
} else if (value->IsHeapNumber()) {
|
|
||||||
double double_value = HeapNumber::cast(value)->value();
|
|
||||||
cast_value = static_cast<ValueType>(DoubleToInt32(double_value));
|
|
||||||
} else {
|
|
||||||
// Clamp undefined to zero (default). All other types have been
|
|
||||||
// converted to a number type further up in the call chain.
|
|
||||||
DCHECK(value->IsUndefined());
|
|
||||||
}
|
|
||||||
receiver->set(index, cast_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt8Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
ExternalArrayIntSetter<ExternalInt8Array, int8_t>(this, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint8Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
ExternalArrayIntSetter<ExternalUint8Array, uint8_t>(this, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt16Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
ExternalArrayIntSetter<ExternalInt16Array, int16_t>(this, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint16Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
ExternalArrayIntSetter<ExternalUint16Array, uint16_t>(this, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalInt32Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
ExternalArrayIntSetter<ExternalInt32Array, int32_t>(this, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalUint32Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
uint32_t cast_value = 0;
|
|
||||||
if (value->IsSmi()) {
|
|
||||||
int int_value = Smi::cast(value)->value();
|
|
||||||
cast_value = static_cast<uint32_t>(int_value);
|
|
||||||
} else if (value->IsHeapNumber()) {
|
|
||||||
double double_value = HeapNumber::cast(value)->value();
|
|
||||||
cast_value = static_cast<uint32_t>(DoubleToUint32(double_value));
|
|
||||||
} else {
|
|
||||||
// Clamp undefined to zero (default). All other types have been
|
|
||||||
// converted to a number type further up in the call chain.
|
|
||||||
DCHECK(value->IsUndefined());
|
|
||||||
}
|
|
||||||
set(index, cast_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalFloat32Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
float cast_value = std::numeric_limits<float>::quiet_NaN();
|
|
||||||
if (value->IsSmi()) {
|
|
||||||
int int_value = Smi::cast(value)->value();
|
|
||||||
cast_value = static_cast<float>(int_value);
|
|
||||||
} else if (value->IsHeapNumber()) {
|
|
||||||
double double_value = HeapNumber::cast(value)->value();
|
|
||||||
cast_value = static_cast<float>(double_value);
|
|
||||||
} else {
|
|
||||||
// Clamp undefined to NaN (default). All other types have been
|
|
||||||
// converted to a number type further up in the call chain.
|
|
||||||
DCHECK(value->IsUndefined());
|
|
||||||
}
|
|
||||||
set(index, cast_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExternalFloat64Array::SetValue(uint32_t index, Object* value) {
|
|
||||||
double double_value = std::numeric_limits<double>::quiet_NaN();
|
|
||||||
if (value->IsNumber()) {
|
|
||||||
double_value = value->Number();
|
|
||||||
} else {
|
|
||||||
// Clamp undefined to NaN (default). All other types have been
|
|
||||||
// converted to a number type further up in the call chain.
|
|
||||||
DCHECK(value->IsUndefined());
|
|
||||||
}
|
|
||||||
set(index, double_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GlobalObject::InvalidatePropertyCell(Handle<GlobalObject> global,
|
void GlobalObject::InvalidatePropertyCell(Handle<GlobalObject> global,
|
||||||
Handle<Name> name) {
|
Handle<Name> name) {
|
||||||
DCHECK(!global->HasFastProperties());
|
DCHECK(!global->HasFastProperties());
|
||||||
@ -15731,21 +15581,6 @@ void JSArrayBuffer::Neuter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ElementsKind FixedToExternalElementsKind(ElementsKind elements_kind) {
|
|
||||||
switch (elements_kind) {
|
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
|
||||||
case TYPE##_ELEMENTS: return EXTERNAL_##TYPE##_ELEMENTS;
|
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
|
||||||
#undef TYPED_ARRAY_CASE
|
|
||||||
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
return FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer(
|
Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer(
|
||||||
Handle<JSTypedArray> typed_array) {
|
Handle<JSTypedArray> typed_array) {
|
||||||
|
|
||||||
@ -15754,10 +15589,6 @@ Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer(
|
|||||||
|
|
||||||
DCHECK(IsFixedTypedArrayElementsKind(map->elements_kind()));
|
DCHECK(IsFixedTypedArrayElementsKind(map->elements_kind()));
|
||||||
|
|
||||||
Handle<Map> new_map = Map::TransitionElementsTo(
|
|
||||||
map,
|
|
||||||
FixedToExternalElementsKind(map->elements_kind()));
|
|
||||||
|
|
||||||
Handle<FixedTypedArrayBase> fixed_typed_array(
|
Handle<FixedTypedArrayBase> fixed_typed_array(
|
||||||
FixedTypedArrayBase::cast(typed_array->elements()));
|
FixedTypedArrayBase::cast(typed_array->elements()));
|
||||||
|
|
||||||
@ -15774,21 +15605,23 @@ Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer(
|
|||||||
memcpy(buffer->backing_store(),
|
memcpy(buffer->backing_store(),
|
||||||
fixed_typed_array->DataPtr(),
|
fixed_typed_array->DataPtr(),
|
||||||
fixed_typed_array->DataSize());
|
fixed_typed_array->DataSize());
|
||||||
Handle<ExternalArray> new_elements =
|
Handle<FixedTypedArrayBase> new_elements =
|
||||||
isolate->factory()->NewExternalArray(
|
isolate->factory()->NewFixedTypedArrayWithExternalPointer(
|
||||||
fixed_typed_array->length(), typed_array->type(),
|
fixed_typed_array->length(), typed_array->type(),
|
||||||
static_cast<uint8_t*>(buffer->backing_store()));
|
static_cast<uint8_t*>(buffer->backing_store()));
|
||||||
|
|
||||||
JSObject::SetMapAndElements(typed_array, new_map, new_elements);
|
typed_array->set_elements(*new_elements);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<JSArrayBuffer> JSTypedArray::GetBuffer() {
|
Handle<JSArrayBuffer> JSTypedArray::GetBuffer() {
|
||||||
if (IsExternalArrayElementsKind(map()->elements_kind())) {
|
Handle<JSArrayBuffer> array_buffer(JSArrayBuffer::cast(buffer()),
|
||||||
Handle<Object> result(buffer(), GetIsolate());
|
GetIsolate());
|
||||||
return Handle<JSArrayBuffer>::cast(result);
|
if (array_buffer->was_neutered() ||
|
||||||
|
array_buffer->backing_store() != nullptr) {
|
||||||
|
return array_buffer;
|
||||||
}
|
}
|
||||||
Handle<JSTypedArray> self(this);
|
Handle<JSTypedArray> self(this);
|
||||||
return MaterializeArrayBuffer(self);
|
return MaterializeArrayBuffer(self);
|
||||||
|
321
src/objects.h
321
src/objects.h
@ -93,15 +93,6 @@
|
|||||||
// - ScriptContextTable
|
// - ScriptContextTable
|
||||||
// - WeakFixedArray
|
// - WeakFixedArray
|
||||||
// - FixedDoubleArray
|
// - FixedDoubleArray
|
||||||
// - ExternalArray
|
|
||||||
// - ExternalUint8ClampedArray
|
|
||||||
// - ExternalInt8Array
|
|
||||||
// - ExternalUint8Array
|
|
||||||
// - ExternalInt16Array
|
|
||||||
// - ExternalUint16Array
|
|
||||||
// - ExternalInt32Array
|
|
||||||
// - ExternalUint32Array
|
|
||||||
// - ExternalFloat32Array
|
|
||||||
// - Name
|
// - Name
|
||||||
// - String
|
// - String
|
||||||
// - SeqString
|
// - SeqString
|
||||||
@ -392,18 +383,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
|||||||
V(BYTE_ARRAY_TYPE) \
|
V(BYTE_ARRAY_TYPE) \
|
||||||
V(BYTECODE_ARRAY_TYPE) \
|
V(BYTECODE_ARRAY_TYPE) \
|
||||||
V(FREE_SPACE_TYPE) \
|
V(FREE_SPACE_TYPE) \
|
||||||
/* Note: the order of these external array */ \
|
|
||||||
/* types is relied upon in */ \
|
|
||||||
/* Object::IsExternalArray(). */ \
|
|
||||||
V(EXTERNAL_INT8_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_UINT8_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_INT16_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_UINT16_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_INT32_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_UINT32_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_FLOAT32_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_FLOAT64_ARRAY_TYPE) \
|
|
||||||
V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \
|
|
||||||
\
|
\
|
||||||
V(FIXED_INT8_ARRAY_TYPE) \
|
V(FIXED_INT8_ARRAY_TYPE) \
|
||||||
V(FIXED_UINT8_ARRAY_TYPE) \
|
V(FIXED_UINT8_ARRAY_TYPE) \
|
||||||
@ -689,15 +668,6 @@ enum InstanceType {
|
|||||||
BYTE_ARRAY_TYPE,
|
BYTE_ARRAY_TYPE,
|
||||||
BYTECODE_ARRAY_TYPE,
|
BYTECODE_ARRAY_TYPE,
|
||||||
FREE_SPACE_TYPE,
|
FREE_SPACE_TYPE,
|
||||||
EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
|
|
||||||
EXTERNAL_UINT8_ARRAY_TYPE,
|
|
||||||
EXTERNAL_INT16_ARRAY_TYPE,
|
|
||||||
EXTERNAL_UINT16_ARRAY_TYPE,
|
|
||||||
EXTERNAL_INT32_ARRAY_TYPE,
|
|
||||||
EXTERNAL_UINT32_ARRAY_TYPE,
|
|
||||||
EXTERNAL_FLOAT32_ARRAY_TYPE,
|
|
||||||
EXTERNAL_FLOAT64_ARRAY_TYPE,
|
|
||||||
EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
|
|
||||||
FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
|
FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
|
||||||
FIXED_UINT8_ARRAY_TYPE,
|
FIXED_UINT8_ARRAY_TYPE,
|
||||||
FIXED_INT16_ARRAY_TYPE,
|
FIXED_INT16_ARRAY_TYPE,
|
||||||
@ -780,9 +750,6 @@ enum InstanceType {
|
|||||||
// Boundaries for testing for a SIMD type.
|
// Boundaries for testing for a SIMD type.
|
||||||
FIRST_SIMD_TYPE = FLOAT32X4_TYPE,
|
FIRST_SIMD_TYPE = FLOAT32X4_TYPE,
|
||||||
LAST_SIMD_TYPE = FLOAT32X4_TYPE,
|
LAST_SIMD_TYPE = FLOAT32X4_TYPE,
|
||||||
// Boundaries for testing for an external array.
|
|
||||||
FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_INT8_ARRAY_TYPE,
|
|
||||||
LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE,
|
|
||||||
// Boundaries for testing for a fixed typed array.
|
// Boundaries for testing for a fixed typed array.
|
||||||
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
|
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
|
||||||
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
|
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE,
|
||||||
@ -812,9 +779,6 @@ enum InstanceType {
|
|||||||
NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2
|
NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
const int kExternalArrayTypeCount =
|
|
||||||
LAST_EXTERNAL_ARRAY_TYPE - FIRST_EXTERNAL_ARRAY_TYPE + 1;
|
|
||||||
|
|
||||||
STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
||||||
STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
||||||
STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
|
STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
|
||||||
@ -933,16 +897,6 @@ template <class C> inline bool Is(Object* obj);
|
|||||||
V(InternalizedString) \
|
V(InternalizedString) \
|
||||||
V(Symbol) \
|
V(Symbol) \
|
||||||
\
|
\
|
||||||
V(ExternalArray) \
|
|
||||||
V(ExternalInt8Array) \
|
|
||||||
V(ExternalUint8Array) \
|
|
||||||
V(ExternalInt16Array) \
|
|
||||||
V(ExternalUint16Array) \
|
|
||||||
V(ExternalInt32Array) \
|
|
||||||
V(ExternalUint32Array) \
|
|
||||||
V(ExternalFloat32Array) \
|
|
||||||
V(ExternalFloat64Array) \
|
|
||||||
V(ExternalUint8ClampedArray) \
|
|
||||||
V(FixedTypedArrayBase) \
|
V(FixedTypedArrayBase) \
|
||||||
V(FixedUint8Array) \
|
V(FixedUint8Array) \
|
||||||
V(FixedInt8Array) \
|
V(FixedInt8Array) \
|
||||||
@ -1772,9 +1726,8 @@ class JSObject: public JSReceiver {
|
|||||||
// writing to any element the array must be copied. Use
|
// writing to any element the array must be copied. Use
|
||||||
// EnsureWritableFastElements in this case.
|
// EnsureWritableFastElements in this case.
|
||||||
//
|
//
|
||||||
// In the slow mode the elements is either a NumberDictionary, an
|
// In the slow mode the elements is either a NumberDictionary, a
|
||||||
// ExternalArray, or a FixedArray parameter map for a (sloppy)
|
// FixedArray parameter map for a (sloppy) arguments object.
|
||||||
// arguments object.
|
|
||||||
DECL_ACCESSORS(elements, FixedArrayBase)
|
DECL_ACCESSORS(elements, FixedArrayBase)
|
||||||
inline void initialize_elements();
|
inline void initialize_elements();
|
||||||
static void ResetElements(Handle<JSObject> object);
|
static void ResetElements(Handle<JSObject> object);
|
||||||
@ -1801,17 +1754,6 @@ class JSObject: public JSReceiver {
|
|||||||
inline bool HasSloppyArgumentsElements();
|
inline bool HasSloppyArgumentsElements();
|
||||||
inline bool HasDictionaryElements();
|
inline bool HasDictionaryElements();
|
||||||
|
|
||||||
inline bool HasExternalUint8ClampedElements();
|
|
||||||
inline bool HasExternalArrayElements();
|
|
||||||
inline bool HasExternalInt8Elements();
|
|
||||||
inline bool HasExternalUint8Elements();
|
|
||||||
inline bool HasExternalInt16Elements();
|
|
||||||
inline bool HasExternalUint16Elements();
|
|
||||||
inline bool HasExternalInt32Elements();
|
|
||||||
inline bool HasExternalUint32Elements();
|
|
||||||
inline bool HasExternalFloat32Elements();
|
|
||||||
inline bool HasExternalFloat64Elements();
|
|
||||||
|
|
||||||
inline bool HasFixedTypedArrayElements();
|
inline bool HasFixedTypedArrayElements();
|
||||||
|
|
||||||
inline bool HasFixedUint8ClampedElements();
|
inline bool HasFixedUint8ClampedElements();
|
||||||
@ -4334,261 +4276,14 @@ class FreeSpace: public HeapObject {
|
|||||||
V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1)
|
V(Uint8Clamped, uint8_clamped, UINT8_CLAMPED, uint8_t, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// An ExternalArray represents a fixed-size array of primitive values
|
|
||||||
// which live outside the JavaScript heap. Its subclasses are used to
|
|
||||||
// implement the CanvasArray types being defined in the WebGL
|
|
||||||
// specification. As of this writing the first public draft is not yet
|
|
||||||
// available, but Khronos members can access the draft at:
|
|
||||||
// https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html
|
|
||||||
//
|
|
||||||
// The semantics of these arrays differ from CanvasPixelArray.
|
|
||||||
// Out-of-range values passed to the setter are converted via a C
|
|
||||||
// cast, not clamping. Out-of-range indices cause exceptions to be
|
|
||||||
// raised rather than being silently ignored.
|
|
||||||
class ExternalArray: public FixedArrayBase {
|
|
||||||
public:
|
|
||||||
inline bool is_the_hole(int index) { return false; }
|
|
||||||
|
|
||||||
// [external_pointer]: The pointer to the external memory area backing this
|
|
||||||
// external array.
|
|
||||||
DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalArray)
|
|
||||||
|
|
||||||
// Maximal acceptable length for an external array.
|
|
||||||
static const int kMaxLength = 0x3fffffff;
|
|
||||||
|
|
||||||
// ExternalArray headers are not quadword aligned.
|
|
||||||
static const int kExternalPointerOffset =
|
|
||||||
POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize);
|
|
||||||
static const int kSize = kExternalPointerOffset + kPointerSize;
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// A ExternalUint8ClampedArray represents a fixed-size byte array with special
|
|
||||||
// semantics used for implementing the CanvasPixelArray object. Please see the
|
|
||||||
// specification at:
|
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/
|
|
||||||
// multipage/the-canvas-element.html#canvaspixelarray
|
|
||||||
// In particular, write access clamps the value written to 0 or 255 if the
|
|
||||||
// value written is outside this range.
|
|
||||||
class ExternalUint8ClampedArray: public ExternalArray {
|
|
||||||
public:
|
|
||||||
inline uint8_t* external_uint8_clamped_pointer();
|
|
||||||
|
|
||||||
// Setter and getter.
|
|
||||||
inline uint8_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array,
|
|
||||||
int index);
|
|
||||||
inline void set(int index, uint8_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined and clamps the converted value between 0 and 255.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalUint8ClampedArray)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalUint8ClampedArray)
|
|
||||||
DECLARE_VERIFIER(ExternalUint8ClampedArray)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalInt8Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline int8_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index);
|
|
||||||
inline void set(int index, int8_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalInt8Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalInt8Array)
|
|
||||||
DECLARE_VERIFIER(ExternalInt8Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalUint8Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline uint8_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index);
|
|
||||||
inline void set(int index, uint8_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalUint8Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalUint8Array)
|
|
||||||
DECLARE_VERIFIER(ExternalUint8Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalInt16Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline int16_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index);
|
|
||||||
inline void set(int index, int16_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalInt16Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalInt16Array)
|
|
||||||
DECLARE_VERIFIER(ExternalInt16Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalUint16Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline uint16_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalUint16Array> array,
|
|
||||||
int index);
|
|
||||||
inline void set(int index, uint16_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalUint16Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalUint16Array)
|
|
||||||
DECLARE_VERIFIER(ExternalUint16Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalInt32Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline int32_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index);
|
|
||||||
inline void set(int index, int32_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalInt32Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalInt32Array)
|
|
||||||
DECLARE_VERIFIER(ExternalInt32Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalUint32Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline uint32_t get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalUint32Array> array,
|
|
||||||
int index);
|
|
||||||
inline void set(int index, uint32_t value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalUint32Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalUint32Array)
|
|
||||||
DECLARE_VERIFIER(ExternalUint32Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalFloat32Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline float get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalFloat32Array> array,
|
|
||||||
int index);
|
|
||||||
inline void set(int index, float value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalFloat32Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalFloat32Array)
|
|
||||||
DECLARE_VERIFIER(ExternalFloat32Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ExternalFloat64Array: public ExternalArray {
|
|
||||||
public:
|
|
||||||
// Setter and getter.
|
|
||||||
inline double get_scalar(int index);
|
|
||||||
static inline Handle<Object> get(Handle<ExternalFloat64Array> array,
|
|
||||||
int index);
|
|
||||||
inline void set(int index, double value);
|
|
||||||
|
|
||||||
// This accessor applies the correct conversion from Smi, HeapNumber
|
|
||||||
// and undefined.
|
|
||||||
void SetValue(uint32_t index, Object* value);
|
|
||||||
|
|
||||||
DECLARE_CAST(ExternalFloat64Array)
|
|
||||||
|
|
||||||
// Dispatched behavior.
|
|
||||||
DECLARE_PRINTER(ExternalFloat64Array)
|
|
||||||
DECLARE_VERIFIER(ExternalFloat64Array)
|
|
||||||
|
|
||||||
private:
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class FixedTypedArrayBase: public FixedArrayBase {
|
class FixedTypedArrayBase: public FixedArrayBase {
|
||||||
public:
|
public:
|
||||||
// [base_pointer]: For now, points to the FixedTypedArrayBase itself.
|
// [base_pointer]: Either points to the FixedTypedArrayBase itself or nullptr.
|
||||||
DECL_ACCESSORS(base_pointer, Object)
|
DECL_ACCESSORS(base_pointer, Object)
|
||||||
|
|
||||||
// [external_pointer]: For now, contains the offset between base_pointer and
|
// [external_pointer]: Contains the offset between base_pointer and the start
|
||||||
// the start of the data.
|
// of the data. If the base_pointer is a nullptr, the external_pointer
|
||||||
|
// therefore points to the actual backing store.
|
||||||
DECL_ACCESSORS(external_pointer, void)
|
DECL_ACCESSORS(external_pointer, void)
|
||||||
|
|
||||||
// Dispatched behavior.
|
// Dispatched behavior.
|
||||||
@ -5739,10 +5434,6 @@ class Map: public HeapObject {
|
|||||||
return IsSloppyArgumentsElements(elements_kind());
|
return IsSloppyArgumentsElements(elements_kind());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool has_external_array_elements() {
|
|
||||||
return IsExternalArrayElementsKind(elements_kind());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool has_fixed_typed_array_elements() {
|
inline bool has_fixed_typed_array_elements() {
|
||||||
return IsFixedTypedArrayElementsKind(elements_kind());
|
return IsFixedTypedArrayElementsKind(elements_kind());
|
||||||
}
|
}
|
||||||
|
@ -3297,10 +3297,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
|
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
DoubleRegister result = ToDoubleRegister(instr->result());
|
DoubleRegister result = ToDoubleRegister(instr->result());
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ Add(scratch0(), external_pointer, constant_key << element_size_shift,
|
__ Add(scratch0(), external_pointer, constant_key << element_size_shift,
|
||||||
@ -3309,8 +3306,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
|
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
|
||||||
__ add(scratch0(), external_pointer, r0);
|
__ add(scratch0(), external_pointer, r0);
|
||||||
}
|
}
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ lfs(result, MemOperand(scratch0(), base_offset));
|
__ lfs(result, MemOperand(scratch0(), base_offset));
|
||||||
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
||||||
__ lfd(result, MemOperand(scratch0(), base_offset));
|
__ lfd(result, MemOperand(scratch0(), base_offset));
|
||||||
@ -3321,7 +3317,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
|
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
|
||||||
constant_key, element_size_shift, base_offset);
|
constant_key, element_size_shift, base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ LoadByte(result, mem_operand, r0);
|
__ LoadByte(result, mem_operand, r0);
|
||||||
@ -3330,8 +3325,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
__ extsb(result, result);
|
__ extsb(result, result);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -3340,7 +3333,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ lbzx(result, mem_operand);
|
__ lbzx(result, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ LoadHalfWordArith(result, mem_operand, r0);
|
__ LoadHalfWordArith(result, mem_operand, r0);
|
||||||
@ -3348,7 +3340,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ lhax(result, mem_operand);
|
__ lhax(result, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ LoadHalfWord(result, mem_operand, r0);
|
__ LoadHalfWord(result, mem_operand, r0);
|
||||||
@ -3356,7 +3347,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ lhzx(result, mem_operand);
|
__ lhzx(result, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ LoadWordArith(result, mem_operand, r0);
|
__ LoadWordArith(result, mem_operand, r0);
|
||||||
@ -3364,7 +3354,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
__ lwax(result, mem_operand);
|
__ lwax(result, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
__ LoadWord(result, mem_operand, r0);
|
__ LoadWord(result, mem_operand, r0);
|
||||||
@ -3379,8 +3368,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||||
case FAST_HOLEY_ELEMENTS:
|
case FAST_HOLEY_ELEMENTS:
|
||||||
case FAST_HOLEY_SMI_ELEMENTS:
|
case FAST_HOLEY_SMI_ELEMENTS:
|
||||||
@ -3517,7 +3504,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4571,10 +4558,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
|
bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi();
|
||||||
int base_offset = instr->base_offset();
|
int base_offset = instr->base_offset();
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
Register address = scratch0();
|
Register address = scratch0();
|
||||||
DoubleRegister value(ToDoubleRegister(instr->value()));
|
DoubleRegister value(ToDoubleRegister(instr->value()));
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4588,8 +4572,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
|
__ IndexToArrayOffset(r0, key, element_size_shift, key_is_smi);
|
||||||
__ add(address, external_pointer, r0);
|
__ add(address, external_pointer, r0);
|
||||||
}
|
}
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
__ frsp(double_scratch0(), value);
|
__ frsp(double_scratch0(), value);
|
||||||
__ stfs(double_scratch0(), MemOperand(address, base_offset));
|
__ stfs(double_scratch0(), MemOperand(address, base_offset));
|
||||||
} else { // Storing doubles, not floats.
|
} else { // Storing doubles, not floats.
|
||||||
@ -4601,9 +4584,6 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
|
PrepareKeyedOperand(key, external_pointer, key_is_constant, key_is_smi,
|
||||||
constant_key, element_size_shift, base_offset);
|
constant_key, element_size_shift, base_offset);
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
@ -4613,8 +4593,6 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
__ stbx(value, mem_operand);
|
__ stbx(value, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4623,8 +4601,6 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
__ sthx(value, mem_operand);
|
__ sthx(value, mem_operand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
if (key_is_constant) {
|
if (key_is_constant) {
|
||||||
@ -4635,8 +4611,6 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
break;
|
break;
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FAST_DOUBLE_ELEMENTS:
|
case FAST_DOUBLE_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4754,7 +4728,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases: external, fast double
|
// By cases: external, fast double
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2198,7 +2198,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = NULL;
|
LOperand* obj = NULL;
|
||||||
if (instr->representation().IsDouble()) {
|
if (instr->representation().IsDouble()) {
|
||||||
obj = UseRegister(instr->elements());
|
obj = UseRegister(instr->elements());
|
||||||
@ -2216,10 +2216,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2253,7 +2252,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
||||||
LOperand* object = NULL;
|
LOperand* object = NULL;
|
||||||
|
@ -1587,13 +1587,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
ElementsKind elements_kind() const { return hydrogen()->elements_kind(); }
|
ElementsKind elements_kind() const { return hydrogen()->elements_kind(); }
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -2168,13 +2164,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = value;
|
inputs_[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -298,7 +298,6 @@ static uint32_t EstimateElementCount(Handle<JSArray> array) {
|
|||||||
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||||
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
|
||||||
case TYPE##_ELEMENTS:
|
case TYPE##_ELEMENTS:
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
@ -418,7 +417,6 @@ static void CollectElementIndices(Handle<JSObject> object, uint32_t range,
|
|||||||
}
|
}
|
||||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case TYPE##_ELEMENTS: \
|
case TYPE##_ELEMENTS: \
|
||||||
case EXTERNAL_##TYPE##_ELEMENTS:
|
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
TYPED_ARRAYS(TYPED_ARRAY_CASE)
|
||||||
#undef TYPED_ARRAY_CASE
|
#undef TYPED_ARRAY_CASE
|
||||||
@ -610,15 +608,6 @@ static bool IterateElements(Isolate* isolate, Handle<JSObject> receiver,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS: {
|
|
||||||
Handle<ExternalUint8ClampedArray> pixels(
|
|
||||||
ExternalUint8ClampedArray::cast(receiver->elements()));
|
|
||||||
for (uint32_t j = 0; j < length; j++) {
|
|
||||||
Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)), isolate);
|
|
||||||
visitor->visit(j, e);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UINT8_CLAMPED_ELEMENTS: {
|
case UINT8_CLAMPED_ELEMENTS: {
|
||||||
Handle<FixedUint8ClampedArray> pixels(
|
Handle<FixedUint8ClampedArray> pixels(
|
||||||
FixedUint8ClampedArray::cast(receiver->elements()));
|
FixedUint8ClampedArray::cast(receiver->elements()));
|
||||||
@ -628,81 +617,41 @@ static bool IterateElements(Isolate* isolate, Handle<JSObject> receiver,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_INT8_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalInt8Array, int8_t>(
|
|
||||||
isolate, receiver, true, true, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INT8_ELEMENTS: {
|
case INT8_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedInt8Array, int8_t>(
|
IterateTypedArrayElements<FixedInt8Array, int8_t>(
|
||||||
isolate, receiver, true, true, visitor);
|
isolate, receiver, true, true, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_UINT8_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalUint8Array, uint8_t>(
|
|
||||||
isolate, receiver, true, true, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UINT8_ELEMENTS: {
|
case UINT8_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedUint8Array, uint8_t>(
|
IterateTypedArrayElements<FixedUint8Array, uint8_t>(
|
||||||
isolate, receiver, true, true, visitor);
|
isolate, receiver, true, true, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_INT16_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalInt16Array, int16_t>(
|
|
||||||
isolate, receiver, true, true, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INT16_ELEMENTS: {
|
case INT16_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedInt16Array, int16_t>(
|
IterateTypedArrayElements<FixedInt16Array, int16_t>(
|
||||||
isolate, receiver, true, true, visitor);
|
isolate, receiver, true, true, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_UINT16_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalUint16Array, uint16_t>(
|
|
||||||
isolate, receiver, true, true, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UINT16_ELEMENTS: {
|
case UINT16_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedUint16Array, uint16_t>(
|
IterateTypedArrayElements<FixedUint16Array, uint16_t>(
|
||||||
isolate, receiver, true, true, visitor);
|
isolate, receiver, true, true, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_INT32_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalInt32Array, int32_t>(
|
|
||||||
isolate, receiver, true, false, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INT32_ELEMENTS: {
|
case INT32_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedInt32Array, int32_t>(
|
IterateTypedArrayElements<FixedInt32Array, int32_t>(
|
||||||
isolate, receiver, true, false, visitor);
|
isolate, receiver, true, false, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_UINT32_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalUint32Array, uint32_t>(
|
|
||||||
isolate, receiver, true, false, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UINT32_ELEMENTS: {
|
case UINT32_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedUint32Array, uint32_t>(
|
IterateTypedArrayElements<FixedUint32Array, uint32_t>(
|
||||||
isolate, receiver, true, false, visitor);
|
isolate, receiver, true, false, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalFloat32Array, float>(
|
|
||||||
isolate, receiver, false, false, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FLOAT32_ELEMENTS: {
|
case FLOAT32_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedFloat32Array, float>(
|
IterateTypedArrayElements<FixedFloat32Array, float>(
|
||||||
isolate, receiver, false, false, visitor);
|
isolate, receiver, false, false, visitor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS: {
|
|
||||||
IterateTypedArrayElements<ExternalFloat64Array, double>(
|
|
||||||
isolate, receiver, false, false, visitor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FLOAT64_ELEMENTS: {
|
case FLOAT64_ELEMENTS: {
|
||||||
IterateTypedArrayElements<FixedFloat64Array, double>(
|
IterateTypedArrayElements<FixedFloat64Array, double>(
|
||||||
isolate, receiver, false, false, visitor);
|
isolate, receiver, false, false, visitor);
|
||||||
@ -1233,8 +1182,7 @@ RUNTIME_FUNCTION(Runtime_NormalizeElements) {
|
|||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
|
||||||
RUNTIME_ASSERT(!array->HasExternalArrayElements() &&
|
RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() &&
|
||||||
!array->HasFixedTypedArrayElements() &&
|
|
||||||
!array->IsJSGlobalProxy());
|
!array->IsJSGlobalProxy());
|
||||||
JSObject::NormalizeElements(array);
|
JSObject::NormalizeElements(array);
|
||||||
return *array;
|
return *array;
|
||||||
|
@ -480,24 +480,13 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements)
|
|||||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
|
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
|
||||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
|
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
|
||||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(SloppyArgumentsElements)
|
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(SloppyArgumentsElements)
|
||||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
|
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FixedTypedArrayElements)
|
||||||
// Properties test sitting with elements tests - not fooling anyone.
|
// Properties test sitting with elements tests - not fooling anyone.
|
||||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
|
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
|
||||||
|
|
||||||
#undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION
|
#undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION
|
||||||
|
|
||||||
|
|
||||||
#define TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, size) \
|
|
||||||
RUNTIME_FUNCTION(Runtime_HasExternal##Type##Elements) { \
|
|
||||||
CONVERT_ARG_CHECKED(JSObject, obj, 0); \
|
|
||||||
return isolate->heap()->ToBoolean(obj->HasExternal##Type##Elements()); \
|
|
||||||
}
|
|
||||||
|
|
||||||
TYPED_ARRAYS(TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION)
|
|
||||||
|
|
||||||
#undef TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
|
|
||||||
|
|
||||||
|
|
||||||
#define FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, s) \
|
#define FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, s) \
|
||||||
RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \
|
RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \
|
||||||
CONVERT_ARG_CHECKED(JSObject, obj, 0); \
|
CONVERT_ARG_CHECKED(JSObject, obj, 0); \
|
||||||
|
@ -159,14 +159,12 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) {
|
|||||||
|
|
||||||
|
|
||||||
void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type,
|
void Runtime::ArrayIdToTypeAndSize(int arrayId, ExternalArrayType* array_type,
|
||||||
ElementsKind* external_elements_kind,
|
|
||||||
ElementsKind* fixed_elements_kind,
|
ElementsKind* fixed_elements_kind,
|
||||||
size_t* element_size) {
|
size_t* element_size) {
|
||||||
switch (arrayId) {
|
switch (arrayId) {
|
||||||
#define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \
|
#define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \
|
||||||
case ARRAY_ID_##TYPE: \
|
case ARRAY_ID_##TYPE: \
|
||||||
*array_type = kExternal##Type##Array; \
|
*array_type = kExternal##Type##Array; \
|
||||||
*external_elements_kind = EXTERNAL_##TYPE##_ELEMENTS; \
|
|
||||||
*fixed_elements_kind = TYPE##_ELEMENTS; \
|
*fixed_elements_kind = TYPE##_ELEMENTS; \
|
||||||
*element_size = size; \
|
*element_size = size; \
|
||||||
break;
|
break;
|
||||||
@ -195,11 +193,9 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitialize) {
|
|||||||
|
|
||||||
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
|
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
|
||||||
size_t element_size = 1; // Bogus initialization.
|
size_t element_size = 1; // Bogus initialization.
|
||||||
ElementsKind external_elements_kind =
|
|
||||||
EXTERNAL_INT8_ELEMENTS; // Bogus initialization.
|
|
||||||
ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization.
|
ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization.
|
||||||
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &external_elements_kind,
|
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind,
|
||||||
&fixed_elements_kind, &element_size);
|
&element_size);
|
||||||
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind);
|
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind);
|
||||||
|
|
||||||
size_t byte_offset = 0;
|
size_t byte_offset = 0;
|
||||||
@ -241,13 +237,11 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitialize) {
|
|||||||
Handle<JSArrayBuffer> buffer = Handle<JSArrayBuffer>::cast(maybe_buffer);
|
Handle<JSArrayBuffer> buffer = Handle<JSArrayBuffer>::cast(maybe_buffer);
|
||||||
holder->set_buffer(*buffer);
|
holder->set_buffer(*buffer);
|
||||||
|
|
||||||
Handle<ExternalArray> elements = isolate->factory()->NewExternalArray(
|
Handle<FixedTypedArrayBase> elements =
|
||||||
static_cast<int>(length), array_type,
|
isolate->factory()->NewFixedTypedArrayWithExternalPointer(
|
||||||
static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
|
static_cast<int>(length), array_type,
|
||||||
Handle<Map> map =
|
static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
|
||||||
JSObject::GetElementsTransitionMap(holder, external_elements_kind);
|
holder->set_elements(*elements);
|
||||||
JSObject::SetMapAndElements(holder, map, elements);
|
|
||||||
DCHECK(IsExternalArrayElementsKind(holder->map()->elements_kind()));
|
|
||||||
} else {
|
} else {
|
||||||
Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
|
Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
|
||||||
Runtime::SetupArrayBuffer(isolate, buffer, true, NULL, byte_length,
|
Runtime::SetupArrayBuffer(isolate, buffer, true, NULL, byte_length,
|
||||||
@ -280,11 +274,9 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) {
|
|||||||
|
|
||||||
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
|
ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
|
||||||
size_t element_size = 1; // Bogus initialization.
|
size_t element_size = 1; // Bogus initialization.
|
||||||
ElementsKind external_elements_kind =
|
|
||||||
EXTERNAL_INT8_ELEMENTS; // Bogus intialization.
|
|
||||||
ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization.
|
ElementsKind fixed_elements_kind = INT8_ELEMENTS; // Bogus initialization.
|
||||||
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &external_elements_kind,
|
Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &fixed_elements_kind,
|
||||||
&fixed_elements_kind, &element_size);
|
&element_size);
|
||||||
|
|
||||||
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind);
|
RUNTIME_ASSERT(holder->map()->elements_kind() == fixed_elements_kind);
|
||||||
|
|
||||||
@ -340,12 +332,11 @@ RUNTIME_FUNCTION(Runtime_TypedArrayInitializeFromArrayLike) {
|
|||||||
holder->set_byte_length(*byte_length_obj);
|
holder->set_byte_length(*byte_length_obj);
|
||||||
holder->set_length(*length_obj);
|
holder->set_length(*length_obj);
|
||||||
|
|
||||||
Handle<ExternalArray> elements = isolate->factory()->NewExternalArray(
|
Handle<FixedTypedArrayBase> elements =
|
||||||
static_cast<int>(length), array_type,
|
isolate->factory()->NewFixedTypedArrayWithExternalPointer(
|
||||||
static_cast<uint8_t*>(buffer->backing_store()));
|
static_cast<int>(length), array_type,
|
||||||
Handle<Map> map =
|
static_cast<uint8_t*>(buffer->backing_store()));
|
||||||
JSObject::GetElementsTransitionMap(holder, external_elements_kind);
|
holder->set_elements(*elements);
|
||||||
JSObject::SetMapAndElements(holder, map, elements);
|
|
||||||
|
|
||||||
if (source->IsJSTypedArray()) {
|
if (source->IsJSTypedArray()) {
|
||||||
Handle<JSTypedArray> typed_array(JSTypedArray::cast(*source));
|
Handle<JSTypedArray> typed_array(JSTypedArray::cast(*source));
|
||||||
|
@ -658,17 +658,8 @@ namespace internal {
|
|||||||
F(HasFastHoleyElements, 1, 1) \
|
F(HasFastHoleyElements, 1, 1) \
|
||||||
F(HasDictionaryElements, 1, 1) \
|
F(HasDictionaryElements, 1, 1) \
|
||||||
F(HasSloppyArgumentsElements, 1, 1) \
|
F(HasSloppyArgumentsElements, 1, 1) \
|
||||||
F(HasExternalArrayElements, 1, 1) \
|
F(HasFixedTypedArrayElements, 1, 1) \
|
||||||
F(HasFastProperties, 1, 1) \
|
F(HasFastProperties, 1, 1) \
|
||||||
F(HasExternalUint8Elements, 1, 1) \
|
|
||||||
F(HasExternalInt8Elements, 1, 1) \
|
|
||||||
F(HasExternalUint16Elements, 1, 1) \
|
|
||||||
F(HasExternalInt16Elements, 1, 1) \
|
|
||||||
F(HasExternalUint32Elements, 1, 1) \
|
|
||||||
F(HasExternalInt32Elements, 1, 1) \
|
|
||||||
F(HasExternalFloat32Elements, 1, 1) \
|
|
||||||
F(HasExternalFloat64Elements, 1, 1) \
|
|
||||||
F(HasExternalUint8ClampedElements, 1, 1) \
|
|
||||||
F(HasFixedUint8Elements, 1, 1) \
|
F(HasFixedUint8Elements, 1, 1) \
|
||||||
F(HasFixedInt8Elements, 1, 1) \
|
F(HasFixedInt8Elements, 1, 1) \
|
||||||
F(HasFixedUint16Elements, 1, 1) \
|
F(HasFixedUint16Elements, 1, 1) \
|
||||||
@ -927,7 +918,6 @@ class Runtime : public AllStatic {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void ArrayIdToTypeAndSize(int array_id, ExternalArrayType* type,
|
static void ArrayIdToTypeAndSize(int array_id, ExternalArrayType* type,
|
||||||
ElementsKind* external_elements_kind,
|
|
||||||
ElementsKind* fixed_elements_kind,
|
ElementsKind* fixed_elements_kind,
|
||||||
size_t* element_size);
|
size_t* element_size);
|
||||||
|
|
||||||
|
@ -3114,40 +3114,31 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
XMMRegister result(ToDoubleRegister(instr->result()));
|
XMMRegister result(ToDoubleRegister(instr->result()));
|
||||||
__ movss(result, operand);
|
__ movss(result, operand);
|
||||||
__ cvtss2sd(result, result);
|
__ cvtss2sd(result, result);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
__ movsd(ToDoubleRegister(instr->result()), operand);
|
__ movsd(ToDoubleRegister(instr->result()), operand);
|
||||||
} else {
|
} else {
|
||||||
Register result(ToRegister(instr->result()));
|
Register result(ToRegister(instr->result()));
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ movsxbl(result, operand);
|
__ movsxbl(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ movzxbl(result, operand);
|
__ movzxbl(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ movsxwl(result, operand);
|
__ movsxwl(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ movzxwl(result, operand);
|
__ movzxwl(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ movl(result, operand);
|
__ movl(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ movl(result, operand);
|
__ movl(result, operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3155,8 +3146,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
@ -3275,7 +3264,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4375,39 +4364,28 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
|
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
XMMRegister value(ToDoubleRegister(instr->value()));
|
XMMRegister value(ToDoubleRegister(instr->value()));
|
||||||
__ cvtsd2ss(value, value);
|
__ cvtsd2ss(value, value);
|
||||||
__ movss(operand, value);
|
__ movss(operand, value);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
__ movsd(operand, ToDoubleRegister(instr->value()));
|
__ movsd(operand, ToDoubleRegister(instr->value()));
|
||||||
} else {
|
} else {
|
||||||
Register value(ToRegister(instr->value()));
|
Register value(ToRegister(instr->value()));
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ movb(operand, value);
|
__ movb(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ movw(operand, value);
|
__ movw(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ movl(operand, value);
|
__ movl(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_ELEMENTS:
|
case FAST_ELEMENTS:
|
||||||
@ -4531,7 +4509,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2238,7 +2238,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
FindDehoistedKeyDefinitions(instr->key());
|
FindDehoistedKeyDefinitions(instr->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = UseRegisterAtStart(instr->elements());
|
LOperand* obj = UseRegisterAtStart(instr->elements());
|
||||||
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
||||||
} else {
|
} else {
|
||||||
@ -2252,10 +2252,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2295,7 +2294,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
|||||||
FindDehoistedKeyDefinitions(instr->key());
|
FindDehoistedKeyDefinitions(instr->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
bool needs_write_barrier = instr->NeedsWriteBarrier();
|
||||||
LOperand* object = NULL;
|
LOperand* object = NULL;
|
||||||
@ -2330,10 +2329,8 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
|||||||
(instr->value()->representation().IsDouble() &&
|
(instr->value()->representation().IsDouble() &&
|
||||||
IsDoubleOrFloatElementsKind(elements_kind)));
|
IsDoubleOrFloatElementsKind(elements_kind)));
|
||||||
DCHECK(instr->elements()->representation().IsExternal());
|
DCHECK(instr->elements()->representation().IsExternal());
|
||||||
bool val_is_temp_register =
|
bool val_is_temp_register = elements_kind == UINT8_CLAMPED_ELEMENTS ||
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
elements_kind == FLOAT32_ELEMENTS;
|
||||||
elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
|
||||||
elements_kind == FLOAT32_ELEMENTS;
|
|
||||||
LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
|
LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
|
||||||
: UseRegister(instr->value());
|
: UseRegister(instr->value());
|
||||||
LOperand* key = NULL;
|
LOperand* key = NULL;
|
||||||
|
@ -1617,12 +1617,8 @@ inline static bool ExternalArrayOpRequiresTemp(
|
|||||||
// an index cannot fold the scale operation into a load and need an extra
|
// an index cannot fold the scale operation into a load and need an extra
|
||||||
// temp register to do the work.
|
// temp register to do the work.
|
||||||
return SmiValuesAre31Bits() && key_representation.IsSmi() &&
|
return SmiValuesAre31Bits() && key_representation.IsSmi() &&
|
||||||
(elements_kind == EXTERNAL_INT8_ELEMENTS ||
|
(elements_kind == UINT8_ELEMENTS || elements_kind == INT8_ELEMENTS ||
|
||||||
elements_kind == EXTERNAL_UINT8_ELEMENTS ||
|
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_ELEMENTS ||
|
|
||||||
elements_kind == INT8_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1636,15 +1632,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
|
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
void PrintDataTo(StringStream* stream) override;
|
void PrintDataTo(StringStream* stream) override;
|
||||||
@ -2233,13 +2223,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = value;
|
inputs_[2] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -3342,38 +3342,29 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
instr->hydrogen()->key()->representation(),
|
instr->hydrogen()->key()->representation(),
|
||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
X87Mov(ToX87Register(instr->result()), operand, kX87FloatOperand);
|
X87Mov(ToX87Register(instr->result()), operand, kX87FloatOperand);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
X87Mov(ToX87Register(instr->result()), operand);
|
X87Mov(ToX87Register(instr->result()), operand);
|
||||||
} else {
|
} else {
|
||||||
Register result(ToRegister(instr->result()));
|
Register result(ToRegister(instr->result()));
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
__ movsx_b(result, operand);
|
__ movsx_b(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ movzx_b(result, operand);
|
__ movzx_b(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ movsx_w(result, operand);
|
__ movsx_w(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
__ movzx_w(result, operand);
|
__ movzx_w(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ mov(result, operand);
|
__ mov(result, operand);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
__ mov(result, operand);
|
__ mov(result, operand);
|
||||||
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
||||||
@ -3381,8 +3372,6 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
|||||||
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -3461,7 +3450,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoLoadKeyedExternalArray(instr);
|
DoLoadKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->representation().IsDouble()) {
|
||||||
DoLoadKeyedFixedDoubleArray(instr);
|
DoLoadKeyedFixedDoubleArray(instr);
|
||||||
@ -4606,11 +4595,9 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
instr->hydrogen()->key()->representation(),
|
instr->hydrogen()->key()->representation(),
|
||||||
elements_kind,
|
elements_kind,
|
||||||
instr->base_offset()));
|
instr->base_offset()));
|
||||||
if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
if (elements_kind == FLOAT32_ELEMENTS) {
|
||||||
elements_kind == FLOAT32_ELEMENTS) {
|
|
||||||
X87Mov(operand, ToX87Register(instr->value()), kX87FloatOperand);
|
X87Mov(operand, ToX87Register(instr->value()), kX87FloatOperand);
|
||||||
} else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
} else if (elements_kind == FLOAT64_ELEMENTS) {
|
||||||
elements_kind == FLOAT64_ELEMENTS) {
|
|
||||||
uint64_t int_val = kHoleNanInt64;
|
uint64_t int_val = kHoleNanInt64;
|
||||||
int32_t lower = static_cast<int32_t>(int_val);
|
int32_t lower = static_cast<int32_t>(int_val);
|
||||||
int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
|
int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
|
||||||
@ -4640,28 +4627,19 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
|||||||
} else {
|
} else {
|
||||||
Register value = ToRegister(instr->value());
|
Register value = ToRegister(instr->value());
|
||||||
switch (elements_kind) {
|
switch (elements_kind) {
|
||||||
case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT8_ELEMENTS:
|
|
||||||
case EXTERNAL_INT8_ELEMENTS:
|
|
||||||
case UINT8_ELEMENTS:
|
case UINT8_ELEMENTS:
|
||||||
case INT8_ELEMENTS:
|
case INT8_ELEMENTS:
|
||||||
case UINT8_CLAMPED_ELEMENTS:
|
case UINT8_CLAMPED_ELEMENTS:
|
||||||
__ mov_b(operand, value);
|
__ mov_b(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT16_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT16_ELEMENTS:
|
|
||||||
case UINT16_ELEMENTS:
|
case UINT16_ELEMENTS:
|
||||||
case INT16_ELEMENTS:
|
case INT16_ELEMENTS:
|
||||||
__ mov_w(operand, value);
|
__ mov_w(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_INT32_ELEMENTS:
|
|
||||||
case EXTERNAL_UINT32_ELEMENTS:
|
|
||||||
case UINT32_ELEMENTS:
|
case UINT32_ELEMENTS:
|
||||||
case INT32_ELEMENTS:
|
case INT32_ELEMENTS:
|
||||||
__ mov(operand, value);
|
__ mov(operand, value);
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_FLOAT32_ELEMENTS:
|
|
||||||
case EXTERNAL_FLOAT64_ELEMENTS:
|
|
||||||
case FLOAT32_ELEMENTS:
|
case FLOAT32_ELEMENTS:
|
||||||
case FLOAT64_ELEMENTS:
|
case FLOAT64_ELEMENTS:
|
||||||
case FAST_SMI_ELEMENTS:
|
case FAST_SMI_ELEMENTS:
|
||||||
@ -4777,7 +4755,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
||||||
// By cases...external, fast-double, fast
|
// By cases...external, fast-double, fast
|
||||||
if (instr->is_typed_elements()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
DoStoreKeyedExternalArray(instr);
|
DoStoreKeyedExternalArray(instr);
|
||||||
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
} else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
||||||
DoStoreKeyedFixedDoubleArray(instr);
|
DoStoreKeyedFixedDoubleArray(instr);
|
||||||
|
@ -2237,7 +2237,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
: UseRegisterOrConstantAtStart(instr->key());
|
: UseRegisterOrConstantAtStart(instr->key());
|
||||||
LInstruction* result = NULL;
|
LInstruction* result = NULL;
|
||||||
|
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
LOperand* obj = UseRegisterAtStart(instr->elements());
|
LOperand* obj = UseRegisterAtStart(instr->elements());
|
||||||
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
|
||||||
} else {
|
} else {
|
||||||
@ -2251,10 +2251,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool needs_environment;
|
bool needs_environment;
|
||||||
if (instr->is_external() || instr->is_fixed_typed_array()) {
|
if (instr->is_fixed_typed_array()) {
|
||||||
// see LCodeGen::DoLoadKeyedExternalArray
|
// see LCodeGen::DoLoadKeyedExternalArray
|
||||||
needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
|
needs_environment = elements_kind == UINT32_ELEMENTS &&
|
||||||
elements_kind == UINT32_ELEMENTS) &&
|
|
||||||
!instr->CheckFlag(HInstruction::kUint32);
|
!instr->CheckFlag(HInstruction::kUint32);
|
||||||
} else {
|
} else {
|
||||||
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
// see LCodeGen::DoLoadKeyedFixedDoubleArray and
|
||||||
@ -2291,9 +2290,6 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
|
|||||||
|
|
||||||
// Determine if we need a byte register in this case for the value.
|
// Determine if we need a byte register in this case for the value.
|
||||||
bool val_is_fixed_register =
|
bool val_is_fixed_register =
|
||||||
elements_kind == EXTERNAL_INT8_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_UINT8_ELEMENTS ||
|
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_ELEMENTS ||
|
elements_kind == UINT8_ELEMENTS ||
|
||||||
elements_kind == INT8_ELEMENTS ||
|
elements_kind == INT8_ELEMENTS ||
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS;
|
elements_kind == UINT8_CLAMPED_ELEMENTS;
|
||||||
@ -2310,7 +2306,7 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) {
|
|||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
|
||||||
if (!instr->is_typed_elements()) {
|
if (!instr->is_fixed_typed_array()) {
|
||||||
DCHECK(instr->elements()->representation().IsTagged());
|
DCHECK(instr->elements()->representation().IsTagged());
|
||||||
DCHECK(instr->key()->representation().IsInteger32() ||
|
DCHECK(instr->key()->representation().IsInteger32() ||
|
||||||
instr->key()->representation().IsSmi());
|
instr->key()->representation().IsSmi());
|
||||||
|
@ -1649,15 +1649,9 @@ class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
|
|||||||
ElementsKind elements_kind() const {
|
ElementsKind elements_kind() const {
|
||||||
return hydrogen()->elements_kind();
|
return hydrogen()->elements_kind();
|
||||||
}
|
}
|
||||||
bool is_external() const {
|
|
||||||
return hydrogen()->is_external();
|
|
||||||
}
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
|
||||||
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
|
||||||
@ -1677,12 +1671,8 @@ inline static bool ExternalArrayOpRequiresTemp(
|
|||||||
// an index cannot fold the scale operation into a load and need an extra
|
// an index cannot fold the scale operation into a load and need an extra
|
||||||
// temp register to do the work.
|
// temp register to do the work.
|
||||||
return key_representation.IsSmi() &&
|
return key_representation.IsSmi() &&
|
||||||
(elements_kind == EXTERNAL_INT8_ELEMENTS ||
|
(elements_kind == UINT8_ELEMENTS || elements_kind == INT8_ELEMENTS ||
|
||||||
elements_kind == EXTERNAL_UINT8_ELEMENTS ||
|
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
||||||
elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_ELEMENTS ||
|
|
||||||
elements_kind == INT8_ELEMENTS ||
|
|
||||||
elements_kind == UINT8_CLAMPED_ELEMENTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2261,13 +2251,9 @@ class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
|
|||||||
inputs_[2] = val;
|
inputs_[2] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_external() const { return hydrogen()->is_external(); }
|
|
||||||
bool is_fixed_typed_array() const {
|
bool is_fixed_typed_array() const {
|
||||||
return hydrogen()->is_fixed_typed_array();
|
return hydrogen()->is_fixed_typed_array();
|
||||||
}
|
}
|
||||||
bool is_typed_elements() const {
|
|
||||||
return is_external() || is_fixed_typed_array();
|
|
||||||
}
|
|
||||||
LOperand* elements() { return inputs_[0]; }
|
LOperand* elements() { return inputs_[0]; }
|
||||||
LOperand* key() { return inputs_[1]; }
|
LOperand* key() { return inputs_[1]; }
|
||||||
LOperand* value() { return inputs_[2]; }
|
LOperand* value() { return inputs_[2]; }
|
||||||
|
@ -21,16 +21,15 @@ static void TypedArrayLoadHelper(const char* array_type) {
|
|||||||
values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
|
values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that below source creates two different typed arrays with distinct
|
// Note that below source creates two different typed arrays with the same
|
||||||
// elements kind to get coverage for both access patterns:
|
// elements kind to get coverage for both (on heap / with external backing
|
||||||
// - IsFixedTypedArrayElementsKind(x)
|
// store) access patterns.
|
||||||
// - IsExternalArrayElementsKind(y)
|
|
||||||
const char* source =
|
const char* source =
|
||||||
"(function(a) {"
|
"(function(a) {"
|
||||||
" var x = (a = new %sArray(%d)); %s;"
|
" var x = (a = new %sArray(%d)); %s;"
|
||||||
" var y = (a = new %sArray(%d)); %s; %%TypedArrayGetBuffer(y);"
|
" var y = (a = new %sArray(%d)); %s; %%TypedArrayGetBuffer(y);"
|
||||||
" if (!%%HasFixed%sElements(x)) %%AbortJS('x');"
|
" if (!%%HasFixed%sElements(x)) %%AbortJS('x');"
|
||||||
" if (!%%HasExternal%sElements(y)) %%AbortJS('y');"
|
" if (!%%HasFixed%sElements(y)) %%AbortJS('y');"
|
||||||
" function f(a,b) {"
|
" function f(a,b) {"
|
||||||
" a = a | 0; b = b | 0;"
|
" a = a | 0; b = b | 0;"
|
||||||
" return x[a] + y[b];"
|
" return x[a] + y[b];"
|
||||||
@ -84,16 +83,15 @@ static void TypedArrayStoreHelper(const char* array_type) {
|
|||||||
values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
|
values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that below source creates two different typed arrays with distinct
|
// Note that below source creates two different typed arrays with the same
|
||||||
// elements kind to get coverage for both access patterns:
|
// elements kind to get coverage for both (on heap/with external backing
|
||||||
// - IsFixedTypedArrayElementsKind(x)
|
// store) access patterns.
|
||||||
// - IsExternalArrayElementsKind(y)
|
|
||||||
const char* source =
|
const char* source =
|
||||||
"(function(a) {"
|
"(function(a) {"
|
||||||
" var x = (a = new %sArray(%d)); %s;"
|
" var x = (a = new %sArray(%d)); %s;"
|
||||||
" var y = (a = new %sArray(%d)); %s; %%TypedArrayGetBuffer(y);"
|
" var y = (a = new %sArray(%d)); %s; %%TypedArrayGetBuffer(y);"
|
||||||
" if (!%%HasFixed%sElements(x)) %%AbortJS('x');"
|
" if (!%%HasFixed%sElements(x)) %%AbortJS('x');"
|
||||||
" if (!%%HasExternal%sElements(y)) %%AbortJS('y');"
|
" if (!%%HasFixed%sElements(y)) %%AbortJS('y');"
|
||||||
" function f(a,b) {"
|
" function f(a,b) {"
|
||||||
" a = a | 0; b = b | 0;"
|
" a = a | 0; b = b | 0;"
|
||||||
" var t = x[a];"
|
" var t = x[a];"
|
||||||
|
@ -14149,58 +14149,58 @@ void TypedArrayTestHelper(i::ExternalArrayType array_type, int64_t low,
|
|||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Uint8Array) {
|
THREADED_TEST(Uint8Array) {
|
||||||
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array,
|
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
|
||||||
v8::ArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
|
v8::ArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Int8Array) {
|
THREADED_TEST(Int8Array) {
|
||||||
TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array,
|
TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
|
||||||
v8::ArrayBuffer>(i::kExternalInt8Array, -0x80, 0x7F);
|
v8::ArrayBuffer>(i::kExternalInt8Array, -0x80, 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Uint16Array) {
|
THREADED_TEST(Uint16Array) {
|
||||||
TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::ExternalUint16Array,
|
TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array,
|
||||||
v8::ArrayBuffer>(i::kExternalUint16Array, 0, 0xFFFF);
|
v8::ArrayBuffer>(i::kExternalUint16Array, 0, 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Int16Array) {
|
THREADED_TEST(Int16Array) {
|
||||||
TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array,
|
TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array,
|
||||||
v8::ArrayBuffer>(i::kExternalInt16Array, -0x8000,
|
v8::ArrayBuffer>(i::kExternalInt16Array, -0x8000,
|
||||||
0x7FFF);
|
0x7FFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Uint32Array) {
|
THREADED_TEST(Uint32Array) {
|
||||||
TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array,
|
TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array,
|
||||||
v8::ArrayBuffer>(i::kExternalUint32Array, 0, UINT_MAX);
|
v8::ArrayBuffer>(i::kExternalUint32Array, 0, UINT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Int32Array) {
|
THREADED_TEST(Int32Array) {
|
||||||
TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array,
|
TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array,
|
||||||
v8::ArrayBuffer>(i::kExternalInt32Array, INT_MIN,
|
v8::ArrayBuffer>(i::kExternalInt32Array, INT_MIN,
|
||||||
INT_MAX);
|
INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Float32Array) {
|
THREADED_TEST(Float32Array) {
|
||||||
TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array,
|
TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array,
|
||||||
v8::ArrayBuffer>(i::kExternalFloat32Array, -500, 500);
|
v8::ArrayBuffer>(i::kExternalFloat32Array, -500, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Float64Array) {
|
THREADED_TEST(Float64Array) {
|
||||||
TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array,
|
TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array,
|
||||||
v8::ArrayBuffer>(i::kExternalFloat64Array, -500, 500);
|
v8::ArrayBuffer>(i::kExternalFloat64Array, -500, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(Uint8ClampedArray) {
|
THREADED_TEST(Uint8ClampedArray) {
|
||||||
TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
|
TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
|
||||||
i::ExternalUint8ClampedArray, v8::ArrayBuffer>(
|
i::FixedUint8ClampedArray, v8::ArrayBuffer>(
|
||||||
i::kExternalUint8ClampedArray, 0, 0xFF);
|
i::kExternalUint8ClampedArray, 0, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14226,14 +14226,14 @@ THREADED_TEST(DataView) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedUint8Array) {
|
THREADED_TEST(SharedUint8Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array,
|
TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
|
v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
THREADED_TEST(SharedInt8Array) {
|
THREADED_TEST(SharedInt8Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array,
|
TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalInt8Array, -0x80,
|
v8::SharedArrayBuffer>(i::kExternalInt8Array, -0x80,
|
||||||
0x7F);
|
0x7F);
|
||||||
}
|
}
|
||||||
@ -14241,7 +14241,7 @@ THREADED_TEST(SharedInt8Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedUint16Array) {
|
THREADED_TEST(SharedUint16Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::ExternalUint16Array,
|
TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalUint16Array, 0,
|
v8::SharedArrayBuffer>(i::kExternalUint16Array, 0,
|
||||||
0xFFFF);
|
0xFFFF);
|
||||||
}
|
}
|
||||||
@ -14249,7 +14249,7 @@ THREADED_TEST(SharedUint16Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedInt16Array) {
|
THREADED_TEST(SharedInt16Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array,
|
TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalInt16Array, -0x8000,
|
v8::SharedArrayBuffer>(i::kExternalInt16Array, -0x8000,
|
||||||
0x7FFF);
|
0x7FFF);
|
||||||
}
|
}
|
||||||
@ -14257,7 +14257,7 @@ THREADED_TEST(SharedInt16Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedUint32Array) {
|
THREADED_TEST(SharedUint32Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array,
|
TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalUint32Array, 0,
|
v8::SharedArrayBuffer>(i::kExternalUint32Array, 0,
|
||||||
UINT_MAX);
|
UINT_MAX);
|
||||||
}
|
}
|
||||||
@ -14265,7 +14265,7 @@ THREADED_TEST(SharedUint32Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedInt32Array) {
|
THREADED_TEST(SharedInt32Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array,
|
TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalInt32Array, INT_MIN,
|
v8::SharedArrayBuffer>(i::kExternalInt32Array, INT_MIN,
|
||||||
INT_MAX);
|
INT_MAX);
|
||||||
}
|
}
|
||||||
@ -14273,7 +14273,7 @@ THREADED_TEST(SharedInt32Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedFloat32Array) {
|
THREADED_TEST(SharedFloat32Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array,
|
TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalFloat32Array, -500,
|
v8::SharedArrayBuffer>(i::kExternalFloat32Array, -500,
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
@ -14281,7 +14281,7 @@ THREADED_TEST(SharedFloat32Array) {
|
|||||||
|
|
||||||
THREADED_TEST(SharedFloat64Array) {
|
THREADED_TEST(SharedFloat64Array) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array,
|
TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array,
|
||||||
v8::SharedArrayBuffer>(i::kExternalFloat64Array, -500,
|
v8::SharedArrayBuffer>(i::kExternalFloat64Array, -500,
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
@ -14290,7 +14290,7 @@ THREADED_TEST(SharedFloat64Array) {
|
|||||||
THREADED_TEST(SharedUint8ClampedArray) {
|
THREADED_TEST(SharedUint8ClampedArray) {
|
||||||
i::FLAG_harmony_sharedarraybuffer = true;
|
i::FLAG_harmony_sharedarraybuffer = true;
|
||||||
TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
|
TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
|
||||||
i::ExternalUint8ClampedArray, v8::SharedArrayBuffer>(
|
i::FixedUint8ClampedArray, v8::SharedArrayBuffer>(
|
||||||
i::kExternalUint8ClampedArray, 0, 0xFF);
|
i::kExternalUint8ClampedArray, 0, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,15 +32,6 @@ var elements_kind = {
|
|||||||
fast : 'fast elements',
|
fast : 'fast elements',
|
||||||
fast_double : 'fast double elements',
|
fast_double : 'fast double elements',
|
||||||
dictionary : 'dictionary elements',
|
dictionary : 'dictionary elements',
|
||||||
external_int32 : 'external int8 elements',
|
|
||||||
external_uint8 : 'external uint8 elements',
|
|
||||||
external_int16 : 'external int16 elements',
|
|
||||||
external_uint16 : 'external uint16 elements',
|
|
||||||
external_int32 : 'external int32 elements',
|
|
||||||
external_uint32 : 'external uint32 elements',
|
|
||||||
external_float32 : 'external float32 elements',
|
|
||||||
external_float64 : 'external float64 elements',
|
|
||||||
external_uint8_clamped : 'external uint8_clamped elements',
|
|
||||||
fixed_int32 : 'fixed int8 elements',
|
fixed_int32 : 'fixed int8 elements',
|
||||||
fixed_uint8 : 'fixed uint8 elements',
|
fixed_uint8 : 'fixed uint8 elements',
|
||||||
fixed_int16 : 'fixed int16 elements',
|
fixed_int16 : 'fixed int16 elements',
|
||||||
@ -58,34 +49,6 @@ function getKind(obj) {
|
|||||||
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
||||||
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
||||||
|
|
||||||
// Every external kind is also an external array.
|
|
||||||
if (%HasExternalInt8Elements(obj)) {
|
|
||||||
return elements_kind.external_int8;
|
|
||||||
}
|
|
||||||
if (%HasExternalUint8Elements(obj)) {
|
|
||||||
return elements_kind.external_uint8;
|
|
||||||
}
|
|
||||||
if (%HasExternalInt16Elements(obj)) {
|
|
||||||
return elements_kind.external_int16;
|
|
||||||
}
|
|
||||||
if (%HasExternalUint16Elements(obj)) {
|
|
||||||
return elements_kind.external_uint16;
|
|
||||||
}
|
|
||||||
if (%HasExternalInt32Elements(obj)) {
|
|
||||||
return elements_kind.external_int32;
|
|
||||||
}
|
|
||||||
if (%HasExternalUint32Elements(obj)) {
|
|
||||||
return elements_kind.external_uint32;
|
|
||||||
}
|
|
||||||
if (%HasExternalFloat32Elements(obj)) {
|
|
||||||
return elements_kind.external_float32;
|
|
||||||
}
|
|
||||||
if (%HasExternalFloat64Elements(obj)) {
|
|
||||||
return elements_kind.external_float64;
|
|
||||||
}
|
|
||||||
if (%HasExternalUint8ClampedElements(obj)) {
|
|
||||||
return elements_kind.external_uint8_clamped;
|
|
||||||
}
|
|
||||||
if (%HasFixedInt8Elements(obj)) {
|
if (%HasFixedInt8Elements(obj)) {
|
||||||
return elements_kind.fixed_int8;
|
return elements_kind.fixed_int8;
|
||||||
}
|
}
|
||||||
@ -164,15 +127,15 @@ function test_wrapper() {
|
|||||||
assertKind(elements_kind.fixed_uint8_clamped, new Uint8ClampedArray(512));
|
assertKind(elements_kind.fixed_uint8_clamped, new Uint8ClampedArray(512));
|
||||||
|
|
||||||
var ab = new ArrayBuffer(128);
|
var ab = new ArrayBuffer(128);
|
||||||
assertKind(elements_kind.external_int8, new Int8Array(ab));
|
assertKind(elements_kind.fixed_int8, new Int8Array(ab));
|
||||||
assertKind(elements_kind.external_uint8, new Uint8Array(ab));
|
assertKind(elements_kind.fixed_uint8, new Uint8Array(ab));
|
||||||
assertKind(elements_kind.external_int16, new Int16Array(ab));
|
assertKind(elements_kind.fixed_int16, new Int16Array(ab));
|
||||||
assertKind(elements_kind.external_uint16, new Uint16Array(ab));
|
assertKind(elements_kind.fixed_uint16, new Uint16Array(ab));
|
||||||
assertKind(elements_kind.external_int32, new Int32Array(ab));
|
assertKind(elements_kind.fixed_int32, new Int32Array(ab));
|
||||||
assertKind(elements_kind.external_uint32, new Uint32Array(ab));
|
assertKind(elements_kind.fixed_uint32, new Uint32Array(ab));
|
||||||
assertKind(elements_kind.external_float32, new Float32Array(ab));
|
assertKind(elements_kind.fixed_float32, new Float32Array(ab));
|
||||||
assertKind(elements_kind.external_float64, new Float64Array(ab));
|
assertKind(elements_kind.fixed_float64, new Float64Array(ab));
|
||||||
assertKind(elements_kind.external_uint8_clamped, new Uint8ClampedArray(ab));
|
assertKind(elements_kind.fixed_uint8_clamped, new Uint8ClampedArray(ab));
|
||||||
|
|
||||||
// Crankshaft support for smi-only array elements.
|
// Crankshaft support for smi-only array elements.
|
||||||
function monomorphic(array) {
|
function monomorphic(array) {
|
||||||
|
@ -33,19 +33,19 @@
|
|||||||
// Flags: --stress-runs=2
|
// Flags: --stress-runs=2
|
||||||
|
|
||||||
var elements_kind = {
|
var elements_kind = {
|
||||||
fast_smi_only : 'fast smi only elements',
|
fast_smi_only : 'fast smi only elements',
|
||||||
fast : 'fast elements',
|
fast : 'fast elements',
|
||||||
fast_double : 'fast double elements',
|
fast_double : 'fast double elements',
|
||||||
dictionary : 'dictionary elements',
|
dictionary : 'dictionary elements',
|
||||||
external_byte : 'external byte elements',
|
fixed_int32 : 'fixed int8 elements',
|
||||||
external_unsigned_byte : 'external unsigned byte elements',
|
fixed_uint8 : 'fixed uint8 elements',
|
||||||
external_short : 'external short elements',
|
fixed_int16 : 'fixed int16 elements',
|
||||||
external_unsigned_short : 'external unsigned short elements',
|
fixed_uint16 : 'fixed uint16 elements',
|
||||||
external_int : 'external int elements',
|
fixed_int32 : 'fixed int32 elements',
|
||||||
external_unsigned_int : 'external unsigned int elements',
|
fixed_uint32 : 'fixed uint32 elements',
|
||||||
external_float : 'external float elements',
|
fixed_float32 : 'fixed float32 elements',
|
||||||
external_double : 'external double elements',
|
fixed_float64 : 'fixed float64 elements',
|
||||||
external_pixel : 'external pixel elements'
|
fixed_uint8_clamped : 'fixed uint8_clamped elements'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getKind(obj) {
|
function getKind(obj) {
|
||||||
@ -53,34 +53,33 @@ function getKind(obj) {
|
|||||||
if (%HasFastObjectElements(obj)) return elements_kind.fast;
|
if (%HasFastObjectElements(obj)) return elements_kind.fast;
|
||||||
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
||||||
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
||||||
// Every external kind is also an external array.
|
|
||||||
assertTrue(%HasExternalArrayElements(obj));
|
if (%HasFixedInt8Elements(obj)) {
|
||||||
if (%HasExternalByteElements(obj)) {
|
return elements_kind.fixed_int8;
|
||||||
return elements_kind.external_byte;
|
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedByteElements(obj)) {
|
if (%HasFixedUint8Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_byte;
|
return elements_kind.fixed_uint8;
|
||||||
}
|
}
|
||||||
if (%HasExternalShortElements(obj)) {
|
if (%HasFixedInt16Elements(obj)) {
|
||||||
return elements_kind.external_short;
|
return elements_kind.fixed_int16;
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedShortElements(obj)) {
|
if (%HasFixedUint16Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_short;
|
return elements_kind.fixed_uint16;
|
||||||
}
|
}
|
||||||
if (%HasExternalIntElements(obj)) {
|
if (%HasFixedInt32Elements(obj)) {
|
||||||
return elements_kind.external_int;
|
return elements_kind.fixed_int32;
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedIntElements(obj)) {
|
if (%HasFixedUint32Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_int;
|
return elements_kind.fixed_uint32;
|
||||||
}
|
}
|
||||||
if (%HasExternalFloatElements(obj)) {
|
if (%HasFixedFloat32Elements(obj)) {
|
||||||
return elements_kind.external_float;
|
return elements_kind.fixed_float32;
|
||||||
}
|
}
|
||||||
if (%HasExternalDoubleElements(obj)) {
|
if (%HasFixedFloat64Elements(obj)) {
|
||||||
return elements_kind.external_double;
|
return elements_kind.fixed_float64;
|
||||||
}
|
}
|
||||||
if (%HasExternalPixelElements(obj)) {
|
if (%HasFixedUint8ClampedElements(obj)) {
|
||||||
return elements_kind.external_pixel;
|
return elements_kind.fixed_uint8_clamped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,19 +33,19 @@
|
|||||||
// Flags: --stress-runs=2
|
// Flags: --stress-runs=2
|
||||||
|
|
||||||
var elements_kind = {
|
var elements_kind = {
|
||||||
fast_smi_only : 'fast smi only elements',
|
fast_smi_only : 'fast smi only elements',
|
||||||
fast : 'fast elements',
|
fast : 'fast elements',
|
||||||
fast_double : 'fast double elements',
|
fast_double : 'fast double elements',
|
||||||
dictionary : 'dictionary elements',
|
dictionary : 'dictionary elements',
|
||||||
external_byte : 'external byte elements',
|
fixed_int32 : 'fixed int8 elements',
|
||||||
external_unsigned_byte : 'external unsigned byte elements',
|
fixed_uint8 : 'fixed uint8 elements',
|
||||||
external_short : 'external short elements',
|
fixed_int16 : 'fixed int16 elements',
|
||||||
external_unsigned_short : 'external unsigned short elements',
|
fixed_uint16 : 'fixed uint16 elements',
|
||||||
external_int : 'external int elements',
|
fixed_int32 : 'fixed int32 elements',
|
||||||
external_unsigned_int : 'external unsigned int elements',
|
fixed_uint32 : 'fixed uint32 elements',
|
||||||
external_float : 'external float elements',
|
fixed_float32 : 'fixed float32 elements',
|
||||||
external_double : 'external double elements',
|
fixed_float64 : 'fixed float64 elements',
|
||||||
external_pixel : 'external pixel elements'
|
fixed_uint8_clamped : 'fixed uint8_clamped elements'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getKind(obj) {
|
function getKind(obj) {
|
||||||
@ -53,34 +53,33 @@ function getKind(obj) {
|
|||||||
if (%HasFastObjectElements(obj)) return elements_kind.fast;
|
if (%HasFastObjectElements(obj)) return elements_kind.fast;
|
||||||
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
|
||||||
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
|
||||||
// Every external kind is also an external array.
|
|
||||||
assertTrue(%HasExternalArrayElements(obj));
|
if (%HasFixedInt8Elements(obj)) {
|
||||||
if (%HasExternalByteElements(obj)) {
|
return elements_kind.fixed_int8;
|
||||||
return elements_kind.external_byte;
|
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedByteElements(obj)) {
|
if (%HasFixedUint8Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_byte;
|
return elements_kind.fixed_uint8;
|
||||||
}
|
}
|
||||||
if (%HasExternalShortElements(obj)) {
|
if (%HasFixedInt16Elements(obj)) {
|
||||||
return elements_kind.external_short;
|
return elements_kind.fixed_int16;
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedShortElements(obj)) {
|
if (%HasFixedUint16Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_short;
|
return elements_kind.fixed_uint16;
|
||||||
}
|
}
|
||||||
if (%HasExternalIntElements(obj)) {
|
if (%HasFixedInt32Elements(obj)) {
|
||||||
return elements_kind.external_int;
|
return elements_kind.fixed_int32;
|
||||||
}
|
}
|
||||||
if (%HasExternalUnsignedIntElements(obj)) {
|
if (%HasFixedUint32Elements(obj)) {
|
||||||
return elements_kind.external_unsigned_int;
|
return elements_kind.fixed_uint32;
|
||||||
}
|
}
|
||||||
if (%HasExternalFloatElements(obj)) {
|
if (%HasFixedFloat32Elements(obj)) {
|
||||||
return elements_kind.external_float;
|
return elements_kind.fixed_float32;
|
||||||
}
|
}
|
||||||
if (%HasExternalDoubleElements(obj)) {
|
if (%HasFixedFloat64Elements(obj)) {
|
||||||
return elements_kind.external_double;
|
return elements_kind.fixed_float64;
|
||||||
}
|
}
|
||||||
if (%HasExternalPixelElements(obj)) {
|
if (%HasFixedUint8ClampedElements(obj)) {
|
||||||
return elements_kind.external_pixel;
|
return elements_kind.fixed_uint8_clamped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user