From a2d1f8b8f63ae4de161bcc714c9c442d22d214a1 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Tue, 28 Jan 2014 13:43:04 +0000 Subject: [PATCH] Drop the native FastNewBlockContextStub. This code is almost never executed in real world and benchmarks, and there's obviously absolutely no need to have this native code hanging around for no benefit. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/148873002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18880 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/code-stubs-arm.cc | 62 ---------------------------------------- src/code-stubs.h | 18 ------------ src/full-codegen.cc | 11 ++------ src/ia32/code-stubs-ia32.cc | 69 --------------------------------------------- src/mips/code-stubs-mips.cc | 60 --------------------------------------- src/x64/code-stubs-x64.cc | 63 ----------------------------------------- 6 files changed, 2 insertions(+), 281 deletions(-) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 74d13e0..e5471fd 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -486,68 +486,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { } -void FastNewBlockContextStub::Generate(MacroAssembler* masm) { - // Stack layout on entry: - // - // [sp]: function. - // [sp + kPointerSize]: serialized scope info - - // Try to allocate the context in new space. - Label gc; - int length = slots_ + Context::MIN_CONTEXT_SLOTS; - __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); - - // Load the function from the stack. - __ ldr(r3, MemOperand(sp, 0)); - - // Load the serialized scope info from the stack. - __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); - - // Set up the object header. - __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); - __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); - __ mov(r2, Operand(Smi::FromInt(length))); - __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); - - // If this block context is nested in the native context we get a smi - // sentinel instead of a function. The block context should get the - // canonical empty function of the native context as its closure which - // we still have to look up. - Label after_sentinel; - __ JumpIfNotSmi(r3, &after_sentinel); - if (FLAG_debug_code) { - __ cmp(r3, Operand::Zero()); - __ Assert(eq, kExpected0AsASmiSentinel); - } - __ ldr(r3, GlobalObjectOperand()); - __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); - __ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX)); - __ bind(&after_sentinel); - - // Set up the fixed slots, copy the global object from the previous context. - __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); - __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX)); - __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX)); - __ str(r1, ContextOperand(r0, Context::EXTENSION_INDEX)); - __ str(r2, ContextOperand(r0, Context::GLOBAL_OBJECT_INDEX)); - - // Initialize the rest of the slots to the hole value. - __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); - for (int i = 0; i < slots_; i++) { - __ str(r1, ContextOperand(r0, i + Context::MIN_CONTEXT_SLOTS)); - } - - // Remove the on-stack argument and return. - __ mov(cp, r0); - __ add(sp, sp, Operand(2 * kPointerSize)); - __ Ret(); - - // Need to collect. Call into runtime system. - __ bind(&gc); - __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); -} - - // Takes a Smi and converts to an IEEE 64 bit floating point value in two // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a diff --git a/src/code-stubs.h b/src/code-stubs.h index 63e9f07..2459cbb 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -64,7 +64,6 @@ namespace internal { V(Interrupt) \ V(FastNewClosure) \ V(FastNewContext) \ - V(FastNewBlockContext) \ V(FastCloneShallowArray) \ V(FastCloneShallowObject) \ V(CreateAllocationSite) \ @@ -586,23 +585,6 @@ class FastNewContextStub V8_FINAL : public HydrogenCodeStub { }; -class FastNewBlockContextStub : public PlatformCodeStub { - public: - static const int kMaximumSlots = 64; - - explicit FastNewBlockContextStub(int slots) : slots_(slots) { - ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); - } - - void Generate(MacroAssembler* masm); - - private: - int slots_; - - Major MajorKey() { return FastNewBlockContext; } - int MinorKey() { return slots_; } -}; - class FastCloneShallowArrayStub : public HydrogenCodeStub { public: // Maximum length of copied elements array. diff --git a/src/full-codegen.cc b/src/full-codegen.cc index cbf013e..fd8f447 100644 --- a/src/full-codegen.cc +++ b/src/full-codegen.cc @@ -1098,16 +1098,9 @@ void FullCodeGenerator::VisitBlock(Block* stmt) { scope_ = stmt->scope(); ASSERT(!scope_->is_module_scope()); { Comment cmnt(masm_, "[ Extend block context"); - Handle scope_info = scope_->GetScopeInfo(); - int heap_slots = scope_info->ContextLength() - Context::MIN_CONTEXT_SLOTS; - __ Push(scope_info); + __ Push(scope_->GetScopeInfo()); PushFunctionArgumentForContextAllocation(); - if (heap_slots <= FastNewBlockContextStub::kMaximumSlots) { - FastNewBlockContextStub stub(heap_slots); - __ CallStub(&stub); - } else { - __ CallRuntime(Runtime::kPushBlockContext, 2); - } + __ CallRuntime(Runtime::kPushBlockContext, 2); // Replace the context stored in the frame. StoreToFrameField(StandardFrameConstants::kContextOffset, diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index a935e12..f81d237 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -465,75 +465,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { } -void FastNewBlockContextStub::Generate(MacroAssembler* masm) { - // Stack layout on entry: - // - // [esp + (1 * kPointerSize)]: function - // [esp + (2 * kPointerSize)]: serialized scope info - - // Try to allocate the context in new space. - Label gc; - int length = slots_ + Context::MIN_CONTEXT_SLOTS; - __ Allocate(FixedArray::SizeFor(length), eax, ebx, ecx, &gc, TAG_OBJECT); - - // Get the function or sentinel from the stack. - __ mov(ecx, Operand(esp, 1 * kPointerSize)); - - // Get the serialized scope info from the stack. - __ mov(ebx, Operand(esp, 2 * kPointerSize)); - - // Set up the object header. - Factory* factory = masm->isolate()->factory(); - __ mov(FieldOperand(eax, HeapObject::kMapOffset), - factory->block_context_map()); - __ mov(FieldOperand(eax, Context::kLengthOffset), - Immediate(Smi::FromInt(length))); - - // If this block context is nested in the native context we get a smi - // sentinel instead of a function. The block context should get the - // canonical empty function of the native context as its closure which - // we still have to look up. - Label after_sentinel; - __ JumpIfNotSmi(ecx, &after_sentinel, Label::kNear); - if (FLAG_debug_code) { - __ cmp(ecx, 0); - __ Assert(equal, kExpected0AsASmiSentinel); - } - __ mov(ecx, GlobalObjectOperand()); - __ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset)); - __ mov(ecx, ContextOperand(ecx, Context::CLOSURE_INDEX)); - __ bind(&after_sentinel); - - // Set up the fixed slots. - __ mov(ContextOperand(eax, Context::CLOSURE_INDEX), ecx); - __ mov(ContextOperand(eax, Context::PREVIOUS_INDEX), esi); - __ mov(ContextOperand(eax, Context::EXTENSION_INDEX), ebx); - - // Copy the global object from the previous context. - __ mov(ebx, ContextOperand(esi, Context::GLOBAL_OBJECT_INDEX)); - __ mov(ContextOperand(eax, Context::GLOBAL_OBJECT_INDEX), ebx); - - // Initialize the rest of the slots to the hole value. - if (slots_ == 1) { - __ mov(ContextOperand(eax, Context::MIN_CONTEXT_SLOTS), - factory->the_hole_value()); - } else { - __ mov(ebx, factory->the_hole_value()); - for (int i = 0; i < slots_; i++) { - __ mov(ContextOperand(eax, i + Context::MIN_CONTEXT_SLOTS), ebx); - } - } - - // Return and remove the on-stack parameters. - __ mov(esi, eax); - __ ret(2 * kPointerSize); - - // Need to collect. Call into runtime system. - __ bind(&gc); - __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); -} - - void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { // We don't allow a GC during a store buffer overflow so there is no need to // store the registers in any particular way, but we do have to store and diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index ab1b90a..afecc5e 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -477,66 +477,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { } -void FastNewBlockContextStub::Generate(MacroAssembler* masm) { - // Stack layout on entry: - // - // [sp]: function. - // [sp + kPointerSize]: serialized scope info - - // Try to allocate the context in new space. - Label gc; - int length = slots_ + Context::MIN_CONTEXT_SLOTS; - __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); - - // Load the function from the stack. - __ lw(a3, MemOperand(sp, 0)); - - // Load the serialized scope info from the stack. - __ lw(a1, MemOperand(sp, 1 * kPointerSize)); - - // Set up the object header. - __ LoadRoot(a2, Heap::kBlockContextMapRootIndex); - __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); - __ li(a2, Operand(Smi::FromInt(length))); - __ sw(a2, FieldMemOperand(v0, FixedArray::kLengthOffset)); - - // If this block context is nested in the native context we get a smi - // sentinel instead of a function. The block context should get the - // canonical empty function of the native context as its closure which - // we still have to look up. - Label after_sentinel; - __ JumpIfNotSmi(a3, &after_sentinel); - if (FLAG_debug_code) { - __ Assert(eq, kExpected0AsASmiSentinel, a3, Operand(zero_reg)); - } - __ lw(a3, GlobalObjectOperand()); - __ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset)); - __ lw(a3, ContextOperand(a3, Context::CLOSURE_INDEX)); - __ bind(&after_sentinel); - - // Set up the fixed slots, copy the global object from the previous context. - __ lw(a2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); - __ sw(a3, ContextOperand(v0, Context::CLOSURE_INDEX)); - __ sw(cp, ContextOperand(v0, Context::PREVIOUS_INDEX)); - __ sw(a1, ContextOperand(v0, Context::EXTENSION_INDEX)); - __ sw(a2, ContextOperand(v0, Context::GLOBAL_OBJECT_INDEX)); - - // Initialize the rest of the slots to the hole value. - __ LoadRoot(a1, Heap::kTheHoleValueRootIndex); - for (int i = 0; i < slots_; i++) { - __ sw(a1, ContextOperand(v0, i + Context::MIN_CONTEXT_SLOTS)); - } - - // Remove the on-stack argument and return. - __ mov(cp, v0); - __ DropAndRet(2); - - // Need to collect. Call into runtime system. - __ bind(&gc); - __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); -} - - // Takes a Smi and converts to an IEEE 64 bit floating point value in two // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index a64cab8..757c58f 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -462,69 +462,6 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { } -void FastNewBlockContextStub::Generate(MacroAssembler* masm) { - // Stack layout on entry: - // - // [rsp + (1 * kPointerSize)] : function - // [rsp + (2 * kPointerSize)] : serialized scope info - - // Try to allocate the context in new space. - Label gc; - int length = slots_ + Context::MIN_CONTEXT_SLOTS; - __ Allocate(FixedArray::SizeFor(length), - rax, rbx, rcx, &gc, TAG_OBJECT); - - // Get the function from the stack. - StackArgumentsAccessor args(rsp, 2, ARGUMENTS_DONT_CONTAIN_RECEIVER); - __ movp(rcx, args.GetArgumentOperand(1)); - // Get the serialized scope info from the stack. - __ movp(rbx, args.GetArgumentOperand(0)); - - // Set up the object header. - __ LoadRoot(kScratchRegister, Heap::kBlockContextMapRootIndex); - __ movp(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister); - __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); - - // If this block context is nested in the native context we get a smi - // sentinel instead of a function. The block context should get the - // canonical empty function of the native context as its closure which - // we still have to look up. - Label after_sentinel; - __ JumpIfNotSmi(rcx, &after_sentinel, Label::kNear); - if (FLAG_debug_code) { - __ cmpq(rcx, Immediate(0)); - __ Assert(equal, kExpected0AsASmiSentinel); - } - __ movp(rcx, GlobalObjectOperand()); - __ movp(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); - __ movp(rcx, ContextOperand(rcx, Context::CLOSURE_INDEX)); - __ bind(&after_sentinel); - - // Set up the fixed slots. - __ movp(ContextOperand(rax, Context::CLOSURE_INDEX), rcx); - __ movp(ContextOperand(rax, Context::PREVIOUS_INDEX), rsi); - __ movp(ContextOperand(rax, Context::EXTENSION_INDEX), rbx); - - // Copy the global object from the previous context. - __ movp(rbx, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); - __ movp(ContextOperand(rax, Context::GLOBAL_OBJECT_INDEX), rbx); - - // Initialize the rest of the slots to the hole value. - __ LoadRoot(rbx, Heap::kTheHoleValueRootIndex); - for (int i = 0; i < slots_; i++) { - __ movp(ContextOperand(rax, i + Context::MIN_CONTEXT_SLOTS), rbx); - } - - // Return and remove the on-stack parameter. - __ movp(rsi, rax); - __ ret(2 * kPointerSize); - - // Need to collect. Call into runtime system. - __ bind(&gc); - __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); -} - - void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { __ PushCallerSaved(save_doubles_); const int argument_count = 1; -- 2.7.4