From b98a37113dce7da2b0da4746cc352cb37e63f3f1 Mon Sep 17 00:00:00 2001 From: ulan Date: Thu, 4 Dec 2014 02:52:33 -0800 Subject: [PATCH] Do not embed function in DirectLoadGlobalFunctionPrototype. BUG=v8:3629 LOG=N Review URL: https://codereview.chromium.org/778673002 Cr-Commit-Position: refs/heads/master@{#25657} --- src/ic/arm/handler-compiler-arm.cc | 24 +++++++----------------- src/ic/arm64/handler-compiler-arm64.cc | 23 +++++++---------------- src/ic/ia32/handler-compiler-ia32.cc | 20 +++++++------------- src/ic/mips/handler-compiler-mips.cc | 23 +++++++---------------- src/ic/mips64/handler-compiler-mips64.cc | 22 +++++++--------------- src/ic/x64/handler-compiler-x64.cc | 22 +++++++--------------- src/ic/x87/handler-compiler-x87.cc | 20 +++++++------------- 7 files changed, 49 insertions(+), 105 deletions(-) diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/arm/handler-compiler-arm.cc index a2b8bb1..ba499ab 100644 --- a/src/ic/arm/handler-compiler-arm.cc +++ b/src/ic/arm/handler-compiler-arm.cc @@ -140,26 +140,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - Isolate* isolate = masm->isolate(); - // Get the global function with the given index. - Handle function( - JSFunction::cast(isolate->native_context()->get(index))); - - // Check we're still in the same context. - Register scratch = prototype; + MacroAssembler* masm, int index, Register result, Label* miss) { const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ ldr(scratch, MemOperand(cp, offset)); - __ ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); - __ ldr(scratch, MemOperand(scratch, Context::SlotOffset(index))); - __ Move(ip, function); - __ cmp(ip, scratch); - __ b(ne, miss); - + __ ldr(result, MemOperand(cp, offset)); + __ ldr(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset)); + __ ldr(result, MemOperand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ Move(prototype, Handle(function->initial_map())); + __ ldr(result, + FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); + __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/arm64/handler-compiler-arm64.cc b/src/ic/arm64/handler-compiler-arm64.cc index 474dd80..2d5999a 100644 --- a/src/ic/arm64/handler-compiler-arm64.cc +++ b/src/ic/arm64/handler-compiler-arm64.cc @@ -57,24 +57,15 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - Isolate* isolate = masm->isolate(); - // Get the global function with the given index. - Handle function( - JSFunction::cast(isolate->native_context()->get(index))); - - // Check we're still in the same context. - Register scratch = prototype; - __ Ldr(scratch, GlobalObjectMemOperand()); - __ Ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); - __ Ldr(scratch, ContextMemOperand(scratch, index)); - __ Cmp(scratch, Operand(function)); - __ B(ne, miss); - + MacroAssembler* masm, int index, Register result, Label* miss) { + __ Ldr(result, GlobalObjectMemOperand()); + __ Ldr(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset)); + __ Ldr(result, ContextMemOperand(result, index)); // Load its initial map. The global functions all have initial maps. - __ Mov(prototype, Operand(Handle(function->initial_map()))); + __ Ldr(result, + FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); + __ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc index 5bdf077..d707e69 100644 --- a/src/ic/ia32/handler-compiler-ia32.cc +++ b/src/ic/ia32/handler-compiler-ia32.cc @@ -88,22 +88,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - // Get the global function with the given index. - Handle function( - JSFunction::cast(masm->isolate()->native_context()->get(index))); - // Check we're still in the same context. - Register scratch = prototype; + MacroAssembler* masm, int index, Register result, Label* miss) { const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ mov(scratch, Operand(esi, offset)); - __ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); - __ cmp(Operand(scratch, Context::SlotOffset(index)), function); - __ j(not_equal, miss); - + __ mov(result, Operand(esi, offset)); + __ mov(result, FieldOperand(result, GlobalObject::kNativeContextOffset)); + __ mov(result, Operand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ Move(prototype, Immediate(Handle(function->initial_map()))); + __ mov(result, + FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); + __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc index 9275db1..6bfc5d7 100644 --- a/src/ic/mips/handler-compiler-mips.cc +++ b/src/ic/mips/handler-compiler-mips.cc @@ -138,25 +138,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - Isolate* isolate = masm->isolate(); - // Get the global function with the given index. - Handle function( - JSFunction::cast(isolate->native_context()->get(index))); - - // Check we're still in the same context. - Register scratch = prototype; + MacroAssembler* masm, int index, Register result, Label* miss) { const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ lw(scratch, MemOperand(cp, offset)); - __ lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); - __ lw(scratch, MemOperand(scratch, Context::SlotOffset(index))); - __ li(at, function); - __ Branch(miss, ne, at, Operand(scratch)); - + __ lw(result, MemOperand(cp, offset)); + __ lw(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset)); + __ lw(result, MemOperand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ li(prototype, Handle(function->initial_map())); + __ lw(result, + FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ lw(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); + __ lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/mips64/handler-compiler-mips64.cc b/src/ic/mips64/handler-compiler-mips64.cc index 0277687..9d63460 100644 --- a/src/ic/mips64/handler-compiler-mips64.cc +++ b/src/ic/mips64/handler-compiler-mips64.cc @@ -138,25 +138,17 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - Isolate* isolate = masm->isolate(); - // Get the global function with the given index. - Handle function( - JSFunction::cast(isolate->native_context()->get(index))); - + MacroAssembler* masm, int index, Register result, Label* miss) { // Check we're still in the same context. - Register scratch = prototype; const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ ld(scratch, MemOperand(cp, offset)); - __ ld(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); - __ ld(scratch, MemOperand(scratch, Context::SlotOffset(index))); - __ li(at, function); - __ Branch(miss, ne, at, Operand(scratch)); - + __ ld(result, MemOperand(cp, offset)); + __ ld(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset)); + __ ld(result, MemOperand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ li(prototype, Handle(function->initial_map())); + __ ld(result, + FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ ld(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); + __ ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index 4ec0289..2e19fb5 100644 --- a/src/ic/x64/handler-compiler-x64.cc +++ b/src/ic/x64/handler-compiler-x64.cc @@ -56,24 +56,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - Isolate* isolate = masm->isolate(); - // Get the global function with the given index. - Handle function( - JSFunction::cast(isolate->native_context()->get(index))); - - // Check we're still in the same context. - Register scratch = prototype; + MacroAssembler* masm, int index, Register result, Label* miss) { const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ movp(scratch, Operand(rsi, offset)); - __ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); - __ Cmp(Operand(scratch, Context::SlotOffset(index)), function); - __ j(not_equal, miss); - + __ movp(result, Operand(rsi, offset)); + __ movp(result, FieldOperand(result, GlobalObject::kNativeContextOffset)); + __ movp(result, Operand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ Move(prototype, Handle(function->initial_map())); + __ movp(result, + FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); + __ movp(result, FieldOperand(result, Map::kPrototypeOffset)); } diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index b23b235..1a2335b 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -88,22 +88,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( - MacroAssembler* masm, int index, Register prototype, Label* miss) { - // Get the global function with the given index. - Handle function( - JSFunction::cast(masm->isolate()->native_context()->get(index))); - // Check we're still in the same context. - Register scratch = prototype; + MacroAssembler* masm, int index, Register result, Label* miss) { const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX); - __ mov(scratch, Operand(esi, offset)); - __ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); - __ cmp(Operand(scratch, Context::SlotOffset(index)), function); - __ j(not_equal, miss); - + __ mov(result, Operand(esi, offset)); + __ mov(result, FieldOperand(result, GlobalObject::kNativeContextOffset)); + __ mov(result, Operand(result, Context::SlotOffset(index))); // Load its initial map. The global functions all have initial maps. - __ Move(prototype, Immediate(Handle(function->initial_map()))); + __ mov(result, + FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); // Load the prototype from the initial map. - __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); + __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); } -- 2.7.4