OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4496 SmiCheckType smi_check_type) { | 4496 SmiCheckType smi_check_type) { |
4497 if (smi_check_type == DO_SMI_CHECK) { | 4497 if (smi_check_type == DO_SMI_CHECK) { |
4498 JumpIfSmi(obj, fail); | 4498 JumpIfSmi(obj, fail); |
4499 } | 4499 } |
4500 Label success; | 4500 Label success; |
4501 CompareMapAndBranch(obj, scratch, map, &success, ne, fail); | 4501 CompareMapAndBranch(obj, scratch, map, &success, ne, fail); |
4502 bind(&success); | 4502 bind(&success); |
4503 } | 4503 } |
4504 | 4504 |
4505 | 4505 |
4506 void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, | |
4507 Register scratch2, Handle<WeakCell> cell, | |
4508 Handle<Code> success, | |
4509 SmiCheckType smi_check_type) { | |
4510 Label fail; | |
4511 if (smi_check_type == DO_SMI_CHECK) { | |
4512 JumpIfSmi(obj, &fail); | |
4513 } | |
4514 ld(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); | |
4515 GetWeakValue(scratch2, cell); | |
4516 Jump(success, RelocInfo::CODE_TARGET, eq, scratch1, Operand(scratch2)); | |
4517 bind(&fail); | |
4518 } | |
4519 | |
4520 | |
4521 void MacroAssembler::CheckMap(Register obj, | 4506 void MacroAssembler::CheckMap(Register obj, |
4522 Register scratch, | 4507 Register scratch, |
4523 Heap::RootListIndex index, | 4508 Heap::RootListIndex index, |
4524 Label* fail, | 4509 Label* fail, |
4525 SmiCheckType smi_check_type) { | 4510 SmiCheckType smi_check_type) { |
4526 if (smi_check_type == DO_SMI_CHECK) { | 4511 if (smi_check_type == DO_SMI_CHECK) { |
4527 JumpIfSmi(obj, fail); | 4512 JumpIfSmi(obj, fail); |
4528 } | 4513 } |
4529 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 4514 ld(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
4530 LoadRoot(at, index); | 4515 LoadRoot(at, index); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4895 Label* fail) { | 4880 Label* fail) { |
4896 DCHECK(kNotStringTag != 0); | 4881 DCHECK(kNotStringTag != 0); |
4897 | 4882 |
4898 ld(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 4883 ld(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
4899 lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 4884 lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
4900 And(scratch, scratch, Operand(kIsNotStringMask)); | 4885 And(scratch, scratch, Operand(kIsNotStringMask)); |
4901 Branch(fail, ne, scratch, Operand(zero_reg)); | 4886 Branch(fail, ne, scratch, Operand(zero_reg)); |
4902 } | 4887 } |
4903 | 4888 |
4904 | 4889 |
4905 void MacroAssembler::IsObjectNameType(Register object, | |
4906 Register scratch, | |
4907 Label* fail) { | |
4908 ld(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | |
4909 lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
4910 Branch(fail, hi, scratch, Operand(LAST_NAME_TYPE)); | |
4911 } | |
4912 | |
4913 | |
4914 // --------------------------------------------------------------------------- | 4890 // --------------------------------------------------------------------------- |
4915 // Support functions. | 4891 // Support functions. |
4916 | 4892 |
4917 | 4893 |
4918 void MacroAssembler::GetObjectType(Register object, | 4894 void MacroAssembler::GetObjectType(Register object, |
4919 Register map, | 4895 Register map, |
4920 Register type_reg) { | 4896 Register type_reg) { |
4921 ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 4897 ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
4922 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 4898 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
4923 } | 4899 } |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5494 // ----------------------------------------------------------------------------- | 5470 // ----------------------------------------------------------------------------- |
5495 // Debugging. | 5471 // Debugging. |
5496 | 5472 |
5497 void MacroAssembler::Assert(Condition cc, BailoutReason reason, | 5473 void MacroAssembler::Assert(Condition cc, BailoutReason reason, |
5498 Register rs, Operand rt) { | 5474 Register rs, Operand rt) { |
5499 if (emit_debug_code()) | 5475 if (emit_debug_code()) |
5500 Check(cc, reason, rs, rt); | 5476 Check(cc, reason, rs, rt); |
5501 } | 5477 } |
5502 | 5478 |
5503 | 5479 |
5504 void MacroAssembler::AssertFastElements(Register elements) { | |
5505 if (emit_debug_code()) { | |
5506 DCHECK(!elements.is(at)); | |
5507 Label ok; | |
5508 push(elements); | |
5509 ld(elements, FieldMemOperand(elements, HeapObject::kMapOffset)); | |
5510 LoadRoot(at, Heap::kFixedArrayMapRootIndex); | |
5511 Branch(&ok, eq, elements, Operand(at)); | |
5512 LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex); | |
5513 Branch(&ok, eq, elements, Operand(at)); | |
5514 LoadRoot(at, Heap::kFixedCOWArrayMapRootIndex); | |
5515 Branch(&ok, eq, elements, Operand(at)); | |
5516 Abort(kJSObjectWithFastElementsMapHasSlowElements); | |
5517 bind(&ok); | |
5518 pop(elements); | |
5519 } | |
5520 } | |
5521 | |
5522 | 5480 |
5523 void MacroAssembler::Check(Condition cc, BailoutReason reason, | 5481 void MacroAssembler::Check(Condition cc, BailoutReason reason, |
5524 Register rs, Operand rt) { | 5482 Register rs, Operand rt) { |
5525 Label L; | 5483 Label L; |
5526 Branch(&L, cc, rs, rt); | 5484 Branch(&L, cc, rs, rt); |
5527 Abort(reason); | 5485 Abort(reason); |
5528 // Will not return here. | 5486 // Will not return here. |
5529 bind(&L); | 5487 bind(&L); |
5530 } | 5488 } |
5531 | 5489 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6006 #if defined(__APPLE__) | 5964 #if defined(__APPLE__) |
6007 DCHECK_EQ(1, kSmiTagMask); | 5965 DCHECK_EQ(1, kSmiTagMask); |
6008 #else | 5966 #else |
6009 DCHECK_EQ((int64_t)1, kSmiTagMask); | 5967 DCHECK_EQ((int64_t)1, kSmiTagMask); |
6010 #endif | 5968 #endif |
6011 // Both Smi tags must be 1 (not Smi). | 5969 // Both Smi tags must be 1 (not Smi). |
6012 and_(at, reg1, reg2); | 5970 and_(at, reg1, reg2); |
6013 JumpIfSmi(at, on_either_smi); | 5971 JumpIfSmi(at, on_either_smi); |
6014 } | 5972 } |
6015 | 5973 |
6016 void MacroAssembler::AssertNotNumber(Register object) { | |
6017 if (emit_debug_code()) { | |
6018 STATIC_ASSERT(kSmiTag == 0); | |
6019 andi(at, object, kSmiTagMask); | |
6020 Check(ne, kOperandIsANumber, at, Operand(zero_reg)); | |
6021 GetObjectType(object, t8, t8); | |
6022 Check(ne, kOperandIsNotANumber, t8, Operand(HEAP_NUMBER_TYPE)); | |
6023 } | |
6024 } | |
6025 | |
6026 void MacroAssembler::AssertNotSmi(Register object) { | 5974 void MacroAssembler::AssertNotSmi(Register object) { |
6027 if (emit_debug_code()) { | 5975 if (emit_debug_code()) { |
6028 STATIC_ASSERT(kSmiTag == 0); | 5976 STATIC_ASSERT(kSmiTag == 0); |
6029 andi(at, object, kSmiTagMask); | 5977 andi(at, object, kSmiTagMask); |
6030 Check(ne, kOperandIsASmi, at, Operand(zero_reg)); | 5978 Check(ne, kOperandIsASmi, at, Operand(zero_reg)); |
6031 } | 5979 } |
6032 } | 5980 } |
6033 | 5981 |
6034 | 5982 |
6035 void MacroAssembler::AssertSmi(Register object) { | 5983 void MacroAssembler::AssertSmi(Register object) { |
6036 if (emit_debug_code()) { | 5984 if (emit_debug_code()) { |
6037 STATIC_ASSERT(kSmiTag == 0); | 5985 STATIC_ASSERT(kSmiTag == 0); |
6038 andi(at, object, kSmiTagMask); | 5986 andi(at, object, kSmiTagMask); |
6039 Check(eq, kOperandIsASmi, at, Operand(zero_reg)); | 5987 Check(eq, kOperandIsASmi, at, Operand(zero_reg)); |
6040 } | 5988 } |
6041 } | 5989 } |
6042 | 5990 |
6043 | 5991 |
6044 void MacroAssembler::AssertString(Register object) { | |
6045 if (emit_debug_code()) { | |
6046 STATIC_ASSERT(kSmiTag == 0); | |
6047 SmiTst(object, t8); | |
6048 Check(ne, kOperandIsASmiAndNotAString, t8, Operand(zero_reg)); | |
6049 GetObjectType(object, t8, t8); | |
6050 Check(lo, kOperandIsNotAString, t8, Operand(FIRST_NONSTRING_TYPE)); | |
6051 } | |
6052 } | |
6053 | |
6054 | |
6055 void MacroAssembler::AssertName(Register object) { | |
6056 if (emit_debug_code()) { | |
6057 STATIC_ASSERT(kSmiTag == 0); | |
6058 SmiTst(object, t8); | |
6059 Check(ne, kOperandIsASmiAndNotAName, t8, Operand(zero_reg)); | |
6060 GetObjectType(object, t8, t8); | |
6061 Check(le, kOperandIsNotAName, t8, Operand(LAST_NAME_TYPE)); | |
6062 } | |
6063 } | |
6064 | |
6065 | |
6066 void MacroAssembler::AssertFunction(Register object) { | 5992 void MacroAssembler::AssertFunction(Register object) { |
6067 if (emit_debug_code()) { | 5993 if (emit_debug_code()) { |
6068 STATIC_ASSERT(kSmiTag == 0); | 5994 STATIC_ASSERT(kSmiTag == 0); |
6069 SmiTst(object, t8); | 5995 SmiTst(object, t8); |
6070 Check(ne, kOperandIsASmiAndNotAFunction, t8, Operand(zero_reg)); | 5996 Check(ne, kOperandIsASmiAndNotAFunction, t8, Operand(zero_reg)); |
6071 GetObjectType(object, t8, t8); | 5997 GetObjectType(object, t8, t8); |
6072 Check(eq, kOperandIsNotAFunction, t8, Operand(JS_FUNCTION_TYPE)); | 5998 Check(eq, kOperandIsNotAFunction, t8, Operand(JS_FUNCTION_TYPE)); |
6073 } | 5999 } |
6074 } | 6000 } |
6075 | 6001 |
(...skipping 12 matching lines...) Expand all Loading... |
6088 if (emit_debug_code()) { | 6014 if (emit_debug_code()) { |
6089 STATIC_ASSERT(kSmiTag == 0); | 6015 STATIC_ASSERT(kSmiTag == 0); |
6090 SmiTst(object, t8); | 6016 SmiTst(object, t8); |
6091 Check(ne, kOperandIsASmiAndNotAGeneratorObject, t8, Operand(zero_reg)); | 6017 Check(ne, kOperandIsASmiAndNotAGeneratorObject, t8, Operand(zero_reg)); |
6092 GetObjectType(object, t8, t8); | 6018 GetObjectType(object, t8, t8); |
6093 Check(eq, kOperandIsNotAGeneratorObject, t8, | 6019 Check(eq, kOperandIsNotAGeneratorObject, t8, |
6094 Operand(JS_GENERATOR_OBJECT_TYPE)); | 6020 Operand(JS_GENERATOR_OBJECT_TYPE)); |
6095 } | 6021 } |
6096 } | 6022 } |
6097 | 6023 |
6098 void MacroAssembler::AssertReceiver(Register object) { | |
6099 if (emit_debug_code()) { | |
6100 STATIC_ASSERT(kSmiTag == 0); | |
6101 SmiTst(object, t8); | |
6102 Check(ne, kOperandIsASmiAndNotAReceiver, t8, Operand(zero_reg)); | |
6103 GetObjectType(object, t8, t8); | |
6104 Check(ge, kOperandIsNotAReceiver, t8, Operand(FIRST_JS_RECEIVER_TYPE)); | |
6105 } | |
6106 } | |
6107 | |
6108 | 6024 |
6109 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, | 6025 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, |
6110 Register scratch) { | 6026 Register scratch) { |
6111 if (emit_debug_code()) { | 6027 if (emit_debug_code()) { |
6112 Label done_checking; | 6028 Label done_checking; |
6113 AssertNotSmi(object); | 6029 AssertNotSmi(object); |
6114 LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 6030 LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
6115 Branch(&done_checking, eq, object, Operand(scratch)); | 6031 Branch(&done_checking, eq, object, Operand(scratch)); |
6116 ld(t8, FieldMemOperand(object, HeapObject::kMapOffset)); | 6032 ld(t8, FieldMemOperand(object, HeapObject::kMapOffset)); |
6117 LoadRoot(scratch, Heap::kAllocationSiteMapRootIndex); | 6033 LoadRoot(scratch, Heap::kAllocationSiteMapRootIndex); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6877 if (mag.shift > 0) sra(result, result, mag.shift); | 6793 if (mag.shift > 0) sra(result, result, mag.shift); |
6878 srl(at, dividend, 31); | 6794 srl(at, dividend, 31); |
6879 Addu(result, result, Operand(at)); | 6795 Addu(result, result, Operand(at)); |
6880 } | 6796 } |
6881 | 6797 |
6882 | 6798 |
6883 } // namespace internal | 6799 } // namespace internal |
6884 } // namespace v8 | 6800 } // namespace v8 |
6885 | 6801 |
6886 #endif // V8_TARGET_ARCH_MIPS64 | 6802 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |