diff --git a/src/a64/code-stubs-a64.cc b/src/a64/code-stubs-a64.cc index b8f5809fb8..89bc51cb60 100644 --- a/src/a64/code-stubs-a64.cc +++ b/src/a64/code-stubs-a64.cc @@ -3290,7 +3290,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { __ JumpIfNotRoot(x5, Heap::kAllocationSiteMapRootIndex, &miss); // Make sure the function is the Array() function - __ LoadArrayFunction(x4); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, x4); __ Cmp(x1, x4); __ B(ne, &megamorphic); __ B(&done); @@ -3312,7 +3312,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { // indicate the ElementsKind if function is the Array constructor. __ Bind(&initialize); // Make sure the function is the Array() function - __ LoadArrayFunction(x4); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, x4); __ Cmp(x1, x4); __ B(ne, ¬_array_function); diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc index 5b979c2b31..e1a8755f4f 100644 --- a/src/a64/macro-assembler-a64.cc +++ b/src/a64/macro-assembler-a64.cc @@ -4712,17 +4712,6 @@ void MacroAssembler::LoadTransitionedArrayMapConditional( } -void MacroAssembler::LoadArrayFunction(Register function) { - // Load the global or builtins object from the current context. - Ldr(function, GlobalObjectMemOperand()); - // Load the global context from the global or builtins object. - Ldr(function, - FieldMemOperand(function, GlobalObject::kGlobalContextOffset)); - // Load the array function from the native context. - Ldr(function, ContextMemOperand(function, Context::ARRAY_FUNCTION_INDEX)); -} - - void MacroAssembler::LoadGlobalFunction(int index, Register function) { // Load the global or builtins object from the current context. Ldr(function, GlobalObjectMemOperand()); diff --git a/src/a64/macro-assembler-a64.h b/src/a64/macro-assembler-a64.h index 153e4d0367..09d667bbf0 100644 --- a/src/a64/macro-assembler-a64.h +++ b/src/a64/macro-assembler-a64.h @@ -1888,7 +1888,6 @@ class MacroAssembler : public Assembler { Register scratch, Label* no_map_match); - void LoadArrayFunction(Register function); void LoadGlobalFunction(int index, Register function); // Load the initial map from the global function. The registers function and diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index b3a3acf3e7..ac46fe8c12 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -3037,7 +3037,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { __ b(ne, &miss); // Make sure the function is the Array() function - __ LoadArrayFunction(r4); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); __ cmp(r1, r4); __ b(ne, &megamorphic); __ jmp(&done); @@ -3060,7 +3060,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { // indicate the ElementsKind if function is the Array constructor. __ bind(&initialize); // Make sure the function is the Array() function - __ LoadArrayFunction(r4); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); __ cmp(r1, r4); __ b(ne, ¬_array_function); diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 58ce0a8545..d705c90bd2 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2902,19 +2902,6 @@ void MacroAssembler::LoadGlobalFunction(int index, Register function) { } -void MacroAssembler::LoadArrayFunction(Register function) { - // Load the global or builtins object from the current context. - ldr(function, - MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - // Load the global context from the global or builtins object. - ldr(function, - FieldMemOperand(function, GlobalObject::kGlobalContextOffset)); - // Load the array function from the native context. - ldr(function, - MemOperand(function, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); -} - - void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, Register map, Register scratch) { diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index 67707fa311..0eaf4dc9b1 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -571,7 +571,6 @@ class MacroAssembler: public Assembler { Label* no_map_match); void LoadGlobalFunction(int index, Register function); - void LoadArrayFunction(Register function); // Load the initial map from the global function. The registers // function and map can be the same, function is then overwritten. diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 2f3df9e22a..55d19e05b2 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -8225,15 +8225,14 @@ static bool IsAllocationInlineable(Handle constructor) { bool HOptimizedGraphBuilder::IsCallNewArrayInlineable(CallNew* expr) { - Handle site = expr->allocation_site(); - if (site.is_null()) return false; - Handle caller = current_info()->closure(); Handle target(isolate()->native_context()->array_function(), isolate()); int argument_count = expr->arguments()->length(); // We should have the function plus array arguments on the environment stack. ASSERT(environment()->length() >= (argument_count + 1)); + Handle site = expr->allocation_site(); + ASSERT(!site.is_null()); bool inline_ok = false; if (site->CanInlineCall()) { diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 78824195df..2ef5a87da2 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -2352,11 +2352,9 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); __ j(not_equal, &miss); - // Load the global or builtins object from the current context - __ LoadGlobalContext(ecx); // Make sure the function is the Array() function - __ cmp(edi, Operand(ecx, - Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); + __ cmp(edi, ecx); __ j(not_equal, &megamorphic); __ jmp(&done, Label::kFar); @@ -2377,10 +2375,9 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { // An uninitialized cache is patched with the function or sentinel to // indicate the ElementsKind if function is the Array constructor. __ bind(&initialize); - __ LoadGlobalContext(ecx); // Make sure the function is the Array() function - __ cmp(edi, Operand(ecx, - Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); + __ cmp(edi, ecx); __ j(not_equal, ¬_array_function); // The target function is the Array constructor, diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 2f46398182..cc0f392f18 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -2689,16 +2689,6 @@ void MacroAssembler::LoadTransitionedArrayMapConditional( } -void MacroAssembler::LoadGlobalContext(Register global_context) { - // Load the global or builtins object from the current context. - mov(global_context, - Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - // Load the native context from the global or builtins object. - mov(global_context, - FieldOperand(global_context, GlobalObject::kNativeContextOffset)); -} - - void MacroAssembler::LoadGlobalFunction(int index, Register function) { // Load the global or builtins object from the current context. mov(function, diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index 456845881f..6b0573ca6e 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -262,8 +262,6 @@ class MacroAssembler: public Assembler { Register scratch, Label* no_map_match); - void LoadGlobalContext(Register global_context); - // Load the global function with the given index. void LoadGlobalFunction(int index, Register function); diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 4b3107fec7..dba129ac9a 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -3184,7 +3184,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { __ Branch(&miss, ne, t1, Operand(at)); // Make sure the function is the Array() function - __ LoadArrayFunction(t0); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); __ Branch(&megamorphic, ne, a1, Operand(t0)); __ jmp(&done); @@ -3207,7 +3207,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { // indicate the ElementsKind if function is the Array constructor. __ bind(&initialize); // Make sure the function is the Array() function - __ LoadArrayFunction(t0); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); __ Branch(¬_array_function, ne, a1, Operand(t0)); // The target function is the Array constructor. diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index ddf926a765..1c22a89e15 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -4442,19 +4442,6 @@ void MacroAssembler::LoadGlobalFunction(int index, Register function) { } -void MacroAssembler::LoadArrayFunction(Register function) { - // Load the global or builtins object from the current context. - lw(function, - MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - // Load the global context from the global or builtins object. - lw(function, - FieldMemOperand(function, GlobalObject::kGlobalContextOffset)); - // Load the array function from the native context. - lw(function, - MemOperand(function, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); -} - - void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, Register map, Register scratch) { diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index 45bfcb38d2..1b64f25689 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -872,7 +872,6 @@ class MacroAssembler: public Assembler { Label* no_map_match); void LoadGlobalFunction(int index, Register function); - void LoadArrayFunction(Register function); // Load the initial map from the global function. The registers // function and map can be the same, function is then overwritten. diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index 8c5a430014..9cf02fafd9 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -2194,7 +2194,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { __ j(not_equal, &miss); // Make sure the function is the Array() function - __ LoadArrayFunction(rcx); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); __ cmpq(rdi, rcx); __ j(not_equal, &megamorphic); __ jmp(&done); @@ -2216,7 +2216,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { // indicate the ElementsKind if function is the Array constructor. __ bind(&initialize); // Make sure the function is the Array() function - __ LoadArrayFunction(rcx); + __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); __ cmpq(rdi, rcx); __ j(not_equal, ¬_array_function); diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 5988b7d2a6..95f17247a9 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -4547,15 +4547,6 @@ void MacroAssembler::LoadGlobalFunction(int index, Register function) { } -void MacroAssembler::LoadArrayFunction(Register function) { - movp(function, - Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); - movp(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); - movp(function, - Operand(function, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); -} - - void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, Register map) { // Load the initial map. The global functions all have initial maps. diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 5efa2d9212..63cf9c5bcc 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -1236,7 +1236,6 @@ class MacroAssembler: public Assembler { // Load the global function with the given index. void LoadGlobalFunction(int index, Register function); - void LoadArrayFunction(Register function); // Load the initial map from the global function. The registers // function and map can be the same.