OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 // We've seen something for the first time -> deopt. | 1973 // We've seen something for the first time -> deopt. |
1974 // This can only happen if we are not generic already. | 1974 // This can only happen if we are not generic already. |
1975 Deoptimize(instr, "unexpected object"); | 1975 Deoptimize(instr, "unexpected object"); |
1976 } | 1976 } |
1977 } | 1977 } |
1978 } | 1978 } |
1979 } | 1979 } |
1980 | 1980 |
1981 | 1981 |
1982 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, | 1982 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
1983 int formal_parameter_count, | 1983 int formal_parameter_count, int arity, |
1984 int arity, | 1984 LInstruction* instr) { |
1985 LInstruction* instr, | |
1986 Register function_reg) { | |
1987 bool dont_adapt_arguments = | 1985 bool dont_adapt_arguments = |
1988 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 1986 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
1989 bool can_invoke_directly = | 1987 bool can_invoke_directly = |
1990 dont_adapt_arguments || formal_parameter_count == arity; | 1988 dont_adapt_arguments || formal_parameter_count == arity; |
1991 | 1989 |
1992 // The function interface relies on the following register assignments. | 1990 // The function interface relies on the following register assignments. |
1993 DCHECK(function_reg.Is(x1) || function_reg.IsNone()); | 1991 Register function_reg = x1; |
1994 Register arity_reg = x0; | 1992 Register arity_reg = x0; |
1995 | 1993 |
1996 LPointerMap* pointers = instr->pointer_map(); | 1994 LPointerMap* pointers = instr->pointer_map(); |
1997 | 1995 |
1998 // If necessary, load the function object. | |
1999 if (function_reg.IsNone()) { | |
2000 function_reg = x1; | |
2001 __ LoadObject(function_reg, function); | |
2002 } | |
2003 | |
2004 if (FLAG_debug_code) { | 1996 if (FLAG_debug_code) { |
2005 Label is_not_smi; | 1997 Label is_not_smi; |
2006 // Try to confirm that function_reg (x1) is a tagged pointer. | 1998 // Try to confirm that function_reg (x1) is a tagged pointer. |
2007 __ JumpIfNotSmi(function_reg, &is_not_smi); | 1999 __ JumpIfNotSmi(function_reg, &is_not_smi); |
2008 __ Abort(kExpectedFunctionObject); | 2000 __ Abort(kExpectedFunctionObject); |
2009 __ Bind(&is_not_smi); | 2001 __ Bind(&is_not_smi); |
2010 } | 2002 } |
2011 | 2003 |
2012 if (can_invoke_directly) { | 2004 if (can_invoke_directly) { |
2013 // Change context. | 2005 // Change context. |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 | 3201 |
3210 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); | 3202 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); |
3211 if (known_function.is_null()) { | 3203 if (known_function.is_null()) { |
3212 LPointerMap* pointers = instr->pointer_map(); | 3204 LPointerMap* pointers = instr->pointer_map(); |
3213 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3205 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3214 ParameterCount count(instr->arity()); | 3206 ParameterCount count(instr->arity()); |
3215 __ InvokeFunction(x1, count, CALL_FUNCTION, generator); | 3207 __ InvokeFunction(x1, count, CALL_FUNCTION, generator); |
3216 } else { | 3208 } else { |
3217 CallKnownFunction(known_function, | 3209 CallKnownFunction(known_function, |
3218 instr->hydrogen()->formal_parameter_count(), | 3210 instr->hydrogen()->formal_parameter_count(), |
3219 instr->arity(), | 3211 instr->arity(), instr); |
3220 instr, | |
3221 x1); | |
3222 } | 3212 } |
3223 after_push_argument_ = false; | 3213 after_push_argument_ = false; |
3224 } | 3214 } |
3225 | 3215 |
3226 | 3216 |
3227 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 3217 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
3228 Register temp1 = ToRegister(instr->temp1()); | 3218 Register temp1 = ToRegister(instr->temp1()); |
3229 Register temp2 = ToRegister(instr->temp2()); | 3219 Register temp2 = ToRegister(instr->temp2()); |
3230 | 3220 |
3231 // Get the frame pointer for the calling frame. | 3221 // Get the frame pointer for the calling frame. |
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6076 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6066 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6077 __ Push(scope_info); | 6067 __ Push(scope_info); |
6078 __ Push(ToRegister(instr->function())); | 6068 __ Push(ToRegister(instr->function())); |
6079 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6069 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6080 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6070 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6081 } | 6071 } |
6082 | 6072 |
6083 | 6073 |
6084 | 6074 |
6085 } } // namespace v8::internal | 6075 } } // namespace v8::internal |
OLD | NEW |