Chromium Code Reviews| 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); | 32 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 36 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
| 37 CFunctionId id, | 37 CFunctionId id, |
| 38 BuiltinExtraArguments extra_args) { | 38 BuiltinExtraArguments extra_args) { |
| 39 // ----------- S t a t e ------------- | 39 // ----------- S t a t e ------------- |
| 40 // -- x0 : number of arguments excluding receiver | 40 // -- x0 : number of arguments excluding receiver |
| 41 // (only guaranteed when the called function | 41 // (only guaranteed when the called function |
| 42 // is not marked as DontAdaptArguments) | 42 // is not marked as DontAdaptArguments) |
|
Jarin
2015/12/02 07:00:36
Should not this comment be updated?
Benedikt Meurer
2015/12/02 07:02:57
Done.
| |
| 43 // -- x1 : called function | 43 // -- x1 : called function |
| 44 // -- sp[0] : last argument | 44 // -- sp[0] : last argument |
| 45 // -- ... | 45 // -- ... |
| 46 // -- sp[4 * (argc - 1)] : first argument | 46 // -- sp[4 * (argc - 1)] : first argument |
| 47 // -- sp[4 * argc] : receiver | 47 // -- sp[4 * argc] : receiver |
| 48 // ----------------------------------- | 48 // ----------------------------------- |
| 49 __ AssertFunction(x1); | 49 __ AssertFunction(x1); |
| 50 | 50 |
| 51 // Make sure we operate in the context of the called function (for example | |
| 52 // ConstructStubs implemented in C++ will be run in the context of the caller | |
| 53 // instead of the callee, due to the way that [[Construct]] is defined for | |
| 54 // ordinary functions). | |
| 55 // TODO(bmeurer): Can we make this more robust? | |
| 56 __ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset)); | |
| 57 | |
| 58 // Insert extra arguments. | 51 // Insert extra arguments. |
| 59 int num_extra_args = 0; | 52 int num_extra_args = 0; |
| 60 if (extra_args == NEEDS_CALLED_FUNCTION) { | 53 if (extra_args == NEEDS_CALLED_FUNCTION) { |
| 61 num_extra_args = 1; | 54 num_extra_args = 1; |
| 62 __ Push(x1); | 55 __ Push(x1); |
| 63 } else { | 56 } else { |
| 64 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); | 57 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); |
| 65 } | 58 } |
| 66 | 59 |
| 67 // JumpToExternalReference expects x0 to contain the number of arguments | 60 // JumpToExternalReference expects x0 to contain the number of arguments |
| 68 // including the receiver and the extra arguments. But x0 is only valid | 61 // including the receiver and the extra arguments. |
| 69 // if the called function is marked as DontAdaptArguments, otherwise we | |
| 70 // need to load the argument count from the SharedFunctionInfo. | |
| 71 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | |
| 72 __ Ldrsw( | |
| 73 x2, FieldMemOperand(x2, SharedFunctionInfo::kFormalParameterCountOffset)); | |
| 74 __ Cmp(x2, SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 75 __ Csel(x0, x0, x2, eq); | |
| 76 __ Add(x0, x0, num_extra_args + 1); | 62 __ Add(x0, x0, num_extra_args + 1); |
| 77 | 63 |
| 78 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 64 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 79 } | 65 } |
| 80 | 66 |
| 81 | 67 |
| 82 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 68 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
| 83 // ----------- S t a t e ------------- | 69 // ----------- S t a t e ------------- |
| 84 // -- x0 : number of arguments | 70 // -- x0 : number of arguments |
| 85 // -- lr : return address | 71 // -- lr : return address |
| (...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2043 } | 2029 } |
| 2044 } | 2030 } |
| 2045 | 2031 |
| 2046 | 2032 |
| 2047 #undef __ | 2033 #undef __ |
| 2048 | 2034 |
| 2049 } // namespace internal | 2035 } // namespace internal |
| 2050 } // namespace v8 | 2036 } // namespace v8 |
| 2051 | 2037 |
| 2052 #endif // V8_TARGET_ARCH_ARM | 2038 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |