OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5550 | 5550 |
5551 | 5551 |
5552 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 5552 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
5553 Label* false_label, | 5553 Label* false_label, |
5554 Register input, | 5554 Register input, |
5555 Handle<String> type_name) { | 5555 Handle<String> type_name) { |
5556 Condition final_branch_condition = kNoCondition; | 5556 Condition final_branch_condition = kNoCondition; |
5557 Register scratch = scratch0(); | 5557 Register scratch = scratch0(); |
5558 if (type_name->Equals(heap()->number_string())) { | 5558 if (type_name->Equals(heap()->number_string())) { |
5559 __ JumpIfSmi(input, true_label); | 5559 __ JumpIfSmi(input, true_label); |
5560 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 5560 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
5561 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 5561 __ CompareRoot(scratch, Heap::kHeapNumberMapRootIndex); |
5562 __ cmp(input, Operand(ip)); | |
5563 final_branch_condition = eq; | 5562 final_branch_condition = eq; |
5564 | 5563 |
5565 } else if (type_name->Equals(heap()->string_string())) { | 5564 } else if (type_name->Equals(heap()->string_string())) { |
5566 __ JumpIfSmi(input, false_label); | 5565 __ JumpIfSmi(input, false_label); |
5567 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); | 5566 __ CompareObjectType(input, scratch, no_reg, FIRST_NONSTRING_TYPE); |
5568 __ b(ge, false_label); | 5567 __ b(ge, false_label); |
5569 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 5568 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); |
5570 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 5569 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); |
5571 final_branch_condition = eq; | 5570 final_branch_condition = eq; |
5572 | 5571 |
5573 } else if (type_name->Equals(heap()->symbol_string())) { | 5572 } else if (type_name->Equals(heap()->symbol_string())) { |
5574 __ JumpIfSmi(input, false_label); | 5573 __ JumpIfSmi(input, false_label); |
5575 __ CompareObjectType(input, input, scratch, SYMBOL_TYPE); | 5574 __ CompareObjectType(input, scratch, no_reg, SYMBOL_TYPE); |
5576 final_branch_condition = eq; | 5575 final_branch_condition = eq; |
5577 | 5576 |
5578 } else if (type_name->Equals(heap()->boolean_string())) { | 5577 } else if (type_name->Equals(heap()->boolean_string())) { |
5579 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 5578 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
5580 __ b(eq, true_label); | 5579 __ b(eq, true_label); |
5581 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 5580 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
5582 final_branch_condition = eq; | 5581 final_branch_condition = eq; |
5583 | 5582 |
5584 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { | 5583 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
5585 __ CompareRoot(input, Heap::kNullValueRootIndex); | 5584 __ CompareRoot(input, Heap::kNullValueRootIndex); |
5586 final_branch_condition = eq; | 5585 final_branch_condition = eq; |
5587 | 5586 |
5588 } else if (type_name->Equals(heap()->undefined_string())) { | 5587 } else if (type_name->Equals(heap()->undefined_string())) { |
5589 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); | 5588 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
5590 __ b(eq, true_label); | 5589 __ b(eq, true_label); |
5591 __ JumpIfSmi(input, false_label); | 5590 __ JumpIfSmi(input, false_label); |
5592 // Check for undetectable objects => true. | 5591 // Check for undetectable objects => true. |
5593 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 5592 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
5594 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 5593 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); |
5595 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 5594 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); |
5596 final_branch_condition = ne; | 5595 final_branch_condition = ne; |
5597 | 5596 |
5598 } else if (type_name->Equals(heap()->function_string())) { | 5597 } else if (type_name->Equals(heap()->function_string())) { |
5599 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 5598 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 5599 Register type_reg = scratch; |
5600 __ JumpIfSmi(input, false_label); | 5600 __ JumpIfSmi(input, false_label); |
5601 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE); | 5601 __ CompareObjectType(input, scratch, type_reg, JS_FUNCTION_TYPE); |
5602 __ b(eq, true_label); | 5602 __ b(eq, true_label); |
5603 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); | 5603 __ cmp(type_reg, Operand(JS_FUNCTION_PROXY_TYPE)); |
5604 final_branch_condition = eq; | 5604 final_branch_condition = eq; |
5605 | 5605 |
5606 } else if (type_name->Equals(heap()->object_string())) { | 5606 } else if (type_name->Equals(heap()->object_string())) { |
| 5607 Register map = scratch; |
5607 __ JumpIfSmi(input, false_label); | 5608 __ JumpIfSmi(input, false_label); |
5608 if (!FLAG_harmony_typeof) { | 5609 if (!FLAG_harmony_typeof) { |
5609 __ CompareRoot(input, Heap::kNullValueRootIndex); | 5610 __ CompareRoot(input, Heap::kNullValueRootIndex); |
5610 __ b(eq, true_label); | 5611 __ b(eq, true_label); |
5611 } | 5612 } |
5612 __ CompareObjectType(input, input, scratch, | 5613 __ CheckObjectTypeRange(input, |
5613 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5614 map, |
5614 __ b(lt, false_label); | 5615 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, |
5615 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5616 LAST_NONCALLABLE_SPEC_OBJECT_TYPE, |
5616 __ b(gt, false_label); | 5617 false_label); |
5617 // Check for undetectable objects => false. | 5618 // Check for undetectable objects => false. |
5618 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 5619 __ ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); |
5619 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 5620 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); |
5620 final_branch_condition = eq; | 5621 final_branch_condition = eq; |
5621 | 5622 |
5622 } else { | 5623 } else { |
5623 __ b(false_label); | 5624 __ b(false_label); |
5624 } | 5625 } |
5625 | 5626 |
5626 return final_branch_condition; | 5627 return final_branch_condition; |
5627 } | 5628 } |
5628 | 5629 |
5629 | 5630 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5878 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5879 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5879 __ ldr(result, FieldMemOperand(scratch, | 5880 __ ldr(result, FieldMemOperand(scratch, |
5880 FixedArray::kHeaderSize - kPointerSize)); | 5881 FixedArray::kHeaderSize - kPointerSize)); |
5881 __ bind(&done); | 5882 __ bind(&done); |
5882 } | 5883 } |
5883 | 5884 |
5884 | 5885 |
5885 #undef __ | 5886 #undef __ |
5886 | 5887 |
5887 } } // namespace v8::internal | 5888 } } // namespace v8::internal |
OLD | NEW |