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

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

Issue 2035413003: Revert of Provide a tagged allocation top pointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months 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/mips64/code-stubs-mips64.cc ('k') | src/x64/code-stubs-x64.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 // 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 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 if (emit_debug_code()) { 4311 if (emit_debug_code()) {
4312 // Assert that result actually contains top on entry. 4312 // Assert that result actually contains top on entry.
4313 ld(alloc_limit, MemOperand(top_address)); 4313 ld(alloc_limit, MemOperand(top_address));
4314 Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit)); 4314 Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit));
4315 } 4315 }
4316 // Load allocation limit. Result already contains allocation top. 4316 // Load allocation limit. Result already contains allocation top.
4317 ld(alloc_limit, MemOperand(top_address, static_cast<int32_t>(limit - top))); 4317 ld(alloc_limit, MemOperand(top_address, static_cast<int32_t>(limit - top)));
4318 } 4318 }
4319 4319
4320 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have 4320 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have
4321 // the same alignment on MIPS64. 4321 // the same alignment on ARM64.
4322 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); 4322 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment);
4323 4323
4324 if (emit_debug_code()) { 4324 if (emit_debug_code()) {
4325 And(at, result, Operand(kDoubleAlignmentMaskTagged)); 4325 And(at, result, Operand(kDoubleAlignmentMask));
4326 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg)); 4326 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg));
4327 } 4327 }
4328 4328
4329 // Calculate new top and bail out if new space is exhausted. Use result 4329 // Calculate new top and bail out if new space is exhausted. Use result
4330 // to calculate the new top. 4330 // to calculate the new top.
4331 Daddu(result_end, result, Operand(object_size)); 4331 Daddu(result_end, result, Operand(object_size));
4332 Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); 4332 Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
4333 4333
4334 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { 4334 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) {
4335 // The top pointer is not updated for allocation folding dominators. 4335 // The top pointer is not updated for allocation folding dominators.
4336 sd(result_end, MemOperand(top_address)); 4336 sd(result_end, MemOperand(top_address));
4337 } 4337 }
4338
4339 // Tag object.
4340 Daddu(result, result, Operand(kHeapObjectTag));
4338 } 4341 }
4339 4342
4340 4343
4341 void MacroAssembler::Allocate(Register object_size, Register result, 4344 void MacroAssembler::Allocate(Register object_size, Register result,
4342 Register result_end, Register scratch, 4345 Register result_end, Register scratch,
4343 Label* gc_required, AllocationFlags flags) { 4346 Label* gc_required, AllocationFlags flags) {
4344 if (!FLAG_inline_new) { 4347 if (!FLAG_inline_new) {
4345 if (emit_debug_code()) { 4348 if (emit_debug_code()) {
4346 // Trash the registers to simulate an allocation failure. 4349 // Trash the registers to simulate an allocation failure.
4347 li(result, 0x7091); 4350 li(result, 0x7091);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4381 if (emit_debug_code()) { 4384 if (emit_debug_code()) {
4382 // Assert that result actually contains top on entry. 4385 // Assert that result actually contains top on entry.
4383 ld(alloc_limit, MemOperand(top_address)); 4386 ld(alloc_limit, MemOperand(top_address));
4384 Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit)); 4387 Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit));
4385 } 4388 }
4386 // Load allocation limit. Result already contains allocation top. 4389 // Load allocation limit. Result already contains allocation top.
4387 ld(alloc_limit, MemOperand(top_address, static_cast<int32_t>(limit - top))); 4390 ld(alloc_limit, MemOperand(top_address, static_cast<int32_t>(limit - top)));
4388 } 4391 }
4389 4392
4390 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have 4393 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have
4391 // the same alignment on MIPS64. 4394 // the same alignment on ARM64.
4392 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); 4395 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment);
4393 4396
4394 if (emit_debug_code()) { 4397 if (emit_debug_code()) {
4395 And(at, result, Operand(kDoubleAlignmentMaskTagged)); 4398 And(at, result, Operand(kDoubleAlignmentMask));
4396 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg)); 4399 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg));
4397 } 4400 }
4398 4401
4399 // Calculate new top and bail out if new space is exhausted. Use result 4402 // Calculate new top and bail out if new space is exhausted. Use result
4400 // to calculate the new top. Object size may be in words so a shift is 4403 // to calculate the new top. Object size may be in words so a shift is
4401 // required to get the number of bytes. 4404 // required to get the number of bytes.
4402 if ((flags & SIZE_IN_WORDS) != 0) { 4405 if ((flags & SIZE_IN_WORDS) != 0) {
4403 Dlsa(result_end, result, object_size, kPointerSizeLog2); 4406 Dlsa(result_end, result, object_size, kPointerSizeLog2);
4404 } else { 4407 } else {
4405 Daddu(result_end, result, Operand(object_size)); 4408 Daddu(result_end, result, Operand(object_size));
4406 } 4409 }
4407 4410
4408 Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); 4411 Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
4409 4412
4410 // Update allocation top. result temporarily holds the new top. 4413 // Update allocation top. result temporarily holds the new top.
4411 if (emit_debug_code()) { 4414 if (emit_debug_code()) {
4412 And(at, result_end, Operand(kObjectAlignmentMask)); 4415 And(at, result_end, Operand(kObjectAlignmentMask));
4413 Check(ne, kUnalignedAllocationInNewSpace, at, Operand(zero_reg)); 4416 Check(eq, kUnalignedAllocationInNewSpace, at, Operand(zero_reg));
4414 } 4417 }
4415 4418
4416 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { 4419 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) {
4417 // The top pointer is not updated for allocation folding dominators. 4420 // The top pointer is not updated for allocation folding dominators.
4418 sd(result_end, MemOperand(top_address)); 4421 sd(result_end, MemOperand(top_address));
4419 } 4422 }
4423
4424 // Tag object if.
4425 Daddu(result, result, Operand(kHeapObjectTag));
4420 } 4426 }
4421 4427
4422 void MacroAssembler::FastAllocate(int object_size, Register result, 4428 void MacroAssembler::FastAllocate(int object_size, Register result,
4423 Register scratch1, Register scratch2, 4429 Register scratch1, Register scratch2,
4424 AllocationFlags flags) { 4430 AllocationFlags flags) {
4425 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); 4431 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
4426 DCHECK(!AreAliased(result, scratch1, scratch2, at)); 4432 DCHECK(!AreAliased(result, scratch1, scratch2, at));
4427 4433
4428 // Make object size into bytes. 4434 // Make object size into bytes.
4429 if ((flags & SIZE_IN_WORDS) != 0) { 4435 if ((flags & SIZE_IN_WORDS) != 0) {
4430 object_size *= kPointerSize; 4436 object_size *= kPointerSize;
4431 } 4437 }
4432 DCHECK(0 == (object_size & kObjectAlignmentMask)); 4438 DCHECK(0 == (object_size & kObjectAlignmentMask));
4433 4439
4434 ExternalReference allocation_top = 4440 ExternalReference allocation_top =
4435 AllocationUtils::GetAllocationTopReference(isolate(), flags); 4441 AllocationUtils::GetAllocationTopReference(isolate(), flags);
4436 4442
4437 Register top_address = scratch1; 4443 Register top_address = scratch1;
4438 Register result_end = scratch2; 4444 Register result_end = scratch2;
4439 li(top_address, Operand(allocation_top)); 4445 li(top_address, Operand(allocation_top));
4440 ld(result, MemOperand(top_address)); 4446 ld(result, MemOperand(top_address));
4441 4447
4442 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have 4448 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have
4443 // the same alignment on MIPS64. 4449 // the same alignment on MIPS64.
4444 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); 4450 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment);
4445 4451
4446 if (emit_debug_code()) { 4452 if (emit_debug_code()) {
4447 And(at, result, Operand(kDoubleAlignmentMaskTagged)); 4453 And(at, result, Operand(kDoubleAlignmentMask));
4448 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg)); 4454 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg));
4449 } 4455 }
4450 4456
4451 // Calculate new top and write it back. 4457 // Calculate new top and write it back.
4452 Daddu(result_end, result, Operand(object_size)); 4458 Daddu(result_end, result, Operand(object_size));
4453 sd(result_end, MemOperand(top_address)); 4459 sd(result_end, MemOperand(top_address));
4460
4461 Daddu(result, result, Operand(kHeapObjectTag));
4454 } 4462 }
4455 4463
4456 void MacroAssembler::FastAllocate(Register object_size, Register result, 4464 void MacroAssembler::FastAllocate(Register object_size, Register result,
4457 Register result_end, Register scratch, 4465 Register result_end, Register scratch,
4458 AllocationFlags flags) { 4466 AllocationFlags flags) {
4459 // |object_size| and |result_end| may overlap, other registers must not. 4467 // |object_size| and |result_end| may overlap, other registers must not.
4460 DCHECK(!AreAliased(object_size, result, scratch, at)); 4468 DCHECK(!AreAliased(object_size, result, scratch, at));
4461 DCHECK(!AreAliased(result_end, result, scratch, at)); 4469 DCHECK(!AreAliased(result_end, result, scratch, at));
4462 4470
4463 ExternalReference allocation_top = 4471 ExternalReference allocation_top =
4464 AllocationUtils::GetAllocationTopReference(isolate(), flags); 4472 AllocationUtils::GetAllocationTopReference(isolate(), flags);
4465 4473
4466 // Set up allocation top address and object size registers. 4474 // Set up allocation top address and object size registers.
4467 Register top_address = scratch; 4475 Register top_address = scratch;
4468 li(top_address, Operand(allocation_top)); 4476 li(top_address, Operand(allocation_top));
4469 ld(result, MemOperand(top_address)); 4477 ld(result, MemOperand(top_address));
4470 4478
4471 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have 4479 // We can ignore DOUBLE_ALIGNMENT flags here because doubles and pointers have
4472 // the same alignment on MIPS64. 4480 // the same alignment on MIPS64.
4473 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment); 4481 STATIC_ASSERT(kPointerAlignment == kDoubleAlignment);
4474 4482
4475 if (emit_debug_code()) { 4483 if (emit_debug_code()) {
4476 And(at, result, Operand(kDoubleAlignmentMaskTagged)); 4484 And(at, result, Operand(kDoubleAlignmentMask));
4477 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg)); 4485 Check(eq, kAllocationIsNotDoubleAligned, at, Operand(zero_reg));
4478 } 4486 }
4479 4487
4480 // Calculate new top and write it back 4488 // Calculate new top and write it back
4481 if ((flags & SIZE_IN_WORDS) != 0) { 4489 if ((flags & SIZE_IN_WORDS) != 0) {
4482 Dlsa(result_end, result, object_size, kPointerSizeLog2); 4490 Dlsa(result_end, result, object_size, kPointerSizeLog2);
4483 } else { 4491 } else {
4484 Daddu(result_end, result, Operand(object_size)); 4492 Daddu(result_end, result, Operand(object_size));
4485 } 4493 }
4486 4494
4487 // Update allocation top. result temporarily holds the new top. 4495 // Update allocation top. result temporarily holds the new top.
4488 if (emit_debug_code()) { 4496 if (emit_debug_code()) {
4489 And(at, result_end, Operand(kObjectAlignmentMask)); 4497 And(at, result_end, Operand(kObjectAlignmentMask));
4490 Check(ne, kUnalignedAllocationInNewSpace, at, Operand(zero_reg)); 4498 Check(eq, kUnalignedAllocationInNewSpace, at, Operand(zero_reg));
4491 } 4499 }
4500
4501 Daddu(result, result, Operand(kHeapObjectTag));
4492 } 4502 }
4493 4503
4494 void MacroAssembler::AllocateTwoByteString(Register result, 4504 void MacroAssembler::AllocateTwoByteString(Register result,
4495 Register length, 4505 Register length,
4496 Register scratch1, 4506 Register scratch1,
4497 Register scratch2, 4507 Register scratch2,
4498 Register scratch3, 4508 Register scratch3,
4499 Label* gc_required) { 4509 Label* gc_required) {
4500 // Calculate the number of bytes needed for the characters in the string while 4510 // Calculate the number of bytes needed for the characters in the string while
4501 // observing object alignment. 4511 // observing object alignment.
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
7130 if (mag.shift > 0) sra(result, result, mag.shift); 7140 if (mag.shift > 0) sra(result, result, mag.shift);
7131 srl(at, dividend, 31); 7141 srl(at, dividend, 31);
7132 Addu(result, result, Operand(at)); 7142 Addu(result, result, Operand(at));
7133 } 7143 }
7134 7144
7135 7145
7136 } // namespace internal 7146 } // namespace internal
7137 } // namespace v8 7147 } // namespace v8
7138 7148
7139 #endif // V8_TARGET_ARCH_MIPS64 7149 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698