Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix NewStringAddStub flags bits. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/objects-inl.h ('K') | « src/typing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
195 static void InitializeArrayConstructorDescriptor( 183 static void InitializeArrayConstructorDescriptor(
196 Isolate* isolate, 184 Isolate* isolate,
197 CodeStubInterfaceDescriptor* descriptor, 185 CodeStubInterfaceDescriptor* descriptor,
198 int constant_stack_parameter_count) { 186 int constant_stack_parameter_count) {
199 // register state 187 // register state
200 // rax -- number of arguments 188 // rax -- number of arguments
201 // rdi -- function 189 // rdi -- function
202 // rbx -- type info cell with elements kind 190 // rbx -- type info cell with elements kind
203 static Register registers_variable_args[] = { rdi, rbx, rax }; 191 static Register registers_variable_args[] = { rdi, rbx, rax };
204 static Register registers_no_args[] = { rdi, rbx }; 192 static Register registers_no_args[] = { rdi, rbx };
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 Isolate* isolate, 320 Isolate* isolate,
333 CodeStubInterfaceDescriptor* descriptor) { 321 CodeStubInterfaceDescriptor* descriptor) {
334 static Register registers[] = { rax, rbx, rcx, rdx }; 322 static Register registers[] = { rax, rbx, rcx, rdx };
335 descriptor->register_param_count_ = 4; 323 descriptor->register_param_count_ = 4;
336 descriptor->register_params_ = registers; 324 descriptor->register_params_ = registers;
337 descriptor->deoptimization_handler_ = 325 descriptor->deoptimization_handler_ =
338 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); 326 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss);
339 } 327 }
340 328
341 329
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
342 void NewStringAddStub::InitializeInterfaceDescriptor( 353 void NewStringAddStub::InitializeInterfaceDescriptor(
343 Isolate* isolate, 354 Isolate* isolate,
344 CodeStubInterfaceDescriptor* descriptor) { 355 CodeStubInterfaceDescriptor* descriptor) {
345 static Register registers[] = { rdx, rax }; 356 static Register registers[] = { rdx, rax };
346 descriptor->register_param_count_ = 2; 357 descriptor->register_param_count_ = 2;
347 descriptor->register_params_ = registers; 358 descriptor->register_params_ = registers;
348 descriptor->deoptimization_handler_ = 359 descriptor->deoptimization_handler_ =
349 Runtime::FunctionForId(Runtime::kStringAdd)->entry; 360 Runtime::FunctionForId(Runtime::kStringAdd)->entry;
350 } 361 }
351 362
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 2701
2691 2702
2692 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 2703 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
2693 CEntryStub::GenerateAheadOfTime(isolate); 2704 CEntryStub::GenerateAheadOfTime(isolate);
2694 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 2705 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
2695 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 2706 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
2696 // It is important that the store buffer overflow stubs are generated first. 2707 // It is important that the store buffer overflow stubs are generated first.
2697 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 2708 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
2698 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 2709 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
2699 BinaryOpICStub::GenerateAheadOfTime(isolate); 2710 BinaryOpICStub::GenerateAheadOfTime(isolate);
2711 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
2700 } 2712 }
2701 2713
2702 2714
2703 void CodeStub::GenerateFPStubs(Isolate* isolate) { 2715 void CodeStub::GenerateFPStubs(Isolate* isolate) {
2704 } 2716 }
2705 2717
2706 2718
2707 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 2719 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
2708 CEntryStub stub(1, kDontSaveFPRegs); 2720 CEntryStub stub(1, kDontSaveFPRegs);
2709 stub.GetCode(isolate); 2721 stub.GetCode(isolate);
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 __ PushReturnAddressFrom(rcx); 4445 __ PushReturnAddressFrom(rcx);
4434 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 4446 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
4435 4447
4436 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 4448 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
4437 // tagged as a small integer. 4449 // tagged as a small integer.
4438 __ bind(&runtime); 4450 __ bind(&runtime);
4439 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4451 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4440 } 4452 }
4441 4453
4442 4454
4455 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
4456 // ----------- S t a t e -------------
4457 // -- rdx : left
4458 // -- rax : right
4459 // -- rsp[0] : return address
4460 // -----------------------------------
4461 Isolate* isolate = masm->isolate();
4462
4463 // Load rcx with the allocation site. We stick an undefined dummy value here
4464 // and replace it with the real allocation site later when we instantiate this
4465 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
4466 __ Move(rcx, handle(isolate->heap()->undefined_value()));
4467
4468 // Make sure that we actually patched the allocation site.
4469 if (FLAG_debug_code) {
4470 __ testb(rcx, Immediate(kSmiTagMask));
4471 __ Assert(zero, kExpectedAllocationSite);
4472 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset),
4473 isolate->factory()->allocation_site_map());
4474 __ Assert(equal, kExpectedAllocationSite);
4475 }
4476
4477 // Tail call into the stub that handles binary operations with allocation
4478 // sites.
4479 BinaryOpWithAllocationSiteStub stub(state_);
4480 __ TailCallStub(&stub);
4481 }
4482
4483
4443 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 4484 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
4444 ASSERT(state_ == CompareIC::SMI); 4485 ASSERT(state_ == CompareIC::SMI);
4445 Label miss; 4486 Label miss;
4446 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear); 4487 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear);
4447 4488
4448 if (GetCondition() == equal) { 4489 if (GetCondition() == equal) {
4449 // For equality we do not care about the sign of the result. 4490 // For equality we do not care about the sign of the result.
4450 __ subq(rax, rdx); 4491 __ subq(rax, rdx);
4451 } else { 4492 } else {
4452 Label done; 4493 Label done;
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
5691 __ bind(&fast_elements_case); 5732 __ bind(&fast_elements_case);
5692 GenerateCase(masm, FAST_ELEMENTS); 5733 GenerateCase(masm, FAST_ELEMENTS);
5693 } 5734 }
5694 5735
5695 5736
5696 #undef __ 5737 #undef __
5697 5738
5698 } } // namespace v8::internal 5739 } } // namespace v8::internal
5699 5740
5700 #endif // V8_TARGET_ARCH_X64 5741 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/objects-inl.h ('K') | « src/typing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698