| Index: src/mips64/lithium-codegen-mips64.cc
|
| diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc
|
| index 15105aa738e8175286133360b943d7abe7614f06..83c14e3cf27cfdf3cee890c5eda60b507234b64a 100644
|
| --- a/src/mips64/lithium-codegen-mips64.cc
|
| +++ b/src/mips64/lithium-codegen-mips64.cc
|
| @@ -1215,7 +1215,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
|
|
| // On MIPS div is asynchronous - it will run in the background while we
|
| // check for special cases.
|
| - __ Div(result, dividend, divisor);
|
| + __ Ddiv(result, dividend, divisor);
|
|
|
| // Check for x / 0.
|
| if (hdiv->CheckFlag(HValue::kCanBeDivByZero)) {
|
| @@ -2284,10 +2284,13 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
|
|
| if (expected.Contains(ToBooleanStub::SIMD_VALUE)) {
|
| // Symbol value -> true.
|
| + Label not_simd;
|
| const Register scratch = scratch1();
|
| __ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
|
| - __ Branch(instr->TrueLabel(chunk_), eq, scratch,
|
| - Operand(FLOAT32X4_TYPE));
|
| + __ Branch(¬_simd, lt, at, Operand(FIRST_SIMD_VALUE_TYPE));
|
| + __ Branch(instr->TrueLabel(chunk_), le, scratch,
|
| + Operand(LAST_SIMD_VALUE_TYPE));
|
| + __ bind(¬_simd);
|
| }
|
|
|
| if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
|
| @@ -3003,17 +3006,15 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
|
| DCHECK(ToRegister(instr->context()).is(cp));
|
| DCHECK(ToRegister(instr->result()).is(v0));
|
|
|
| - int const slot = instr->slot_index();
|
| - int const depth = instr->depth();
|
| - if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
|
| - __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
|
| - Handle<Code> stub =
|
| - CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
|
| - CallCode(stub, RelocInfo::CODE_TARGET, instr);
|
| - } else {
|
| - __ Push(Smi::FromInt(slot));
|
| - __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
|
| - }
|
| + __ li(LoadGlobalViaContextDescriptor::DepthRegister(),
|
| + Operand(Smi::FromInt(instr->depth())));
|
| + __ li(LoadGlobalViaContextDescriptor::SlotRegister(),
|
| + Operand(Smi::FromInt(instr->slot_index())));
|
| + __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(instr->name()));
|
| +
|
| + Handle<Code> stub =
|
| + CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code();
|
| + CallCode(stub, RelocInfo::CODE_TARGET, instr);
|
| }
|
|
|
|
|
| @@ -3231,7 +3232,10 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| : element_size_shift;
|
| int base_offset = instr->base_offset();
|
|
|
| - if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| + elements_kind == FLOAT32_ELEMENTS ||
|
| + elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
| + elements_kind == FLOAT64_ELEMENTS) {
|
| FPURegister result = ToDoubleRegister(instr->result());
|
| if (key_is_constant) {
|
| __ Daddu(scratch0(), external_pointer,
|
| @@ -3248,7 +3252,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| }
|
| __ Daddu(scratch0(), scratch0(), external_pointer);
|
| }
|
| - if (elements_kind == FLOAT32_ELEMENTS) {
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| + elements_kind == FLOAT32_ELEMENTS) {
|
| __ lwc1(result, MemOperand(scratch0(), base_offset));
|
| __ cvt_d_s(result, result);
|
| } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
|
| @@ -3260,22 +3265,29 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| key, external_pointer, key_is_constant, constant_key,
|
| element_size_shift, shift_size, base_offset);
|
| switch (elements_kind) {
|
| + case EXTERNAL_INT8_ELEMENTS:
|
| case INT8_ELEMENTS:
|
| __ lb(result, mem_operand);
|
| break;
|
| + case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
| + case EXTERNAL_UINT8_ELEMENTS:
|
| case UINT8_ELEMENTS:
|
| case UINT8_CLAMPED_ELEMENTS:
|
| __ lbu(result, mem_operand);
|
| break;
|
| + case EXTERNAL_INT16_ELEMENTS:
|
| case INT16_ELEMENTS:
|
| __ lh(result, mem_operand);
|
| break;
|
| + case EXTERNAL_UINT16_ELEMENTS:
|
| case UINT16_ELEMENTS:
|
| __ lhu(result, mem_operand);
|
| break;
|
| + case EXTERNAL_INT32_ELEMENTS:
|
| case INT32_ELEMENTS:
|
| __ lw(result, mem_operand);
|
| break;
|
| + case EXTERNAL_UINT32_ELEMENTS:
|
| case UINT32_ELEMENTS:
|
| __ lw(result, mem_operand);
|
| if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
| @@ -3285,6 +3297,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| break;
|
| case FLOAT32_ELEMENTS:
|
| case FLOAT64_ELEMENTS:
|
| + case EXTERNAL_FLOAT32_ELEMENTS:
|
| + case EXTERNAL_FLOAT64_ELEMENTS:
|
| case FAST_DOUBLE_ELEMENTS:
|
| case FAST_ELEMENTS:
|
| case FAST_SMI_ELEMENTS:
|
| @@ -3422,7 +3436,7 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
|
|
|
|
|
| void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
|
| - if (instr->is_fixed_typed_array()) {
|
| + if (instr->is_typed_elements()) {
|
| DoLoadKeyedExternalArray(instr);
|
| } else if (instr->hydrogen()->representation().IsDouble()) {
|
| DoLoadKeyedFixedDoubleArray(instr);
|
| @@ -3686,8 +3700,9 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
|
| DCHECK(ToRegister(instr->context()).is(cp));
|
| __ li(scratch0(), instr->hydrogen()->pairs());
|
| __ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
|
| - __ Push(scratch0(), scratch1());
|
| - CallRuntime(Runtime::kDeclareGlobals, 2, instr);
|
| + // The context is the first argument.
|
| + __ Push(cp, scratch0(), scratch1());
|
| + CallRuntime(Runtime::kDeclareGlobals, 3, instr);
|
| }
|
|
|
|
|
| @@ -4390,22 +4405,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
|
| DCHECK(ToRegister(instr->value())
|
| .is(StoreGlobalViaContextDescriptor::ValueRegister()));
|
|
|
| - int const slot = instr->slot_index();
|
| - int const depth = instr->depth();
|
| - if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
|
| - __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
|
| - Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
|
| - isolate(), depth, instr->language_mode())
|
| - .code();
|
| - CallCode(stub, RelocInfo::CODE_TARGET, instr);
|
| - } else {
|
| - __ Push(Smi::FromInt(slot));
|
| - __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
|
| - __ CallRuntime(is_strict(language_mode())
|
| - ? Runtime::kStoreGlobalViaContext_Strict
|
| - : Runtime::kStoreGlobalViaContext_Sloppy,
|
| - 2);
|
| - }
|
| + __ li(StoreGlobalViaContextDescriptor::DepthRegister(),
|
| + Operand(Smi::FromInt(instr->depth())));
|
| + __ li(StoreGlobalViaContextDescriptor::SlotRegister(),
|
| + Operand(Smi::FromInt(instr->slot_index())));
|
| + __ li(StoreGlobalViaContextDescriptor::NameRegister(),
|
| + Operand(instr->name()));
|
| +
|
| + Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
|
| + isolate(), instr->depth(), instr->language_mode())
|
| + .code();
|
| + CallCode(stub, RelocInfo::CODE_TARGET, instr);
|
| }
|
|
|
|
|
| @@ -4452,7 +4462,10 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| : element_size_shift;
|
| int base_offset = instr->base_offset();
|
|
|
| - if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| + elements_kind == FLOAT32_ELEMENTS ||
|
| + elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
| + elements_kind == FLOAT64_ELEMENTS) {
|
| Register address = scratch0();
|
| FPURegister value(ToDoubleRegister(instr->value()));
|
| if (key_is_constant) {
|
| @@ -4475,7 +4488,8 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| __ Daddu(address, external_pointer, address);
|
| }
|
|
|
| - if (elements_kind == FLOAT32_ELEMENTS) {
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| + elements_kind == FLOAT32_ELEMENTS) {
|
| __ cvt_s_d(double_scratch0(), value);
|
| __ swc1(double_scratch0(), MemOperand(address, base_offset));
|
| } else { // Storing doubles, not floats.
|
| @@ -4488,21 +4502,30 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| element_size_shift, shift_size,
|
| base_offset);
|
| switch (elements_kind) {
|
| + case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
| + case EXTERNAL_INT8_ELEMENTS:
|
| + case EXTERNAL_UINT8_ELEMENTS:
|
| case UINT8_ELEMENTS:
|
| case UINT8_CLAMPED_ELEMENTS:
|
| case INT8_ELEMENTS:
|
| __ sb(value, mem_operand);
|
| break;
|
| + case EXTERNAL_INT16_ELEMENTS:
|
| + case EXTERNAL_UINT16_ELEMENTS:
|
| case INT16_ELEMENTS:
|
| case UINT16_ELEMENTS:
|
| __ sh(value, mem_operand);
|
| break;
|
| + case EXTERNAL_INT32_ELEMENTS:
|
| + case EXTERNAL_UINT32_ELEMENTS:
|
| case INT32_ELEMENTS:
|
| case UINT32_ELEMENTS:
|
| __ sw(value, mem_operand);
|
| break;
|
| case FLOAT32_ELEMENTS:
|
| case FLOAT64_ELEMENTS:
|
| + case EXTERNAL_FLOAT32_ELEMENTS:
|
| + case EXTERNAL_FLOAT64_ELEMENTS:
|
| case FAST_DOUBLE_ELEMENTS:
|
| case FAST_ELEMENTS:
|
| case FAST_SMI_ELEMENTS:
|
| @@ -4629,7 +4652,7 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
|
|
|
| void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
|
| // By cases: external, fast double
|
| - if (instr->is_fixed_typed_array()) {
|
| + if (instr->is_typed_elements()) {
|
| DoStoreKeyedExternalArray(instr);
|
| } else if (instr->hydrogen()->value()->representation().IsDouble()) {
|
| DoStoreKeyedFixedDoubleArray(instr);
|
| @@ -5882,6 +5905,48 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label,
|
| *cmp2 = Operand(FLOAT32X4_TYPE);
|
| final_branch_condition = eq;
|
|
|
| + } else if (String::Equals(type_name, factory->int32x4_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(INT32X4_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| + } else if (String::Equals(type_name, factory->bool32x4_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(BOOL32X4_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| + } else if (String::Equals(type_name, factory->int16x8_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(INT16X8_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| + } else if (String::Equals(type_name, factory->bool16x8_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(BOOL16X8_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| + } else if (String::Equals(type_name, factory->int8x16_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(INT8X16_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| + } else if (String::Equals(type_name, factory->bool8x16_string())) {
|
| + __ JumpIfSmi(input, false_label);
|
| + __ GetObjectType(input, input, scratch);
|
| + *cmp1 = scratch;
|
| + *cmp2 = Operand(BOOL8X16_TYPE);
|
| + final_branch_condition = eq;
|
| +
|
| } else if (String::Equals(type_name, factory->boolean_string())) {
|
| __ LoadRoot(at, Heap::kTrueValueRootIndex);
|
| __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input));
|
|
|