| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index ebeaaa8216a0db4747f6c9aa1820a06a92e7f2a0..de52fadda939f9e5c93be34d664355dab12ec445 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -1043,7 +1043,7 @@ void LCodeGen::DeoptimizeIf(Condition cc,
|
| return;
|
| }
|
|
|
| - if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
|
| + if (DeoptEveryNTimes()) {
|
| ExternalReference count = ExternalReference::stress_deopt_count(isolate());
|
| Label no_deopt;
|
| __ pushfd();
|
| @@ -1958,7 +1958,7 @@ void LCodeGen::DoConstantD(LConstantD* instr) {
|
| XMMRegister xmm_scratch = double_scratch0();
|
| __ Set(temp, Immediate(lower));
|
| __ movd(xmm_scratch, Operand(temp));
|
| - __ por(res, xmm_scratch);
|
| + __ orps(res, xmm_scratch);
|
| }
|
| }
|
| }
|
| @@ -2047,7 +2047,7 @@ void LCodeGen::DoDateField(LDateField* instr) {
|
| __ j(not_equal, &runtime, Label::kNear);
|
| __ mov(result, FieldOperand(object, JSDate::kValueOffset +
|
| kPointerSize * index->value()));
|
| - __ jmp(&done);
|
| + __ jmp(&done, Label::kNear);
|
| }
|
| __ bind(&runtime);
|
| __ PrepareCallCFunction(2, scratch);
|
| @@ -2059,32 +2059,90 @@ void LCodeGen::DoDateField(LDateField* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
| +Operand LCodeGen::BuildSeqStringOperand(Register string,
|
| + LOperand* index,
|
| + String::Encoding encoding) {
|
| + if (index->IsConstantOperand()) {
|
| + int offset = ToRepresentation(LConstantOperand::cast(index),
|
| + Representation::Integer32());
|
| + if (encoding == String::TWO_BYTE_ENCODING) {
|
| + offset *= kUC16Size;
|
| + }
|
| + STATIC_ASSERT(kCharSize == 1);
|
| + return FieldOperand(string, SeqString::kHeaderSize + offset);
|
| + }
|
| + return FieldOperand(
|
| + string, ToRegister(index),
|
| + encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2,
|
| + SeqString::kHeaderSize);
|
| +}
|
| +
|
| +
|
| +void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
|
| + String::Encoding encoding = instr->hydrogen()->encoding();
|
| + Register result = ToRegister(instr->result());
|
| Register string = ToRegister(instr->string());
|
| - Register index = ToRegister(instr->index());
|
| - Register value = ToRegister(instr->value());
|
| - String::Encoding encoding = instr->encoding();
|
|
|
| if (FLAG_debug_code) {
|
| - __ push(value);
|
| - __ mov(value, FieldOperand(string, HeapObject::kMapOffset));
|
| - __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset));
|
| + __ push(string);
|
| + __ mov(string, FieldOperand(string, HeapObject::kMapOffset));
|
| + __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset));
|
|
|
| - __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
| + __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
| static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
|
| static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
|
| - __ cmp(value, Immediate(encoding == String::ONE_BYTE_ENCODING
|
| - ? one_byte_seq_type : two_byte_seq_type));
|
| + __ cmp(string, Immediate(encoding == String::ONE_BYTE_ENCODING
|
| + ? one_byte_seq_type : two_byte_seq_type));
|
| __ Check(equal, kUnexpectedStringType);
|
| - __ pop(value);
|
| + __ pop(string);
|
| }
|
|
|
| + Operand operand = BuildSeqStringOperand(string, instr->index(), encoding);
|
| if (encoding == String::ONE_BYTE_ENCODING) {
|
| - __ mov_b(FieldOperand(string, index, times_1, SeqString::kHeaderSize),
|
| - value);
|
| + __ movzx_b(result, operand);
|
| + } else {
|
| + __ movzx_w(result, operand);
|
| + }
|
| +}
|
| +
|
| +
|
| +void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
| + String::Encoding encoding = instr->hydrogen()->encoding();
|
| + Register string = ToRegister(instr->string());
|
| +
|
| + if (FLAG_debug_code) {
|
| + __ push(string);
|
| + __ mov(string, FieldOperand(string, HeapObject::kMapOffset));
|
| + __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset));
|
| +
|
| + __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
| + static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
|
| + static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
|
| + __ cmp(string, Immediate(encoding == String::ONE_BYTE_ENCODING
|
| + ? one_byte_seq_type : two_byte_seq_type));
|
| + __ Check(equal, kUnexpectedStringType);
|
| + __ pop(string);
|
| + }
|
| +
|
| + Operand operand = BuildSeqStringOperand(string, instr->index(), encoding);
|
| + if (instr->value()->IsConstantOperand()) {
|
| + int value = ToRepresentation(LConstantOperand::cast(instr->value()),
|
| + Representation::Integer32());
|
| + ASSERT_LE(0, value);
|
| + if (encoding == String::ONE_BYTE_ENCODING) {
|
| + ASSERT_LE(value, String::kMaxOneByteCharCode);
|
| + __ mov_b(operand, static_cast<int8_t>(value));
|
| + } else {
|
| + ASSERT_LE(value, String::kMaxUtf16CodeUnit);
|
| + __ mov_w(operand, static_cast<int16_t>(value));
|
| + }
|
| } else {
|
| - __ mov_w(FieldOperand(string, index, times_2, SeqString::kHeaderSize),
|
| - value);
|
| + Register value = ToRegister(instr->value());
|
| + if (encoding == String::ONE_BYTE_ENCODING) {
|
| + __ mov_b(operand, value);
|
| + } else {
|
| + __ mov_w(operand, value);
|
| + }
|
| }
|
| }
|
|
|
| @@ -2184,7 +2242,7 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
|
| __ ucomisd(left_reg, left_reg); // NaN check.
|
| __ j(parity_even, &return_left, Label::kNear); // left == NaN.
|
| __ bind(&return_right);
|
| - __ movsd(left_reg, right_reg);
|
| + __ movaps(left_reg, right_reg);
|
|
|
| __ bind(&return_left);
|
| }
|
| @@ -2589,7 +2647,7 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
|
| __ fld(0);
|
| __ FCmp();
|
| Label ok;
|
| - __ j(parity_even, &ok);
|
| + __ j(parity_even, &ok, Label::kNear);
|
| __ fstp(0);
|
| EmitFalseBranch(instr, no_condition);
|
| __ bind(&ok);
|
| @@ -2612,6 +2670,35 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
|
| + Representation rep = instr->hydrogen()->value()->representation();
|
| + ASSERT(!rep.IsInteger32());
|
| + Register scratch = ToRegister(instr->temp());
|
| +
|
| + if (rep.IsDouble()) {
|
| + CpuFeatureScope use_sse2(masm(), SSE2);
|
| + XMMRegister value = ToDoubleRegister(instr->value());
|
| + XMMRegister xmm_scratch = double_scratch0();
|
| + __ xorps(xmm_scratch, xmm_scratch);
|
| + __ ucomisd(xmm_scratch, value);
|
| + EmitFalseBranch(instr, not_equal);
|
| + __ movmskpd(scratch, value);
|
| + __ test(scratch, Immediate(1));
|
| + EmitBranch(instr, not_zero);
|
| + } else {
|
| + Register value = ToRegister(instr->value());
|
| + Handle<Map> map = masm()->isolate()->factory()->heap_number_map();
|
| + __ CheckMap(value, map, instr->FalseLabel(chunk()), DO_SMI_CHECK);
|
| + __ cmp(FieldOperand(value, HeapNumber::kExponentOffset),
|
| + Immediate(0x80000000));
|
| + EmitFalseBranch(instr, not_equal);
|
| + __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset),
|
| + Immediate(0x00000000));
|
| + EmitBranch(instr, equal);
|
| + }
|
| +}
|
| +
|
| +
|
| Condition LCodeGen::EmitIsObject(Register input,
|
| Register temp1,
|
| Label* is_not_object,
|
| @@ -2913,7 +3000,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
| Register temp = ToRegister(instr->temp());
|
|
|
| // A Smi is not an instance of anything.
|
| - __ JumpIfSmi(object, &false_result);
|
| + __ JumpIfSmi(object, &false_result, Label::kNear);
|
|
|
| // This is the inlined call site instanceof cache. The two occurences of the
|
| // hole value will be patched to the last map/result pair generated by the
|
| @@ -2926,18 +3013,18 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
| __ cmp(map, Operand::ForCell(cache_cell)); // Patched to cached map.
|
| __ j(not_equal, &cache_miss, Label::kNear);
|
| __ mov(eax, factory()->the_hole_value()); // Patched to either true or false.
|
| - __ jmp(&done);
|
| + __ jmp(&done, Label::kNear);
|
|
|
| // The inlined call site cache did not match. Check for null and string
|
| // before calling the deferred code.
|
| __ bind(&cache_miss);
|
| // Null is not an instance of anything.
|
| __ cmp(object, factory()->null_value());
|
| - __ j(equal, &false_result);
|
| + __ j(equal, &false_result, Label::kNear);
|
|
|
| // String values are not instances of anything.
|
| Condition is_string = masm_->IsObjectStringType(object, temp, temp);
|
| - __ j(is_string, &false_result);
|
| + __ j(is_string, &false_result, Label::kNear);
|
|
|
| // Go to the deferred code.
|
| __ jmp(deferred->entry());
|
| @@ -3082,7 +3169,7 @@ void LCodeGen::DoReturn(LReturn* instr) {
|
| if (dynamic_frame_alignment_) {
|
| Label no_padding;
|
| __ cmp(edx, Immediate(kNoAlignmentPadding));
|
| - __ j(equal, &no_padding);
|
| + __ j(equal, &no_padding, Label::kNear);
|
|
|
| EmitReturn(instr, true);
|
| __ bind(&no_padding);
|
| @@ -3215,12 +3302,7 @@ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
|
| ? MemOperand::StaticVariable(ToExternalReference(
|
| LConstantOperand::cast(instr->object())))
|
| : MemOperand(ToRegister(instr->object()), offset);
|
| - if (access.representation().IsByte()) {
|
| - ASSERT(instr->hydrogen()->representation().IsInteger32());
|
| - __ movzx_b(result, operand);
|
| - } else {
|
| - __ mov(result, operand);
|
| - }
|
| + __ Load(result, operand, access.representation());
|
| return;
|
| }
|
|
|
| @@ -3242,12 +3324,7 @@ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
|
| __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
| object = result;
|
| }
|
| - if (access.representation().IsByte()) {
|
| - ASSERT(instr->hydrogen()->representation().IsInteger32());
|
| - __ movzx_b(result, FieldOperand(object, offset));
|
| - } else {
|
| - __ mov(result, FieldOperand(object, offset));
|
| - }
|
| + __ Load(result, FieldOperand(object, offset), access.representation());
|
| }
|
|
|
|
|
| @@ -3600,6 +3677,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| // object as a receiver to normal functions. Values have to be
|
| // passed unchanged to builtins and strict-mode functions.
|
| Label global_object, receiver_ok;
|
| + Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear;
|
|
|
| // Do not transform the receiver to object for strict mode
|
| // functions.
|
| @@ -3607,12 +3685,12 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
|
| __ test_b(FieldOperand(scratch, SharedFunctionInfo::kStrictModeByteOffset),
|
| 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
|
| - __ j(not_equal, &receiver_ok); // A near jump is not sufficient here!
|
| + __ j(not_equal, &receiver_ok, dist);
|
|
|
| // Do not transform the receiver to object for builtins.
|
| __ test_b(FieldOperand(scratch, SharedFunctionInfo::kNativeByteOffset),
|
| 1 << SharedFunctionInfo::kNativeBitWithinByte);
|
| - __ j(not_equal, &receiver_ok);
|
| + __ j(not_equal, &receiver_ok, dist);
|
|
|
| // Normal function. Replace undefined or null with global receiver.
|
| __ cmp(receiver, factory()->null_value());
|
| @@ -3821,7 +3899,7 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
|
| // |result| are the same register and |input| will be restored
|
| // unchanged by popping safepoint registers.
|
| __ test(tmp, Immediate(HeapNumber::kSignMask));
|
| - __ j(zero, &done);
|
| + __ j(zero, &done, Label::kNear);
|
|
|
| __ AllocateHeapNumber(tmp, tmp2, no_reg, &slow);
|
| __ jmp(&allocated, Label::kNear);
|
| @@ -3883,7 +3961,7 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
|
| XMMRegister input_reg = ToDoubleRegister(instr->value());
|
| __ xorps(scratch, scratch);
|
| __ subsd(scratch, input_reg);
|
| - __ pand(input_reg, scratch);
|
| + __ andps(input_reg, scratch);
|
| } else if (r.IsSmiOrInteger32()) {
|
| EmitIntegerMathAbs(instr);
|
| } else { // Tagged case.
|
| @@ -3975,9 +4053,11 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
|
| ExternalReference::address_of_minus_one_half();
|
|
|
| Label done, round_to_zero, below_one_half, do_not_compensate;
|
| + Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear;
|
| +
|
| __ movsd(xmm_scratch, Operand::StaticVariable(one_half));
|
| __ ucomisd(xmm_scratch, input_reg);
|
| - __ j(above, &below_one_half);
|
| + __ j(above, &below_one_half, Label::kNear);
|
|
|
| // CVTTSD2SI rounds towards zero, since 0.5 <= x, we use floor(0.5 + x).
|
| __ addsd(xmm_scratch, input_reg);
|
| @@ -3986,16 +4066,16 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
|
| __ cmp(output_reg, 0x80000000u);
|
| __ RecordComment("D2I conversion overflow");
|
| DeoptimizeIf(equal, instr->environment());
|
| - __ jmp(&done);
|
| + __ jmp(&done, dist);
|
|
|
| __ bind(&below_one_half);
|
| __ movsd(xmm_scratch, Operand::StaticVariable(minus_one_half));
|
| __ ucomisd(xmm_scratch, input_reg);
|
| - __ j(below_equal, &round_to_zero);
|
| + __ j(below_equal, &round_to_zero, Label::kNear);
|
|
|
| // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then
|
| // compare and compensate.
|
| - __ movsd(input_temp, input_reg); // Do not alter input_reg.
|
| + __ movaps(input_temp, input_reg); // Do not alter input_reg.
|
| __ subsd(input_temp, xmm_scratch);
|
| __ cvttsd2si(output_reg, Operand(input_temp));
|
| // Catch minint due to overflow, and to prevent overflow when compensating.
|
| @@ -4005,10 +4085,10 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
|
|
|
| __ Cvtsi2sd(xmm_scratch, output_reg);
|
| __ ucomisd(xmm_scratch, input_temp);
|
| - __ j(equal, &done);
|
| + __ j(equal, &done, dist);
|
| __ sub(output_reg, Immediate(1));
|
| // No overflow because we already ruled out minint.
|
| - __ jmp(&done);
|
| + __ jmp(&done, dist);
|
|
|
| __ bind(&round_to_zero);
|
| // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if
|
| @@ -4363,13 +4443,13 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
|
| // look at the first argument
|
| __ mov(ecx, Operand(esp, 0));
|
| __ test(ecx, ecx);
|
| - __ j(zero, &packed_case);
|
| + __ j(zero, &packed_case, Label::kNear);
|
|
|
| ElementsKind holey_kind = GetHoleyElementsKind(kind);
|
| ArraySingleArgumentConstructorStub stub(holey_kind, context_mode,
|
| override_mode);
|
| CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
|
| - __ jmp(&done);
|
| + __ jmp(&done, Label::kNear);
|
| __ bind(&packed_case);
|
| }
|
|
|
| @@ -4384,6 +4464,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
|
|
|
|
|
| void LCodeGen::DoCallRuntime(LCallRuntime* instr) {
|
| + ASSERT(ToRegister(instr->context()).is(esi));
|
| CallRuntime(instr->function(), instr->arity(), instr, instr->save_doubles());
|
| }
|
|
|
| @@ -4416,16 +4497,11 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
| ToExternalReference(LConstantOperand::cast(instr->object())))
|
| : MemOperand(ToRegister(instr->object()), offset);
|
| if (instr->value()->IsConstantOperand()) {
|
| - ASSERT(!representation.IsByte());
|
| LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
|
| __ mov(operand, Immediate(ToInteger32(operand_value)));
|
| } else {
|
| Register value = ToRegister(instr->value());
|
| - if (representation.IsByte()) {
|
| - __ mov_b(operand, value);
|
| - } else {
|
| - __ mov(operand, value);
|
| - }
|
| + __ Store(value, operand, representation);
|
| }
|
| return;
|
| }
|
| @@ -4503,11 +4579,11 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
| LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
|
| if (operand_value->IsRegister()) {
|
| Register value = ToRegister(operand_value);
|
| - if (representation.IsByte()) {
|
| - __ mov_b(operand, value);
|
| - } else {
|
| - __ mov(operand, value);
|
| - }
|
| + __ Store(value, operand, representation);
|
| + } else if (representation.IsInteger32()) {
|
| + Immediate immediate = ToImmediate(operand_value, representation);
|
| + ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
| + __ mov(operand, immediate);
|
| } else {
|
| Handle<Object> handle_value = ToHandle(operand_value);
|
| ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
| @@ -4515,11 +4591,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
| }
|
| } else {
|
| Register value = ToRegister(instr->value());
|
| - if (representation.IsByte()) {
|
| - __ mov_b(operand, value);
|
| - } else {
|
| - __ mov(operand, value);
|
| - }
|
| + __ Store(value, operand, representation);
|
| }
|
|
|
| if (instr->hydrogen()->NeedsWriteBarrier()) {
|
| @@ -4666,7 +4738,7 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
|
| Label have_value;
|
|
|
| __ ucomisd(value, value);
|
| - __ j(parity_odd, &have_value); // NaN.
|
| + __ j(parity_odd, &have_value, Label::kNear); // NaN.
|
|
|
| __ movsd(value, Operand::StaticVariable(canonical_nan_reference));
|
| __ bind(&have_value);
|
| @@ -4702,15 +4774,15 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
|
| __ fld(0);
|
| __ FCmp();
|
|
|
| - __ j(parity_odd, &no_special_nan_handling);
|
| + __ j(parity_odd, &no_special_nan_handling, Label::kNear);
|
| __ sub(esp, Immediate(kDoubleSize));
|
| __ fst_d(MemOperand(esp, 0));
|
| __ cmp(MemOperand(esp, sizeof(kHoleNanLower32)),
|
| Immediate(kHoleNanUpper32));
|
| __ add(esp, Immediate(kDoubleSize));
|
| Label canonicalize;
|
| - __ j(not_equal, &canonicalize);
|
| - __ jmp(&no_special_nan_handling);
|
| + __ j(not_equal, &canonicalize, Label::kNear);
|
| + __ jmp(&no_special_nan_handling, Label::kNear);
|
| __ bind(&canonicalize);
|
| __ fstp(0);
|
| __ fld_d(Operand::StaticVariable(canonical_nan_reference));
|
| @@ -4957,10 +5029,19 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
|
|
|
|
|
| void LCodeGen::DoStringAdd(LStringAdd* instr) {
|
| - EmitPushTaggedOperand(instr->left());
|
| - EmitPushTaggedOperand(instr->right());
|
| - StringAddStub stub(instr->hydrogen()->flags());
|
| - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| + ASSERT(ToRegister(instr->context()).is(esi));
|
| + if (FLAG_new_string_add) {
|
| + ASSERT(ToRegister(instr->left()).is(edx));
|
| + ASSERT(ToRegister(instr->right()).is(eax));
|
| + NewStringAddStub stub(instr->hydrogen()->flags(),
|
| + isolate()->heap()->GetPretenureMode());
|
| + CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| + } else {
|
| + EmitPushTaggedOperand(instr->left());
|
| + EmitPushTaggedOperand(instr->right());
|
| + StringAddStub stub(instr->hydrogen()->flags());
|
| + CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
|
| + }
|
| }
|
|
|
|
|
| @@ -5012,6 +5093,17 @@ void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) {
|
| + Register input = ToRegister(instr->value());
|
| + if (!instr->hydrogen()->value()->HasRange() ||
|
| + !instr->hydrogen()->value()->range()->IsInSmiRange()) {
|
| + __ test(input, Immediate(0xc0000000));
|
| + DeoptimizeIf(not_zero, instr->environment());
|
| + }
|
| + __ SmiTag(input);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
|
| class DeferredNumberTagI V8_FINAL : public LDeferredCode {
|
| public:
|
| @@ -5679,12 +5771,12 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
|
| Label success;
|
| for (int i = 0; i < map_set.size() - 1; i++) {
|
| Handle<Map> map = map_set.at(i).handle();
|
| - __ CompareMap(reg, map, &success);
|
| - __ j(equal, &success);
|
| + __ CompareMap(reg, map);
|
| + __ j(equal, &success, Label::kNear);
|
| }
|
|
|
| Handle<Map> map = map_set.at(map_set.size() - 1).handle();
|
| - __ CompareMap(reg, map, &success);
|
| + __ CompareMap(reg, map);
|
| if (instr->hydrogen()->has_migration_target()) {
|
| __ j(not_equal, deferred->entry());
|
| } else {
|
| @@ -5762,13 +5854,13 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) {
|
| // Check for heap number
|
| __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
|
| factory()->heap_number_map());
|
| - __ j(equal, &heap_number, Label::kFar);
|
| + __ j(equal, &heap_number, Label::kNear);
|
|
|
| // Check for undefined. Undefined is converted to zero for clamping
|
| // conversions.
|
| __ cmp(input_reg, factory()->undefined_value());
|
| DeoptimizeIf(not_equal, instr->environment());
|
| - __ jmp(&zero_result);
|
| + __ jmp(&zero_result, Label::kNear);
|
|
|
| // Heap number
|
| __ bind(&heap_number);
|
| @@ -5783,15 +5875,15 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) {
|
|
|
| // Test for negative values --> clamp to zero
|
| __ test(scratch, scratch);
|
| - __ j(negative, &zero_result);
|
| + __ j(negative, &zero_result, Label::kNear);
|
|
|
| // Get exponent alone in scratch2.
|
| __ mov(scratch2, scratch);
|
| __ and_(scratch2, HeapNumber::kExponentMask);
|
| __ shr(scratch2, HeapNumber::kExponentShift);
|
| - __ j(zero, &zero_result);
|
| + __ j(zero, &zero_result, Label::kNear);
|
| __ sub(scratch2, Immediate(HeapNumber::kExponentBias - 1));
|
| - __ j(negative, &zero_result);
|
| + __ j(negative, &zero_result, Label::kNear);
|
|
|
| const uint32_t non_int8_exponent = 7;
|
| __ cmp(scratch2, Immediate(non_int8_exponent + 1));
|
| @@ -5822,18 +5914,18 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) {
|
| __ and_(scratch2, Immediate((1 << one_bit_shift) - 1));
|
| __ cmp(scratch2, Immediate(1 << one_half_bit_shift));
|
| Label no_round;
|
| - __ j(less, &no_round);
|
| + __ j(less, &no_round, Label::kNear);
|
| Label round_up;
|
| __ mov(scratch2, Immediate(1 << one_half_bit_shift));
|
| - __ j(greater, &round_up);
|
| + __ j(greater, &round_up, Label::kNear);
|
| __ test(scratch3, scratch3);
|
| - __ j(not_zero, &round_up);
|
| + __ j(not_zero, &round_up, Label::kNear);
|
| __ mov(scratch2, scratch);
|
| __ and_(scratch2, Immediate(1 << one_bit_shift));
|
| __ shr(scratch2, 1);
|
| __ bind(&round_up);
|
| __ add(scratch, scratch2);
|
| - __ j(overflow, &largest_value);
|
| + __ j(overflow, &largest_value, Label::kNear);
|
| __ bind(&no_round);
|
| __ shr(scratch, 23);
|
| __ mov(result_reg, scratch);
|
| @@ -5848,7 +5940,7 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) {
|
| // bit is set.
|
| __ and_(scratch, HeapNumber::kMantissaMask);
|
| __ or_(scratch, FieldOperand(input_reg, HeapNumber::kMantissaOffset));
|
| - __ j(not_zero, &zero_result); // M!=0 --> NaN
|
| + __ j(not_zero, &zero_result, Label::kNear); // M!=0 --> NaN
|
| // Infinity -> Fall through to map to 255.
|
|
|
| __ bind(&largest_value);
|
| @@ -5857,7 +5949,7 @@ void LCodeGen::DoClampTToUint8NoSSE2(LClampTToUint8NoSSE2* instr) {
|
|
|
| __ bind(&zero_result);
|
| __ xor_(result_reg, result_reg);
|
| - __ jmp(&done);
|
| + __ jmp(&done, Label::kNear);
|
|
|
| // smi
|
| __ bind(&is_smi);
|
| @@ -6005,7 +6097,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
|
| int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
|
| Label allocated, runtime_allocate;
|
| __ Allocate(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT);
|
| - __ jmp(&allocated);
|
| + __ jmp(&allocated, Label::kNear);
|
|
|
| __ bind(&runtime_allocate);
|
| __ push(ebx);
|
| @@ -6050,6 +6142,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
|
|
|
|
|
| void LCodeGen::DoTypeof(LTypeof* instr) {
|
| + ASSERT(ToRegister(instr->context()).is(esi));
|
| LOperand* input = instr->value();
|
| EmitPushTaggedOperand(input);
|
| CallRuntime(Runtime::kTypeof, 1, instr);
|
| @@ -6205,6 +6298,11 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoDummy(LDummy* instr) {
|
| + // Nothing to see here, move on!
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoDummyUse(LDummyUse* instr) {
|
| // Nothing to see here, move on!
|
| }
|
| @@ -6294,6 +6392,7 @@ void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
|
|
|
|
|
| void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
|
| + ASSERT(ToRegister(instr->context()).is(esi));
|
| __ cmp(eax, isolate()->factory()->undefined_value());
|
| DeoptimizeIf(equal, instr->environment());
|
|
|
| @@ -6331,9 +6430,9 @@ void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
|
| Label load_cache, done;
|
| __ EnumLength(result, map);
|
| __ cmp(result, Immediate(Smi::FromInt(0)));
|
| - __ j(not_equal, &load_cache);
|
| + __ j(not_equal, &load_cache, Label::kNear);
|
| __ mov(result, isolate()->factory()->empty_fixed_array());
|
| - __ jmp(&done);
|
| + __ jmp(&done, Label::kNear);
|
|
|
| __ bind(&load_cache);
|
| __ LoadInstanceDescriptors(map, result);
|
| @@ -6361,7 +6460,7 @@ void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
|
|
|
| Label out_of_object, done;
|
| __ cmp(index, Immediate(0));
|
| - __ j(less, &out_of_object);
|
| + __ j(less, &out_of_object, Label::kNear);
|
| __ mov(object, FieldOperand(object,
|
| index,
|
| times_half_pointer_size,
|
|
|