MIPS: Allow direct allocation in old pointer space.
Port r13940 (a39765e7) BUG= Review URL: https://codereview.chromium.org/12413026 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13979 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
859a7154bc
commit
87ab8ab1ea
@ -128,12 +128,8 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
|
||||
if (initial_capacity > 0) {
|
||||
size += FixedArray::SizeFor(initial_capacity);
|
||||
}
|
||||
__ AllocateInNewSpace(size,
|
||||
result,
|
||||
scratch2,
|
||||
scratch3,
|
||||
gc_required,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT);
|
||||
|
||||
// Allocated the JSArray. Now initialize the fields except for the elements
|
||||
// array.
|
||||
// result: JSObject
|
||||
@ -665,7 +661,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
|
||||
// -----------------------------------
|
||||
|
||||
Label gc_required;
|
||||
__ AllocateInNewSpace(JSValue::kSize,
|
||||
__ Allocate(JSValue::kSize,
|
||||
v0, // Result.
|
||||
a3, // Scratch.
|
||||
t0, // Scratch.
|
||||
|
@ -168,12 +168,7 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
|
||||
__ pop(a3);
|
||||
|
||||
// Attempt to allocate new JSFunction in new space.
|
||||
__ AllocateInNewSpace(JSFunction::kSize,
|
||||
v0,
|
||||
a1,
|
||||
a2,
|
||||
&gc,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(JSFunction::kSize, v0, a1, a2, &gc, TAG_OBJECT);
|
||||
|
||||
__ IncrementCounter(counters->fast_new_closure_total(), 1, t2, t3);
|
||||
|
||||
@ -300,12 +295,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) {
|
||||
int length = slots_ + Context::MIN_CONTEXT_SLOTS;
|
||||
|
||||
// Attempt to allocate the context in new space.
|
||||
__ AllocateInNewSpace(FixedArray::SizeFor(length),
|
||||
v0,
|
||||
a1,
|
||||
a2,
|
||||
&gc,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT);
|
||||
|
||||
// Load the function from the stack.
|
||||
__ lw(a3, MemOperand(sp, 0));
|
||||
@ -349,8 +339,7 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
|
||||
// Try to allocate the context in new space.
|
||||
Label gc;
|
||||
int length = slots_ + Context::MIN_CONTEXT_SLOTS;
|
||||
__ AllocateInNewSpace(FixedArray::SizeFor(length),
|
||||
v0, a1, a2, &gc, TAG_OBJECT);
|
||||
__ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT);
|
||||
|
||||
// Load the function from the stack.
|
||||
__ lw(a3, MemOperand(sp, 0));
|
||||
@ -429,12 +418,7 @@ static void GenerateFastCloneShallowArrayCommon(
|
||||
|
||||
// Allocate both the JS array and the elements array in one big
|
||||
// allocation. This avoids multiple limit checks.
|
||||
__ AllocateInNewSpace(size,
|
||||
v0,
|
||||
a1,
|
||||
a2,
|
||||
fail,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(size, v0, a1, a2, fail, TAG_OBJECT);
|
||||
|
||||
if (allocation_site_mode == TRACK_ALLOCATION_SITE) {
|
||||
__ li(a2, Operand(Handle<Map>(masm->isolate()->heap()->
|
||||
|
@ -1553,7 +1553,7 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
|
||||
__ bind(&materialized);
|
||||
int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
|
||||
Label allocated, runtime_allocate;
|
||||
__ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ jmp(&allocated);
|
||||
|
||||
__ bind(&runtime_allocate);
|
||||
|
@ -5255,11 +5255,7 @@ void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
|
||||
// the constructor's prototype changes, but instance size and property
|
||||
// counts remain unchanged (if slack tracking finished).
|
||||
ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress());
|
||||
__ AllocateInNewSpace(instance_size,
|
||||
result,
|
||||
scratch,
|
||||
scratch2,
|
||||
deferred->entry(),
|
||||
__ Allocate(instance_size, result, scratch, scratch2, deferred->entry(),
|
||||
TAG_OBJECT);
|
||||
|
||||
__ bind(deferred->exit());
|
||||
@ -5335,12 +5331,10 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
|
||||
}
|
||||
if (instr->size()->IsConstantOperand()) {
|
||||
int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
|
||||
__ AllocateInNewSpace(size,
|
||||
result,
|
||||
scratch,
|
||||
scratch2,
|
||||
deferred->entry(),
|
||||
flags);
|
||||
if (instr->hydrogen()->CanAllocateInOldPointerSpace()) {
|
||||
flags = static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE);
|
||||
}
|
||||
__ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
|
||||
} else {
|
||||
Register size = ToRegister(instr->size());
|
||||
__ AllocateInNewSpace(size,
|
||||
@ -5575,7 +5569,7 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
|
||||
// Allocate all objects that are part of the literal in one big
|
||||
// allocation. This avoids multiple limit checks.
|
||||
Label allocated, runtime_allocate;
|
||||
__ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ jmp(&allocated);
|
||||
|
||||
__ bind(&runtime_allocate);
|
||||
@ -5658,7 +5652,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
|
||||
int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
|
||||
Label allocated, runtime_allocate;
|
||||
|
||||
__ AllocateInNewSpace(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ Allocate(size, v0, a2, a3, &runtime_allocate, TAG_OBJECT);
|
||||
__ jmp(&allocated);
|
||||
|
||||
__ bind(&runtime_allocate);
|
||||
|
@ -2912,7 +2912,7 @@ void MacroAssembler::ThrowUncatchable(Register value) {
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(int object_size,
|
||||
void MacroAssembler::Allocate(int object_size,
|
||||
Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
@ -2945,20 +2945,21 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
||||
// Check relative positions of allocation top and limit addresses.
|
||||
// ARM adds additional checks to make sure the ldm instruction can be
|
||||
// used. On MIPS we don't have ldm so we don't need additional checks either.
|
||||
ExternalReference new_space_allocation_top =
|
||||
ExternalReference::new_space_allocation_top_address(isolate());
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
ExternalReference allocation_top =
|
||||
AllocationUtils::GetAllocationTopReference(isolate(), flags);
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
|
||||
intptr_t top =
|
||||
reinterpret_cast<intptr_t>(new_space_allocation_top.address());
|
||||
reinterpret_cast<intptr_t>(allocation_top.address());
|
||||
intptr_t limit =
|
||||
reinterpret_cast<intptr_t>(new_space_allocation_limit.address());
|
||||
reinterpret_cast<intptr_t>(allocation_limit.address());
|
||||
ASSERT((limit - top) == kPointerSize);
|
||||
|
||||
// Set up allocation top address and object size registers.
|
||||
Register topaddr = scratch1;
|
||||
Register obj_size_reg = scratch2;
|
||||
li(topaddr, Operand(new_space_allocation_top));
|
||||
li(topaddr, Operand(allocation_top));
|
||||
li(obj_size_reg, Operand(object_size));
|
||||
|
||||
// This code stores a temporary value in t9.
|
||||
@ -2997,6 +2998,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
Register scratch2,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -3159,11 +3161,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required) {
|
||||
AllocateInNewSpace(ConsString::kSize,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
gc_required,
|
||||
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
|
||||
TAG_OBJECT);
|
||||
InitializeNewString(result,
|
||||
length,
|
||||
@ -3178,11 +3176,7 @@ void MacroAssembler::AllocateAsciiConsString(Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required) {
|
||||
AllocateInNewSpace(ConsString::kSize,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
gc_required,
|
||||
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
|
||||
TAG_OBJECT);
|
||||
InitializeNewString(result,
|
||||
length,
|
||||
@ -3197,11 +3191,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required) {
|
||||
AllocateInNewSpace(SlicedString::kSize,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
gc_required,
|
||||
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
|
||||
TAG_OBJECT);
|
||||
|
||||
InitializeNewString(result,
|
||||
@ -3217,11 +3207,7 @@ void MacroAssembler::AllocateAsciiSlicedString(Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required) {
|
||||
AllocateInNewSpace(SlicedString::kSize,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
gc_required,
|
||||
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
|
||||
TAG_OBJECT);
|
||||
|
||||
InitializeNewString(result,
|
||||
@ -3242,13 +3228,8 @@ void MacroAssembler::AllocateHeapNumber(Register result,
|
||||
TaggingMode tagging_mode) {
|
||||
// Allocate an object in the heap for the heap number and tag it as a heap
|
||||
// object.
|
||||
AllocateInNewSpace(HeapNumber::kSize,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
need_gc,
|
||||
tagging_mode == TAG_RESULT ? TAG_OBJECT :
|
||||
NO_ALLOCATION_FLAGS);
|
||||
Allocate(HeapNumber::kSize, result, scratch1, scratch2, need_gc,
|
||||
tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS);
|
||||
|
||||
// Store heap number map in the allocated object.
|
||||
AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
|
||||
|
@ -477,19 +477,20 @@ class MacroAssembler: public Assembler {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Allocation support.
|
||||
|
||||
// Allocate an object in new space. The object_size is specified
|
||||
// either in bytes or in words if the allocation flag SIZE_IN_WORDS
|
||||
// is passed. If the new space is exhausted control continues at the
|
||||
// gc_required label. The allocated object is returned in result. If
|
||||
// the flag tag_allocated_object is true the result is tagged as as
|
||||
// a heap object. All registers are clobbered also when control
|
||||
// continues at the gc_required label.
|
||||
void AllocateInNewSpace(int object_size,
|
||||
// Allocate an object in new space or old pointer space. The object_size is
|
||||
// specified either in bytes or in words if the allocation flag SIZE_IN_WORDS
|
||||
// is passed. If the space is exhausted control continues at the gc_required
|
||||
// label. The allocated object is returned in result. If the flag
|
||||
// tag_allocated_object is true the result is tagged as as a heap object.
|
||||
// All registers are clobbered also when control continues at the gc_required
|
||||
// label.
|
||||
void Allocate(int object_size,
|
||||
Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(Register object_size,
|
||||
Register result,
|
||||
Register scratch1,
|
||||
|
@ -3731,8 +3731,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(
|
||||
__ Branch(&check_capacity, ne, elements_reg, Operand(at));
|
||||
|
||||
int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
|
||||
__ AllocateInNewSpace(size, elements_reg, scratch, scratch2, &slow,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(size, elements_reg, scratch, scratch2, &slow, TAG_OBJECT);
|
||||
|
||||
__ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
|
||||
__ sw(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset));
|
||||
@ -3882,8 +3881,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
|
||||
__ Branch(&check_capacity, ne, elements_reg, Operand(at));
|
||||
|
||||
int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements);
|
||||
__ AllocateInNewSpace(size, elements_reg, scratch1, scratch2, &slow,
|
||||
TAG_OBJECT);
|
||||
__ Allocate(size, elements_reg, scratch1, scratch2, &slow, TAG_OBJECT);
|
||||
|
||||
// Initialize the new FixedDoubleArray.
|
||||
__ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user