Chromium Code Reviews

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 78583002: [v8-dev] ARM: Optimize TypeofIsAndBranch (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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 5579 matching lines...)
5590 5590
5591 5591
5592 Condition LCodeGen::EmitTypeofIs(Label* true_label, 5592 Condition LCodeGen::EmitTypeofIs(Label* true_label,
5593 Label* false_label, 5593 Label* false_label,
5594 Register input, 5594 Register input,
5595 Handle<String> type_name) { 5595 Handle<String> type_name) {
5596 Condition final_branch_condition = kNoCondition; 5596 Condition final_branch_condition = kNoCondition;
5597 Register scratch = scratch0(); 5597 Register scratch = scratch0();
5598 if (type_name->Equals(heap()->number_string())) { 5598 if (type_name->Equals(heap()->number_string())) {
5599 __ JumpIfSmi(input, true_label); 5599 __ JumpIfSmi(input, true_label);
5600 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); 5600 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
5601 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 5601 __ CompareRoot(scratch, Heap::kHeapNumberMapRootIndex);
5602 __ cmp(input, Operand(ip));
5603 final_branch_condition = eq; 5602 final_branch_condition = eq;
5604 5603
5605 } else if (type_name->Equals(heap()->string_string())) { 5604 } else if (type_name->Equals(heap()->string_string())) {
5606 __ JumpIfSmi(input, false_label); 5605 __ JumpIfSmi(input, false_label);
5607 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); 5606 __ CompareObjectType(input, scratch, no_reg, FIRST_NONSTRING_TYPE);
5608 __ b(ge, false_label); 5607 __ b(ge, false_label);
5609 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 5608 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
5610 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 5609 __ tst(scratch, Operand(1 << Map::kIsUndetectable));
5611 final_branch_condition = eq; 5610 final_branch_condition = eq;
5612 5611
5613 } else if (type_name->Equals(heap()->symbol_string())) { 5612 } else if (type_name->Equals(heap()->symbol_string())) {
5614 __ JumpIfSmi(input, false_label); 5613 __ JumpIfSmi(input, false_label);
5615 __ CompareObjectType(input, input, scratch, SYMBOL_TYPE); 5614 __ CompareObjectType(input, scratch, no_reg, SYMBOL_TYPE);
5616 final_branch_condition = eq; 5615 final_branch_condition = eq;
5617 5616
5618 } else if (type_name->Equals(heap()->boolean_string())) { 5617 } else if (type_name->Equals(heap()->boolean_string())) {
5619 __ CompareRoot(input, Heap::kTrueValueRootIndex); 5618 __ CompareRoot(input, Heap::kTrueValueRootIndex);
5620 __ b(eq, true_label); 5619 __ b(eq, true_label);
5621 __ CompareRoot(input, Heap::kFalseValueRootIndex); 5620 __ CompareRoot(input, Heap::kFalseValueRootIndex);
5622 final_branch_condition = eq; 5621 final_branch_condition = eq;
5623 5622
5624 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { 5623 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) {
5625 __ CompareRoot(input, Heap::kNullValueRootIndex); 5624 __ CompareRoot(input, Heap::kNullValueRootIndex);
5626 final_branch_condition = eq; 5625 final_branch_condition = eq;
5627 5626
5628 } else if (type_name->Equals(heap()->undefined_string())) { 5627 } else if (type_name->Equals(heap()->undefined_string())) {
5629 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 5628 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
5630 __ b(eq, true_label); 5629 __ b(eq, true_label);
5631 __ JumpIfSmi(input, false_label); 5630 __ JumpIfSmi(input, false_label);
5632 // Check for undetectable objects => true. 5631 // Check for undetectable objects => true.
5633 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); 5632 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
5634 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 5633 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
5635 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 5634 __ tst(scratch, Operand(1 << Map::kIsUndetectable));
5636 final_branch_condition = ne; 5635 final_branch_condition = ne;
5637 5636
5638 } else if (type_name->Equals(heap()->function_string())) { 5637 } else if (type_name->Equals(heap()->function_string())) {
5639 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 5638 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
5639 Register type_reg = scratch;
5640 __ JumpIfSmi(input, false_label); 5640 __ JumpIfSmi(input, false_label);
5641 __ CompareObjectType(input, scratch, input, JS_FUNCTION_TYPE); 5641 __ CompareObjectType(input, scratch, type_reg, JS_FUNCTION_TYPE);
5642 __ b(eq, true_label); 5642 __ b(eq, true_label);
5643 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); 5643 __ cmp(type_reg, Operand(JS_FUNCTION_PROXY_TYPE));
5644 final_branch_condition = eq; 5644 final_branch_condition = eq;
5645 5645
5646 } else if (type_name->Equals(heap()->object_string())) { 5646 } else if (type_name->Equals(heap()->object_string())) {
5647 __ JumpIfSmi(input, false_label); 5647 __ JumpIfSmi(input, false_label);
5648 if (!FLAG_harmony_typeof) { 5648 if (!FLAG_harmony_typeof) {
5649 __ CompareRoot(input, Heap::kNullValueRootIndex); 5649 __ CompareRoot(input, Heap::kNullValueRootIndex);
5650 __ b(eq, true_label); 5650 __ b(eq, true_label);
5651 } 5651 }
5652 __ CompareObjectType(input, input, scratch, 5652 __ CheckObjectTypeRange(input,
5653 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); 5653 scratch,
ulan 2013/11/22 15:43:46 Maybe name the scratch "map" similar to the "type_
5654 __ b(lt, false_label); 5654 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE,
5655 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 5655 LAST_NONCALLABLE_SPEC_OBJECT_TYPE,
5656 __ b(gt, false_label); 5656 false_label);
5657 // Check for undetectable objects => false. 5657 // Check for undetectable objects => false.
5658 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); 5658 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
5659 __ tst(ip, Operand(1 << Map::kIsUndetectable)); 5659 __ tst(scratch, Operand(1 << Map::kIsUndetectable));
5660 final_branch_condition = eq; 5660 final_branch_condition = eq;
5661 5661
5662 } else { 5662 } else {
5663 __ b(false_label); 5663 __ b(false_label);
5664 } 5664 }
5665 5665
5666 return final_branch_condition; 5666 return final_branch_condition;
5667 } 5667 }
5668 5668
5669 5669
(...skipping 248 matching lines...)
5918 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5918 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5919 __ ldr(result, FieldMemOperand(scratch, 5919 __ ldr(result, FieldMemOperand(scratch,
5920 FixedArray::kHeaderSize - kPointerSize)); 5920 FixedArray::kHeaderSize - kPointerSize));
5921 __ bind(&done); 5921 __ bind(&done);
5922 } 5922 }
5923 5923
5924 5924
5925 #undef __ 5925 #undef __
5926 5926
5927 } } // namespace v8::internal 5927 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine