| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 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 void FastNewClosureStub::InitializeInterfaceDescriptor( | |
| 23 CodeStubInterfaceDescriptor* descriptor) { | |
| 24 Register registers[] = { cp, a2 }; | |
| 25 descriptor->Initialize( | |
| 26 MajorKey(), arraysize(registers), registers, | |
| 27 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); | |
| 28 } | |
| 29 | |
| 30 | |
| 31 void FastNewContextStub::InitializeInterfaceDescriptor( | |
| 32 CodeStubInterfaceDescriptor* descriptor) { | |
| 33 Register registers[] = { cp, a1 }; | |
| 34 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
| 35 } | |
| 36 | |
| 37 | |
| 38 void ToNumberStub::InitializeInterfaceDescriptor( | |
| 39 CodeStubInterfaceDescriptor* descriptor) { | |
| 40 Register registers[] = { cp, a0 }; | |
| 41 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
| 42 } | |
| 43 | |
| 44 | |
| 45 void NumberToStringStub::InitializeInterfaceDescriptor( | |
| 46 CodeStubInterfaceDescriptor* descriptor) { | |
| 47 Register registers[] = { cp, a0 }; | |
| 48 descriptor->Initialize( | |
| 49 MajorKey(), arraysize(registers), registers, | |
| 50 Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry); | |
| 51 } | |
| 52 | |
| 53 | |
| 54 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | |
| 55 CodeStubInterfaceDescriptor* descriptor) { | |
| 56 Register registers[] = { cp, a3, a2, a1 }; | |
| 57 Representation representations[] = { | |
| 58 Representation::Tagged(), | |
| 59 Representation::Tagged(), | |
| 60 Representation::Smi(), | |
| 61 Representation::Tagged() }; | |
| 62 descriptor->Initialize( | |
| 63 MajorKey(), arraysize(registers), registers, | |
| 64 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry, | |
| 65 representations); | |
| 66 } | |
| 67 | |
| 68 | |
| 69 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( | |
| 70 CodeStubInterfaceDescriptor* descriptor) { | |
| 71 Register registers[] = { cp, a3, a2, a1, a0 }; | |
| 72 descriptor->Initialize( | |
| 73 MajorKey(), arraysize(registers), registers, | |
| 74 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); | |
| 75 } | |
| 76 | |
| 77 | |
| 78 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | |
| 79 CodeStubInterfaceDescriptor* descriptor) { | |
| 80 Register registers[] = { cp, a2, a3 }; | |
| 81 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
| 82 } | |
| 83 | |
| 84 | |
| 85 void CallFunctionStub::InitializeInterfaceDescriptor( | |
| 86 CodeStubInterfaceDescriptor* descriptor) { | |
| 87 UNIMPLEMENTED(); | |
| 88 } | |
| 89 | |
| 90 | |
| 91 void CallConstructStub::InitializeInterfaceDescriptor( | |
| 92 CodeStubInterfaceDescriptor* descriptor) { | |
| 93 UNIMPLEMENTED(); | |
| 94 } | |
| 95 | |
| 96 | |
| 97 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | |
| 98 CodeStubInterfaceDescriptor* descriptor) { | |
| 99 Register registers[] = { cp, a2, a1, a0 }; | |
| 100 descriptor->Initialize( | |
| 101 MajorKey(), arraysize(registers), registers, | |
| 102 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | |
| 103 } | |
| 104 | |
| 105 | |
| 106 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | |
| 107 CodeStubInterfaceDescriptor* descriptor) { | |
| 108 Register registers[] = { cp, a0, a1 }; | |
| 109 Address entry = | |
| 110 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | |
| 111 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 112 FUNCTION_ADDR(entry)); | |
| 113 } | |
| 114 | |
| 115 | |
| 116 void CompareNilICStub::InitializeInterfaceDescriptor( | |
| 117 CodeStubInterfaceDescriptor* descriptor) { | |
| 118 Register registers[] = { cp, a0 }; | |
| 119 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 120 FUNCTION_ADDR(CompareNilIC_Miss)); | |
| 121 descriptor->SetMissHandler( | |
| 122 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | |
| 123 } | |
| 124 | |
| 125 | |
| 126 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
| 127 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 23 Isolate* isolate, CodeStub::Major major, |
| 24 CodeStubInterfaceDescriptor* descriptor, |
| 128 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
| 129 // register state | |
| 130 // cp -- context | |
| 131 // a0 -- number of arguments | |
| 132 // a1 -- function | |
| 133 // a2 -- allocation site with elements kind | |
| 134 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
| 135 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
| 136 | 28 |
| 137 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
| 138 Register registers[] = { cp, a1, a2 }; | 30 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
| 139 descriptor->Initialize(major, arraysize(registers), registers, | 31 CallDescriptorKey::ArrayConstructorConstantArgCountCall); |
| 140 deopt_handler, NULL, constant_stack_parameter_count, | 32 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 33 constant_stack_parameter_count, |
| 141 JS_FUNCTION_STUB_MODE); | 34 JS_FUNCTION_STUB_MODE); |
| 142 } else { | 35 } else { |
| 143 // stack param count needs (constructor pointer, and single argument) | 36 CallInterfaceDescriptor* call_descriptor = |
| 144 Register registers[] = { cp, a1, a2, a0 }; | 37 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); |
| 145 Representation representations[] = { | 38 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, |
| 146 Representation::Tagged(), | |
| 147 Representation::Tagged(), | |
| 148 Representation::Tagged(), | |
| 149 Representation::Integer32() }; | |
| 150 descriptor->Initialize(major, arraysize(registers), registers, a0, | |
| 151 deopt_handler, representations, | |
| 152 constant_stack_parameter_count, | 39 constant_stack_parameter_count, |
| 153 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 40 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 154 } | 41 } |
| 155 } | 42 } |
| 156 | 43 |
| 157 | 44 |
| 158 static void InitializeInternalArrayConstructorDescriptor( | 45 static void InitializeInternalArrayConstructorDescriptor( |
| 159 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 46 Isolate* isolate, CodeStub::Major major, |
| 47 CodeStubInterfaceDescriptor* descriptor, |
| 160 int constant_stack_parameter_count) { | 48 int constant_stack_parameter_count) { |
| 161 // register state | |
| 162 // cp -- context | |
| 163 // a0 -- number of arguments | |
| 164 // a1 -- constructor function | |
| 165 Address deopt_handler = Runtime::FunctionForId( | 49 Address deopt_handler = Runtime::FunctionForId( |
| 166 Runtime::kInternalArrayConstructor)->entry; | 50 Runtime::kInternalArrayConstructor)->entry; |
| 167 | 51 |
| 168 if (constant_stack_parameter_count == 0) { | 52 if (constant_stack_parameter_count == 0) { |
| 169 Register registers[] = { cp, a1 }; | 53 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
| 170 descriptor->Initialize(major, arraysize(registers), registers, | 54 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); |
| 171 deopt_handler, NULL, constant_stack_parameter_count, | 55 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 56 constant_stack_parameter_count, |
| 172 JS_FUNCTION_STUB_MODE); | 57 JS_FUNCTION_STUB_MODE); |
| 173 } else { | 58 } else { |
| 174 // stack param count needs (constructor pointer, and single argument) | 59 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
| 175 Register registers[] = { cp, a1, a0 }; | 60 CallDescriptorKey::InternalArrayConstructorCall); |
| 176 Representation representations[] = { | 61 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, |
| 177 Representation::Tagged(), | |
| 178 Representation::Tagged(), | |
| 179 Representation::Integer32() }; | |
| 180 descriptor->Initialize(major, arraysize(registers), registers, a0, | |
| 181 deopt_handler, representations, | |
| 182 constant_stack_parameter_count, | 62 constant_stack_parameter_count, |
| 183 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 63 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 184 } | 64 } |
| 185 } | 65 } |
| 186 | 66 |
| 187 | 67 |
| 188 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 68 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 189 CodeStubInterfaceDescriptor* descriptor) { | 69 CodeStubInterfaceDescriptor* descriptor) { |
| 190 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 70 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); |
| 191 } | 71 } |
| 192 | 72 |
| 193 | 73 |
| 194 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 74 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 195 CodeStubInterfaceDescriptor* descriptor) { | 75 CodeStubInterfaceDescriptor* descriptor) { |
| 196 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 76 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); |
| 197 } | 77 } |
| 198 | 78 |
| 199 | 79 |
| 200 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 80 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
| 201 CodeStubInterfaceDescriptor* descriptor) { | 81 CodeStubInterfaceDescriptor* descriptor) { |
| 202 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 82 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); |
| 203 } | |
| 204 | |
| 205 | |
| 206 void ToBooleanStub::InitializeInterfaceDescriptor( | |
| 207 CodeStubInterfaceDescriptor* descriptor) { | |
| 208 Register registers[] = { cp, a0 }; | |
| 209 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 210 FUNCTION_ADDR(ToBooleanIC_Miss)); | |
| 211 descriptor->SetMissHandler( | |
| 212 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | |
| 213 } | 83 } |
| 214 | 84 |
| 215 | 85 |
| 216 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 86 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 217 CodeStubInterfaceDescriptor* descriptor) { | 87 CodeStubInterfaceDescriptor* descriptor) { |
| 218 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 88 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 89 descriptor, 0); |
| 219 } | 90 } |
| 220 | 91 |
| 221 | 92 |
| 222 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 93 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 223 CodeStubInterfaceDescriptor* descriptor) { | 94 CodeStubInterfaceDescriptor* descriptor) { |
| 224 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 95 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 96 descriptor, 1); |
| 225 } | 97 } |
| 226 | 98 |
| 227 | 99 |
| 228 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 100 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
| 229 CodeStubInterfaceDescriptor* descriptor) { | 101 CodeStubInterfaceDescriptor* descriptor) { |
| 230 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 102 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 103 descriptor, -1); |
| 231 } | 104 } |
| 232 | 105 |
| 233 | 106 |
| 234 void BinaryOpICStub::InitializeInterfaceDescriptor( | |
| 235 CodeStubInterfaceDescriptor* descriptor) { | |
| 236 Register registers[] = { cp, a1, a0 }; | |
| 237 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 238 FUNCTION_ADDR(BinaryOpIC_Miss)); | |
| 239 descriptor->SetMissHandler( | |
| 240 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | |
| 241 } | |
| 242 | |
| 243 | |
| 244 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | |
| 245 CodeStubInterfaceDescriptor* descriptor) { | |
| 246 Register registers[] = { cp, a2, a1, a0 }; | |
| 247 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 248 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); | |
| 249 } | |
| 250 | |
| 251 | |
| 252 void StringAddStub::InitializeInterfaceDescriptor( | |
| 253 CodeStubInterfaceDescriptor* descriptor) { | |
| 254 Register registers[] = { cp, a1, a0 }; | |
| 255 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
| 256 Runtime::FunctionForId(Runtime::kStringAdd)->entry); | |
| 257 } | |
| 258 | |
| 259 | |
| 260 #define __ ACCESS_MASM(masm) | 107 #define __ ACCESS_MASM(masm) |
| 261 | 108 |
| 262 | 109 |
| 263 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 110 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
| 264 Label* slow, | 111 Label* slow, |
| 265 Condition cc); | 112 Condition cc); |
| 266 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 113 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
| 267 Register lhs, | 114 Register lhs, |
| 268 Register rhs, | 115 Register rhs, |
| 269 Label* rhs_not_nan, | 116 Label* rhs_not_nan, |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 Label miss; | 1726 Label miss; |
| 1880 Register receiver = LoadConvention::ReceiverRegister(); | 1727 Register receiver = LoadConvention::ReceiverRegister(); |
| 1881 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, | 1728 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, |
| 1882 t0, &miss); | 1729 t0, &miss); |
| 1883 __ bind(&miss); | 1730 __ bind(&miss); |
| 1884 PropertyAccessCompiler::TailCallBuiltin( | 1731 PropertyAccessCompiler::TailCallBuiltin( |
| 1885 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 1732 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
| 1886 } | 1733 } |
| 1887 | 1734 |
| 1888 | 1735 |
| 1889 Register InstanceofStub::left() { return a0; } | |
| 1890 | |
| 1891 | |
| 1892 Register InstanceofStub::right() { return a1; } | |
| 1893 | |
| 1894 | |
| 1895 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1736 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
| 1896 // The displacement is the offset of the last parameter (if any) | 1737 // The displacement is the offset of the last parameter (if any) |
| 1897 // relative to the frame pointer. | 1738 // relative to the frame pointer. |
| 1898 const int kDisplacement = | 1739 const int kDisplacement = |
| 1899 StandardFrameConstants::kCallerSPOffset - kPointerSize; | 1740 StandardFrameConstants::kCallerSPOffset - kPointerSize; |
| 1900 | 1741 |
| 1901 // Check that the key is a smiGenerateReadElement. | 1742 // Check that the key is a smiGenerateReadElement. |
| 1902 Label slow; | 1743 Label slow; |
| 1903 __ JumpIfNotSmi(a1, &slow); | 1744 __ JumpIfNotSmi(a1, &slow); |
| 1904 | 1745 |
| (...skipping 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5223 MemOperand(fp, 6 * kPointerSize), | 5064 MemOperand(fp, 6 * kPointerSize), |
| 5224 NULL); | 5065 NULL); |
| 5225 } | 5066 } |
| 5226 | 5067 |
| 5227 | 5068 |
| 5228 #undef __ | 5069 #undef __ |
| 5229 | 5070 |
| 5230 } } // namespace v8::internal | 5071 } } // namespace v8::internal |
| 5231 | 5072 |
| 5232 #endif // V8_TARGET_ARCH_MIPS | 5073 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |