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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 78403002: MIPS: Use SmiTst and TrySmiTag MacroAssembler instructions. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('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 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 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 STATIC_ASSERT(kSmiTag == 0); 4836 STATIC_ASSERT(kSmiTag == 0);
4837 andi(at, object, kSmiTagMask); 4837 andi(at, object, kSmiTagMask);
4838 Check(eq, kOperandIsASmi, at, Operand(zero_reg)); 4838 Check(eq, kOperandIsASmi, at, Operand(zero_reg));
4839 } 4839 }
4840 } 4840 }
4841 4841
4842 4842
4843 void MacroAssembler::AssertString(Register object) { 4843 void MacroAssembler::AssertString(Register object) {
4844 if (emit_debug_code()) { 4844 if (emit_debug_code()) {
4845 STATIC_ASSERT(kSmiTag == 0); 4845 STATIC_ASSERT(kSmiTag == 0);
4846 And(t0, object, Operand(kSmiTagMask)); 4846 SmiTst(object, t0);
4847 Check(ne, kOperandIsASmiAndNotAString, t0, Operand(zero_reg)); 4847 Check(ne, kOperandIsASmiAndNotAString, t0, Operand(zero_reg));
4848 push(object); 4848 push(object);
4849 lw(object, FieldMemOperand(object, HeapObject::kMapOffset)); 4849 lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
4850 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset)); 4850 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
4851 Check(lo, kOperandIsNotAString, object, Operand(FIRST_NONSTRING_TYPE)); 4851 Check(lo, kOperandIsNotAString, object, Operand(FIRST_NONSTRING_TYPE));
4852 pop(object); 4852 pop(object);
4853 } 4853 }
4854 } 4854 }
4855 4855
4856 4856
4857 void MacroAssembler::AssertName(Register object) { 4857 void MacroAssembler::AssertName(Register object) {
4858 if (emit_debug_code()) { 4858 if (emit_debug_code()) {
4859 STATIC_ASSERT(kSmiTag == 0); 4859 STATIC_ASSERT(kSmiTag == 0);
4860 And(t0, object, Operand(kSmiTagMask)); 4860 SmiTst(object, t0);
4861 Check(ne, kOperandIsASmiAndNotAName, t0, Operand(zero_reg)); 4861 Check(ne, kOperandIsASmiAndNotAName, t0, Operand(zero_reg));
4862 push(object); 4862 push(object);
4863 lw(object, FieldMemOperand(object, HeapObject::kMapOffset)); 4863 lw(object, FieldMemOperand(object, HeapObject::kMapOffset));
4864 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset)); 4864 lbu(object, FieldMemOperand(object, Map::kInstanceTypeOffset));
4865 Check(le, kOperandIsNotAName, object, Operand(LAST_NAME_TYPE)); 4865 Check(le, kOperandIsNotAName, object, Operand(LAST_NAME_TYPE));
4866 pop(object); 4866 pop(object);
4867 } 4867 }
4868 } 4868 }
4869 4869
4870 4870
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 return stack_passed_words; 5050 return stack_passed_words;
5051 } 5051 }
5052 5052
5053 5053
5054 void MacroAssembler::EmitSeqStringSetCharCheck(Register string, 5054 void MacroAssembler::EmitSeqStringSetCharCheck(Register string,
5055 Register index, 5055 Register index,
5056 Register value, 5056 Register value,
5057 Register scratch, 5057 Register scratch,
5058 uint32_t encoding_mask) { 5058 uint32_t encoding_mask) {
5059 Label is_object; 5059 Label is_object;
5060 And(at, string, Operand(kSmiTagMask)); 5060 SmiTst(string, at);
5061 ThrowIf(eq, kNonObject, at, Operand(zero_reg)); 5061 ThrowIf(eq, kNonObject, at, Operand(zero_reg));
5062 5062
5063 lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); 5063 lw(at, FieldMemOperand(string, HeapObject::kMapOffset));
5064 lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); 5064 lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset));
5065 5065
5066 andi(at, at, kStringRepresentationMask | kStringEncodingMask); 5066 andi(at, at, kStringRepresentationMask | kStringEncodingMask);
5067 li(scratch, Operand(encoding_mask)); 5067 li(scratch, Operand(encoding_mask));
5068 ThrowIf(ne, kUnexpectedStringType, at, Operand(scratch)); 5068 ThrowIf(ne, kUnexpectedStringType, at, Operand(scratch));
5069 5069
5070 // The index is assumed to be untagged coming in, tag it to compare with the 5070 // The index is assumed to be untagged coming in, tag it to compare with the
5071 // string length without using a temp register, it is restored at the end of 5071 // string length without using a temp register, it is restored at the end of
5072 // this function. 5072 // this function.
5073 Label index_tag_ok, index_tag_bad; 5073 Label index_tag_ok, index_tag_bad;
5074 // On ARM TrySmiTag is used here. 5074 TrySmiTag(index, scratch, &index_tag_bad);
5075 AdduAndCheckForOverflow(index, index, index, scratch);
5076 BranchOnOverflow(&index_tag_bad, scratch);
5077 Branch(&index_tag_ok); 5075 Branch(&index_tag_ok);
5078 bind(&index_tag_bad); 5076 bind(&index_tag_bad);
5079 Throw(kIndexIsTooLarge); 5077 Throw(kIndexIsTooLarge);
5080 bind(&index_tag_ok); 5078 bind(&index_tag_ok);
5081 5079
5082 lw(at, FieldMemOperand(string, String::kLengthOffset)); 5080 lw(at, FieldMemOperand(string, String::kLengthOffset));
5083 ThrowIf(ge, kIndexIsTooLarge, index, Operand(at)); 5081 ThrowIf(ge, kIndexIsTooLarge, index, Operand(at));
5084 5082
5085 li(at, Operand(Smi::FromInt(0))); 5083 li(at, Operand(Smi::FromInt(0)));
5086 ThrowIf(lt, kIndexIsNegative, index, Operand(at)); 5084 ThrowIf(lt, kIndexIsNegative, index, Operand(at));
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5749 opcode == BGTZL); 5747 opcode == BGTZL);
5750 opcode = (cond == eq) ? BEQ : BNE; 5748 opcode = (cond == eq) ? BEQ : BNE;
5751 instr = (instr & ~kOpcodeMask) | opcode; 5749 instr = (instr & ~kOpcodeMask) | opcode;
5752 masm_.emit(instr); 5750 masm_.emit(instr);
5753 } 5751 }
5754 5752
5755 5753
5756 } } // namespace v8::internal 5754 } } // namespace v8::internal
5757 5755
5758 #endif // V8_TARGET_ARCH_MIPS 5756 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698