| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index 7c3db27b51da796f74c38d8675e3e3232bf8713c..7f5900df0e5b6de3c3071b2416dd67a77597eea0 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -84,7 +84,7 @@ void LCodeGen::FinishCode(Handle<Code> code) {
|
| ASSERT(is_done());
|
| code->set_stack_slots(GetStackSlotCount());
|
| code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
|
| - RegisterDependentCodeForEmbeddedMaps(code);
|
| + if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
|
| PopulateDeoptimizationData(code);
|
| info()->CommitDependencies(code);
|
| }
|
| @@ -207,17 +207,18 @@ bool LCodeGen::GeneratePrologue() {
|
| if (heap_slots > 0) {
|
| Comment(";;; Allocate local context");
|
| // Argument to NewContext is the function, which is in r1.
|
| - __ push(r1);
|
| if (heap_slots <= FastNewContextStub::kMaximumSlots) {
|
| FastNewContextStub stub(heap_slots);
|
| __ CallStub(&stub);
|
| } else {
|
| + __ push(r1);
|
| __ CallRuntime(Runtime::kNewFunctionContext, 1);
|
| }
|
| RecordSafepoint(Safepoint::kNoLazyDeopt);
|
| // Context is returned in both r0 and cp. It replaces the context
|
| // passed to us. It's saved in the stack and kept live in cp.
|
| - __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| + __ mov(cp, r0);
|
| + __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| // Copy any necessary parameters into the context.
|
| int num_parameters = scope()->num_parameters();
|
| for (int i = 0; i < num_parameters; i++) {
|
| @@ -276,7 +277,8 @@ bool LCodeGen::GenerateDeferredCode() {
|
|
|
| HValue* value =
|
| instructions_->at(code->instruction_index())->hydrogen_value();
|
| - RecordAndWritePosition(value->position());
|
| + RecordAndWritePosition(
|
| + chunk()->graph()->SourcePositionToScriptPosition(value->position()));
|
|
|
| Comment(";;; <@%d,#%d> "
|
| "-------------------- Deferred %s --------------------",
|
| @@ -905,6 +907,14 @@ void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
|
| translations_.CreateByteArray(isolate()->factory());
|
| data->SetTranslationByteArray(*translations);
|
| data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
|
| + data->SetOptimizationId(Smi::FromInt(info_->optimization_id()));
|
| + if (info_->IsOptimizing()) {
|
| + // Reference to shared function info does not change between phases.
|
| + AllowDeferredHandleDereference allow_handle_dereference;
|
| + data->SetSharedFunctionInfo(*info_->shared_info());
|
| + } else {
|
| + data->SetSharedFunctionInfo(Smi::FromInt(0));
|
| + }
|
|
|
| Handle<FixedArray> literals =
|
| factory()->NewFixedArray(deoptimization_literals_.length(), TENURED);
|
| @@ -1079,11 +1089,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) {
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
| switch (instr->hydrogen()->major_key()) {
|
| - case CodeStub::RegExpConstructResult: {
|
| - RegExpConstructResultStub stub;
|
| - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| - break;
|
| - }
|
| case CodeStub::RegExpExec: {
|
| RegExpExecStub stub;
|
| CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| @@ -1114,7 +1119,7 @@ void LCodeGen::DoModI(LModI* instr) {
|
| HMod* hmod = instr->hydrogen();
|
| HValue* left = hmod->left();
|
| HValue* right = hmod->right();
|
| - if (hmod->HasPowerOf2Divisor()) {
|
| + if (hmod->RightIsPowerOf2()) {
|
| // TODO(svenpanne) We should really do the strength reduction on the
|
| // Hydrogen level.
|
| Register left_reg = ToRegister(instr->left());
|
| @@ -1344,55 +1349,46 @@ void LCodeGen::EmitSignedIntegerDivisionByConstant(
|
|
|
|
|
| void LCodeGen::DoDivI(LDivI* instr) {
|
| - if (instr->hydrogen()->HasPowerOf2Divisor()) {
|
| - const Register dividend = ToRegister(instr->left());
|
| - const Register result = ToRegister(instr->result());
|
| - int32_t divisor = instr->hydrogen()->right()->GetInteger32Constant();
|
| - int32_t test_value = 0;
|
| - int32_t power = 0;
|
| -
|
| - if (divisor > 0) {
|
| - test_value = divisor - 1;
|
| - power = WhichPowerOf2(divisor);
|
| - } else {
|
| - // Check for (0 / -x) that will produce negative zero.
|
| - if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| - __ cmp(dividend, Operand::Zero());
|
| - DeoptimizeIf(eq, instr->environment());
|
| - }
|
| - // Check for (kMinInt / -1).
|
| - if (divisor == -1 && instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
|
| - __ cmp(dividend, Operand(kMinInt));
|
| - DeoptimizeIf(eq, instr->environment());
|
| - }
|
| - test_value = - divisor - 1;
|
| - power = WhichPowerOf2(-divisor);
|
| - }
|
| + if (!instr->is_flooring() && instr->hydrogen()->RightIsPowerOf2()) {
|
| + Register dividend = ToRegister(instr->left());
|
| + HDiv* hdiv = instr->hydrogen();
|
| + int32_t divisor = hdiv->right()->GetInteger32Constant();
|
| + Register result = ToRegister(instr->result());
|
| + ASSERT(!result.is(dividend));
|
|
|
| - if (test_value != 0) {
|
| - if (instr->hydrogen()->CheckFlag(
|
| - HInstruction::kAllUsesTruncatingToInt32)) {
|
| - __ sub(result, dividend, Operand::Zero(), SetCC);
|
| - __ rsb(result, result, Operand::Zero(), LeaveCC, lt);
|
| - __ mov(result, Operand(result, ASR, power));
|
| - if (divisor > 0) __ rsb(result, result, Operand::Zero(), LeaveCC, lt);
|
| - if (divisor < 0) __ rsb(result, result, Operand::Zero(), LeaveCC, gt);
|
| - return; // Don't fall through to "__ rsb" below.
|
| - } else {
|
| - // Deoptimize if remainder is not 0.
|
| - __ tst(dividend, Operand(test_value));
|
| - DeoptimizeIf(ne, instr->environment());
|
| - __ mov(result, Operand(dividend, ASR, power));
|
| - if (divisor < 0) __ rsb(result, result, Operand(0));
|
| - }
|
| + // Check for (0 / -x) that will produce negative zero.
|
| + if (hdiv->left()->RangeCanInclude(0) && divisor < 0 &&
|
| + hdiv->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| + __ cmp(dividend, Operand::Zero());
|
| + DeoptimizeIf(eq, instr->environment());
|
| + }
|
| + // Check for (kMinInt / -1).
|
| + if (hdiv->left()->RangeCanInclude(kMinInt) && divisor == -1 &&
|
| + hdiv->CheckFlag(HValue::kCanOverflow)) {
|
| + __ cmp(dividend, Operand(kMinInt));
|
| + DeoptimizeIf(eq, instr->environment());
|
| + }
|
| + // Deoptimize if remainder will not be 0.
|
| + if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
|
| + Abs(divisor) != 1) {
|
| + __ tst(dividend, Operand(Abs(divisor) - 1));
|
| + DeoptimizeIf(ne, instr->environment());
|
| + }
|
| + if (divisor == -1) { // Nice shortcut, not needed for correctness.
|
| + __ rsb(result, dividend, Operand(0));
|
| + return;
|
| + }
|
| + int32_t shift = WhichPowerOf2(Abs(divisor));
|
| + if (shift == 0) {
|
| + __ mov(result, dividend);
|
| + } else if (shift == 1) {
|
| + __ add(result, dividend, Operand(dividend, LSR, 31));
|
| } else {
|
| - if (divisor < 0) {
|
| - __ rsb(result, dividend, Operand(0));
|
| - } else {
|
| - __ Move(result, dividend);
|
| - }
|
| + __ mov(result, Operand(dividend, ASR, 31));
|
| + __ add(result, dividend, Operand(result, LSR, 32 - shift));
|
| }
|
| -
|
| + if (shift > 0) __ mov(result, Operand(result, ASR, shift));
|
| + if (divisor < 0) __ rsb(result, result, Operand(0));
|
| return;
|
| }
|
|
|
| @@ -1401,15 +1397,15 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| const Register result = ToRegister(instr->result());
|
|
|
| // Check for x / 0.
|
| - if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
|
| + if (instr->hydrogen_value()->CheckFlag(HValue::kCanBeDivByZero)) {
|
| __ cmp(right, Operand::Zero());
|
| DeoptimizeIf(eq, instr->environment());
|
| }
|
|
|
| // Check for (0 / -x) that will produce negative zero.
|
| - if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| + if (instr->hydrogen_value()->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| Label positive;
|
| - if (!instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
|
| + if (!instr->hydrogen_value()->CheckFlag(HValue::kCanBeDivByZero)) {
|
| // Do the test only if it hadn't be done above.
|
| __ cmp(right, Operand::Zero());
|
| }
|
| @@ -1420,9 +1416,10 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| }
|
|
|
| // Check for (kMinInt / -1).
|
| - if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow) &&
|
| + if (instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow) &&
|
| (!CpuFeatures::IsSupported(SUDIV) ||
|
| - !instr->hydrogen()->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
|
| + !instr->hydrogen_value()->CheckFlag(
|
| + HValue::kAllUsesTruncatingToInt32))) {
|
| // We don't need to check for overflow when truncating with sdiv
|
| // support because, on ARM, sdiv kMinInt, -1 -> kMinInt.
|
| __ cmp(left, Operand(kMinInt));
|
| @@ -1434,7 +1431,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| CpuFeatureScope scope(masm(), SUDIV);
|
| __ sdiv(result, left, right);
|
|
|
| - if (!instr->hydrogen()->CheckFlag(
|
| + if (!instr->hydrogen_value()->CheckFlag(
|
| HInstruction::kAllUsesTruncatingToInt32)) {
|
| // Compute remainder and deopt if it's not zero.
|
| const Register remainder = scratch0();
|
| @@ -1453,7 +1450,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
|
| __ vcvt_s32_f64(double_scratch0().low(), vleft);
|
| __ vmov(result, double_scratch0().low());
|
|
|
| - if (!instr->hydrogen()->CheckFlag(
|
| + if (!instr->hydrogen_value()->CheckFlag(
|
| HInstruction::kAllUsesTruncatingToInt32)) {
|
| // Deopt if exact conversion to integer was not possible.
|
| // Use vright as scratch register.
|
| @@ -1867,42 +1864,6 @@ void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoElementsKind(LElementsKind* instr) {
|
| - Register result = ToRegister(instr->result());
|
| - Register input = ToRegister(instr->value());
|
| -
|
| - // Load map into |result|.
|
| - __ ldr(result, FieldMemOperand(input, HeapObject::kMapOffset));
|
| - // Load the map's "bit field 2" into |result|. We only need the first byte,
|
| - // but the following bit field extraction takes care of that anyway.
|
| - __ ldr(result, FieldMemOperand(result, Map::kBitField2Offset));
|
| - // Retrieve elements_kind from bit field 2.
|
| - __ ubfx(result, result, Map::kElementsKindShift, Map::kElementsKindBitCount);
|
| -}
|
| -
|
| -
|
| -void LCodeGen::DoValueOf(LValueOf* instr) {
|
| - Register input = ToRegister(instr->value());
|
| - Register result = ToRegister(instr->result());
|
| - Register map = ToRegister(instr->temp());
|
| - Label done;
|
| -
|
| - if (!instr->hydrogen()->value()->IsHeapObject()) {
|
| - // If the object is a smi return the object.
|
| - __ SmiTst(input);
|
| - __ Move(result, input, eq);
|
| - __ b(eq, &done);
|
| - }
|
| -
|
| - // If the object is not a value type, return the object.
|
| - __ CompareObjectType(input, map, map, JS_VALUE_TYPE);
|
| - __ Move(result, input, ne);
|
| - __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset), eq);
|
| -
|
| - __ bind(&done);
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoDateField(LDateField* instr) {
|
| Register object = ToRegister(instr->date());
|
| Register result = ToRegister(instr->result());
|
| @@ -2018,17 +1979,6 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoThrow(LThrow* instr) {
|
| - __ push(ToRegister(instr->value()));
|
| - ASSERT(ToRegister(instr->context()).is(cp));
|
| - CallRuntime(Runtime::kThrow, 1, instr);
|
| -
|
| - if (FLAG_debug_code) {
|
| - __ stop("Unreachable code.");
|
| - }
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoAddI(LAddI* instr) {
|
| LOperand* left = instr->left();
|
| LOperand* right = instr->right();
|
| @@ -3145,15 +3095,6 @@ void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoLoadExternalArrayPointer(
|
| - LLoadExternalArrayPointer* instr) {
|
| - Register to_reg = ToRegister(instr->result());
|
| - Register from_reg = ToRegister(instr->object());
|
| - __ ldr(to_reg, FieldMemOperand(from_reg,
|
| - ExternalArray::kExternalPointerOffset));
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
|
| Register arguments = ToRegister(instr->arguments());
|
| Register result = ToRegister(instr->result());
|
| @@ -3212,9 +3153,9 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| : 0;
|
|
|
|
|
| - if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| elements_kind == FLOAT32_ELEMENTS ||
|
| - elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
|
| + elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
| elements_kind == FLOAT64_ELEMENTS) {
|
| int base_offset =
|
| (instr->additional_index() << element_size_shift) + additional_offset;
|
| @@ -3223,7 +3164,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| ? Operand(constant_key << element_size_shift)
|
| : Operand(key, LSL, shift_size);
|
| __ add(scratch0(), external_pointer, operand);
|
| - if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| elements_kind == FLOAT32_ELEMENTS) {
|
| __ vldr(double_scratch0().low(), scratch0(), base_offset);
|
| __ vcvt_f64_f32(result, double_scratch0().low());
|
| @@ -3237,29 +3178,29 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| element_size_shift, shift_size,
|
| instr->additional_index(), additional_offset);
|
| switch (elements_kind) {
|
| - case EXTERNAL_BYTE_ELEMENTS:
|
| + case EXTERNAL_INT8_ELEMENTS:
|
| case INT8_ELEMENTS:
|
| __ ldrsb(result, mem_operand);
|
| break;
|
| - case EXTERNAL_PIXEL_ELEMENTS:
|
| - case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
|
| + case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
| + case EXTERNAL_UINT8_ELEMENTS:
|
| case UINT8_ELEMENTS:
|
| case UINT8_CLAMPED_ELEMENTS:
|
| __ ldrb(result, mem_operand);
|
| break;
|
| - case EXTERNAL_SHORT_ELEMENTS:
|
| + case EXTERNAL_INT16_ELEMENTS:
|
| case INT16_ELEMENTS:
|
| __ ldrsh(result, mem_operand);
|
| break;
|
| - case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
|
| + case EXTERNAL_UINT16_ELEMENTS:
|
| case UINT16_ELEMENTS:
|
| __ ldrh(result, mem_operand);
|
| break;
|
| - case EXTERNAL_INT_ELEMENTS:
|
| + case EXTERNAL_INT32_ELEMENTS:
|
| case INT32_ELEMENTS:
|
| __ ldr(result, mem_operand);
|
| break;
|
| - case EXTERNAL_UNSIGNED_INT_ELEMENTS:
|
| + case EXTERNAL_UINT32_ELEMENTS:
|
| case UINT32_ELEMENTS:
|
| __ ldr(result, mem_operand);
|
| if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
|
| @@ -3269,8 +3210,8 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
| break;
|
| case FLOAT32_ELEMENTS:
|
| case FLOAT64_ELEMENTS:
|
| - case EXTERNAL_FLOAT_ELEMENTS:
|
| - case EXTERNAL_DOUBLE_ELEMENTS:
|
| + case EXTERNAL_FLOAT32_ELEMENTS:
|
| + case EXTERNAL_FLOAT64_ELEMENTS:
|
| case FAST_HOLEY_DOUBLE_ELEMENTS:
|
| case FAST_HOLEY_ELEMENTS:
|
| case FAST_HOLEY_SMI_ELEMENTS:
|
| @@ -3488,19 +3429,21 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| // passed unchanged to builtins and strict-mode functions.
|
| Label global_object, result_in_receiver;
|
|
|
| - // Do not transform the receiver to object for strict mode
|
| - // functions.
|
| - __ ldr(scratch,
|
| - FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
|
| - __ ldr(scratch,
|
| - FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
|
| - __ tst(scratch,
|
| - Operand(1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize)));
|
| - __ b(ne, &result_in_receiver);
|
| + if (!instr->hydrogen()->known_function()) {
|
| + // Do not transform the receiver to object for strict mode
|
| + // functions.
|
| + __ ldr(scratch,
|
| + FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
|
| + __ ldr(scratch,
|
| + FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset));
|
| + int mask = 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize);
|
| + __ tst(scratch, Operand(mask));
|
| + __ b(ne, &result_in_receiver);
|
|
|
| - // Do not transform the receiver to object for builtins.
|
| - __ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
| - __ b(ne, &result_in_receiver);
|
| + // Do not transform the receiver to object for builtins.
|
| + __ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
| + __ b(ne, &result_in_receiver);
|
| + }
|
|
|
| // Normal function. Replace undefined or null with global receiver.
|
| __ LoadRoot(scratch, Heap::kNullValueRootIndex);
|
| @@ -3515,14 +3458,14 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| DeoptimizeIf(eq, instr->environment());
|
| __ CompareObjectType(receiver, scratch, scratch, FIRST_SPEC_OBJECT_TYPE);
|
| DeoptimizeIf(lt, instr->environment());
|
| - __ b(&result_in_receiver);
|
|
|
| + __ b(&result_in_receiver);
|
| __ bind(&global_object);
|
| - __ ldr(receiver, FieldMemOperand(function, JSFunction::kContextOffset));
|
| - __ ldr(receiver,
|
| - ContextOperand(receiver, Context::GLOBAL_OBJECT_INDEX));
|
| - __ ldr(receiver,
|
| - FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset));
|
| + __ ldr(result, FieldMemOperand(function, JSFunction::kContextOffset));
|
| + __ ldr(result,
|
| + ContextOperand(result, Context::GLOBAL_OBJECT_INDEX));
|
| + __ ldr(result,
|
| + FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset));
|
|
|
| if (result.is(receiver)) {
|
| __ bind(&result_in_receiver);
|
| @@ -3617,14 +3560,6 @@ void LCodeGen::DoContext(LContext* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoOuterContext(LOuterContext* instr) {
|
| - Register context = ToRegister(instr->context());
|
| - Register result = ToRegister(instr->result());
|
| - __ ldr(result,
|
| - MemOperand(context, Context::SlotOffset(Context::PREVIOUS_INDEX)));
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| __ push(cp); // The context is the first argument.
|
| @@ -3636,20 +3571,6 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoGlobalObject(LGlobalObject* instr) {
|
| - Register context = ToRegister(instr->context());
|
| - Register result = ToRegister(instr->result());
|
| - __ ldr(result, ContextOperand(context, Context::GLOBAL_OBJECT_INDEX));
|
| -}
|
| -
|
| -
|
| -void LCodeGen::DoGlobalReceiver(LGlobalReceiver* instr) {
|
| - Register global = ToRegister(instr->global_object());
|
| - Register result = ToRegister(instr->result());
|
| - __ ldr(result, FieldMemOperand(global, GlobalObject::kGlobalReceiverOffset));
|
| -}
|
| -
|
| -
|
| void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| int formal_parameter_count,
|
| int arity,
|
| @@ -3954,6 +3875,13 @@ void LCodeGen::DoMathLog(LMathLog* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoMathClz32(LMathClz32* instr) {
|
| + Register input = ToRegister(instr->value());
|
| + Register result = ToRegister(instr->result());
|
| + __ clz(result, input);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| ASSERT(ToRegister(instr->function()).is(r1));
|
| @@ -4025,13 +3953,8 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
|
|
| int arity = instr->arity();
|
| - CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
|
| - if (instr->hydrogen()->IsTailCall()) {
|
| - if (NeedsEagerFrame()) __ mov(sp, fp);
|
| - __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
|
| - } else {
|
| - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| - }
|
| + CallFunctionStub stub(arity, instr->hydrogen()->function_flags());
|
| + CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| }
|
|
|
|
|
| @@ -4055,7 +3978,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
|
|
| __ mov(r0, Operand(instr->arity()));
|
| - __ mov(r2, Operand(instr->hydrogen()->property_cell()));
|
| + __ mov(r2, Operand(factory()->undefined_value()));
|
| ElementsKind kind = instr->hydrogen()->elements_kind();
|
| AllocationSiteOverrideMode override_mode =
|
| (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
|
| @@ -4135,14 +4058,20 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
| }
|
|
|
| Handle<Map> transition = instr->transition();
|
| + SmiCheck check_needed =
|
| + instr->hydrogen()->value()->IsHeapObject()
|
| + ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
|
|
|
| if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
|
| Register value = ToRegister(instr->value());
|
| if (!instr->hydrogen()->value()->type().IsHeapObject()) {
|
| __ SmiTst(value);
|
| DeoptimizeIf(eq, instr->environment());
|
| +
|
| + // We know that value is a smi now, so we can omit the check below.
|
| + check_needed = OMIT_SMI_CHECK;
|
| }
|
| - } else if (FLAG_track_double_fields && representation.IsDouble()) {
|
| + } else if (representation.IsDouble()) {
|
| ASSERT(transition.is_null());
|
| ASSERT(access.IsInobject());
|
| ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
| @@ -4170,10 +4099,6 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
|
|
| // Do the store.
|
| Register value = ToRegister(instr->value());
|
| - ASSERT(!object.is(value));
|
| - SmiCheck check_needed =
|
| - instr->hydrogen()->value()->IsHeapObject()
|
| - ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
|
| if (access.IsInobject()) {
|
| MemOperand operand = FieldMemOperand(object, offset);
|
| __ Store(value, operand, representation);
|
| @@ -4274,9 +4199,9 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
|
| : 0;
|
|
|
| - if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| elements_kind == FLOAT32_ELEMENTS ||
|
| - elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
|
| + elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
|
| elements_kind == FLOAT64_ELEMENTS) {
|
| int base_offset =
|
| (instr->additional_index() << element_size_shift) + additional_offset;
|
| @@ -4292,7 +4217,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| } else {
|
| __ add(address, external_pointer, Operand(key, LSL, shift_size));
|
| }
|
| - if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
|
| + if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
|
| elements_kind == FLOAT32_ELEMENTS) {
|
| __ vcvt_f32_f64(double_scratch0().low(), value);
|
| __ vstr(double_scratch0().low(), address, base_offset);
|
| @@ -4306,30 +4231,30 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
| element_size_shift, shift_size,
|
| instr->additional_index(), additional_offset);
|
| switch (elements_kind) {
|
| - case EXTERNAL_PIXEL_ELEMENTS:
|
| - case EXTERNAL_BYTE_ELEMENTS:
|
| - case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
|
| + case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
|
| + case EXTERNAL_INT8_ELEMENTS:
|
| + case EXTERNAL_UINT8_ELEMENTS:
|
| case UINT8_ELEMENTS:
|
| case UINT8_CLAMPED_ELEMENTS:
|
| case INT8_ELEMENTS:
|
| __ strb(value, mem_operand);
|
| break;
|
| - case EXTERNAL_SHORT_ELEMENTS:
|
| - case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
|
| + case EXTERNAL_INT16_ELEMENTS:
|
| + case EXTERNAL_UINT16_ELEMENTS:
|
| case INT16_ELEMENTS:
|
| case UINT16_ELEMENTS:
|
| __ strh(value, mem_operand);
|
| break;
|
| - case EXTERNAL_INT_ELEMENTS:
|
| - case EXTERNAL_UNSIGNED_INT_ELEMENTS:
|
| + case EXTERNAL_INT32_ELEMENTS:
|
| + case EXTERNAL_UINT32_ELEMENTS:
|
| case INT32_ELEMENTS:
|
| case UINT32_ELEMENTS:
|
| __ str(value, mem_operand);
|
| break;
|
| case FLOAT32_ELEMENTS:
|
| case FLOAT64_ELEMENTS:
|
| - case EXTERNAL_FLOAT_ELEMENTS:
|
| - case EXTERNAL_DOUBLE_ELEMENTS:
|
| + case EXTERNAL_FLOAT32_ELEMENTS:
|
| + case EXTERNAL_FLOAT64_ELEMENTS:
|
| case FAST_DOUBLE_ELEMENTS:
|
| case FAST_ELEMENTS:
|
| case FAST_SMI_ELEMENTS:
|
| @@ -4508,18 +4433,11 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
|
|
|
| void LCodeGen::DoStringAdd(LStringAdd* instr) {
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| - if (FLAG_new_string_add) {
|
| - ASSERT(ToRegister(instr->left()).is(r1));
|
| - ASSERT(ToRegister(instr->right()).is(r0));
|
| - NewStringAddStub stub(instr->hydrogen()->flags(),
|
| - isolate()->heap()->GetPretenureMode());
|
| - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| - } else {
|
| - __ push(ToRegister(instr->left()));
|
| - __ push(ToRegister(instr->right()));
|
| - StringAddStub stub(instr->hydrogen()->flags());
|
| - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| - }
|
| + ASSERT(ToRegister(instr->left()).is(r1));
|
| + ASSERT(ToRegister(instr->right()).is(r0));
|
| + StringAddStub stub(instr->hydrogen()->flags(),
|
| + instr->hydrogen()->pretenure_flag());
|
| + CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| }
|
|
|
|
|
| @@ -5341,7 +5259,11 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
|
|
|
| if (instr->size()->IsConstantOperand()) {
|
| int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
|
| - __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
|
| + if (size <= Page::kMaxRegularHeapObjectSize) {
|
| + __ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
|
| + } else {
|
| + __ jmp(deferred->entry());
|
| + }
|
| } else {
|
| Register size = ToRegister(instr->size());
|
| __ Allocate(size,
|
|
|