From 7fd5d4540c3c2d71b4f068868e167c98baca7767 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Thu, 21 Oct 2010 13:15:12 +0000 Subject: [PATCH] Implement --noinline-new flag fully on x64 and ia32 platforms. Review URL: http://codereview.chromium.org/3961005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5687 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ia32/macro-assembler-ia32.cc | 40 ++++++++++++++++++++++++++++++++++++++ src/ia32/stub-cache-ia32.cc | 4 ++++ src/x64/macro-assembler-x64.cc | 42 ++++++++++++++++++++++++++++++++++++++++ src/x64/stub-cache-x64.cc | 4 ++++ 4 files changed, 90 insertions(+) diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index a62f74b..a26ee56 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -584,6 +584,20 @@ void MacroAssembler::AllocateInNewSpace(int object_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + mov(result, Immediate(0x7091)); + if (result_end.is_valid()) { + mov(result_end, Immediate(0x7191)); + } + if (scratch.is_valid()) { + mov(scratch, Immediate(0x7291)); + } + } + jmp(gc_required); + return; + } ASSERT(!result.is(result_end)); // Load address of new object into result. @@ -627,6 +641,19 @@ void MacroAssembler::AllocateInNewSpace(int header_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + mov(result, Immediate(0x7091)); + mov(result_end, Immediate(0x7191)); + if (scratch.is_valid()) { + mov(scratch, Immediate(0x7291)); + } + // Register element_count is not modified by the function. + } + jmp(gc_required); + return; + } ASSERT(!result.is(result_end)); // Load address of new object into result. @@ -655,6 +682,19 @@ void MacroAssembler::AllocateInNewSpace(Register object_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + mov(result, Immediate(0x7091)); + mov(result_end, Immediate(0x7191)); + if (scratch.is_valid()) { + mov(scratch, Immediate(0x7291)); + } + // object_size is left unchanged by this function. + } + jmp(gc_required); + return; + } ASSERT(!result.is(result_end)); // Load address of new object into result. diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index bb0a46c..5af75e1 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -1465,6 +1465,10 @@ Object* CallStubCompiler::CompileArrayPushCall(Object* object, __ ret((argc + 1) * kPointerSize); __ bind(&attempt_to_grow_elements); + if (!FLAG_inline_new) { + __ jmp(&call_builtin); + } + ExternalReference new_space_allocation_top = ExternalReference::new_space_allocation_top_address(); ExternalReference new_space_allocation_limit = diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 2c946f5..ed231e6 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -1891,6 +1891,20 @@ void MacroAssembler::AllocateInNewSpace(int object_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + movl(result, Immediate(0x7091)); + if (result_end.is_valid()) { + movl(result_end, Immediate(0x7191)); + } + if (scratch.is_valid()) { + movl(scratch, Immediate(0x7291)); + } + } + jmp(gc_required); + return; + } ASSERT(!result.is(result_end)); // Load address of new object into result. @@ -1935,6 +1949,19 @@ void MacroAssembler::AllocateInNewSpace(int header_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + movl(result, Immediate(0x7091)); + movl(result_end, Immediate(0x7191)); + if (scratch.is_valid()) { + movl(scratch, Immediate(0x7291)); + } + // Register element_count is not modified by the function. + } + jmp(gc_required); + return; + } ASSERT(!result.is(result_end)); // Load address of new object into result. @@ -1964,6 +1991,21 @@ void MacroAssembler::AllocateInNewSpace(Register object_size, Register scratch, Label* gc_required, AllocationFlags flags) { + if (!FLAG_inline_new) { + if (FLAG_debug_code) { + // Trash the registers to simulate an allocation failure. + movl(result, Immediate(0x7091)); + movl(result_end, Immediate(0x7191)); + if (scratch.is_valid()) { + movl(scratch, Immediate(0x7291)); + } + // object_size is left unchanged by this function. + } + jmp(gc_required); + return; + } + ASSERT(!result.is(result_end)); + // Load address of new object into result. LoadAllocationTopHelper(result, result_end, scratch, flags); diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index eb48da9..ad7b851 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -1191,6 +1191,10 @@ Object* CallStubCompiler::CompileArrayPushCall(Object* object, __ ret((argc + 1) * kPointerSize); __ bind(&attempt_to_grow_elements); + if (!FLAG_inline_new) { + __ jmp(&call_builtin); + } + ExternalReference new_space_allocation_top = ExternalReference::new_space_allocation_top_address(); ExternalReference new_space_allocation_limit = -- 2.7.4