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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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" |
11 #include "src/runtime/runtime.h" | 11 #include "src/runtime/runtime.h" |
12 | 12 |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 | 17 |
18 #define __ ACCESS_MASM(masm) | 18 #define __ ACCESS_MASM(masm) |
19 | 19 |
20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, | 20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) { |
21 ExitFrameType exit_frame_type) { | |
22 // ----------- S t a t e ------------- | 21 // ----------- S t a t e ------------- |
23 // -- a0 : number of arguments excluding receiver | 22 // -- a0 : number of arguments excluding receiver |
24 // -- a1 : target | 23 // -- a1 : target |
25 // -- a3 : new.target | 24 // -- a3 : new.target |
26 // -- sp[0] : last argument | 25 // -- sp[0] : last argument |
27 // -- ... | 26 // -- ... |
28 // -- sp[4 * (argc - 1)] : first argument | 27 // -- sp[4 * (argc - 1)] : first argument |
29 // -- sp[4 * agrc] : receiver | 28 // -- sp[4 * agrc] : receiver |
30 // ----------------------------------- | 29 // ----------------------------------- |
31 __ AssertFunction(a1); | 30 __ AssertFunction(a1); |
32 | 31 |
33 // Make sure we operate in the context of the called function (for example | 32 // Make sure we operate in the context of the called function (for example |
34 // ConstructStubs implemented in C++ will be run in the context of the caller | 33 // ConstructStubs implemented in C++ will be run in the context of the caller |
35 // instead of the callee, due to the way that [[Construct]] is defined for | 34 // instead of the callee, due to the way that [[Construct]] is defined for |
36 // ordinary functions). | 35 // ordinary functions). |
37 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 36 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
38 | 37 |
39 // Insert extra arguments. | 38 // Insert extra arguments. |
40 const int num_extra_args = 2; | 39 const int num_extra_args = 2; |
41 __ Push(a1, a3); | 40 __ Push(a1, a3); |
42 | 41 |
43 // JumpToExternalReference expects a0 to contain the number of arguments | 42 // JumpToExternalReference expects a0 to contain the number of arguments |
44 // including the receiver and the extra arguments. | 43 // including the receiver and the extra arguments. |
45 __ Addu(a0, a0, num_extra_args + 1); | 44 __ Addu(a0, a0, num_extra_args + 1); |
46 | 45 |
47 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), PROTECT, | 46 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
48 exit_frame_type == BUILTIN_EXIT); | |
49 } | 47 } |
50 | 48 |
51 | 49 |
52 // Load the built-in InternalArray function from the current context. | 50 // Load the built-in InternalArray function from the current context. |
53 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 51 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
54 Register result) { | 52 Register result) { |
55 // Load the InternalArray function from the native context. | 53 // Load the InternalArray function from the native context. |
56 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); | 54 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
57 } | 55 } |
58 | 56 |
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2972 } | 2970 } |
2973 } | 2971 } |
2974 | 2972 |
2975 | 2973 |
2976 #undef __ | 2974 #undef __ |
2977 | 2975 |
2978 } // namespace internal | 2976 } // namespace internal |
2979 } // namespace v8 | 2977 } // namespace v8 |
2980 | 2978 |
2981 #endif // V8_TARGET_ARCH_MIPS | 2979 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |