| Index: src/ia32/lithium-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-codegen-ia32.cc (revision 7051)
|
| +++ src/ia32/lithium-codegen-ia32.cc (working copy)
|
| @@ -1654,6 +1654,19 @@
|
| }
|
|
|
|
|
| +void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
|
| + Register input = ToRegister(instr->InputAt(0));
|
| + Register result = ToRegister(instr->result());
|
| +
|
| + if (FLAG_debug_code) {
|
| + __ AbortIfNotString(input);
|
| + }
|
| +
|
| + __ mov(result, FieldOperand(input, String::kHashFieldOffset));
|
| + __ IndexFromHash(result, result);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
|
| Register input = ToRegister(instr->InputAt(0));
|
| Register result = ToRegister(instr->result());
|
| @@ -1663,7 +1676,7 @@
|
| __ test(FieldOperand(input, String::kHashFieldOffset),
|
| Immediate(String::kContainsCachedArrayIndexMask));
|
| NearLabel done;
|
| - __ j(not_zero, &done);
|
| + __ j(zero, &done);
|
| __ mov(result, FACTORY->false_value());
|
| __ bind(&done);
|
| }
|
| @@ -1678,7 +1691,7 @@
|
|
|
| __ test(FieldOperand(input, String::kHashFieldOffset),
|
| Immediate(String::kContainsCachedArrayIndexMask));
|
| - EmitBranch(true_block, false_block, not_equal);
|
| + EmitBranch(true_block, false_block, equal);
|
| }
|
|
|
|
|
| @@ -3695,21 +3708,18 @@
|
| Handle<String> type_name) {
|
| Condition final_branch_condition = no_condition;
|
| if (type_name->Equals(HEAP->number_symbol())) {
|
| - __ test(input, Immediate(kSmiTagMask));
|
| - __ j(zero, true_label);
|
| + __ JumpIfSmi(input, true_label);
|
| __ cmp(FieldOperand(input, HeapObject::kMapOffset),
|
| FACTORY->heap_number_map());
|
| final_branch_condition = equal;
|
|
|
| } else if (type_name->Equals(HEAP->string_symbol())) {
|
| - __ test(input, Immediate(kSmiTagMask));
|
| - __ j(zero, false_label);
|
| - __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
|
| + __ JumpIfSmi(input, false_label);
|
| + __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
|
| + __ j(above_equal, false_label);
|
| __ test_b(FieldOperand(input, Map::kBitFieldOffset),
|
| 1 << Map::kIsUndetectable);
|
| - __ j(not_zero, false_label);
|
| - __ CmpInstanceType(input, FIRST_NONSTRING_TYPE);
|
| - final_branch_condition = below;
|
| + final_branch_condition = zero;
|
|
|
| } else if (type_name->Equals(HEAP->boolean_symbol())) {
|
| __ cmp(input, FACTORY->true_value());
|
| @@ -3720,8 +3730,7 @@
|
| } else if (type_name->Equals(HEAP->undefined_symbol())) {
|
| __ cmp(input, FACTORY->undefined_value());
|
| __ j(equal, true_label);
|
| - __ test(input, Immediate(kSmiTagMask));
|
| - __ j(zero, false_label);
|
| + __ JumpIfSmi(input, false_label);
|
| // Check for undetectable objects => true.
|
| __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
|
| __ test_b(FieldOperand(input, Map::kBitFieldOffset),
|
| @@ -3729,8 +3738,7 @@
|
| final_branch_condition = not_zero;
|
|
|
| } else if (type_name->Equals(HEAP->function_symbol())) {
|
| - __ test(input, Immediate(kSmiTagMask));
|
| - __ j(zero, false_label);
|
| + __ JumpIfSmi(input, false_label);
|
| __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
|
| __ j(equal, true_label);
|
| // Regular expressions => 'function' (they are callable).
|
| @@ -3738,22 +3746,18 @@
|
| final_branch_condition = equal;
|
|
|
| } else if (type_name->Equals(HEAP->object_symbol())) {
|
| - __ test(input, Immediate(kSmiTagMask));
|
| - __ j(zero, false_label);
|
| + __ JumpIfSmi(input, false_label);
|
| __ cmp(input, FACTORY->null_value());
|
| __ j(equal, true_label);
|
| // Regular expressions => 'function', not 'object'.
|
| - __ CmpObjectType(input, JS_REGEXP_TYPE, input);
|
| - __ j(equal, false_label);
|
| + __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input);
|
| + __ j(below, false_label);
|
| + __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE);
|
| + __ j(above_equal, false_label);
|
| // Check for undetectable objects => false.
|
| __ test_b(FieldOperand(input, Map::kBitFieldOffset),
|
| 1 << Map::kIsUndetectable);
|
| - __ j(not_zero, false_label);
|
| - // Check for JS objects => true.
|
| - __ CmpInstanceType(input, FIRST_JS_OBJECT_TYPE);
|
| - __ j(below, false_label);
|
| - __ CmpInstanceType(input, LAST_JS_OBJECT_TYPE);
|
| - final_branch_condition = below_equal;
|
| + final_branch_condition = zero;
|
|
|
| } else {
|
| final_branch_condition = not_equal;
|
|
|