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

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

Issue 106313003: Reland "Allocation site support for monomorphic StringAdds in BinaryOps". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months 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
« no previous file with comments | « 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 2487
2477 2488
2478 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 2489 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
2479 CEntryStub::GenerateAheadOfTime(isolate); 2490 CEntryStub::GenerateAheadOfTime(isolate);
2480 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 2491 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
2481 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 2492 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
2482 // It is important that the store buffer overflow stubs are generated first. 2493 // It is important that the store buffer overflow stubs are generated first.
2483 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 2494 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
2484 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 2495 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
2485 BinaryOpICStub::GenerateAheadOfTime(isolate); 2496 BinaryOpICStub::GenerateAheadOfTime(isolate);
2497 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
2486 } 2498 }
2487 2499
2488 2500
2489 void CodeStub::GenerateFPStubs(Isolate* isolate) { 2501 void CodeStub::GenerateFPStubs(Isolate* isolate) {
2490 } 2502 }
2491 2503
2492 2504
2493 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 2505 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
2494 CEntryStub stub(1, kDontSaveFPRegs); 2506 CEntryStub stub(1, kDontSaveFPRegs);
2495 stub.GetCode(isolate); 2507 stub.GetCode(isolate);
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
4222 __ PushReturnAddressFrom(rcx); 4234 __ PushReturnAddressFrom(rcx);
4223 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 4235 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
4224 4236
4225 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 4237 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
4226 // tagged as a small integer. 4238 // tagged as a small integer.
4227 __ bind(&runtime); 4239 __ bind(&runtime);
4228 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4240 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4229 } 4241 }
4230 4242
4231 4243
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
4232 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 4273 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
4233 ASSERT(state_ == CompareIC::SMI); 4274 ASSERT(state_ == CompareIC::SMI);
4234 Label miss; 4275 Label miss;
4235 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear); 4276 __ JumpIfNotBothSmi(rdx, rax, &miss, Label::kNear);
4236 4277
4237 if (GetCondition() == equal) { 4278 if (GetCondition() == equal) {
4238 // For equality we do not care about the sign of the result. 4279 // For equality we do not care about the sign of the result.
4239 __ subq(rax, rdx); 4280 __ subq(rax, rdx);
4240 } else { 4281 } else {
4241 Label done; 4282 Label done;
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
5480 __ bind(&fast_elements_case); 5521 __ bind(&fast_elements_case);
5481 GenerateCase(masm, FAST_ELEMENTS); 5522 GenerateCase(masm, FAST_ELEMENTS);
5482 } 5523 }
5483 5524
5484 5525
5485 #undef __ 5526 #undef __
5486 5527
5487 } } // namespace v8::internal 5528 } } // namespace v8::internal
5488 5529
5489 #endif // V8_TARGET_ARCH_X64 5530 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698