OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 | 294 |
295 // A register that isn't one of the parameters to the load ic. | 295 // A register that isn't one of the parameters to the load ic. |
296 static const Register LoadIC_TempRegister() { return r6; } | 296 static const Register LoadIC_TempRegister() { return r6; } |
297 | 297 |
298 | 298 |
299 static void LoadIC_PushArgs(MacroAssembler* masm) { | 299 static void LoadIC_PushArgs(MacroAssembler* masm) { |
300 Register receiver = LoadDescriptor::ReceiverRegister(); | 300 Register receiver = LoadDescriptor::ReceiverRegister(); |
301 Register name = LoadDescriptor::NameRegister(); | 301 Register name = LoadDescriptor::NameRegister(); |
302 if (FLAG_vector_ics) { | 302 Register slot = VectorLoadICDescriptor::SlotRegister(); |
303 Register slot = VectorLoadICDescriptor::SlotRegister(); | 303 Register vector = VectorLoadICDescriptor::VectorRegister(); |
304 Register vector = VectorLoadICDescriptor::VectorRegister(); | |
305 | 304 |
306 __ Push(receiver, name, slot, vector); | 305 __ Push(receiver, name, slot, vector); |
307 } else { | |
308 __ Push(receiver, name); | |
309 } | |
310 } | 306 } |
311 | 307 |
312 | 308 |
313 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 309 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
314 // The return address is in lr. | 310 // The return address is in lr. |
315 Isolate* isolate = masm->isolate(); | 311 Isolate* isolate = masm->isolate(); |
316 | 312 |
317 DCHECK(!FLAG_vector_ics || | 313 DCHECK(!AreAliased(r7, r8, VectorLoadICDescriptor::SlotRegister(), |
318 !AreAliased(r7, r8, VectorLoadICDescriptor::SlotRegister(), | |
319 VectorLoadICDescriptor::VectorRegister())); | 314 VectorLoadICDescriptor::VectorRegister())); |
320 __ IncrementCounter(isolate->counters()->load_miss(), 1, r7, r8); | 315 __ IncrementCounter(isolate->counters()->load_miss(), 1, r7, r8); |
321 | 316 |
322 LoadIC_PushArgs(masm); | 317 LoadIC_PushArgs(masm); |
323 | 318 |
324 // Perform tail call to the entry. | 319 // Perform tail call to the entry. |
325 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate); | 320 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate); |
326 int arg_count = FLAG_vector_ics ? 4 : 2; | 321 int arg_count = 4; |
327 __ TailCallExternalReference(ref, arg_count, 1); | 322 __ TailCallExternalReference(ref, arg_count, 1); |
328 } | 323 } |
329 | 324 |
330 | 325 |
331 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 326 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
332 // The return address is in lr. | 327 // The return address is in lr. |
333 | 328 |
334 __ mr(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister()); | 329 __ mr(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister()); |
335 __ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister()); | 330 __ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister()); |
336 | 331 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 __ Ret(); | 441 __ Ret(); |
447 __ bind(&slow); | 442 __ bind(&slow); |
448 GenerateMiss(masm); | 443 GenerateMiss(masm); |
449 } | 444 } |
450 | 445 |
451 | 446 |
452 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 447 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
453 // The return address is in lr. | 448 // The return address is in lr. |
454 Isolate* isolate = masm->isolate(); | 449 Isolate* isolate = masm->isolate(); |
455 | 450 |
456 DCHECK(!FLAG_vector_ics || | 451 DCHECK(!AreAliased(r7, r8, VectorLoadICDescriptor::SlotRegister(), |
457 !AreAliased(r7, r8, VectorLoadICDescriptor::SlotRegister(), | |
458 VectorLoadICDescriptor::VectorRegister())); | 452 VectorLoadICDescriptor::VectorRegister())); |
459 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r7, r8); | 453 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r7, r8); |
460 | 454 |
461 LoadIC_PushArgs(masm); | 455 LoadIC_PushArgs(masm); |
462 | 456 |
463 // Perform tail call to the entry. | 457 // Perform tail call to the entry. |
464 ExternalReference ref = | 458 ExternalReference ref = |
465 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); | 459 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); |
466 int arg_count = FLAG_vector_ics ? 4 : 2; | 460 int arg_count = 4; |
467 __ TailCallExternalReference(ref, arg_count, 1); | 461 __ TailCallExternalReference(ref, arg_count, 1); |
468 } | 462 } |
469 | 463 |
470 | 464 |
471 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 465 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
472 // The return address is in lr. | 466 // The return address is in lr. |
473 | 467 |
474 __ Push(LoadDescriptor::ReceiverRegister(), LoadDescriptor::NameRegister()); | 468 __ Push(LoadDescriptor::ReceiverRegister(), LoadDescriptor::NameRegister()); |
475 | 469 |
476 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); | 470 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 527 |
534 // If the receiver is a fast-case object, check the stub cache. Otherwise | 528 // If the receiver is a fast-case object, check the stub cache. Otherwise |
535 // probe the dictionary. | 529 // probe the dictionary. |
536 __ LoadP(r6, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 530 __ LoadP(r6, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
537 __ LoadP(r7, FieldMemOperand(r6, HeapObject::kMapOffset)); | 531 __ LoadP(r7, FieldMemOperand(r6, HeapObject::kMapOffset)); |
538 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 532 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); |
539 __ cmp(r7, ip); | 533 __ cmp(r7, ip); |
540 __ beq(&probe_dictionary); | 534 __ beq(&probe_dictionary); |
541 | 535 |
542 | 536 |
543 if (FLAG_vector_ics) { | 537 // The handlers in the stub cache expect a vector and slot. Since we won't |
544 // When vector ics are in use, the handlers in the stub cache expect a | 538 // change the IC from any downstream misses, a dummy vector can be used. |
545 // vector and slot. Since we won't change the IC from any downstream | 539 Register vector = VectorLoadICDescriptor::VectorRegister(); |
546 // misses, a dummy vector can be used. | 540 Register slot = VectorLoadICDescriptor::SlotRegister(); |
547 Register vector = VectorLoadICDescriptor::VectorRegister(); | 541 DCHECK(!AreAliased(vector, slot, r7, r8, r9, r10)); |
548 Register slot = VectorLoadICDescriptor::SlotRegister(); | 542 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( |
549 DCHECK(!AreAliased(vector, slot, r7, r8, r9, r10)); | 543 masm->isolate()->factory()->keyed_load_dummy_vector()); |
550 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( | 544 int int_slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); |
551 masm->isolate()->factory()->keyed_load_dummy_vector()); | 545 __ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex); |
552 int int_slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); | 546 __ LoadSmiLiteral(slot, Smi::FromInt(int_slot)); |
553 __ LoadRoot(vector, Heap::kKeyedLoadDummyVectorRootIndex); | |
554 __ LoadSmiLiteral(slot, Smi::FromInt(int_slot)); | |
555 } | |
556 | 547 |
557 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 548 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
558 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 549 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
559 masm->isolate()->stub_cache()->GenerateProbe( | 550 masm->isolate()->stub_cache()->GenerateProbe( |
560 masm, Code::KEYED_LOAD_IC, flags, false, receiver, key, r7, r8, r9, r10); | 551 masm, Code::KEYED_LOAD_IC, flags, false, receiver, key, r7, r8, r9, r10); |
561 // Cache miss. | 552 // Cache miss. |
562 GenerateMiss(masm); | 553 GenerateMiss(masm); |
563 | 554 |
564 // Do a quick inline probe of the receiver's dictionary, if it | 555 // Do a quick inline probe of the receiver's dictionary, if it |
565 // exists. | 556 // exists. |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 patcher.EmitCondition(ne); | 999 patcher.EmitCondition(ne); |
1009 } else { | 1000 } else { |
1010 DCHECK(Assembler::GetCondition(branch_instr) == ne); | 1001 DCHECK(Assembler::GetCondition(branch_instr) == ne); |
1011 patcher.EmitCondition(eq); | 1002 patcher.EmitCondition(eq); |
1012 } | 1003 } |
1013 } | 1004 } |
1014 } | 1005 } |
1015 } // namespace v8::internal | 1006 } // namespace v8::internal |
1016 | 1007 |
1017 #endif // V8_TARGET_ARCH_PPC | 1008 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |