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 d4cbbcec8fd609f1029221de88cce9b027e83327..7bc3f0d7471b387527671aab59e19cb1dac9f24c 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -1716,6 +1716,33 @@ void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { |
| } |
| +Condition LCodeGen::EmitIsString(Register input, |
| + Register temp1, |
| + Label* is_not_string, |
| + Label* is_string) { |
| + __ JumpIfSmi(input, is_not_string); |
| + |
| + Condition cond = masm_->IsObjectStringType(input, temp1, temp1); |
| + |
| + return cond; |
| +} |
| + |
| + |
| +void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { |
| + Register reg = ToRegister(instr->InputAt(0)); |
| + Register temp = ToRegister(instr->TempAt(0)); |
| + |
| + int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| + int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| + Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| + Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| + |
| + Condition true_cond = EmitIsString(reg, temp, false_label, true_label); |
| + |
| + EmitBranch(true_block, false_block, true_cond); |
| +} |
| + |
| + |
| void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
| Operand input = ToOperand(instr->InputAt(0)); |
| @@ -1743,6 +1770,41 @@ void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
| } |
| +static Condition ComputeCompareCondition(Token::Value op) { |
| + switch (op) { |
| + case Token::EQ_STRICT: |
| + case Token::EQ: |
| + return equal; |
| + case Token::LT: |
| + return less; |
| + case Token::GT: |
| + return greater; |
| + case Token::LTE: |
| + return less_equal; |
| + case Token::GTE: |
| + return greater_equal; |
| + default: |
| + UNREACHABLE(); |
| + return no_condition; |
| + } |
| +} |
| + |
| + |
| +void LCodeGen::DoCompareGenericAndBranch(LCompareGenericAndBranch* instr) { |
| + Token::Value op = instr->op(); |
| + int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| + int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| + |
| + Handle<Code> ic = CompareIC::GetUninitialized(op); |
|
fschneider
2011/11/07 08:27:18
Use StringCompareStub instead. StringCompareStub s
indutny
2011/11/07 11:49:28
Just benchmarked it, and found that StringCompareS
fschneider
2011/11/07 15:34:00
Ok, thanks for trying out. Stick to the faster ver
|
| + CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| + |
| + Condition condition = ComputeCompareCondition(op); |
| + __ test(eax, Operand(eax)); |
| + |
| + EmitBranch(true_block, false_block, condition); |
| +} |
| + |
| + |
| static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
| InstanceType from = instr->from(); |
| InstanceType to = instr->to(); |
| @@ -2016,26 +2078,6 @@ void LCodeGen::DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| } |
| -static Condition ComputeCompareCondition(Token::Value op) { |
| - switch (op) { |
| - case Token::EQ_STRICT: |
| - case Token::EQ: |
| - return equal; |
| - case Token::LT: |
| - return less; |
| - case Token::GT: |
| - return greater; |
| - case Token::LTE: |
| - return less_equal; |
| - case Token::GTE: |
| - return greater_equal; |
| - default: |
| - UNREACHABLE(); |
| - return no_condition; |
| - } |
| -} |
| - |
| - |
| void LCodeGen::DoCmpT(LCmpT* instr) { |
| Token::Value op = instr->op(); |