OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 __ bind(&done); | 163 __ bind(&done); |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 167 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
168 // ----------- S t a t e ------------- | 168 // ----------- S t a t e ------------- |
169 // -- r2 : name | 169 // -- r2 : name |
170 // -- lr : return address | 170 // -- lr : return address |
171 // -- [sp] : receiver | 171 // -- [sp] : receiver |
172 // ----------------------------------- | 172 // ----------------------------------- |
173 | |
174 Label miss; | 173 Label miss; |
175 | 174 |
176 __ ldr(r0, MemOperand(sp, 0)); | 175 __ ldr(r0, MemOperand(sp, 0)); |
177 | 176 |
178 StubCompiler::GenerateLoadArrayLength(masm, r0, r3, &miss); | 177 StubCompiler::GenerateLoadArrayLength(masm, r0, r3, &miss); |
179 __ bind(&miss); | 178 __ bind(&miss); |
180 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 179 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
181 } | 180 } |
182 | 181 |
183 | 182 |
(...skipping 13 matching lines...) Expand all Loading... |
197 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 196 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
198 } | 197 } |
199 | 198 |
200 | 199 |
201 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { | 200 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
202 // ----------- S t a t e ------------- | 201 // ----------- S t a t e ------------- |
203 // -- r2 : name | 202 // -- r2 : name |
204 // -- lr : return address | 203 // -- lr : return address |
205 // -- [sp] : receiver | 204 // -- [sp] : receiver |
206 // ----------------------------------- | 205 // ----------------------------------- |
207 | |
208 Label miss; | 206 Label miss; |
209 | 207 |
210 // Load receiver. | 208 // Load receiver. |
211 __ ldr(r0, MemOperand(sp, 0)); | 209 __ ldr(r0, MemOperand(sp, 0)); |
212 | 210 |
213 StubCompiler::GenerateLoadFunctionPrototype(masm, r0, r1, r3, &miss); | 211 StubCompiler::GenerateLoadFunctionPrototype(masm, r0, r1, r3, &miss); |
214 __ bind(&miss); | 212 __ bind(&miss); |
215 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 213 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
216 } | 214 } |
217 | 215 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // Invoke the function. | 309 // Invoke the function. |
312 ParameterCount actual(argc); | 310 ParameterCount actual(argc); |
313 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 311 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
314 } | 312 } |
315 | 313 |
316 | 314 |
317 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { | 315 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
318 // ----------- S t a t e ------------- | 316 // ----------- S t a t e ------------- |
319 // -- lr: return address | 317 // -- lr: return address |
320 // ----------------------------------- | 318 // ----------------------------------- |
321 | |
322 Label miss, global_object, non_global_object; | 319 Label miss, global_object, non_global_object; |
323 | 320 |
324 // Get the receiver of the function from the stack into r1. | 321 // Get the receiver of the function from the stack into r1. |
325 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 322 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
326 // Get the name of the function from the stack; 1 ~ receiver. | 323 // Get the name of the function from the stack; 1 ~ receiver. |
327 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); | 324 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); |
328 | 325 |
329 // Check that the receiver isn't a smi. | 326 // Check that the receiver isn't a smi. |
330 __ tst(r1, Operand(kSmiTagMask)); | 327 __ tst(r1, Operand(kSmiTagMask)); |
331 __ b(eq, &miss); | 328 __ b(eq, &miss); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 441 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
445 } | 442 } |
446 | 443 |
447 | 444 |
448 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 445 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
449 // ----------- S t a t e ------------- | 446 // ----------- S t a t e ------------- |
450 // -- r2 : name | 447 // -- r2 : name |
451 // -- lr : return address | 448 // -- lr : return address |
452 // -- [sp] : receiver | 449 // -- [sp] : receiver |
453 // ----------------------------------- | 450 // ----------------------------------- |
454 | |
455 Label miss, probe, global; | 451 Label miss, probe, global; |
456 | 452 |
457 __ ldr(r0, MemOperand(sp, 0)); | 453 __ ldr(r0, MemOperand(sp, 0)); |
458 // Check that the receiver isn't a smi. | 454 // Check that the receiver isn't a smi. |
459 __ tst(r0, Operand(kSmiTagMask)); | 455 __ tst(r0, Operand(kSmiTagMask)); |
460 __ b(eq, &miss); | 456 __ b(eq, &miss); |
461 | 457 |
462 // Check that the receiver is a valid JS object. Put the map in r3. | 458 // Check that the receiver is a valid JS object. Put the map in r3. |
463 __ CompareObjectType(r0, r3, r1, FIRST_JS_OBJECT_TYPE); | 459 __ CompareObjectType(r0, r3, r1, FIRST_JS_OBJECT_TYPE); |
464 __ b(lt, &miss); | 460 __ b(lt, &miss); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 532 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
537 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); | 533 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); |
538 } | 534 } |
539 | 535 |
540 | 536 |
541 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 537 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
542 // ---------- S t a t e -------------- | 538 // ---------- S t a t e -------------- |
543 // -- lr : return address | 539 // -- lr : return address |
544 // -- sp[0] : key | 540 // -- sp[0] : key |
545 // -- sp[4] : receiver | 541 // -- sp[4] : receiver |
| 542 // ----------------------------------- |
| 543 |
546 __ ldm(ia, sp, r2.bit() | r3.bit()); | 544 __ ldm(ia, sp, r2.bit() | r3.bit()); |
547 __ stm(db_w, sp, r2.bit() | r3.bit()); | 545 __ stm(db_w, sp, r2.bit() | r3.bit()); |
548 | 546 |
549 __ TailCallRuntime(f, 2, 1); | 547 __ TailCallRuntime(f, 2, 1); |
550 } | 548 } |
551 | 549 |
552 | 550 |
553 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 551 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
554 // ---------- S t a t e -------------- | 552 // ---------- S t a t e -------------- |
555 // -- lr : return address | 553 // -- lr : return address |
556 // -- sp[0] : key | 554 // -- sp[0] : key |
557 // -- sp[4] : receiver | 555 // -- sp[4] : receiver |
| 556 // ----------------------------------- |
558 Label slow, fast; | 557 Label slow, fast; |
559 | 558 |
560 // Get the key and receiver object from the stack. | 559 // Get the key and receiver object from the stack. |
561 __ ldm(ia, sp, r0.bit() | r1.bit()); | 560 __ ldm(ia, sp, r0.bit() | r1.bit()); |
562 // Check that the key is a smi. | 561 // Check that the key is a smi. |
563 __ tst(r0, Operand(kSmiTagMask)); | 562 __ tst(r0, Operand(kSmiTagMask)); |
564 __ b(ne, &slow); | 563 __ b(ne, &slow); |
565 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); | 564 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
566 // Check that the object isn't a smi. | 565 // Check that the object isn't a smi. |
567 __ tst(r1, Operand(kSmiTagMask)); | 566 __ tst(r1, Operand(kSmiTagMask)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 614 |
616 __ Ret(); | 615 __ Ret(); |
617 } | 616 } |
618 | 617 |
619 | 618 |
620 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { | 619 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
621 // ---------- S t a t e -------------- | 620 // ---------- S t a t e -------------- |
622 // -- lr : return address | 621 // -- lr : return address |
623 // -- sp[0] : key | 622 // -- sp[0] : key |
624 // -- sp[4] : receiver | 623 // -- sp[4] : receiver |
| 624 // ----------------------------------- |
| 625 |
625 GenerateGeneric(masm); | 626 GenerateGeneric(masm); |
626 } | 627 } |
627 | 628 |
628 | 629 |
629 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, | 630 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
630 ExternalArrayType array_type) { | 631 ExternalArrayType array_type) { |
631 // TODO(476): port specialized code. | 632 // TODO(476): port specialized code. |
632 GenerateGeneric(masm); | 633 GenerateGeneric(masm); |
633 } | 634 } |
634 | 635 |
635 | 636 |
636 void KeyedStoreIC::Generate(MacroAssembler* masm, | 637 void KeyedStoreIC::Generate(MacroAssembler* masm, |
637 const ExternalReference& f) { | 638 const ExternalReference& f) { |
638 // ---------- S t a t e -------------- | 639 // ---------- S t a t e -------------- |
639 // -- r0 : value | 640 // -- r0 : value |
640 // -- lr : return address | 641 // -- lr : return address |
641 // -- sp[0] : key | 642 // -- sp[0] : key |
642 // -- sp[1] : receiver | 643 // -- sp[1] : receiver |
| 644 // ----------------------------------- |
643 | 645 |
644 __ ldm(ia, sp, r2.bit() | r3.bit()); | 646 __ ldm(ia, sp, r2.bit() | r3.bit()); |
645 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); | 647 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); |
646 | 648 |
647 __ TailCallRuntime(f, 3, 1); | 649 __ TailCallRuntime(f, 3, 1); |
648 } | 650 } |
649 | 651 |
650 | 652 |
651 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 653 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
652 // ---------- S t a t e -------------- | 654 // ---------- S t a t e -------------- |
653 // -- r0 : value | 655 // -- r0 : value |
654 // -- lr : return address | 656 // -- lr : return address |
655 // -- sp[0] : key | 657 // -- sp[0] : key |
656 // -- sp[1] : receiver | 658 // -- sp[1] : receiver |
| 659 // ----------------------------------- |
657 Label slow, fast, array, extra, exit; | 660 Label slow, fast, array, extra, exit; |
| 661 |
658 // Get the key and the object from the stack. | 662 // Get the key and the object from the stack. |
659 __ ldm(ia, sp, r1.bit() | r3.bit()); // r1 = key, r3 = receiver | 663 __ ldm(ia, sp, r1.bit() | r3.bit()); // r1 = key, r3 = receiver |
660 // Check that the key is a smi. | 664 // Check that the key is a smi. |
661 __ tst(r1, Operand(kSmiTagMask)); | 665 __ tst(r1, Operand(kSmiTagMask)); |
662 __ b(ne, &slow); | 666 __ b(ne, &slow); |
663 // Check that the object isn't a smi. | 667 // Check that the object isn't a smi. |
664 __ tst(r3, Operand(kSmiTagMask)); | 668 __ tst(r3, Operand(kSmiTagMask)); |
665 __ b(eq, &slow); | 669 __ b(eq, &slow); |
666 // Get the map of the object. | 670 // Get the map of the object. |
667 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 671 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 844 |
841 // Perform tail call to the entry. | 845 // Perform tail call to the entry. |
842 __ TailCallRuntime(f, 3, 1); | 846 __ TailCallRuntime(f, 3, 1); |
843 } | 847 } |
844 | 848 |
845 | 849 |
846 #undef __ | 850 #undef __ |
847 | 851 |
848 | 852 |
849 } } // namespace v8::internal | 853 } } // namespace v8::internal |
OLD | NEW |