OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 static Register registers[] = { r0 }; | 186 static Register registers[] = { r0 }; |
187 descriptor->register_param_count_ = 1; | 187 descriptor->register_param_count_ = 1; |
188 descriptor->register_params_ = registers; | 188 descriptor->register_params_ = registers; |
189 descriptor->deoptimization_handler_ = | 189 descriptor->deoptimization_handler_ = |
190 FUNCTION_ADDR(CompareNilIC_Miss); | 190 FUNCTION_ADDR(CompareNilIC_Miss); |
191 descriptor->SetMissHandler( | 191 descriptor->SetMissHandler( |
192 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate)); | 192 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate)); |
193 } | 193 } |
194 | 194 |
195 | 195 |
| 196 void BinaryOpICStub::InitializeInterfaceDescriptor( |
| 197 Isolate* isolate, |
| 198 CodeStubInterfaceDescriptor* descriptor) { |
| 199 static Register registers[] = { r1, r0 }; |
| 200 descriptor->register_param_count_ = 2; |
| 201 descriptor->register_params_ = registers; |
| 202 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
| 203 descriptor->SetMissHandler( |
| 204 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
| 205 } |
| 206 |
| 207 |
196 static void InitializeArrayConstructorDescriptor( | 208 static void InitializeArrayConstructorDescriptor( |
197 Isolate* isolate, | 209 Isolate* isolate, |
198 CodeStubInterfaceDescriptor* descriptor, | 210 CodeStubInterfaceDescriptor* descriptor, |
199 int constant_stack_parameter_count) { | 211 int constant_stack_parameter_count) { |
200 // register state | 212 // register state |
201 // r0 -- number of arguments | 213 // r0 -- number of arguments |
202 // r1 -- function | 214 // r1 -- function |
203 // r2 -- type info cell with elements kind | 215 // r2 -- type info cell with elements kind |
204 static Register registers_variable_args[] = { r1, r2, r0 }; | 216 static Register registers_variable_args[] = { r1, r2, r0 }; |
205 static Register registers_no_args[] = { r1, r2 }; | 217 static Register registers_no_args[] = { r1, r2 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 Isolate* isolate, | 332 Isolate* isolate, |
321 CodeStubInterfaceDescriptor* descriptor) { | 333 CodeStubInterfaceDescriptor* descriptor) { |
322 static Register registers[] = { r0, r3, r1, r2 }; | 334 static Register registers[] = { r0, r3, r1, r2 }; |
323 descriptor->register_param_count_ = 4; | 335 descriptor->register_param_count_ = 4; |
324 descriptor->register_params_ = registers; | 336 descriptor->register_params_ = registers; |
325 descriptor->deoptimization_handler_ = | 337 descriptor->deoptimization_handler_ = |
326 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); | 338 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); |
327 } | 339 } |
328 | 340 |
329 | 341 |
330 void BinaryOpICStub::InitializeInterfaceDescriptor( | |
331 Isolate* isolate, | |
332 CodeStubInterfaceDescriptor* descriptor) { | |
333 static Register registers[] = { r1, r0 }; | |
334 descriptor->register_param_count_ = 2; | |
335 descriptor->register_params_ = registers; | |
336 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); | |
337 descriptor->SetMissHandler( | |
338 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); | |
339 } | |
340 | |
341 | |
342 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | |
343 Isolate* isolate, | |
344 CodeStubInterfaceDescriptor* descriptor) { | |
345 static Register registers[] = { r2, r1, r0 }; | |
346 descriptor->register_param_count_ = 3; | |
347 descriptor->register_params_ = registers; | |
348 descriptor->deoptimization_handler_ = | |
349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); | |
350 } | |
351 | |
352 | |
353 void NewStringAddStub::InitializeInterfaceDescriptor( | 342 void NewStringAddStub::InitializeInterfaceDescriptor( |
354 Isolate* isolate, | 343 Isolate* isolate, |
355 CodeStubInterfaceDescriptor* descriptor) { | 344 CodeStubInterfaceDescriptor* descriptor) { |
356 static Register registers[] = { r1, r0 }; | 345 static Register registers[] = { r1, r0 }; |
357 descriptor->register_param_count_ = 2; | 346 descriptor->register_param_count_ = 2; |
358 descriptor->register_params_ = registers; | 347 descriptor->register_params_ = registers; |
359 descriptor->deoptimization_handler_ = | 348 descriptor->deoptimization_handler_ = |
360 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 349 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
361 } | 350 } |
362 | 351 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 | 1435 |
1447 | 1436 |
1448 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 1437 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
1449 CEntryStub::GenerateAheadOfTime(isolate); | 1438 CEntryStub::GenerateAheadOfTime(isolate); |
1450 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1439 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1451 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1440 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1452 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 1441 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
1453 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1442 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
1454 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 1443 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
1455 BinaryOpICStub::GenerateAheadOfTime(isolate); | 1444 BinaryOpICStub::GenerateAheadOfTime(isolate); |
1456 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
1457 } | 1445 } |
1458 | 1446 |
1459 | 1447 |
1460 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 1448 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
1461 SaveFPRegsMode mode = kSaveFPRegs; | 1449 SaveFPRegsMode mode = kSaveFPRegs; |
1462 CEntryStub save_doubles(1, mode); | 1450 CEntryStub save_doubles(1, mode); |
1463 StoreBufferOverflowStub stub(mode); | 1451 StoreBufferOverflowStub stub(mode); |
1464 // These stubs might already be in the snapshot, detect that and don't | 1452 // These stubs might already be in the snapshot, detect that and don't |
1465 // regenerate, which would lead to code stub initialization state being messed | 1453 // regenerate, which would lead to code stub initialization state being messed |
1466 // up. | 1454 // up. |
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4167 __ add(sp, sp, Operand(2 * kPointerSize)); | 4155 __ add(sp, sp, Operand(2 * kPointerSize)); |
4168 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); | 4156 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); |
4169 | 4157 |
4170 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4158 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
4171 // tagged as a small integer. | 4159 // tagged as a small integer. |
4172 __ bind(&runtime); | 4160 __ bind(&runtime); |
4173 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4161 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4174 } | 4162 } |
4175 | 4163 |
4176 | 4164 |
4177 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | |
4178 // ----------- S t a t e ------------- | |
4179 // -- r1 : left | |
4180 // -- r0 : right | |
4181 // -- lr : return address | |
4182 // ----------------------------------- | |
4183 Isolate* isolate = masm->isolate(); | |
4184 | |
4185 // Load r2 with the allocation site. We stick an undefined dummy value here | |
4186 // and replace it with the real allocation site later when we instantiate this | |
4187 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | |
4188 __ Move(r2, handle(isolate->heap()->undefined_value())); | |
4189 | |
4190 // Make sure that we actually patched the allocation site. | |
4191 if (FLAG_debug_code) { | |
4192 __ tst(r2, Operand(kSmiTagMask)); | |
4193 __ Assert(ne, kExpectedAllocationSite); | |
4194 __ push(r2); | |
4195 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); | |
4196 __ LoadRoot(ip, Heap::kAllocationSiteMapRootIndex); | |
4197 __ cmp(r2, ip); | |
4198 __ pop(r2); | |
4199 __ Assert(eq, kExpectedAllocationSite); | |
4200 } | |
4201 | |
4202 // Tail call into the stub that handles binary operations with allocation | |
4203 // sites. | |
4204 BinaryOpWithAllocationSiteStub stub(state_); | |
4205 __ TailCallStub(&stub); | |
4206 } | |
4207 | |
4208 | |
4209 void StringAddStub::Generate(MacroAssembler* masm) { | 4165 void StringAddStub::Generate(MacroAssembler* masm) { |
4210 Label call_runtime, call_builtin; | 4166 Label call_runtime, call_builtin; |
4211 Builtins::JavaScript builtin_id = Builtins::ADD; | 4167 Builtins::JavaScript builtin_id = Builtins::ADD; |
4212 | 4168 |
4213 Counters* counters = masm->isolate()->counters(); | 4169 Counters* counters = masm->isolate()->counters(); |
4214 | 4170 |
4215 // Stack on entry: | 4171 // Stack on entry: |
4216 // sp[0]: second argument (right). | 4172 // sp[0]: second argument (right). |
4217 // sp[4]: first argument (left). | 4173 // sp[4]: first argument (left). |
4218 | 4174 |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5838 __ bind(&fast_elements_case); | 5794 __ bind(&fast_elements_case); |
5839 GenerateCase(masm, FAST_ELEMENTS); | 5795 GenerateCase(masm, FAST_ELEMENTS); |
5840 } | 5796 } |
5841 | 5797 |
5842 | 5798 |
5843 #undef __ | 5799 #undef __ |
5844 | 5800 |
5845 } } // namespace v8::internal | 5801 } } // namespace v8::internal |
5846 | 5802 |
5847 #endif // V8_TARGET_ARCH_ARM | 5803 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |