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 4274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4285 | 4285 |
4286 // Update allocation top. result temporarily holds the new top. | 4286 // Update allocation top. result temporarily holds the new top. |
4287 if (emit_debug_code()) { | 4287 if (emit_debug_code()) { |
4288 And(at, result_end, Operand(kObjectAlignmentMask)); | 4288 And(at, result_end, Operand(kObjectAlignmentMask)); |
4289 Check(eq, kUnalignedAllocationInNewSpace, at, Operand(zero_reg)); | 4289 Check(eq, kUnalignedAllocationInNewSpace, at, Operand(zero_reg)); |
4290 } | 4290 } |
4291 | 4291 |
4292 Daddu(result, result, Operand(kHeapObjectTag)); | 4292 Daddu(result, result, Operand(kHeapObjectTag)); |
4293 } | 4293 } |
4294 | 4294 |
4295 void MacroAssembler::AllocateTwoByteString(Register result, | |
4296 Register length, | |
4297 Register scratch1, | |
4298 Register scratch2, | |
4299 Register scratch3, | |
4300 Label* gc_required) { | |
4301 // Calculate the number of bytes needed for the characters in the string while | |
4302 // observing object alignment. | |
4303 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
4304 dsll(scratch1, length, 1); // Length in bytes, not chars. | |
4305 daddiu(scratch1, scratch1, | |
4306 kObjectAlignmentMask + SeqTwoByteString::kHeaderSize); | |
4307 And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
4308 | |
4309 // Allocate two-byte string in new space. | |
4310 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
4311 NO_ALLOCATION_FLAGS); | |
4312 | |
4313 // Set the map, length and hash field. | |
4314 InitializeNewString(result, | |
4315 length, | |
4316 Heap::kStringMapRootIndex, | |
4317 scratch1, | |
4318 scratch2); | |
4319 } | |
4320 | |
4321 | |
4322 void MacroAssembler::AllocateOneByteString(Register result, Register length, | |
4323 Register scratch1, Register scratch2, | |
4324 Register scratch3, | |
4325 Label* gc_required) { | |
4326 // Calculate the number of bytes needed for the characters in the string | |
4327 // while observing object alignment. | |
4328 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
4329 DCHECK(kCharSize == 1); | |
4330 daddiu(scratch1, length, | |
4331 kObjectAlignmentMask + SeqOneByteString::kHeaderSize); | |
4332 And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); | |
4333 | |
4334 // Allocate one-byte string in new space. | |
4335 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
4336 NO_ALLOCATION_FLAGS); | |
4337 | |
4338 // Set the map, length and hash field. | |
4339 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, | |
4340 scratch1, scratch2); | |
4341 } | |
4342 | |
4343 | |
4344 void MacroAssembler::AllocateTwoByteConsString(Register result, | |
4345 Register length, | |
4346 Register scratch1, | |
4347 Register scratch2, | |
4348 Label* gc_required) { | |
4349 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
4350 NO_ALLOCATION_FLAGS); | |
4351 InitializeNewString(result, | |
4352 length, | |
4353 Heap::kConsStringMapRootIndex, | |
4354 scratch1, | |
4355 scratch2); | |
4356 } | |
4357 | |
4358 | |
4359 void MacroAssembler::AllocateOneByteConsString(Register result, Register length, | |
4360 Register scratch1, | |
4361 Register scratch2, | |
4362 Label* gc_required) { | |
4363 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
4364 NO_ALLOCATION_FLAGS); | |
4365 | |
4366 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, | |
4367 scratch1, scratch2); | |
4368 } | |
4369 | |
4370 | |
4371 void MacroAssembler::AllocateTwoByteSlicedString(Register result, | |
4372 Register length, | |
4373 Register scratch1, | |
4374 Register scratch2, | |
4375 Label* gc_required) { | |
4376 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
4377 NO_ALLOCATION_FLAGS); | |
4378 | |
4379 InitializeNewString(result, | |
4380 length, | |
4381 Heap::kSlicedStringMapRootIndex, | |
4382 scratch1, | |
4383 scratch2); | |
4384 } | |
4385 | |
4386 | |
4387 void MacroAssembler::AllocateOneByteSlicedString(Register result, | |
4388 Register length, | |
4389 Register scratch1, | |
4390 Register scratch2, | |
4391 Label* gc_required) { | |
4392 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
4393 NO_ALLOCATION_FLAGS); | |
4394 | |
4395 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, | |
4396 scratch1, scratch2); | |
4397 } | |
4398 | |
4399 | |
4400 void MacroAssembler::JumpIfNotUniqueNameInstanceType(Register reg, | 4295 void MacroAssembler::JumpIfNotUniqueNameInstanceType(Register reg, |
4401 Label* not_unique_name) { | 4296 Label* not_unique_name) { |
4402 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); | 4297 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
4403 Label succeed; | 4298 Label succeed; |
4404 And(at, reg, Operand(kIsNotStringMask | kIsNotInternalizedMask)); | 4299 And(at, reg, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
4405 Branch(&succeed, eq, at, Operand(zero_reg)); | 4300 Branch(&succeed, eq, at, Operand(zero_reg)); |
4406 Branch(not_unique_name, ne, reg, Operand(SYMBOL_TYPE)); | 4301 Branch(not_unique_name, ne, reg, Operand(SYMBOL_TYPE)); |
4407 | 4302 |
4408 bind(&succeed); | 4303 bind(&succeed); |
4409 } | 4304 } |
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 6376 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
6482 const int kFlatOneByteStringTag = | 6377 const int kFlatOneByteStringTag = |
6483 kStringTag | kOneByteStringTag | kSeqStringTag; | 6378 kStringTag | kOneByteStringTag | kSeqStringTag; |
6484 DCHECK(kFlatOneByteStringTag <= 0xffff); // Ensure this fits 16-bit immed. | 6379 DCHECK(kFlatOneByteStringTag <= 0xffff); // Ensure this fits 16-bit immed. |
6485 andi(scratch1, first, kFlatOneByteStringMask); | 6380 andi(scratch1, first, kFlatOneByteStringMask); |
6486 Branch(failure, ne, scratch1, Operand(kFlatOneByteStringTag)); | 6381 Branch(failure, ne, scratch1, Operand(kFlatOneByteStringTag)); |
6487 andi(scratch2, second, kFlatOneByteStringMask); | 6382 andi(scratch2, second, kFlatOneByteStringMask); |
6488 Branch(failure, ne, scratch2, Operand(kFlatOneByteStringTag)); | 6383 Branch(failure, ne, scratch2, Operand(kFlatOneByteStringTag)); |
6489 } | 6384 } |
6490 | 6385 |
6491 | |
6492 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(Register type, | |
6493 Register scratch, | |
6494 Label* failure) { | |
6495 const int kFlatOneByteStringMask = | |
6496 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | |
6497 const int kFlatOneByteStringTag = | |
6498 kStringTag | kOneByteStringTag | kSeqStringTag; | |
6499 And(scratch, type, Operand(kFlatOneByteStringMask)); | |
6500 Branch(failure, ne, scratch, Operand(kFlatOneByteStringTag)); | |
6501 } | |
6502 | |
6503 static const int kRegisterPassedArguments = 8; | 6386 static const int kRegisterPassedArguments = 8; |
6504 | 6387 |
6505 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, | 6388 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, |
6506 int num_double_arguments) { | 6389 int num_double_arguments) { |
6507 int stack_passed_words = 0; | 6390 int stack_passed_words = 0; |
6508 num_reg_arguments += 2 * num_double_arguments; | 6391 num_reg_arguments += 2 * num_double_arguments; |
6509 | 6392 |
6510 // O32: Up to four simple arguments are passed in registers a0..a3. | 6393 // O32: Up to four simple arguments are passed in registers a0..a3. |
6511 // N64: Up to eight simple arguments are passed in registers a0..a7. | 6394 // N64: Up to eight simple arguments are passed in registers a0..a7. |
6512 if (num_reg_arguments > kRegisterPassedArguments) { | 6395 if (num_reg_arguments > kRegisterPassedArguments) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7021 if (mag.shift > 0) sra(result, result, mag.shift); | 6904 if (mag.shift > 0) sra(result, result, mag.shift); |
7022 srl(at, dividend, 31); | 6905 srl(at, dividend, 31); |
7023 Addu(result, result, Operand(at)); | 6906 Addu(result, result, Operand(at)); |
7024 } | 6907 } |
7025 | 6908 |
7026 | 6909 |
7027 } // namespace internal | 6910 } // namespace internal |
7028 } // namespace v8 | 6911 } // namespace v8 |
7029 | 6912 |
7030 #endif // V8_TARGET_ARCH_MIPS64 | 6913 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |