Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
| index 46c87e1d62a9686627ec995c363fb87d6d7e5d41..52ed2d7f8b73aa040f94fa643ea181d613aa3568 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -160,7 +160,7 @@ bool LCodeGen::GeneratePrologue() { |
| if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { |
| // Move state of dynamic frame alignment into edx. |
| - __ mov(edx, Immediate(kNoAlignmentPadding)); |
| + __ Set(edx, Immediate(kNoAlignmentPadding)); |
| Label do_not_pad, align_loop; |
| STATIC_ASSERT(kDoubleSize == 2 * kPointerSize); |
| @@ -316,7 +316,7 @@ void LCodeGen::GenerateOsrPrologue() { |
| osr_pc_offset_ = masm()->pc_offset(); |
| // Move state of dynamic frame alignment into edx. |
| - __ mov(edx, Immediate(kNoAlignmentPadding)); |
| + __ Set(edx, Immediate(kNoAlignmentPadding)); |
| if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { |
| Label do_not_pad, align_loop; |
| @@ -5951,7 +5951,7 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
| // TODO(3095996): Get rid of this. For now, we need to make the |
| // result register contain a valid pointer because it is already |
| // contained in the register pointer map. |
| - __ mov(result, Immediate(Smi::FromInt(0))); |
| + __ Set(result, Immediate(Smi::FromInt(0))); |
| PushSafepointRegistersScope scope(this); |
| if (instr->size()->IsRegister()) { |
| @@ -6068,44 +6068,63 @@ void LCodeGen::DoTypeof(LTypeof* instr) { |
| void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
| - Register input = ToRegister(instr->value()); |
| + Representation rep = instr->hydrogen()->value()->representation(); |
|
Jakob Kummerow
2013/11/08 12:07:05
Thanks to overriding KnownSuccessorBlock and the m
Weiliang
2013/11/08 13:50:26
Done.
|
| + if (rep.IsSpecialization()) { |
| + if (instr->hydrogen()->CheckNumberString()) { |
| + EmitGoto(instr->TrueDestination(chunk_)); |
| + } else { |
| + EmitGoto(instr->FalseDestination(chunk_)); |
| + } |
| + return; |
| + } |
| - Condition final_branch_condition = |
| - EmitTypeofIs(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), |
| - input, instr->type_literal()); |
| + Register input = ToRegister(instr->value()); |
| + Condition final_branch_condition = EmitTypeofIs(instr, input); |
| if (final_branch_condition != no_condition) { |
| EmitBranch(instr, final_branch_condition); |
| } |
| } |
| -Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| - Label* false_label, |
| - Register input, |
| - Handle<String> type_name) { |
| +Condition LCodeGen::EmitTypeofIs(LTypeofIsAndBranch* instr, Register input) { |
| + Label* true_label = instr->TrueLabel(chunk_); |
| + Label* false_label = instr->FalseLabel(chunk_); |
| + Handle<String> type_name = instr->type_literal(); |
| + int left_block = instr->TrueDestination(chunk_); |
| + int right_block = instr->FalseDestination(chunk_); |
| + int next_block = GetNextEmittedBlock(); |
| + |
| + Label::Distance true_distance = Label::kFar; |
|
Jakob Kummerow
2013/11/08 12:07:05
Label::Distance true_distance = left_block == next
Weiliang
2013/11/08 13:50:26
Done.
Weiliang
2013/11/08 13:50:26
Done.
|
| + Label::Distance false_distance = Label::kFar; |
| + if (left_block == next_block) { |
| + true_distance = Label::kNear; |
| + } else if (right_block == next_block) { |
| + false_distance = Label::kNear; |
| + } |
| + |
| Condition final_branch_condition = no_condition; |
| if (type_name->Equals(heap()->number_string())) { |
| - __ JumpIfSmi(input, true_label); |
| + __ JumpIfSmi(input, true_label, true_distance); |
| __ cmp(FieldOperand(input, HeapObject::kMapOffset), |
| factory()->heap_number_map()); |
| final_branch_condition = equal; |
| } else if (type_name->Equals(heap()->string_string())) { |
| - __ JumpIfSmi(input, false_label); |
| + __ JumpIfSmi(input, false_label, false_distance); |
| __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| - __ j(above_equal, false_label); |
| + __ j(above_equal, false_label, false_distance); |
| __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 1 << Map::kIsUndetectable); |
| final_branch_condition = zero; |
| } else if (type_name->Equals(heap()->symbol_string())) { |
| - __ JumpIfSmi(input, false_label); |
| + __ JumpIfSmi(input, false_label, false_distance); |
| __ CmpObjectType(input, SYMBOL_TYPE, input); |
| final_branch_condition = equal; |
| } else if (type_name->Equals(heap()->boolean_string())) { |
| __ cmp(input, factory()->true_value()); |
| - __ j(equal, true_label); |
| + __ j(equal, true_label, true_distance); |
| __ cmp(input, factory()->false_value()); |
| final_branch_condition = equal; |
| @@ -6115,8 +6134,8 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| } else if (type_name->Equals(heap()->undefined_string())) { |
| __ cmp(input, factory()->undefined_value()); |
| - __ j(equal, true_label); |
| - __ JumpIfSmi(input, false_label); |
| + __ j(equal, true_label, true_distance); |
| + __ JumpIfSmi(input, false_label, false_distance); |
| // Check for undetectable objects => true. |
| __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); |
| __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| @@ -6125,29 +6144,29 @@ Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| } else if (type_name->Equals(heap()->function_string())) { |
| STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| - __ JumpIfSmi(input, false_label); |
| + __ JumpIfSmi(input, false_label, false_distance); |
| __ CmpObjectType(input, JS_FUNCTION_TYPE, input); |
| - __ j(equal, true_label); |
| + __ j(equal, true_label, true_distance); |
| __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); |
| final_branch_condition = equal; |
| } else if (type_name->Equals(heap()->object_string())) { |
| - __ JumpIfSmi(input, false_label); |
| + __ JumpIfSmi(input, false_label, false_distance); |
| if (!FLAG_harmony_typeof) { |
| __ cmp(input, factory()->null_value()); |
| - __ j(equal, true_label); |
| + __ j(equal, true_label, true_distance); |
| } |
| __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
| - __ j(below, false_label); |
| + __ j(below, false_label, false_distance); |
| __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| - __ j(above, false_label); |
| + __ j(above, false_label, false_distance); |
| // Check for undetectable objects => false. |
| __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 1 << Map::kIsUndetectable); |
| final_branch_condition = zero; |
| } else { |
| - __ jmp(false_label); |
| + __ jmp(false_label, false_distance); |
| } |
| return final_branch_condition; |
| } |