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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/ic/handler-compiler.h" | 12 #include "src/ic/handler-compiler.h" |
13 #include "src/isolate.h" | 13 #include "src/isolate.h" |
14 #include "src/jsregexp.h" | 14 #include "src/jsregexp.h" |
15 #include "src/regexp-macro-assembler.h" | 15 #include "src/regexp-macro-assembler.h" |
16 #include "src/runtime.h" | 16 #include "src/runtime.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 | 21 |
22 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
23 Isolate* isolate, CodeStub::Major major, | 23 Isolate* isolate, CodeStubDescriptor* descriptor, |
24 CodeStubInterfaceDescriptor* descriptor, | |
25 int constant_stack_parameter_count) { | 24 int constant_stack_parameter_count) { |
26 Address deopt_handler = Runtime::FunctionForId( | 25 Address deopt_handler = Runtime::FunctionForId( |
27 Runtime::kArrayConstructor)->entry; | 26 Runtime::kArrayConstructor)->entry; |
28 | 27 |
29 if (constant_stack_parameter_count == 0) { | 28 if (constant_stack_parameter_count == 0) { |
30 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 29 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
31 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
32 constant_stack_parameter_count, | |
33 JS_FUNCTION_STUB_MODE); | 30 JS_FUNCTION_STUB_MODE); |
34 } else { | 31 } else { |
35 ArrayConstructorDescriptor call_descriptor(isolate); | 32 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, |
36 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, | |
37 constant_stack_parameter_count, | |
38 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 33 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
39 } | 34 } |
40 } | 35 } |
41 | 36 |
42 | 37 |
43 static void InitializeInternalArrayConstructorDescriptor( | 38 static void InitializeInternalArrayConstructorDescriptor( |
44 Isolate* isolate, CodeStub::Major major, | 39 Isolate* isolate, CodeStubDescriptor* descriptor, |
45 CodeStubInterfaceDescriptor* descriptor, | |
46 int constant_stack_parameter_count) { | 40 int constant_stack_parameter_count) { |
47 Address deopt_handler = Runtime::FunctionForId( | 41 Address deopt_handler = Runtime::FunctionForId( |
48 Runtime::kInternalArrayConstructor)->entry; | 42 Runtime::kInternalArrayConstructor)->entry; |
49 | 43 |
50 if (constant_stack_parameter_count == 0) { | 44 if (constant_stack_parameter_count == 0) { |
51 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 45 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
52 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
53 constant_stack_parameter_count, | |
54 JS_FUNCTION_STUB_MODE); | 46 JS_FUNCTION_STUB_MODE); |
55 } else { | 47 } else { |
56 InternalArrayConstructorDescriptor call_descriptor(isolate); | 48 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, |
57 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, | |
58 constant_stack_parameter_count, | |
59 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 49 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
60 } | 50 } |
61 } | 51 } |
62 | 52 |
63 | 53 |
64 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 54 void ArrayNoArgumentConstructorStub::InitializeDescriptor( |
65 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubDescriptor* descriptor) { |
66 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 56 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0); |
67 } | 57 } |
68 | 58 |
69 | 59 |
70 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 60 void ArraySingleArgumentConstructorStub::InitializeDescriptor( |
71 CodeStubInterfaceDescriptor* descriptor) { | 61 CodeStubDescriptor* descriptor) { |
72 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); | 62 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1); |
73 } | 63 } |
74 | 64 |
75 | 65 |
76 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 66 void ArrayNArgumentsConstructorStub::InitializeDescriptor( |
77 CodeStubInterfaceDescriptor* descriptor) { | 67 CodeStubDescriptor* descriptor) { |
78 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); | 68 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); |
79 } | 69 } |
80 | 70 |
81 | 71 |
82 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 72 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor( |
83 CodeStubInterfaceDescriptor* descriptor) { | 73 CodeStubDescriptor* descriptor) { |
84 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 74 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0); |
85 descriptor, 0); | |
86 } | 75 } |
87 | 76 |
88 | 77 |
89 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 78 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor( |
90 CodeStubInterfaceDescriptor* descriptor) { | 79 CodeStubDescriptor* descriptor) { |
91 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 80 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1); |
92 descriptor, 1); | |
93 } | 81 } |
94 | 82 |
95 | 83 |
96 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 84 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( |
97 CodeStubInterfaceDescriptor* descriptor) { | 85 CodeStubDescriptor* descriptor) { |
98 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 86 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); |
99 descriptor, -1); | |
100 } | 87 } |
101 | 88 |
102 | 89 |
103 #define __ ACCESS_MASM(masm) | 90 #define __ ACCESS_MASM(masm) |
104 | 91 |
105 | 92 |
106 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 93 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
107 Label* slow, | 94 Label* slow, |
108 Condition cc); | 95 Condition cc); |
109 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 96 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
110 Register lhs, | 97 Register lhs, |
111 Register rhs, | 98 Register rhs, |
112 Label* rhs_not_nan, | 99 Label* rhs_not_nan, |
113 Label* slow, | 100 Label* slow, |
114 bool strict); | 101 bool strict); |
115 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 102 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
116 Register lhs, | 103 Register lhs, |
117 Register rhs); | 104 Register rhs); |
118 | 105 |
119 | 106 |
120 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 107 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
| 108 ExternalReference miss) { |
121 // Update the static counter each time a new code stub is generated. | 109 // Update the static counter each time a new code stub is generated. |
122 isolate()->counters()->code_stubs()->Increment(); | 110 isolate()->counters()->code_stubs()->Increment(); |
123 | 111 |
124 CodeStubInterfaceDescriptor descriptor(this); | 112 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
125 int param_count = descriptor.GetEnvironmentParameterCount(); | 113 int param_count = descriptor.GetEnvironmentParameterCount(); |
126 { | 114 { |
127 // Call the runtime system in a fresh internal frame. | 115 // Call the runtime system in a fresh internal frame. |
128 FrameScope scope(masm, StackFrame::INTERNAL); | 116 FrameScope scope(masm, StackFrame::INTERNAL); |
129 DCHECK((param_count == 0) || | 117 DCHECK((param_count == 0) || |
130 a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 118 a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
131 // Push arguments, adjust sp. | 119 // Push arguments, adjust sp. |
132 __ Dsubu(sp, sp, Operand(param_count * kPointerSize)); | 120 __ Dsubu(sp, sp, Operand(param_count * kPointerSize)); |
133 for (int i = 0; i < param_count; ++i) { | 121 for (int i = 0; i < param_count; ++i) { |
134 // Store argument to stack. | 122 // Store argument to stack. |
135 __ sd(descriptor.GetEnvironmentParameterRegister(i), | 123 __ sd(descriptor.GetEnvironmentParameterRegister(i), |
136 MemOperand(sp, (param_count - 1 - i) * kPointerSize)); | 124 MemOperand(sp, (param_count - 1 - i) * kPointerSize)); |
137 } | 125 } |
138 ExternalReference miss = descriptor.miss_handler(); | |
139 __ CallExternalReference(miss, param_count); | 126 __ CallExternalReference(miss, param_count); |
140 } | 127 } |
141 | 128 |
142 __ Ret(); | 129 __ Ret(); |
143 } | 130 } |
144 | 131 |
145 | 132 |
146 void DoubleToIStub::Generate(MacroAssembler* masm) { | 133 void DoubleToIStub::Generate(MacroAssembler* masm) { |
147 Label out_of_range, only_low, negate, done; | 134 Label out_of_range, only_low, negate, done; |
148 Register input_reg = source(); | 135 Register input_reg = source(); |
(...skipping 4775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4924 MemOperand(fp, 6 * kPointerSize), | 4911 MemOperand(fp, 6 * kPointerSize), |
4925 NULL); | 4912 NULL); |
4926 } | 4913 } |
4927 | 4914 |
4928 | 4915 |
4929 #undef __ | 4916 #undef __ |
4930 | 4917 |
4931 } } // namespace v8::internal | 4918 } } // namespace v8::internal |
4932 | 4919 |
4933 #endif // V8_TARGET_ARCH_MIPS64 | 4920 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |