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

Side by Side Diff: src/arm/ic-arm.cc

Issue 356713003: Use IC register definitions in platform files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports and comments. Created 6 years, 5 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
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/arm/assembler-arm.h" 9 #include "src/arm/assembler-arm.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 __ bind(&unique); 309 __ bind(&unique);
310 } 310 }
311 311
312 312
313 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 313 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
314 // ----------- S t a t e ------------- 314 // ----------- S t a t e -------------
315 // -- r2 : name 315 // -- r2 : name
316 // -- lr : return address 316 // -- lr : return address
317 // -- r0 : receiver 317 // -- r0 : receiver
318 // ----------------------------------- 318 // -----------------------------------
319 ASSERT(r0.is(ReceiverRegister()));
320 ASSERT(r2.is(NameRegister()));
319 321
320 // Probe the stub cache. 322 // Probe the stub cache.
321 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 323 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
322 masm->isolate()->stub_cache()->GenerateProbe( 324 masm->isolate()->stub_cache()->GenerateProbe(
323 masm, flags, r0, r2, r3, r4, r5, r6); 325 masm, flags, r0, r2, r3, r4, r5, r6);
324 326
325 // Cache miss: Jump to runtime. 327 // Cache miss: Jump to runtime.
326 GenerateMiss(masm); 328 GenerateMiss(masm);
327 } 329 }
328 330
329 331
330 void LoadIC::GenerateNormal(MacroAssembler* masm) { 332 void LoadIC::GenerateNormal(MacroAssembler* masm) {
331 // ----------- S t a t e ------------- 333 // ----------- S t a t e -------------
332 // -- r2 : name 334 // -- r2 : name
333 // -- lr : return address 335 // -- lr : return address
334 // -- r0 : receiver 336 // -- r0 : receiver
335 // ----------------------------------- 337 // -----------------------------------
338 ASSERT(r0.is(ReceiverRegister()));
339 ASSERT(r2.is(NameRegister()));
340
336 Label miss, slow; 341 Label miss, slow;
337 342
338 GenerateNameDictionaryReceiverCheck(masm, r0, r1, r3, r4, &miss); 343 GenerateNameDictionaryReceiverCheck(masm, r0, r1, r3, r4, &miss);
339 344
340 // r1: elements 345 // r1: elements
341 GenerateDictionaryLoad(masm, &slow, r1, r2, r0, r3, r4); 346 GenerateDictionaryLoad(masm, &slow, r1, r2, r0, r3, r4);
342 __ Ret(); 347 __ Ret();
343 348
344 // Dictionary load failed, go slow (but don't miss). 349 // Dictionary load failed, go slow (but don't miss).
345 __ bind(&slow); 350 __ bind(&slow);
346 GenerateRuntimeGetProperty(masm); 351 GenerateRuntimeGetProperty(masm);
347 352
348 // Cache miss: Jump to runtime. 353 // Cache miss: Jump to runtime.
349 __ bind(&miss); 354 __ bind(&miss);
350 GenerateMiss(masm); 355 GenerateMiss(masm);
351 } 356 }
352 357
353 358
359 // A register that isn't one of the parameters to the load ic.
360 static const Register LoadIC_TempRegister() { return r3; }
361
362
354 void LoadIC::GenerateMiss(MacroAssembler* masm) { 363 void LoadIC::GenerateMiss(MacroAssembler* masm) {
355 // ----------- S t a t e ------------- 364 // ----------- S t a t e -------------
356 // -- r2 : name
357 // -- lr : return address 365 // -- lr : return address
358 // -- r0 : receiver
359 // ----------------------------------- 366 // -----------------------------------
360 Isolate* isolate = masm->isolate(); 367 Isolate* isolate = masm->isolate();
361 368
362 __ IncrementCounter(isolate->counters()->load_miss(), 1, r3, r4); 369 __ IncrementCounter(isolate->counters()->load_miss(), 1, r3, r4);
363 370
364 __ mov(r3, r0); 371 __ mov(LoadIC_TempRegister(), ReceiverRegister());
365 __ Push(r3, r2); 372 __ Push(LoadIC_TempRegister(), NameRegister());
366 373
367 // Perform tail call to the entry. 374 // Perform tail call to the entry.
368 ExternalReference ref = 375 ExternalReference ref =
369 ExternalReference(IC_Utility(kLoadIC_Miss), isolate); 376 ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
370 __ TailCallExternalReference(ref, 2, 1); 377 __ TailCallExternalReference(ref, 2, 1);
371 } 378 }
372 379
373 380
374 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 381 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
375 // ---------- S t a t e -------------- 382 // ---------- S t a t e --------------
376 // -- r2 : name
377 // -- lr : return address 383 // -- lr : return address
378 // -- r0 : receiver
379 // ----------------------------------- 384 // -----------------------------------
380 385
381 __ mov(r3, r0); 386 __ mov(LoadIC_TempRegister(), ReceiverRegister());
382 __ Push(r3, r2); 387 __ Push(LoadIC_TempRegister(), NameRegister());
383 388
384 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); 389 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
385 } 390 }
386 391
387 392
388 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, 393 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm,
389 Register object, 394 Register object,
390 Register key, 395 Register key,
391 Register scratch1, 396 Register scratch1,
392 Register scratch2, 397 Register scratch2,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 return MemOperand(backing_store, scratch); 474 return MemOperand(backing_store, scratch);
470 } 475 }
471 476
472 477
473 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { 478 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
474 // ---------- S t a t e -------------- 479 // ---------- S t a t e --------------
475 // -- lr : return address 480 // -- lr : return address
476 // -- r0 : key 481 // -- r0 : key
477 // -- r1 : receiver 482 // -- r1 : receiver
478 // ----------------------------------- 483 // -----------------------------------
484 ASSERT(r1.is(ReceiverRegister()));
485 ASSERT(r0.is(NameRegister()));
479 Label slow, notin; 486 Label slow, notin;
480 MemOperand mapped_location = 487 MemOperand mapped_location =
481 GenerateMappedArgumentsLookup(masm, r1, r0, r2, r3, r4, &notin, &slow); 488 GenerateMappedArgumentsLookup(masm, r1, r0, r2, r3, r4, &notin, &slow);
482 __ ldr(r0, mapped_location); 489 __ ldr(r0, mapped_location);
483 __ Ret(); 490 __ Ret();
484 __ bind(&notin); 491 __ bind(&notin);
485 // The unmapped lookup expects that the parameter map is in r2. 492 // The unmapped lookup expects that the parameter map is in r2.
486 MemOperand unmapped_location = 493 MemOperand unmapped_location =
487 GenerateUnmappedArgumentsLookup(masm, r0, r2, r3, &slow); 494 GenerateUnmappedArgumentsLookup(masm, r0, r2, r3, &slow);
488 __ ldr(r2, unmapped_location); 495 __ ldr(r2, unmapped_location);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 __ RecordWrite(r3, r6, r9, kLRHasNotBeenSaved, kDontSaveFPRegs); 528 __ RecordWrite(r3, r6, r9, kLRHasNotBeenSaved, kDontSaveFPRegs);
522 __ Ret(); 529 __ Ret();
523 __ bind(&slow); 530 __ bind(&slow);
524 GenerateMiss(masm); 531 GenerateMiss(masm);
525 } 532 }
526 533
527 534
528 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 535 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
529 // ---------- S t a t e -------------- 536 // ---------- S t a t e --------------
530 // -- lr : return address 537 // -- lr : return address
531 // -- r0 : key
532 // -- r1 : receiver
533 // ----------------------------------- 538 // -----------------------------------
534 Isolate* isolate = masm->isolate(); 539 Isolate* isolate = masm->isolate();
535 540
536 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4); 541 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4);
537 542
538 __ Push(r1, r0); 543 __ Push(ReceiverRegister(), NameRegister());
539 544
540 // Perform tail call to the entry. 545 // Perform tail call to the entry.
541 ExternalReference ref = 546 ExternalReference ref =
542 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); 547 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
543 548
544 __ TailCallExternalReference(ref, 2, 1); 549 __ TailCallExternalReference(ref, 2, 1);
545 } 550 }
546 551
547 552
548 // IC register specifications 553 // IC register specifications
549 const Register LoadIC::ReceiverRegister() { return r0; } 554 const Register LoadIC::ReceiverRegister() { return r0; }
550 const Register LoadIC::NameRegister() { return r2; } 555 const Register LoadIC::NameRegister() { return r2; }
551 const Register KeyedLoadIC::ReceiverRegister() { return r1; } 556 const Register KeyedLoadIC::ReceiverRegister() { return r1; }
552 const Register KeyedLoadIC::NameRegister() { return r0; } 557 const Register KeyedLoadIC::NameRegister() { return r0; }
553 558
554 559
555 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 560 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
556 // ---------- S t a t e -------------- 561 // ---------- S t a t e --------------
557 // -- lr : return address 562 // -- lr : return address
558 // -- r0 : key
559 // -- r1 : receiver
560 // ----------------------------------- 563 // -----------------------------------
561 564
562 __ Push(r1, r0); 565 __ Push(ReceiverRegister(), NameRegister());
563 566
564 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 567 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
565 } 568 }
566 569
567 570
568 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 571 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
569 // ---------- S t a t e -------------- 572 // ---------- S t a t e --------------
570 // -- lr : return address 573 // -- lr : return address
571 // -- r0 : key 574 // -- r0 : key
572 // -- r1 : receiver 575 // -- r1 : receiver
573 // ----------------------------------- 576 // -----------------------------------
577 ASSERT(r1.is(ReceiverRegister()));
578 ASSERT(r0.is(NameRegister()));
574 Label slow, check_name, index_smi, index_name, property_array_property; 579 Label slow, check_name, index_smi, index_name, property_array_property;
575 Label probe_dictionary, check_number_dictionary; 580 Label probe_dictionary, check_number_dictionary;
576 581
577 Register key = r0; 582 Register key = r0;
578 Register receiver = r1; 583 Register receiver = r1;
579 584
580 Isolate* isolate = masm->isolate(); 585 Isolate* isolate = masm->isolate();
581 586
582 // Check that the key is a smi. 587 // Check that the key is a smi.
583 __ JumpIfNotSmi(key, &check_name); 588 __ JumpIfNotSmi(key, &check_name);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 __ jmp(&index_smi); 740 __ jmp(&index_smi);
736 } 741 }
737 742
738 743
739 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 744 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
740 // ---------- S t a t e -------------- 745 // ---------- S t a t e --------------
741 // -- lr : return address 746 // -- lr : return address
742 // -- r0 : key (index) 747 // -- r0 : key (index)
743 // -- r1 : receiver 748 // -- r1 : receiver
744 // ----------------------------------- 749 // -----------------------------------
750 ASSERT(r1.is(ReceiverRegister()));
751 ASSERT(r0.is(NameRegister()));
745 Label miss; 752 Label miss;
746 753
747 Register receiver = r1; 754 Register receiver = r1;
748 Register index = r0; 755 Register index = r0;
749 Register scratch = r3; 756 Register scratch = r3;
750 Register result = r0; 757 Register result = r0;
751 758
752 StringCharAtGenerator char_at_generator(receiver, 759 StringCharAtGenerator char_at_generator(receiver,
753 index, 760 index,
754 scratch, 761 scratch,
(...skipping 12 matching lines...) Expand all
767 GenerateMiss(masm); 774 GenerateMiss(masm);
768 } 775 }
769 776
770 777
771 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 778 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
772 // ---------- S t a t e -------------- 779 // ---------- S t a t e --------------
773 // -- lr : return address 780 // -- lr : return address
774 // -- r0 : key 781 // -- r0 : key
775 // -- r1 : receiver 782 // -- r1 : receiver
776 // ----------------------------------- 783 // -----------------------------------
784 ASSERT(r1.is(ReceiverRegister()));
785 ASSERT(r0.is(NameRegister()));
777 Label slow; 786 Label slow;
778 787
779 // Check that the receiver isn't a smi. 788 // Check that the receiver isn't a smi.
780 __ JumpIfSmi(r1, &slow); 789 __ JumpIfSmi(r1, &slow);
781 790
782 // Check that the key is an array index, that is Uint32. 791 // Check that the key is an array index, that is Uint32.
783 __ NonNegativeSmiTst(r0); 792 __ NonNegativeSmiTst(r0);
784 __ b(ne, &slow); 793 __ b(ne, &slow);
785 794
786 // Get the map of the receiver. 795 // Get the map of the receiver.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 } else { 1328 } else {
1320 ASSERT(Assembler::GetCondition(branch_instr) == ne); 1329 ASSERT(Assembler::GetCondition(branch_instr) == ne);
1321 patcher.EmitCondition(eq); 1330 patcher.EmitCondition(eq);
1322 } 1331 }
1323 } 1332 }
1324 1333
1325 1334
1326 } } // namespace v8::internal 1335 } } // namespace v8::internal
1327 1336
1328 #endif // V8_TARGET_ARCH_ARM 1337 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698