| OLD | NEW |
| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // (only guaranteed when the called function | 25 // (only guaranteed when the called function |
| 26 // is not marked as DontAdaptArguments) | 26 // is not marked as DontAdaptArguments) |
| 27 // -- r1 : called function | 27 // -- r1 : called function |
| 28 // -- sp[0] : last argument | 28 // -- sp[0] : last argument |
| 29 // -- ... | 29 // -- ... |
| 30 // -- sp[4 * (argc - 1)] : first argument | 30 // -- sp[4 * (argc - 1)] : first argument |
| 31 // -- sp[4 * argc] : receiver | 31 // -- sp[4 * argc] : receiver |
| 32 // ----------------------------------- | 32 // ----------------------------------- |
| 33 __ AssertFunction(r1); | 33 __ AssertFunction(r1); |
| 34 | 34 |
| 35 // Make sure we operate in the context of the called function (for example | |
| 36 // ConstructStubs implemented in C++ will be run in the context of the caller | |
| 37 // instead of the callee, due to the way that [[Construct]] is defined for | |
| 38 // ordinary functions). | |
| 39 // TODO(bmeurer): Can we make this more robust? | |
| 40 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | |
| 41 | |
| 42 // Insert extra arguments. | 35 // Insert extra arguments. |
| 43 int num_extra_args = 0; | 36 int num_extra_args = 0; |
| 44 if (extra_args == NEEDS_CALLED_FUNCTION) { | 37 if (extra_args == NEEDS_CALLED_FUNCTION) { |
| 45 num_extra_args = 1; | 38 num_extra_args = 1; |
| 46 __ push(r1); | 39 __ push(r1); |
| 47 } else { | 40 } else { |
| 48 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); | 41 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); |
| 49 } | 42 } |
| 50 | 43 |
| 51 // JumpToExternalReference expects r0 to contain the number of arguments | 44 // JumpToExternalReference expects r0 to contain the number of arguments |
| 52 // including the receiver and the extra arguments. But r0 is only valid | 45 // including the receiver and the extra arguments. |
| 53 // if the called function is marked as DontAdaptArguments, otherwise we | |
| 54 // need to load the argument count from the SharedFunctionInfo. | |
| 55 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | |
| 56 __ ldr(r2, | |
| 57 FieldMemOperand(r2, SharedFunctionInfo::kFormalParameterCountOffset)); | |
| 58 __ SmiUntag(r2); | |
| 59 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | |
| 60 __ mov(r0, r2, LeaveCC, ne); | |
| 61 __ add(r0, r0, Operand(num_extra_args + 1)); | 46 __ add(r0, r0, Operand(num_extra_args + 1)); |
| 62 | 47 |
| 63 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 48 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 64 } | 49 } |
| 65 | 50 |
| 66 | 51 |
| 67 // Load the built-in InternalArray function from the current context. | 52 // Load the built-in InternalArray function from the current context. |
| 68 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 53 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
| 69 Register result) { | 54 Register result) { |
| 70 // Load the InternalArray function from the current native context. | 55 // Load the InternalArray function from the current native context. |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 } | 1942 } |
| 1958 } | 1943 } |
| 1959 | 1944 |
| 1960 | 1945 |
| 1961 #undef __ | 1946 #undef __ |
| 1962 | 1947 |
| 1963 } // namespace internal | 1948 } // namespace internal |
| 1964 } // namespace v8 | 1949 } // namespace v8 |
| 1965 | 1950 |
| 1966 #endif // V8_TARGET_ARCH_ARM | 1951 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |