Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

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

Issue 225823003: Implement handlified String::Equals and Name::Equals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored StringToDouble Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5697 matching lines...) Expand 10 before | Expand all | Expand 10 after
5708 CallRuntime(Runtime::kTypeof, 1, instr); 5708 CallRuntime(Runtime::kTypeof, 1, instr);
5709 } 5709 }
5710 5710
5711 5711
5712 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { 5712 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5713 Handle<String> type_name = instr->type_literal(); 5713 Handle<String> type_name = instr->type_literal();
5714 Label* true_label = instr->TrueLabel(chunk_); 5714 Label* true_label = instr->TrueLabel(chunk_);
5715 Label* false_label = instr->FalseLabel(chunk_); 5715 Label* false_label = instr->FalseLabel(chunk_);
5716 Register value = ToRegister(instr->value()); 5716 Register value = ToRegister(instr->value());
5717 5717
5718 if (type_name->Equals(heap()->number_string())) { 5718 Factory* factory = isolate()->factory();
5719 if (String::Equals(type_name, factory->number_string())) {
5719 ASSERT(instr->temp1() != NULL); 5720 ASSERT(instr->temp1() != NULL);
5720 Register map = ToRegister(instr->temp1()); 5721 Register map = ToRegister(instr->temp1());
5721 5722
5722 __ JumpIfSmi(value, true_label); 5723 __ JumpIfSmi(value, true_label);
5723 __ Ldr(map, FieldMemOperand(value, HeapObject::kMapOffset)); 5724 __ Ldr(map, FieldMemOperand(value, HeapObject::kMapOffset));
5724 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); 5725 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
5725 EmitBranch(instr, eq); 5726 EmitBranch(instr, eq);
5726 5727
5727 } else if (type_name->Equals(heap()->string_string())) { 5728 } else if (String::Equals(type_name, factory->string_string())) {
5728 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL)); 5729 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5729 Register map = ToRegister(instr->temp1()); 5730 Register map = ToRegister(instr->temp1());
5730 Register scratch = ToRegister(instr->temp2()); 5731 Register scratch = ToRegister(instr->temp2());
5731 5732
5732 __ JumpIfSmi(value, false_label); 5733 __ JumpIfSmi(value, false_label);
5733 __ JumpIfObjectType( 5734 __ JumpIfObjectType(
5734 value, map, scratch, FIRST_NONSTRING_TYPE, false_label, ge); 5735 value, map, scratch, FIRST_NONSTRING_TYPE, false_label, ge);
5735 __ Ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset)); 5736 __ Ldrb(scratch, FieldMemOperand(map, Map::kBitFieldOffset));
5736 EmitTestAndBranch(instr, eq, scratch, 1 << Map::kIsUndetectable); 5737 EmitTestAndBranch(instr, eq, scratch, 1 << Map::kIsUndetectable);
5737 5738
5738 } else if (type_name->Equals(heap()->symbol_string())) { 5739 } else if (String::Equals(type_name, factory->symbol_string())) {
5739 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL)); 5740 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5740 Register map = ToRegister(instr->temp1()); 5741 Register map = ToRegister(instr->temp1());
5741 Register scratch = ToRegister(instr->temp2()); 5742 Register scratch = ToRegister(instr->temp2());
5742 5743
5743 __ JumpIfSmi(value, false_label); 5744 __ JumpIfSmi(value, false_label);
5744 __ CompareObjectType(value, map, scratch, SYMBOL_TYPE); 5745 __ CompareObjectType(value, map, scratch, SYMBOL_TYPE);
5745 EmitBranch(instr, eq); 5746 EmitBranch(instr, eq);
5746 5747
5747 } else if (type_name->Equals(heap()->boolean_string())) { 5748 } else if (String::Equals(type_name, factory->boolean_string())) {
5748 __ JumpIfRoot(value, Heap::kTrueValueRootIndex, true_label); 5749 __ JumpIfRoot(value, Heap::kTrueValueRootIndex, true_label);
5749 __ CompareRoot(value, Heap::kFalseValueRootIndex); 5750 __ CompareRoot(value, Heap::kFalseValueRootIndex);
5750 EmitBranch(instr, eq); 5751 EmitBranch(instr, eq);
5751 5752
5752 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { 5753 } else if (FLAG_harmony_typeof &&
5754 String::Equals(type_name, factory->null_string())) {
5753 __ CompareRoot(value, Heap::kNullValueRootIndex); 5755 __ CompareRoot(value, Heap::kNullValueRootIndex);
5754 EmitBranch(instr, eq); 5756 EmitBranch(instr, eq);
5755 5757
5756 } else if (type_name->Equals(heap()->undefined_string())) { 5758 } else if (String::Equals(type_name, factory->undefined_string())) {
5757 ASSERT(instr->temp1() != NULL); 5759 ASSERT(instr->temp1() != NULL);
5758 Register scratch = ToRegister(instr->temp1()); 5760 Register scratch = ToRegister(instr->temp1());
5759 5761
5760 __ JumpIfRoot(value, Heap::kUndefinedValueRootIndex, true_label); 5762 __ JumpIfRoot(value, Heap::kUndefinedValueRootIndex, true_label);
5761 __ JumpIfSmi(value, false_label); 5763 __ JumpIfSmi(value, false_label);
5762 // Check for undetectable objects and jump to the true branch in this case. 5764 // Check for undetectable objects and jump to the true branch in this case.
5763 __ Ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); 5765 __ Ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
5764 __ Ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); 5766 __ Ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset));
5765 EmitTestAndBranch(instr, ne, scratch, 1 << Map::kIsUndetectable); 5767 EmitTestAndBranch(instr, ne, scratch, 1 << Map::kIsUndetectable);
5766 5768
5767 } else if (type_name->Equals(heap()->function_string())) { 5769 } else if (String::Equals(type_name, factory->function_string())) {
5768 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 5770 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
5769 ASSERT(instr->temp1() != NULL); 5771 ASSERT(instr->temp1() != NULL);
5770 Register type = ToRegister(instr->temp1()); 5772 Register type = ToRegister(instr->temp1());
5771 5773
5772 __ JumpIfSmi(value, false_label); 5774 __ JumpIfSmi(value, false_label);
5773 __ JumpIfObjectType(value, type, type, JS_FUNCTION_TYPE, true_label); 5775 __ JumpIfObjectType(value, type, type, JS_FUNCTION_TYPE, true_label);
5774 // HeapObject's type has been loaded into type register by JumpIfObjectType. 5776 // HeapObject's type has been loaded into type register by JumpIfObjectType.
5775 EmitCompareAndBranch(instr, eq, type, JS_FUNCTION_PROXY_TYPE); 5777 EmitCompareAndBranch(instr, eq, type, JS_FUNCTION_PROXY_TYPE);
5776 5778
5777 } else if (type_name->Equals(heap()->object_string())) { 5779 } else if (String::Equals(type_name, factory->object_string())) {
5778 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL)); 5780 ASSERT((instr->temp1() != NULL) && (instr->temp2() != NULL));
5779 Register map = ToRegister(instr->temp1()); 5781 Register map = ToRegister(instr->temp1());
5780 Register scratch = ToRegister(instr->temp2()); 5782 Register scratch = ToRegister(instr->temp2());
5781 5783
5782 __ JumpIfSmi(value, false_label); 5784 __ JumpIfSmi(value, false_label);
5783 if (!FLAG_harmony_typeof) { 5785 if (!FLAG_harmony_typeof) {
5784 __ JumpIfRoot(value, Heap::kNullValueRootIndex, true_label); 5786 __ JumpIfRoot(value, Heap::kNullValueRootIndex, true_label);
5785 } 5787 }
5786 __ JumpIfObjectType(value, map, scratch, 5788 __ JumpIfObjectType(value, map, scratch,
5787 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, false_label, lt); 5789 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, false_label, lt);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5925 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5927 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5926 // Index is equal to negated out of object property index plus 1. 5928 // Index is equal to negated out of object property index plus 1.
5927 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5929 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5928 __ Ldr(result, FieldMemOperand(result, 5930 __ Ldr(result, FieldMemOperand(result,
5929 FixedArray::kHeaderSize - kPointerSize)); 5931 FixedArray::kHeaderSize - kPointerSize));
5930 __ Bind(deferred->exit()); 5932 __ Bind(deferred->exit());
5931 __ Bind(&done); 5933 __ Bind(&done);
5932 } 5934 }
5933 5935
5934 } } // namespace v8::internal 5936 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698