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

Side by Side Diff: src/mips/lithium-codegen-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/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.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 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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 Register object = ToRegister(instr->date()); 1726 Register object = ToRegister(instr->date());
1727 Register result = ToRegister(instr->result()); 1727 Register result = ToRegister(instr->result());
1728 Register scratch = ToRegister(instr->temp()); 1728 Register scratch = ToRegister(instr->temp());
1729 Smi* index = instr->index(); 1729 Smi* index = instr->index();
1730 Label runtime, done; 1730 Label runtime, done;
1731 ASSERT(object.is(a0)); 1731 ASSERT(object.is(a0));
1732 ASSERT(result.is(v0)); 1732 ASSERT(result.is(v0));
1733 ASSERT(!scratch.is(scratch0())); 1733 ASSERT(!scratch.is(scratch0()));
1734 ASSERT(!scratch.is(object)); 1734 ASSERT(!scratch.is(object));
1735 1735
1736 __ And(at, object, Operand(kSmiTagMask)); 1736 __ SmiTst(object, at);
1737 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); 1737 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
1738 __ GetObjectType(object, scratch, scratch); 1738 __ GetObjectType(object, scratch, scratch);
1739 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_DATE_TYPE)); 1739 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_DATE_TYPE));
1740 1740
1741 if (index->value() == 0) { 1741 if (index->value() == 0) {
1742 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset)); 1742 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset));
1743 } else { 1743 } else {
1744 if (index->value() < JSDate::kFirstUncachedField) { 1744 if (index->value() < JSDate::kFirstUncachedField) {
1745 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 1745 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1746 __ li(scratch, Operand(stamp)); 1746 __ li(scratch, Operand(stamp));
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 __ LoadRoot(at, Heap::kNullValueRootIndex); 2137 __ LoadRoot(at, Heap::kNullValueRootIndex);
2138 __ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(at)); 2138 __ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(at));
2139 } 2139 }
2140 2140
2141 if (expected.Contains(ToBooleanStub::SMI)) { 2141 if (expected.Contains(ToBooleanStub::SMI)) {
2142 // Smis: 0 -> false, all other -> true. 2142 // Smis: 0 -> false, all other -> true.
2143 __ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(zero_reg)); 2143 __ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(zero_reg));
2144 __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); 2144 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2145 } else if (expected.NeedsMap()) { 2145 } else if (expected.NeedsMap()) {
2146 // If we need a map later and have a Smi -> deopt. 2146 // If we need a map later and have a Smi -> deopt.
2147 __ And(at, reg, Operand(kSmiTagMask)); 2147 __ SmiTst(reg, at);
2148 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); 2148 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
2149 } 2149 }
2150 2150
2151 const Register map = scratch0(); 2151 const Register map = scratch0();
2152 if (expected.NeedsMap()) { 2152 if (expected.NeedsMap()) {
2153 __ lw(map, FieldMemOperand(reg, HeapObject::kMapOffset)); 2153 __ lw(map, FieldMemOperand(reg, HeapObject::kMapOffset));
2154 if (expected.CanBeUndetectable()) { 2154 if (expected.CanBeUndetectable()) {
2155 // Undetectable -> false. 2155 // Undetectable -> false.
2156 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); 2156 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset));
2157 __ And(at, at, Operand(1 << Map::kIsUndetectable)); 2157 __ And(at, at, Operand(1 << Map::kIsUndetectable));
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 __ sll(scratch, key, kPointerSizeLog2); 3230 __ sll(scratch, key, kPointerSizeLog2);
3231 __ addu(scratch, elements, scratch); 3231 __ addu(scratch, elements, scratch);
3232 } 3232 }
3233 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 3233 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
3234 } 3234 }
3235 __ lw(result, FieldMemOperand(store_base, offset)); 3235 __ lw(result, FieldMemOperand(store_base, offset));
3236 3236
3237 // Check for the hole value. 3237 // Check for the hole value.
3238 if (instr->hydrogen()->RequiresHoleCheck()) { 3238 if (instr->hydrogen()->RequiresHoleCheck()) {
3239 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { 3239 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
3240 __ And(scratch, result, Operand(kSmiTagMask)); 3240 __ SmiTst(result, scratch);
3241 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); 3241 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
3242 } else { 3242 } else {
3243 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); 3243 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
3244 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch)); 3244 DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
3245 } 3245 }
3246 } 3246 }
3247 } 3247 }
3248 3248
3249 3249
3250 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3250 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 __ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask)); 3379 __ And(scratch, scratch, Operand(strict_mode_function_mask | native_mask));
3380 __ Branch(&receiver_ok, ne, scratch, Operand(zero_reg)); 3380 __ Branch(&receiver_ok, ne, scratch, Operand(zero_reg));
3381 3381
3382 // Normal function. Replace undefined or null with global receiver. 3382 // Normal function. Replace undefined or null with global receiver.
3383 __ LoadRoot(scratch, Heap::kNullValueRootIndex); 3383 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
3384 __ Branch(&global_object, eq, receiver, Operand(scratch)); 3384 __ Branch(&global_object, eq, receiver, Operand(scratch));
3385 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 3385 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
3386 __ Branch(&global_object, eq, receiver, Operand(scratch)); 3386 __ Branch(&global_object, eq, receiver, Operand(scratch));
3387 3387
3388 // Deoptimize if the receiver is not a JS object. 3388 // Deoptimize if the receiver is not a JS object.
3389 __ And(scratch, receiver, Operand(kSmiTagMask)); 3389 __ SmiTst(receiver, scratch);
3390 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); 3390 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
3391 3391
3392 __ GetObjectType(receiver, scratch, scratch); 3392 __ GetObjectType(receiver, scratch, scratch);
3393 DeoptimizeIf(lt, instr->environment(), 3393 DeoptimizeIf(lt, instr->environment(),
3394 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); 3394 scratch, Operand(FIRST_SPEC_OBJECT_TYPE));
3395 __ Branch(&receiver_ok); 3395 __ Branch(&receiver_ok);
3396 3396
3397 __ bind(&global_object); 3397 __ bind(&global_object);
3398 __ lw(receiver, GlobalObjectOperand()); 3398 __ lw(receiver, GlobalObjectOperand());
3399 __ lw(receiver, 3399 __ lw(receiver,
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 MemOperand operand = MemOperand(object, offset); 4157 MemOperand operand = MemOperand(object, offset);
4158 __ Store(value, operand, representation); 4158 __ Store(value, operand, representation);
4159 return; 4159 return;
4160 } 4160 }
4161 4161
4162 Handle<Map> transition = instr->transition(); 4162 Handle<Map> transition = instr->transition();
4163 4163
4164 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 4164 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
4165 Register value = ToRegister(instr->value()); 4165 Register value = ToRegister(instr->value());
4166 if (!instr->hydrogen()->value()->type().IsHeapObject()) { 4166 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4167 __ And(scratch, value, Operand(kSmiTagMask)); 4167 __ SmiTst(value, scratch);
4168 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); 4168 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
4169 } 4169 }
4170 } else if (FLAG_track_double_fields && representation.IsDouble()) { 4170 } else if (FLAG_track_double_fields && representation.IsDouble()) {
4171 ASSERT(transition.is_null()); 4171 ASSERT(transition.is_null());
4172 ASSERT(access.IsInobject()); 4172 ASSERT(access.IsInobject());
4173 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 4173 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
4174 DoubleRegister value = ToDoubleRegister(instr->value()); 4174 DoubleRegister value = ToDoubleRegister(instr->value());
4175 __ sdc1(value, FieldMemOperand(object, offset)); 4175 __ sdc1(value, FieldMemOperand(object, offset));
4176 return; 4176 return;
4177 } 4177 }
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 __ bind(&done); 5152 __ bind(&done);
5153 } 5153 }
5154 } 5154 }
5155 __ SmiTagCheckOverflow(result_reg, result_reg, scratch1); 5155 __ SmiTagCheckOverflow(result_reg, result_reg, scratch1);
5156 DeoptimizeIf(lt, instr->environment(), scratch1, Operand(zero_reg)); 5156 DeoptimizeIf(lt, instr->environment(), scratch1, Operand(zero_reg));
5157 } 5157 }
5158 5158
5159 5159
5160 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { 5160 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
5161 LOperand* input = instr->value(); 5161 LOperand* input = instr->value();
5162 __ And(at, ToRegister(input), Operand(kSmiTagMask)); 5162 __ SmiTst(ToRegister(input), at);
5163 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg)); 5163 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
5164 } 5164 }
5165 5165
5166 5166
5167 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { 5167 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
5168 if (!instr->hydrogen()->value()->IsHeapObject()) { 5168 if (!instr->hydrogen()->value()->IsHeapObject()) {
5169 LOperand* input = instr->value(); 5169 LOperand* input = instr->value();
5170 __ And(at, ToRegister(input), Operand(kSmiTagMask)); 5170 __ SmiTst(ToRegister(input), at);
5171 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); 5171 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
5172 } 5172 }
5173 } 5173 }
5174 5174
5175 5175
5176 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { 5176 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
5177 Register input = ToRegister(instr->value()); 5177 Register input = ToRegister(instr->value());
5178 Register scratch = scratch0(); 5178 Register scratch = scratch0();
5179 5179
5180 __ GetObjectType(input, scratch, scratch); 5180 __ GetObjectType(input, scratch, scratch);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5233 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { 5233 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
5234 { 5234 {
5235 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 5235 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
5236 __ push(object); 5236 __ push(object);
5237 __ mov(cp, zero_reg); 5237 __ mov(cp, zero_reg);
5238 __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance); 5238 __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance);
5239 RecordSafepointWithRegisters( 5239 RecordSafepointWithRegisters(
5240 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); 5240 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
5241 __ StoreToSafepointRegisterSlot(v0, scratch0()); 5241 __ StoreToSafepointRegisterSlot(v0, scratch0());
5242 } 5242 }
5243 __ And(at, scratch0(), Operand(kSmiTagMask)); 5243 __ SmiTst(scratch0(), at);
5244 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); 5244 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg));
5245 } 5245 }
5246 5246
5247 5247
5248 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { 5248 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5249 class DeferredCheckMaps V8_FINAL : public LDeferredCode { 5249 class DeferredCheckMaps V8_FINAL : public LDeferredCode {
5250 public: 5250 public:
5251 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) 5251 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
5252 : LDeferredCode(codegen), instr_(instr), object_(object) { 5252 : LDeferredCode(codegen), instr_(instr), object_(object) {
5253 SetExit(check_maps()); 5253 SetExit(check_maps());
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
5914 __ Subu(scratch, result, scratch); 5914 __ Subu(scratch, result, scratch);
5915 __ lw(result, FieldMemOperand(scratch, 5915 __ lw(result, FieldMemOperand(scratch,
5916 FixedArray::kHeaderSize - kPointerSize)); 5916 FixedArray::kHeaderSize - kPointerSize));
5917 __ bind(&done); 5917 __ bind(&done);
5918 } 5918 }
5919 5919
5920 5920
5921 #undef __ 5921 #undef __
5922 5922
5923 } } // namespace v8::internal 5923 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698