Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips64/code-stubs-mips64.cc

Issue 2412453005: [stubs] Refactor the CallICStub to pass the number of arguments. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, 1957 static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
1958 Register slot) { 1958 Register slot) {
1959 __ dsrl(t0, slot, 32 - kPointerSizeLog2); 1959 __ dsrl(t0, slot, 32 - kPointerSizeLog2);
1960 __ Daddu(slot, feedback_vector, Operand(t0)); 1960 __ Daddu(slot, feedback_vector, Operand(t0));
1961 __ ld(t0, FieldMemOperand(slot, FixedArray::kHeaderSize + kPointerSize)); 1961 __ ld(t0, FieldMemOperand(slot, FixedArray::kHeaderSize + kPointerSize));
1962 __ Daddu(t0, t0, Operand(Smi::FromInt(1))); 1962 __ Daddu(t0, t0, Operand(Smi::FromInt(1)));
1963 __ sd(t0, FieldMemOperand(slot, FixedArray::kHeaderSize + kPointerSize)); 1963 __ sd(t0, FieldMemOperand(slot, FixedArray::kHeaderSize + kPointerSize));
1964 } 1964 }
1965 1965
1966 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { 1966 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
1967 // a0 - number of arguments
1967 // a1 - function 1968 // a1 - function
1968 // a3 - slot id 1969 // a3 - slot id
1969 // a2 - vector 1970 // a2 - vector
1970 // a4 - allocation site (loaded from vector[slot]) 1971 // a4 - allocation site (loaded from vector[slot])
1971 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); 1972 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at);
1972 __ Branch(miss, ne, a1, Operand(at)); 1973 __ Branch(miss, ne, a1, Operand(at));
1973 1974
1974 // Increment the call count for monomorphic function calls. 1975 // Increment the call count for monomorphic function calls.
1975 IncrementCallCount(masm, a2, a3); 1976 IncrementCallCount(masm, a2, a3);
1976 1977
1977 __ mov(a2, a4); 1978 __ mov(a2, a4);
1978 __ mov(a3, a1); 1979 __ mov(a3, a1);
1979 __ li(a0, Operand(arg_count()));
1980 ArrayConstructorStub stub(masm->isolate()); 1980 ArrayConstructorStub stub(masm->isolate());
1981 __ TailCallStub(&stub); 1981 __ TailCallStub(&stub);
1982 } 1982 }
1983 1983
1984 1984
1985 void CallICStub::Generate(MacroAssembler* masm) { 1985 void CallICStub::Generate(MacroAssembler* masm) {
1986 // a0 - number of arguments
1986 // a1 - function 1987 // a1 - function
1987 // a3 - slot id (Smi) 1988 // a3 - slot id (Smi)
1988 // a2 - vector 1989 // a2 - vector
1989 Label extra_checks_or_miss, call, call_function, call_count_incremented; 1990 Label extra_checks_or_miss, call, call_function, call_count_incremented;
1990 int argc = arg_count();
1991 ParameterCount actual(argc);
1992 1991
1993 // The checks. First, does r1 match the recorded monomorphic target? 1992 // The checks. First, does r1 match the recorded monomorphic target?
1994 __ dsrl(a4, a3, 32 - kPointerSizeLog2); 1993 __ dsrl(a4, a3, 32 - kPointerSizeLog2);
1995 __ Daddu(a4, a2, Operand(a4)); 1994 __ Daddu(a4, a2, Operand(a4));
1996 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize)); 1995 __ ld(a4, FieldMemOperand(a4, FixedArray::kHeaderSize));
1997 1996
1998 // We don't know that we have a weak cell. We might have a private symbol 1997 // We don't know that we have a weak cell. We might have a private symbol
1999 // or an AllocationSite, but the memory is safe to examine. 1998 // or an AllocationSite, but the memory is safe to examine.
2000 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to 1999 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to
2001 // FixedArray. 2000 // FixedArray.
(...skipping 13 matching lines...) Expand all
2015 // The compare above could have been a SMI/SMI comparison. Guard against this 2014 // The compare above could have been a SMI/SMI comparison. Guard against this
2016 // convincing us that we have a monomorphic JSFunction. 2015 // convincing us that we have a monomorphic JSFunction.
2017 __ JumpIfSmi(a1, &extra_checks_or_miss); 2016 __ JumpIfSmi(a1, &extra_checks_or_miss);
2018 2017
2019 __ bind(&call_function); 2018 __ bind(&call_function);
2020 // Increment the call count for monomorphic function calls. 2019 // Increment the call count for monomorphic function calls.
2021 IncrementCallCount(masm, a2, a3); 2020 IncrementCallCount(masm, a2, a3);
2022 2021
2023 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), 2022 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
2024 tail_call_mode()), 2023 tail_call_mode()),
2025 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), 2024 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg));
2026 USE_DELAY_SLOT);
2027 __ li(a0, Operand(argc)); // In delay slot.
2028 2025
2029 __ bind(&extra_checks_or_miss); 2026 __ bind(&extra_checks_or_miss);
2030 Label uninitialized, miss, not_allocation_site; 2027 Label uninitialized, miss, not_allocation_site;
2031 2028
2032 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); 2029 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
2033 __ Branch(&call, eq, a4, Operand(at)); 2030 __ Branch(&call, eq, a4, Operand(at));
2034 2031
2035 // Verify that a4 contains an AllocationSite 2032 // Verify that a4 contains an AllocationSite
2036 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset)); 2033 __ ld(a5, FieldMemOperand(a4, HeapObject::kMapOffset));
2037 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2034 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
(...skipping 21 matching lines...) Expand all
2059 __ Daddu(a4, a2, Operand(a4)); 2056 __ Daddu(a4, a2, Operand(a4));
2060 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); 2057 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
2061 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize)); 2058 __ sd(at, FieldMemOperand(a4, FixedArray::kHeaderSize));
2062 2059
2063 __ bind(&call); 2060 __ bind(&call);
2064 IncrementCallCount(masm, a2, a3); 2061 IncrementCallCount(masm, a2, a3);
2065 2062
2066 __ bind(&call_count_incremented); 2063 __ bind(&call_count_incremented);
2067 2064
2068 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), 2065 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
2069 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg), 2066 RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg));
2070 USE_DELAY_SLOT);
2071 __ li(a0, Operand(argc)); // In delay slot.
2072 2067
2073 __ bind(&uninitialized); 2068 __ bind(&uninitialized);
2074 2069
2075 // We are going monomorphic, provided we actually have a JSFunction. 2070 // We are going monomorphic, provided we actually have a JSFunction.
2076 __ JumpIfSmi(a1, &miss); 2071 __ JumpIfSmi(a1, &miss);
2077 2072
2078 // Goto miss case if we do not have a function. 2073 // Goto miss case if we do not have a function.
2079 __ GetObjectType(a1, a4, a4); 2074 __ GetObjectType(a1, a4, a4);
2080 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE)); 2075 __ Branch(&miss, ne, a4, Operand(JS_FUNCTION_TYPE));
2081 2076
2082 // Make sure the function is not the Array() function, which requires special 2077 // Make sure the function is not the Array() function, which requires special
2083 // behavior on MISS. 2078 // behavior on MISS.
2084 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a4); 2079 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a4);
2085 __ Branch(&miss, eq, a1, Operand(a4)); 2080 __ Branch(&miss, eq, a1, Operand(a4));
2086 2081
2087 // Make sure the function belongs to the same native context. 2082 // Make sure the function belongs to the same native context.
2088 __ ld(t0, FieldMemOperand(a1, JSFunction::kContextOffset)); 2083 __ ld(t0, FieldMemOperand(a1, JSFunction::kContextOffset));
2089 __ ld(t0, ContextMemOperand(t0, Context::NATIVE_CONTEXT_INDEX)); 2084 __ ld(t0, ContextMemOperand(t0, Context::NATIVE_CONTEXT_INDEX));
2090 __ ld(t1, NativeContextMemOperand()); 2085 __ ld(t1, NativeContextMemOperand());
2091 __ Branch(&miss, ne, t0, Operand(t1)); 2086 __ Branch(&miss, ne, t0, Operand(t1));
2092 2087
2093 // Store the function. Use a stub since we need a frame for allocation. 2088 // Store the function. Use a stub since we need a frame for allocation.
2094 // a2 - vector 2089 // a2 - vector
2095 // a3 - slot 2090 // a3 - slot
2096 // a1 - function 2091 // a1 - function
2097 { 2092 {
2098 FrameScope scope(masm, StackFrame::INTERNAL); 2093 FrameScope scope(masm, StackFrame::INTERNAL);
2099 CreateWeakCellStub create_stub(masm->isolate()); 2094 CreateWeakCellStub create_stub(masm->isolate());
2095 __ SmiTag(a0);
2096 __ Push(a0);
2100 __ Push(a2, a3); 2097 __ Push(a2, a3);
2101 __ Push(cp, a1); 2098 __ Push(cp, a1);
2102 __ CallStub(&create_stub); 2099 __ CallStub(&create_stub);
2103 __ Pop(cp, a1); 2100 __ Pop(cp, a1);
2104 __ Pop(a2, a3); 2101 __ Pop(a2, a3);
2102 __ Pop(a0);
2103 __ SmiUntag(a0);
2105 } 2104 }
2106 2105
2107 __ Branch(&call_function); 2106 __ Branch(&call_function);
2108 2107
2109 // We are here because tracing is on or we encountered a MISS case we can't 2108 // We are here because tracing is on or we encountered a MISS case we can't
2110 // handle here. 2109 // handle here.
2111 __ bind(&miss); 2110 __ bind(&miss);
2112 GenerateMiss(masm); 2111 GenerateMiss(masm);
2113 2112
2114 __ Branch(&call_count_incremented); 2113 __ Branch(&call_count_incremented);
2115 } 2114 }
2116 2115
2117 2116
2118 void CallICStub::GenerateMiss(MacroAssembler* masm) { 2117 void CallICStub::GenerateMiss(MacroAssembler* masm) {
2119 FrameScope scope(masm, StackFrame::INTERNAL); 2118 FrameScope scope(masm, StackFrame::INTERNAL);
2120 2119
2120 // Preserve number of arguments as Smi.
2121 __ SmiTag(a0);
2122 __ Push(a0);
2123
2121 // Push the receiver and the function and feedback info. 2124 // Push the receiver and the function and feedback info.
2122 __ Push(a1, a2, a3); 2125 __ Push(a1, a2, a3);
2123 2126
2124 // Call the entry. 2127 // Call the entry.
2125 __ CallRuntime(Runtime::kCallIC_Miss); 2128 __ CallRuntime(Runtime::kCallIC_Miss);
2126 2129
2127 // Move result to a1 and exit the internal frame. 2130 // Move result to a1 and exit the internal frame.
2128 __ mov(a1, v0); 2131 __ mov(a1, v0);
2132
2133 // Restore number of arguments.
2134 __ Pop(a0);
2135 __ SmiUntag(a0);
2129 } 2136 }
2130 2137
2131 2138
2132 void StringCharCodeAtGenerator::GenerateSlow( 2139 void StringCharCodeAtGenerator::GenerateSlow(
2133 MacroAssembler* masm, EmbedMode embed_mode, 2140 MacroAssembler* masm, EmbedMode embed_mode,
2134 const RuntimeCallHelper& call_helper) { 2141 const RuntimeCallHelper& call_helper) {
2135 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); 2142 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase);
2136 2143
2137 // Index is not a smi. 2144 // Index is not a smi.
2138 __ bind(&index_not_smi_); 2145 __ bind(&index_not_smi_);
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after
5102 kStackUnwindSpace, kInvalidStackOffset, 5109 kStackUnwindSpace, kInvalidStackOffset,
5103 return_value_operand, NULL); 5110 return_value_operand, NULL);
5104 } 5111 }
5105 5112
5106 #undef __ 5113 #undef __
5107 5114
5108 } // namespace internal 5115 } // namespace internal
5109 } // namespace v8 5116 } // namespace v8
5110 5117
5111 #endif // V8_TARGET_ARCH_MIPS64 5118 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698