| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4147 } else { | 4147 } else { |
| 4148 Addu(result_end, result, Operand(object_size)); | 4148 Addu(result_end, result, Operand(object_size)); |
| 4149 } | 4149 } |
| 4150 | 4150 |
| 4151 // The top pointer is not updated for allocation folding dominators. | 4151 // The top pointer is not updated for allocation folding dominators. |
| 4152 sw(result_end, MemOperand(top_address)); | 4152 sw(result_end, MemOperand(top_address)); |
| 4153 | 4153 |
| 4154 Addu(result, result, Operand(kHeapObjectTag)); | 4154 Addu(result, result, Operand(kHeapObjectTag)); |
| 4155 } | 4155 } |
| 4156 | 4156 |
| 4157 void MacroAssembler::AllocateTwoByteString(Register result, | |
| 4158 Register length, | |
| 4159 Register scratch1, | |
| 4160 Register scratch2, | |
| 4161 Register scratch3, | |
| 4162 Label* gc_required) { | |
| 4163 // Calculate the number of bytes needed for the characters in the string while | |
| 4164 // observing object alignment. | |
| 4165 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
| 4166 sll(scratch1, length, 1); // Length in bytes, not chars. | |
| 4167 addiu(scratch1, scratch1, | |
| 4168 kObjectAlignmentMask + SeqTwoByteString::kHeaderSize); | |
| 4169 And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
| 4170 | |
| 4171 // Allocate two-byte string in new space. | |
| 4172 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
| 4173 NO_ALLOCATION_FLAGS); | |
| 4174 | |
| 4175 // Set the map, length and hash field. | |
| 4176 InitializeNewString(result, | |
| 4177 length, | |
| 4178 Heap::kStringMapRootIndex, | |
| 4179 scratch1, | |
| 4180 scratch2); | |
| 4181 } | |
| 4182 | |
| 4183 | |
| 4184 void MacroAssembler::AllocateOneByteString(Register result, Register length, | |
| 4185 Register scratch1, Register scratch2, | |
| 4186 Register scratch3, | |
| 4187 Label* gc_required) { | |
| 4188 // Calculate the number of bytes needed for the characters in the string | |
| 4189 // while observing object alignment. | |
| 4190 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
| 4191 DCHECK(kCharSize == 1); | |
| 4192 addiu(scratch1, length, kObjectAlignmentMask + SeqOneByteString::kHeaderSize); | |
| 4193 And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
| 4194 | |
| 4195 // Allocate one-byte string in new space. | |
| 4196 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
| 4197 NO_ALLOCATION_FLAGS); | |
| 4198 | |
| 4199 // Set the map, length and hash field. | |
| 4200 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, | |
| 4201 scratch1, scratch2); | |
| 4202 } | |
| 4203 | |
| 4204 | |
| 4205 void MacroAssembler::AllocateTwoByteConsString(Register result, | |
| 4206 Register length, | |
| 4207 Register scratch1, | |
| 4208 Register scratch2, | |
| 4209 Label* gc_required) { | |
| 4210 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
| 4211 NO_ALLOCATION_FLAGS); | |
| 4212 InitializeNewString(result, | |
| 4213 length, | |
| 4214 Heap::kConsStringMapRootIndex, | |
| 4215 scratch1, | |
| 4216 scratch2); | |
| 4217 } | |
| 4218 | |
| 4219 | |
| 4220 void MacroAssembler::AllocateOneByteConsString(Register result, Register length, | |
| 4221 Register scratch1, | |
| 4222 Register scratch2, | |
| 4223 Label* gc_required) { | |
| 4224 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
| 4225 NO_ALLOCATION_FLAGS); | |
| 4226 | |
| 4227 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, | |
| 4228 scratch1, scratch2); | |
| 4229 } | |
| 4230 | |
| 4231 | |
| 4232 void MacroAssembler::AllocateTwoByteSlicedString(Register result, | |
| 4233 Register length, | |
| 4234 Register scratch1, | |
| 4235 Register scratch2, | |
| 4236 Label* gc_required) { | |
| 4237 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
| 4238 NO_ALLOCATION_FLAGS); | |
| 4239 | |
| 4240 InitializeNewString(result, | |
| 4241 length, | |
| 4242 Heap::kSlicedStringMapRootIndex, | |
| 4243 scratch1, | |
| 4244 scratch2); | |
| 4245 } | |
| 4246 | |
| 4247 | |
| 4248 void MacroAssembler::AllocateOneByteSlicedString(Register result, | |
| 4249 Register length, | |
| 4250 Register scratch1, | |
| 4251 Register scratch2, | |
| 4252 Label* gc_required) { | |
| 4253 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
| 4254 NO_ALLOCATION_FLAGS); | |
| 4255 | |
| 4256 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, | |
| 4257 scratch1, scratch2); | |
| 4258 } | |
| 4259 | |
| 4260 | |
| 4261 void MacroAssembler::JumpIfNotUniqueNameInstanceType(Register reg, | 4157 void MacroAssembler::JumpIfNotUniqueNameInstanceType(Register reg, |
| 4262 Label* not_unique_name) { | 4158 Label* not_unique_name) { |
| 4263 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 4159 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
| 4264 Label succeed; | 4160 Label succeed; |
| 4265 And(at, reg, Operand(kIsNotStringMask | kIsNotInternalizedMask)); | 4161 And(at, reg, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
| 4266 Branch(&succeed, eq, at, Operand(zero_reg)); | 4162 Branch(&succeed, eq, at, Operand(zero_reg)); |
| 4267 Branch(not_unique_name, ne, reg, Operand(SYMBOL_TYPE)); | 4163 Branch(not_unique_name, ne, reg, Operand(SYMBOL_TYPE)); |
| 4268 | 4164 |
| 4269 bind(&succeed); | 4165 bind(&succeed); |
| 4270 } | 4166 } |
| (...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6058 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 5954 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 6059 const int kFlatOneByteStringTag = | 5955 const int kFlatOneByteStringTag = |
| 6060 kStringTag | kOneByteStringTag | kSeqStringTag; | 5956 kStringTag | kOneByteStringTag | kSeqStringTag; |
| 6061 DCHECK(kFlatOneByteStringTag <= 0xffff); // Ensure this fits 16-bit immed. | 5957 DCHECK(kFlatOneByteStringTag <= 0xffff); // Ensure this fits 16-bit immed. |
| 6062 andi(scratch1, first, kFlatOneByteStringMask); | 5958 andi(scratch1, first, kFlatOneByteStringMask); |
| 6063 Branch(failure, ne, scratch1, Operand(kFlatOneByteStringTag)); | 5959 Branch(failure, ne, scratch1, Operand(kFlatOneByteStringTag)); |
| 6064 andi(scratch2, second, kFlatOneByteStringMask); | 5960 andi(scratch2, second, kFlatOneByteStringMask); |
| 6065 Branch(failure, ne, scratch2, Operand(kFlatOneByteStringTag)); | 5961 Branch(failure, ne, scratch2, Operand(kFlatOneByteStringTag)); |
| 6066 } | 5962 } |
| 6067 | 5963 |
| 6068 | |
| 6069 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(Register type, | |
| 6070 Register scratch, | |
| 6071 Label* failure) { | |
| 6072 const int kFlatOneByteStringMask = | |
| 6073 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | |
| 6074 const int kFlatOneByteStringTag = | |
| 6075 kStringTag | kOneByteStringTag | kSeqStringTag; | |
| 6076 And(scratch, type, Operand(kFlatOneByteStringMask)); | |
| 6077 Branch(failure, ne, scratch, Operand(kFlatOneByteStringTag)); | |
| 6078 } | |
| 6079 | |
| 6080 | |
| 6081 static const int kRegisterPassedArguments = 4; | 5964 static const int kRegisterPassedArguments = 4; |
| 6082 | 5965 |
| 6083 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, | 5966 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, |
| 6084 int num_double_arguments) { | 5967 int num_double_arguments) { |
| 6085 int stack_passed_words = 0; | 5968 int stack_passed_words = 0; |
| 6086 num_reg_arguments += 2 * num_double_arguments; | 5969 num_reg_arguments += 2 * num_double_arguments; |
| 6087 | 5970 |
| 6088 // Up to four simple arguments are passed in registers a0..a3. | 5971 // Up to four simple arguments are passed in registers a0..a3. |
| 6089 if (num_reg_arguments > kRegisterPassedArguments) { | 5972 if (num_reg_arguments > kRegisterPassedArguments) { |
| 6090 stack_passed_words += num_reg_arguments - kRegisterPassedArguments; | 5973 stack_passed_words += num_reg_arguments - kRegisterPassedArguments; |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6602 if (mag.shift > 0) sra(result, result, mag.shift); | 6485 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6603 srl(at, dividend, 31); | 6486 srl(at, dividend, 31); |
| 6604 Addu(result, result, Operand(at)); | 6487 Addu(result, result, Operand(at)); |
| 6605 } | 6488 } |
| 6606 | 6489 |
| 6607 | 6490 |
| 6608 } // namespace internal | 6491 } // namespace internal |
| 6609 } // namespace v8 | 6492 } // namespace v8 |
| 6610 | 6493 |
| 6611 #endif // V8_TARGET_ARCH_MIPS | 6494 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |