OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 5 |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 __ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 310 __ lbu(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
311 STATIC_ASSERT(kInternalizedTag == 0); | 311 STATIC_ASSERT(kInternalizedTag == 0); |
312 __ And(at, hash, Operand(kIsNotInternalizedMask)); | 312 __ And(at, hash, Operand(kIsNotInternalizedMask)); |
313 __ Branch(not_unique, ne, at, Operand(zero_reg)); | 313 __ Branch(not_unique, ne, at, Operand(zero_reg)); |
314 | 314 |
315 __ bind(&unique); | 315 __ bind(&unique); |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 319 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
320 // ----------- S t a t e ------------- | 320 // The return address is in lr. |
321 // -- a2 : name | 321 Register receiver = ReceiverRegister(); |
322 // -- ra : return address | 322 Register name = NameRegister(); |
323 // -- a0 : receiver | 323 ASSERT(receiver.is(a1)); |
324 // ----------------------------------- | 324 ASSERT(name.is(a2)); |
325 ASSERT(a0.is(ReceiverRegister())); | |
326 ASSERT(a2.is(NameRegister())); | |
327 | 325 |
328 // Probe the stub cache. | 326 // Probe the stub cache. |
329 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); | 327 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
330 masm->isolate()->stub_cache()->GenerateProbe( | 328 masm->isolate()->stub_cache()->GenerateProbe( |
331 masm, flags, a0, a2, a3, t0, t1, t2); | 329 masm, flags, receiver, name, a3, t0, t1, t2); |
332 | 330 |
333 // Cache miss: Jump to runtime. | 331 // Cache miss: Jump to runtime. |
334 GenerateMiss(masm); | 332 GenerateMiss(masm); |
335 } | 333 } |
336 | 334 |
337 | 335 |
338 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 336 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
339 // ----------- S t a t e ------------- | 337 // ----------- S t a t e ------------- |
340 // -- a2 : name | 338 // -- a2 : name |
341 // -- lr : return address | 339 // -- lr : return address |
342 // -- a0 : receiver | 340 // -- a1 : receiver |
343 // ----------------------------------- | 341 // ----------------------------------- |
344 ASSERT(a0.is(ReceiverRegister())); | 342 ASSERT(a1.is(ReceiverRegister())); |
345 ASSERT(a2.is(NameRegister())); | 343 ASSERT(a2.is(NameRegister())); |
346 | 344 |
347 Label miss, slow; | 345 Label miss, slow; |
348 | 346 |
349 GenerateNameDictionaryReceiverCheck(masm, a0, a1, a3, t0, &miss); | 347 GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss); |
350 | 348 |
351 // a1: elements | 349 // a0: elements |
352 GenerateDictionaryLoad(masm, &slow, a1, a2, v0, a3, t0); | 350 GenerateDictionaryLoad(masm, &slow, a0, a2, v0, a3, t0); |
353 __ Ret(); | 351 __ Ret(); |
354 | 352 |
355 // Dictionary load failed, go slow (but don't miss). | 353 // Dictionary load failed, go slow (but don't miss). |
356 __ bind(&slow); | 354 __ bind(&slow); |
357 GenerateRuntimeGetProperty(masm); | 355 GenerateRuntimeGetProperty(masm); |
358 | 356 |
359 // Cache miss: Jump to runtime. | 357 // Cache miss: Jump to runtime. |
360 __ bind(&miss); | 358 __ bind(&miss); |
361 GenerateMiss(masm); | 359 GenerateMiss(masm); |
362 } | 360 } |
363 | 361 |
364 | 362 |
365 // A register that isn't one of the parameters to the load ic. | 363 // A register that isn't one of the parameters to the load ic. |
366 static const Register LoadIC_TempRegister() { return a3; } | 364 static const Register LoadIC_TempRegister() { return a3; } |
367 | 365 |
368 | 366 |
369 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 367 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
370 // The return address is on the stack. | 368 // The return address is in ra. |
371 Isolate* isolate = masm->isolate(); | 369 Isolate* isolate = masm->isolate(); |
372 | 370 |
373 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); | 371 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); |
374 | 372 |
375 __ mov(LoadIC_TempRegister(), ReceiverRegister()); | 373 __ mov(LoadIC_TempRegister(), ReceiverRegister()); |
376 __ Push(LoadIC_TempRegister(), NameRegister()); | 374 __ Push(LoadIC_TempRegister(), NameRegister()); |
377 | 375 |
378 // Perform tail call to the entry. | 376 // Perform tail call to the entry. |
379 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate); | 377 ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate); |
380 __ TailCallExternalReference(ref, 2, 1); | 378 __ TailCallExternalReference(ref, 2, 1); |
381 } | 379 } |
382 | 380 |
383 | 381 |
384 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 382 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
385 // The return address is on the stack. | 383 // The return address is in ra. |
386 | 384 |
387 __ mov(LoadIC_TempRegister(), ReceiverRegister()); | 385 __ mov(LoadIC_TempRegister(), ReceiverRegister()); |
388 __ Push(LoadIC_TempRegister(), NameRegister()); | 386 __ Push(LoadIC_TempRegister(), NameRegister()); |
389 | 387 |
390 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 388 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
391 } | 389 } |
392 | 390 |
393 | 391 |
394 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, | 392 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, |
395 Register object, | 393 Register object, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 __ Mul(scratch, key, scratch); | 473 __ Mul(scratch, key, scratch); |
476 __ Addu(scratch, | 474 __ Addu(scratch, |
477 scratch, | 475 scratch, |
478 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 476 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
479 __ Addu(scratch, backing_store, scratch); | 477 __ Addu(scratch, backing_store, scratch); |
480 return MemOperand(scratch); | 478 return MemOperand(scratch); |
481 } | 479 } |
482 | 480 |
483 | 481 |
484 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { | 482 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
485 // ---------- S t a t e -------------- | 483 // The return address is in ra. |
486 // -- lr : return address | 484 Register receiver = ReceiverRegister(); |
487 // -- a0 : key | 485 Register key = NameRegister(); |
488 // -- a1 : receiver | 486 ASSERT(receiver.is(a1)); |
489 // ----------------------------------- | 487 ASSERT(key.is(a2)); |
490 ASSERT(a1.is(ReceiverRegister())); | 488 |
491 ASSERT(a0.is(NameRegister())); | |
492 Label slow, notin; | 489 Label slow, notin; |
493 MemOperand mapped_location = | 490 MemOperand mapped_location = |
494 GenerateMappedArgumentsLookup(masm, a1, a0, a2, a3, t0, ¬in, &slow); | 491 GenerateMappedArgumentsLookup( |
| 492 masm, receiver, key, a0, a3, t0, ¬in, &slow); |
495 __ Ret(USE_DELAY_SLOT); | 493 __ Ret(USE_DELAY_SLOT); |
496 __ lw(v0, mapped_location); | 494 __ lw(v0, mapped_location); |
497 __ bind(¬in); | 495 __ bind(¬in); |
498 // The unmapped lookup expects that the parameter map is in a2. | 496 // The unmapped lookup expects that the parameter map is in a0. |
499 MemOperand unmapped_location = | 497 MemOperand unmapped_location = |
500 GenerateUnmappedArgumentsLookup(masm, a0, a2, a3, &slow); | 498 GenerateUnmappedArgumentsLookup(masm, key, a0, a3, &slow); |
501 __ lw(a2, unmapped_location); | 499 __ lw(a0, unmapped_location); |
502 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); | 500 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); |
503 __ Branch(&slow, eq, a2, Operand(a3)); | 501 __ Branch(&slow, eq, a0, Operand(a3)); |
504 __ Ret(USE_DELAY_SLOT); | 502 __ Ret(USE_DELAY_SLOT); |
505 __ mov(v0, a2); | 503 __ mov(v0, a0); |
506 __ bind(&slow); | 504 __ bind(&slow); |
507 GenerateMiss(masm); | 505 GenerateMiss(masm); |
508 } | 506 } |
509 | 507 |
510 | 508 |
511 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { | 509 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { |
512 // ---------- S t a t e -------------- | 510 // ---------- S t a t e -------------- |
513 // -- a0 : value | 511 // -- a0 : value |
514 // -- a1 : key | 512 // -- a1 : key |
515 // -- a2 : receiver | 513 // -- a2 : receiver |
(...skipping 21 matching lines...) Expand all Loading... |
537 __ RecordWrite(a3, unmapped_location.rm(), t5, | 535 __ RecordWrite(a3, unmapped_location.rm(), t5, |
538 kRAHasNotBeenSaved, kDontSaveFPRegs); | 536 kRAHasNotBeenSaved, kDontSaveFPRegs); |
539 __ Ret(USE_DELAY_SLOT); | 537 __ Ret(USE_DELAY_SLOT); |
540 __ mov(v0, a0); // (In delay slot) return the value stored in v0. | 538 __ mov(v0, a0); // (In delay slot) return the value stored in v0. |
541 __ bind(&slow); | 539 __ bind(&slow); |
542 GenerateMiss(masm); | 540 GenerateMiss(masm); |
543 } | 541 } |
544 | 542 |
545 | 543 |
546 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 544 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
547 // The return address is on the stack. | 545 // The return address is in ra. |
548 Isolate* isolate = masm->isolate(); | 546 Isolate* isolate = masm->isolate(); |
549 | 547 |
550 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); | 548 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, a3, t0); |
551 | 549 |
552 __ Push(ReceiverRegister(), NameRegister()); | 550 __ Push(ReceiverRegister(), NameRegister()); |
553 | 551 |
554 // Perform tail call to the entry. | 552 // Perform tail call to the entry. |
555 ExternalReference ref = | 553 ExternalReference ref = |
556 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); | 554 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); |
557 | 555 |
558 __ TailCallExternalReference(ref, 2, 1); | 556 __ TailCallExternalReference(ref, 2, 1); |
559 } | 557 } |
560 | 558 |
561 | 559 |
562 // IC register specifications | 560 // IC register specifications |
563 const Register LoadIC::ReceiverRegister() { return a0; } | 561 const Register LoadIC::ReceiverRegister() { return a1; } |
564 const Register LoadIC::NameRegister() { return a2; } | 562 const Register LoadIC::NameRegister() { return a2; } |
565 const Register KeyedLoadIC::ReceiverRegister() { return a1; } | |
566 const Register KeyedLoadIC::NameRegister() { return a0; } | |
567 | 563 |
568 | 564 |
569 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 565 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
570 // The return address is on the stack. | 566 // The return address is in ra. |
571 | 567 |
572 __ Push(ReceiverRegister(), NameRegister()); | 568 __ Push(ReceiverRegister(), NameRegister()); |
573 | 569 |
574 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); | 570 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
575 } | 571 } |
576 | 572 |
577 | 573 |
578 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 574 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
579 // ---------- S t a t e -------------- | 575 // The return address is in ra. |
580 // -- ra : return address | |
581 // -- a0 : key | |
582 // -- a1 : receiver | |
583 // ----------------------------------- | |
584 Label slow, check_name, index_smi, index_name, property_array_property; | 576 Label slow, check_name, index_smi, index_name, property_array_property; |
585 Label probe_dictionary, check_number_dictionary; | 577 Label probe_dictionary, check_number_dictionary; |
586 | 578 |
587 Register key = NameRegister(); | 579 Register key = NameRegister(); |
588 Register receiver = ReceiverRegister(); | 580 Register receiver = ReceiverRegister(); |
589 ASSERT(key.is(a0)); | 581 ASSERT(key.is(a2)); |
590 ASSERT(receiver.is(a1)); | 582 ASSERT(receiver.is(a1)); |
591 | 583 |
592 Isolate* isolate = masm->isolate(); | 584 Isolate* isolate = masm->isolate(); |
593 | 585 |
594 // Check that the key is a smi. | 586 // Check that the key is a smi. |
595 __ JumpIfNotSmi(key, &check_name); | 587 __ JumpIfNotSmi(key, &check_name); |
596 __ bind(&index_smi); | 588 __ bind(&index_smi); |
597 // Now the key is known to be a smi. This place is also jumped to from below | 589 // Now the key is known to be a smi. This place is also jumped to from below |
598 // where a numeric string is converted to a smi. | 590 // where a numeric string is converted to a smi. |
599 | 591 |
600 GenerateKeyedLoadReceiverCheck( | 592 GenerateKeyedLoadReceiverCheck( |
601 masm, receiver, a2, a3, Map::kHasIndexedInterceptor, &slow); | 593 masm, receiver, a0, a3, Map::kHasIndexedInterceptor, &slow); |
602 | 594 |
603 // Check the receiver's map to see if it has fast elements. | 595 // Check the receiver's map to see if it has fast elements. |
604 __ CheckFastElements(a2, a3, &check_number_dictionary); | 596 __ CheckFastElements(a0, a3, &check_number_dictionary); |
605 | 597 |
606 GenerateFastArrayLoad( | 598 GenerateFastArrayLoad( |
607 masm, receiver, key, t0, a3, a2, v0, NULL, &slow); | 599 masm, receiver, key, a0, a3, t0, v0, NULL, &slow); |
608 | 600 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, t0, a3); |
609 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, a2, a3); | |
610 __ Ret(); | 601 __ Ret(); |
611 | 602 |
612 __ bind(&check_number_dictionary); | 603 __ bind(&check_number_dictionary); |
613 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 604 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
614 __ lw(a3, FieldMemOperand(t0, JSObject::kMapOffset)); | 605 __ lw(a3, FieldMemOperand(t0, JSObject::kMapOffset)); |
615 | 606 |
616 // Check whether the elements is a number dictionary. | 607 // Check whether the elements is a number dictionary. |
617 // a0: key | |
618 // a3: elements map | 608 // a3: elements map |
619 // t0: elements | 609 // t0: elements |
620 __ LoadRoot(at, Heap::kHashTableMapRootIndex); | 610 __ LoadRoot(at, Heap::kHashTableMapRootIndex); |
621 __ Branch(&slow, ne, a3, Operand(at)); | 611 __ Branch(&slow, ne, a3, Operand(at)); |
622 __ sra(a2, a0, kSmiTagSize); | 612 __ sra(a0, key, kSmiTagSize); |
623 __ LoadFromNumberDictionary(&slow, t0, a0, v0, a2, a3, t1); | 613 __ LoadFromNumberDictionary(&slow, t0, key, v0, a0, a3, t1); |
624 __ Ret(); | 614 __ Ret(); |
625 | 615 |
626 // Slow case, key and receiver still in a0 and a1. | 616 // Slow case, key and receiver still in a2 and a1. |
627 __ bind(&slow); | 617 __ bind(&slow); |
628 __ IncrementCounter(isolate->counters()->keyed_load_generic_slow(), | 618 __ IncrementCounter(isolate->counters()->keyed_load_generic_slow(), |
629 1, | 619 1, |
630 a2, | 620 t0, |
631 a3); | 621 a3); |
632 GenerateRuntimeGetProperty(masm); | 622 GenerateRuntimeGetProperty(masm); |
633 | 623 |
634 __ bind(&check_name); | 624 __ bind(&check_name); |
635 GenerateKeyNameCheck(masm, key, a2, a3, &index_name, &slow); | 625 GenerateKeyNameCheck(masm, key, a0, a3, &index_name, &slow); |
636 | 626 |
637 GenerateKeyedLoadReceiverCheck( | 627 GenerateKeyedLoadReceiverCheck( |
638 masm, receiver, a2, a3, Map::kHasNamedInterceptor, &slow); | 628 masm, receiver, a0, a3, Map::kHasNamedInterceptor, &slow); |
639 | 629 |
640 | 630 |
641 // If the receiver is a fast-case object, check the keyed lookup | 631 // If the receiver is a fast-case object, check the keyed lookup |
642 // cache. Otherwise probe the dictionary. | 632 // cache. Otherwise probe the dictionary. |
643 __ lw(a3, FieldMemOperand(a1, JSObject::kPropertiesOffset)); | 633 __ lw(a3, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
644 __ lw(t0, FieldMemOperand(a3, HeapObject::kMapOffset)); | 634 __ lw(t0, FieldMemOperand(a3, HeapObject::kMapOffset)); |
645 __ LoadRoot(at, Heap::kHashTableMapRootIndex); | 635 __ LoadRoot(at, Heap::kHashTableMapRootIndex); |
646 __ Branch(&probe_dictionary, eq, t0, Operand(at)); | 636 __ Branch(&probe_dictionary, eq, t0, Operand(at)); |
647 | 637 |
648 // Load the map of the receiver, compute the keyed lookup cache hash | 638 // Load the map of the receiver, compute the keyed lookup cache hash |
649 // based on 32 bits of the map pointer and the name hash. | 639 // based on 32 bits of the map pointer and the name hash. |
650 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 640 __ lw(a0, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
651 __ sra(a3, a2, KeyedLookupCache::kMapHashShift); | 641 __ sra(a3, a0, KeyedLookupCache::kMapHashShift); |
652 __ lw(t0, FieldMemOperand(a0, Name::kHashFieldOffset)); | 642 __ lw(t0, FieldMemOperand(key, Name::kHashFieldOffset)); |
653 __ sra(at, t0, Name::kHashShift); | 643 __ sra(at, t0, Name::kHashShift); |
654 __ xor_(a3, a3, at); | 644 __ xor_(a3, a3, at); |
655 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; | 645 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; |
656 __ And(a3, a3, Operand(mask)); | 646 __ And(a3, a3, Operand(mask)); |
657 | 647 |
658 // Load the key (consisting of map and unique name) from the cache and | 648 // Load the key (consisting of map and unique name) from the cache and |
659 // check for match. | 649 // check for match. |
660 Label load_in_object_property; | 650 Label load_in_object_property; |
661 static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; | 651 static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; |
662 Label hit_on_nth_entry[kEntriesPerBucket]; | 652 Label hit_on_nth_entry[kEntriesPerBucket]; |
663 ExternalReference cache_keys = | 653 ExternalReference cache_keys = |
664 ExternalReference::keyed_lookup_cache_keys(isolate); | 654 ExternalReference::keyed_lookup_cache_keys(isolate); |
665 __ li(t0, Operand(cache_keys)); | 655 __ li(t0, Operand(cache_keys)); |
666 __ sll(at, a3, kPointerSizeLog2 + 1); | 656 __ sll(at, a3, kPointerSizeLog2 + 1); |
667 __ addu(t0, t0, at); | 657 __ addu(t0, t0, at); |
668 | 658 |
669 for (int i = 0; i < kEntriesPerBucket - 1; i++) { | 659 for (int i = 0; i < kEntriesPerBucket - 1; i++) { |
670 Label try_next_entry; | 660 Label try_next_entry; |
671 __ lw(t1, MemOperand(t0, kPointerSize * i * 2)); | 661 __ lw(t1, MemOperand(t0, kPointerSize * i * 2)); |
672 __ Branch(&try_next_entry, ne, a2, Operand(t1)); | 662 __ Branch(&try_next_entry, ne, a0, Operand(t1)); |
673 __ lw(t1, MemOperand(t0, kPointerSize * (i * 2 + 1))); | 663 __ lw(t1, MemOperand(t0, kPointerSize * (i * 2 + 1))); |
674 __ Branch(&hit_on_nth_entry[i], eq, a0, Operand(t1)); | 664 __ Branch(&hit_on_nth_entry[i], eq, key, Operand(t1)); |
675 __ bind(&try_next_entry); | 665 __ bind(&try_next_entry); |
676 } | 666 } |
677 | 667 |
678 __ lw(t1, MemOperand(t0, kPointerSize * (kEntriesPerBucket - 1) * 2)); | 668 __ lw(t1, MemOperand(t0, kPointerSize * (kEntriesPerBucket - 1) * 2)); |
679 __ Branch(&slow, ne, a2, Operand(t1)); | 669 __ Branch(&slow, ne, a0, Operand(t1)); |
680 __ lw(t1, MemOperand(t0, kPointerSize * ((kEntriesPerBucket - 1) * 2 + 1))); | 670 __ lw(t1, MemOperand(t0, kPointerSize * ((kEntriesPerBucket - 1) * 2 + 1))); |
681 __ Branch(&slow, ne, a0, Operand(t1)); | 671 __ Branch(&slow, ne, key, Operand(t1)); |
682 | 672 |
683 // Get field offset. | 673 // Get field offset. |
684 // a0 : key | 674 // a0 : receiver's map |
685 // a1 : receiver | |
686 // a2 : receiver's map | |
687 // a3 : lookup cache index | 675 // a3 : lookup cache index |
688 ExternalReference cache_field_offsets = | 676 ExternalReference cache_field_offsets = |
689 ExternalReference::keyed_lookup_cache_field_offsets(isolate); | 677 ExternalReference::keyed_lookup_cache_field_offsets(isolate); |
690 | 678 |
691 // Hit on nth entry. | 679 // Hit on nth entry. |
692 for (int i = kEntriesPerBucket - 1; i >= 0; i--) { | 680 for (int i = kEntriesPerBucket - 1; i >= 0; i--) { |
693 __ bind(&hit_on_nth_entry[i]); | 681 __ bind(&hit_on_nth_entry[i]); |
694 __ li(t0, Operand(cache_field_offsets)); | 682 __ li(t0, Operand(cache_field_offsets)); |
695 __ sll(at, a3, kPointerSizeLog2); | 683 __ sll(at, a3, kPointerSizeLog2); |
696 __ addu(at, t0, at); | 684 __ addu(at, t0, at); |
697 __ lw(t1, MemOperand(at, kPointerSize * i)); | 685 __ lw(t1, MemOperand(at, kPointerSize * i)); |
698 __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); | 686 __ lbu(t2, FieldMemOperand(a0, Map::kInObjectPropertiesOffset)); |
699 __ Subu(t1, t1, t2); | 687 __ Subu(t1, t1, t2); |
700 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); | 688 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
701 if (i != 0) { | 689 if (i != 0) { |
702 __ Branch(&load_in_object_property); | 690 __ Branch(&load_in_object_property); |
703 } | 691 } |
704 } | 692 } |
705 | 693 |
706 // Load in-object property. | 694 // Load in-object property. |
707 __ bind(&load_in_object_property); | 695 __ bind(&load_in_object_property); |
708 __ lbu(t2, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 696 __ lbu(t2, FieldMemOperand(a0, Map::kInstanceSizeOffset)); |
709 __ addu(t2, t2, t1); // Index from start of object. | 697 __ addu(t2, t2, t1); // Index from start of object. |
710 __ Subu(a1, a1, Operand(kHeapObjectTag)); // Remove the heap tag. | 698 __ Subu(receiver, receiver, Operand(kHeapObjectTag)); // Remove the heap tag. |
711 __ sll(at, t2, kPointerSizeLog2); | 699 __ sll(at, t2, kPointerSizeLog2); |
712 __ addu(at, a1, at); | 700 __ addu(at, receiver, at); |
713 __ lw(v0, MemOperand(at)); | 701 __ lw(v0, MemOperand(at)); |
714 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), | 702 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), |
715 1, | 703 1, |
716 a2, | 704 t0, |
717 a3); | 705 a3); |
718 __ Ret(); | 706 __ Ret(); |
719 | 707 |
720 // Load property array property. | 708 // Load property array property. |
721 __ bind(&property_array_property); | 709 __ bind(&property_array_property); |
722 __ lw(a1, FieldMemOperand(a1, JSObject::kPropertiesOffset)); | 710 __ lw(receiver, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
723 __ Addu(a1, a1, FixedArray::kHeaderSize - kHeapObjectTag); | 711 __ Addu(receiver, receiver, FixedArray::kHeaderSize - kHeapObjectTag); |
724 __ sll(t0, t1, kPointerSizeLog2); | 712 __ sll(v0, t1, kPointerSizeLog2); |
725 __ Addu(t0, t0, a1); | 713 __ Addu(v0, v0, receiver); |
726 __ lw(v0, MemOperand(t0)); | 714 __ lw(v0, MemOperand(v0)); |
727 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), | 715 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), |
728 1, | 716 1, |
729 a2, | 717 t0, |
730 a3); | 718 a3); |
731 __ Ret(); | 719 __ Ret(); |
732 | 720 |
733 | 721 |
734 // Do a quick inline probe of the receiver's dictionary, if it | 722 // Do a quick inline probe of the receiver's dictionary, if it |
735 // exists. | 723 // exists. |
736 __ bind(&probe_dictionary); | 724 __ bind(&probe_dictionary); |
737 // a1: receiver | |
738 // a0: key | |
739 // a3: elements | 725 // a3: elements |
740 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 726 __ lw(a0, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
741 __ lbu(a2, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 727 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); |
742 GenerateGlobalInstanceTypeCheck(masm, a2, &slow); | 728 GenerateGlobalInstanceTypeCheck(masm, a0, &slow); |
743 // Load the property to v0. | 729 // Load the property to v0. |
744 GenerateDictionaryLoad(masm, &slow, a3, a0, v0, a2, t0); | 730 GenerateDictionaryLoad(masm, &slow, a3, key, v0, t1, t0); |
745 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), | 731 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), |
746 1, | 732 1, |
747 a2, | 733 t0, |
748 a3); | 734 a3); |
749 __ Ret(); | 735 __ Ret(); |
750 | 736 |
751 __ bind(&index_name); | 737 __ bind(&index_name); |
752 __ IndexFromHash(a3, key); | 738 __ IndexFromHash(a3, key); |
753 // Now jump to the place where smi keys are handled. | 739 // Now jump to the place where smi keys are handled. |
754 __ Branch(&index_smi); | 740 __ Branch(&index_smi); |
755 } | 741 } |
756 | 742 |
757 | 743 |
758 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { | 744 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
759 // Return address is on the stack. | 745 // Return address is in ra. |
760 Label miss; | 746 Label miss; |
761 | 747 |
762 Register receiver = ReceiverRegister(); | 748 Register receiver = ReceiverRegister(); |
763 Register index = NameRegister(); | 749 Register index = NameRegister(); |
764 Register scratch = a3; | 750 Register scratch = a3; |
765 Register result = v0; | 751 Register result = v0; |
766 ASSERT(!scratch.is(receiver) && !scratch.is(index)); | 752 ASSERT(!scratch.is(receiver) && !scratch.is(index)); |
767 | 753 |
768 StringCharAtGenerator char_at_generator(receiver, | 754 StringCharAtGenerator char_at_generator(receiver, |
769 index, | 755 index, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 value, key, receiver, receiver_map, | 1050 value, key, receiver, receiver_map, |
1065 elements_map, elements); | 1051 elements_map, elements); |
1066 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 1052 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, |
1067 &slow, kDontCheckMap, kIncrementLength, | 1053 &slow, kDontCheckMap, kIncrementLength, |
1068 value, key, receiver, receiver_map, | 1054 value, key, receiver, receiver_map, |
1069 elements_map, elements); | 1055 elements_map, elements); |
1070 } | 1056 } |
1071 | 1057 |
1072 | 1058 |
1073 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 1059 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
1074 // Return address is on the stack. | 1060 // Return address is in ra. |
1075 Label slow; | 1061 Label slow; |
1076 | 1062 |
1077 Register receiver = ReceiverRegister(); | 1063 Register receiver = ReceiverRegister(); |
1078 Register key = NameRegister(); | 1064 Register key = NameRegister(); |
1079 Register scratch1 = a2; | 1065 Register scratch1 = a3; |
1080 Register scratch2 = a3; | 1066 Register scratch2 = t0; |
1081 ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); | 1067 ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); |
1082 ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); | 1068 ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); |
1083 | 1069 |
1084 // Check that the receiver isn't a smi. | 1070 // Check that the receiver isn't a smi. |
1085 __ JumpIfSmi(receiver, &slow); | 1071 __ JumpIfSmi(receiver, &slow); |
1086 | 1072 |
1087 // Check that the key is an array index, that is Uint32. | 1073 // Check that the key is an array index, that is Uint32. |
1088 __ And(t0, key, Operand(kSmiTagMask | kSmiSignMask)); | 1074 __ And(t0, key, Operand(kSmiTagMask | kSmiSignMask)); |
1089 __ Branch(&slow, ne, t0, Operand(zero_reg)); | 1075 __ Branch(&slow, ne, t0, Operand(zero_reg)); |
1090 | 1076 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 } else { | 1319 } else { |
1334 ASSERT(Assembler::IsBne(branch_instr)); | 1320 ASSERT(Assembler::IsBne(branch_instr)); |
1335 patcher.ChangeBranchCondition(eq); | 1321 patcher.ChangeBranchCondition(eq); |
1336 } | 1322 } |
1337 } | 1323 } |
1338 | 1324 |
1339 | 1325 |
1340 } } // namespace v8::internal | 1326 } } // namespace v8::internal |
1341 | 1327 |
1342 #endif // V8_TARGET_ARCH_MIPS | 1328 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |