| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 Isolate* isolate, | 173 Isolate* isolate, |
| 174 CodeStubInterfaceDescriptor* descriptor) { | 174 CodeStubInterfaceDescriptor* descriptor) { |
| 175 static Register registers[] = { rax, rbx }; | 175 static Register registers[] = { rax, rbx }; |
| 176 descriptor->register_param_count_ = 2; | 176 descriptor->register_param_count_ = 2; |
| 177 descriptor->register_params_ = registers; | 177 descriptor->register_params_ = registers; |
| 178 descriptor->deoptimization_handler_ = | 178 descriptor->deoptimization_handler_ = |
| 179 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | 179 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
| 180 } | 180 } |
| 181 | 181 |
| 182 | 182 |
| 183 void BinaryOpICStub::InitializeInterfaceDescriptor( |
| 184 Isolate* isolate, |
| 185 CodeStubInterfaceDescriptor* descriptor) { |
| 186 static Register registers[] = { rdx, rax }; |
| 187 descriptor->register_param_count_ = 2; |
| 188 descriptor->register_params_ = registers; |
| 189 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
| 190 descriptor->SetMissHandler( |
| 191 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
| 192 } |
| 193 |
| 194 |
| 183 static void InitializeArrayConstructorDescriptor( | 195 static void InitializeArrayConstructorDescriptor( |
| 184 Isolate* isolate, | 196 Isolate* isolate, |
| 185 CodeStubInterfaceDescriptor* descriptor, | 197 CodeStubInterfaceDescriptor* descriptor, |
| 186 int constant_stack_parameter_count) { | 198 int constant_stack_parameter_count) { |
| 187 // register state | 199 // register state |
| 188 // rax -- number of arguments | 200 // rax -- number of arguments |
| 189 // rdi -- function | 201 // rdi -- function |
| 190 // rbx -- type info cell with elements kind | 202 // rbx -- type info cell with elements kind |
| 191 static Register registers_variable_args[] = { rdi, rbx, rax }; | 203 static Register registers_variable_args[] = { rdi, rbx, rax }; |
| 192 static Register registers_no_args[] = { rdi, rbx }; | 204 static Register registers_no_args[] = { rdi, rbx }; |
| (...skipping 127 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[] = { rax, rbx, rcx, rdx }; | 334 static Register registers[] = { rax, rbx, rcx, rdx }; |
| 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[] = { rdx, rax }; | |
| 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[] = { rcx, rdx, rax }; | |
| 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[] = { rdx, rax }; | 345 static Register registers[] = { rdx, rax }; |
| 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 | 2476 |
| 2488 | 2477 |
| 2489 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2478 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
| 2490 CEntryStub::GenerateAheadOfTime(isolate); | 2479 CEntryStub::GenerateAheadOfTime(isolate); |
| 2491 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 2480 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
| 2492 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 2481 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
| 2493 // It is important that the store buffer overflow stubs are generated first. | 2482 // It is important that the store buffer overflow stubs are generated first. |
| 2494 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 2483 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 2495 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 2484 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
| 2496 BinaryOpICStub::GenerateAheadOfTime(isolate); | 2485 BinaryOpICStub::GenerateAheadOfTime(isolate); |
| 2497 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
| 2498 } | 2486 } |
| 2499 | 2487 |
| 2500 | 2488 |
| 2501 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 2489 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
| 2502 } | 2490 } |
| 2503 | 2491 |
| 2504 | 2492 |
| 2505 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { | 2493 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { |
| 2506 CEntryStub stub(1, kDontSaveFPRegs); | 2494 CEntryStub stub(1, kDontSaveFPRegs); |
| 2507 stub.GetCode(isolate); | 2495 stub.GetCode(isolate); |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4234 __ PushReturnAddressFrom(rcx); | 4222 __ PushReturnAddressFrom(rcx); |
| 4235 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); | 4223 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); |
| 4236 | 4224 |
| 4237 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4225 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 4238 // tagged as a small integer. | 4226 // tagged as a small integer. |
| 4239 __ bind(&runtime); | 4227 __ bind(&runtime); |
| 4240 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4228 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 4241 } | 4229 } |
| 4242 | 4230 |
| 4243 | 4231 |
| 4244 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | |
| 4245 // ----------- S t a t e ------------- | |
| 4246 // -- rdx : left | |
| 4247 // -- rax : right | |
| 4248 // -- rsp[0] : return address | |
| 4249 // ----------------------------------- | |
| 4250 Isolate* isolate = masm->isolate(); | |
| 4251 | |
| 4252 // Load rcx with the allocation site. We stick an undefined dummy value here | |
| 4253 // and replace it with the real allocation site later when we instantiate this | |
| 4254 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | |
| 4255 __ Move(rcx, handle(isolate->heap()->undefined_value())); | |
| 4256 | |
| 4257 // Make sure that we actually patched the allocation site. | |
| 4258 if (FLAG_debug_code) { | |
| 4259 __ testb(rcx, Immediate(kSmiTagMask)); | |
| 4260 __ Assert(zero, kExpectedAllocationSite); | |
| 4261 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), | |
| 4262 isolate->factory()->allocation_site_map()); | |
| 4263 __ Assert(equal, kExpectedAllocationSite); | |
| 4264 } | |
| 4265 | |
| 4266 // Tail call into the stub that handles binary operations with allocation | |
| 4267 // sites. | |
| 4268 BinaryOpWithAllocationSiteStub stub(state_); | |
| 4269 __ TailCallStub(&stub); | |
| 4270 } | |
| 4271 | |
| 4272 | |
| 4273 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 4232 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
| 4274 ASSERT(state_ == CompareIC::SMI); | 4233 ASSERT(state_ == CompareIC::SMI); |
| 4275 Label miss; | 4234 Label miss; |
| 4276 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear); | 4235 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear); |
| 4277 | 4236 |
| 4278 if (GetCondition() == equal) { | 4237 if (GetCondition() == equal) { |
| 4279 // For equality we do not care about the sign of the result. | 4238 // For equality we do not care about the sign of the result. |
| 4280 __ subq(rax, rdx); | 4239 __ subq(rax, rdx); |
| 4281 } else { | 4240 } else { |
| 4282 Label done; | 4241 Label done; |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5521 __ bind(&fast_elements_case); | 5480 __ bind(&fast_elements_case); |
| 5522 GenerateCase(masm, FAST_ELEMENTS); | 5481 GenerateCase(masm, FAST_ELEMENTS); |
| 5523 } | 5482 } |
| 5524 | 5483 |
| 5525 | 5484 |
| 5526 #undef __ | 5485 #undef __ |
| 5527 | 5486 |
| 5528 } } // namespace v8::internal | 5487 } } // namespace v8::internal |
| 5529 | 5488 |
| 5530 #endif // V8_TARGET_ARCH_X64 | 5489 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |