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

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

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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/mips/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 __ And(at, hash, Operand(kIsSymbolMask)); 377 __ And(at, hash, Operand(kIsSymbolMask));
378 __ Branch(not_symbol, eq, at, Operand(zero_reg)); 378 __ Branch(not_symbol, eq, at, Operand(zero_reg));
379 } 379 }
380 380
381 381
382 // Defined in ic.cc. 382 // Defined in ic.cc.
383 Object* CallIC_Miss(Arguments args); 383 Object* CallIC_Miss(Arguments args);
384 384
385 // The generated code does not accept smi keys. 385 // The generated code does not accept smi keys.
386 // The generated code falls through if both probes miss. 386 // The generated code falls through if both probes miss.
387 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, 387 void CallICBase::GenerateMonomorphicCacheProbe(MacroAssembler* masm,
388 int argc, 388 int argc,
389 Code::Kind kind, 389 Code::Kind kind,
390 Code::ExtraICState extra_ic_state) { 390 Code::ExtraICState extra_state) {
391 // ----------- S t a t e ------------- 391 // ----------- S t a t e -------------
392 // -- a1 : receiver 392 // -- a1 : receiver
393 // -- a2 : name 393 // -- a2 : name
394 // ----------------------------------- 394 // -----------------------------------
395 Label number, non_number, non_string, boolean, probe, miss; 395 Label number, non_number, non_string, boolean, probe, miss;
396 396
397 // Probe the stub cache. 397 // Probe the stub cache.
398 Code::Flags flags = Code::ComputeFlags(kind, 398 Code::Flags flags = Code::ComputeFlags(kind,
399 MONOMORPHIC, 399 MONOMORPHIC,
400 extra_ic_state, 400 extra_state,
401 NORMAL, 401 NORMAL,
402 argc); 402 argc);
403 Isolate::Current()->stub_cache()->GenerateProbe( 403 Isolate::Current()->stub_cache()->GenerateProbe(
404 masm, flags, a1, a2, a3, t0, t1); 404 masm, flags, a1, a2, a3, t0, t1);
405 405
406 // If the stub cache probing failed, the receiver might be a value. 406 // If the stub cache probing failed, the receiver might be a value.
407 // For value objects, we use the map of the prototype objects for 407 // For value objects, we use the map of the prototype objects for
408 // the corresponding JSValue for the cache and that is what we need 408 // the corresponding JSValue for the cache and that is what we need
409 // to probe. 409 // to probe.
410 // 410 //
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 __ GetObjectType(a1, scratch, scratch); 456 __ GetObjectType(a1, scratch, scratch);
457 __ Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); 457 __ Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE));
458 458
459 // Invoke the function. 459 // Invoke the function.
460 ParameterCount actual(argc); 460 ParameterCount actual(argc);
461 __ InvokeFunction(a1, actual, JUMP_FUNCTION, 461 __ InvokeFunction(a1, actual, JUMP_FUNCTION,
462 NullCallWrapper(), CALL_AS_METHOD); 462 NullCallWrapper(), CALL_AS_METHOD);
463 } 463 }
464 464
465 465
466 static void GenerateCallNormal(MacroAssembler* masm, int argc) { 466 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) {
467 // ----------- S t a t e ------------- 467 // ----------- S t a t e -------------
468 // -- a2 : name 468 // -- a2 : name
469 // -- ra : return address 469 // -- ra : return address
470 // ----------------------------------- 470 // -----------------------------------
471 Label miss; 471 Label miss;
472 472
473 // Get the receiver of the function from the stack into a1. 473 // Get the receiver of the function from the stack into a1.
474 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 474 __ lw(a1, MemOperand(sp, argc * kPointerSize));
475 475
476 GenerateStringDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss); 476 GenerateStringDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss);
477 477
478 // a0: elements 478 // a0: elements
479 // Search the dictionary - put result in register a1. 479 // Search the dictionary - put result in register a1.
480 GenerateDictionaryLoad(masm, &miss, a0, a2, a1, a3, t0); 480 GenerateDictionaryLoad(masm, &miss, a0, a2, a1, a3, t0);
481 481
482 GenerateFunctionTailCall(masm, argc, &miss, t0); 482 GenerateFunctionTailCall(masm, argc, &miss, t0);
483 483
484 // Cache miss: Jump to runtime. 484 // Cache miss: Jump to runtime.
485 __ bind(&miss); 485 __ bind(&miss);
486 } 486 }
487 487
488 488
489 static void GenerateCallMiss(MacroAssembler* masm, 489 void CallICBase::GenerateMiss(MacroAssembler* masm,
490 int argc, 490 int argc,
491 IC::UtilityId id, 491 IC::UtilityId id,
492 Code::ExtraICState extra_ic_state) { 492 Code::ExtraICState extra_state) {
493 // ----------- S t a t e ------------- 493 // ----------- S t a t e -------------
494 // -- a2 : name 494 // -- a2 : name
495 // -- ra : return address 495 // -- ra : return address
496 // ----------------------------------- 496 // -----------------------------------
497 Isolate* isolate = masm->isolate(); 497 Isolate* isolate = masm->isolate();
498 498
499 if (id == IC::kCallIC_Miss) { 499 if (id == IC::kCallIC_Miss) {
500 __ IncrementCounter(isolate->counters()->call_miss(), 1, a3, t0); 500 __ IncrementCounter(isolate->counters()->call_miss(), 1, a3, t0);
501 } else { 501 } else {
502 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, a3, t0); 502 __ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, a3, t0);
(...skipping 30 matching lines...) Expand all
533 __ Branch(&global, eq, a3, Operand(JS_GLOBAL_OBJECT_TYPE)); 533 __ Branch(&global, eq, a3, Operand(JS_GLOBAL_OBJECT_TYPE));
534 __ Branch(&invoke, ne, a3, Operand(JS_BUILTINS_OBJECT_TYPE)); 534 __ Branch(&invoke, ne, a3, Operand(JS_BUILTINS_OBJECT_TYPE));
535 535
536 // Patch the receiver on the stack. 536 // Patch the receiver on the stack.
537 __ bind(&global); 537 __ bind(&global);
538 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); 538 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset));
539 __ sw(a2, MemOperand(sp, argc * kPointerSize)); 539 __ sw(a2, MemOperand(sp, argc * kPointerSize));
540 __ bind(&invoke); 540 __ bind(&invoke);
541 } 541 }
542 // Invoke the function. 542 // Invoke the function.
543 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state) 543 CallKind call_kind = CallICBase::Contextual::decode(extra_state)
544 ? CALL_AS_FUNCTION 544 ? CALL_AS_FUNCTION
545 : CALL_AS_METHOD; 545 : CALL_AS_METHOD;
546 ParameterCount actual(argc); 546 ParameterCount actual(argc);
547 __ InvokeFunction(a1, 547 __ InvokeFunction(a1,
548 actual, 548 actual,
549 JUMP_FUNCTION, 549 JUMP_FUNCTION,
550 NullCallWrapper(), 550 NullCallWrapper(),
551 call_kind); 551 call_kind);
552 } 552 }
553 553
554 554
555 void CallIC::GenerateMiss(MacroAssembler* masm,
556 int argc,
557 Code::ExtraICState extra_ic_state) {
558 // ----------- S t a t e -------------
559 // -- a2 : name
560 // -- ra : return address
561 // -----------------------------------
562
563 GenerateCallMiss(masm, argc, IC::kCallIC_Miss, extra_ic_state);
564 }
565
566
567 void CallIC::GenerateMegamorphic(MacroAssembler* masm, 555 void CallIC::GenerateMegamorphic(MacroAssembler* masm,
568 int argc, 556 int argc,
569 Code::ExtraICState extra_ic_state) { 557 Code::ExtraICState extra_ic_state) {
570 // ----------- S t a t e ------------- 558 // ----------- S t a t e -------------
571 // -- a2 : name 559 // -- a2 : name
572 // -- ra : return address 560 // -- ra : return address
573 // ----------------------------------- 561 // -----------------------------------
574 562
575 // Get the receiver of the function from the stack into a1. 563 // Get the receiver of the function from the stack into a1.
576 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 564 __ lw(a1, MemOperand(sp, argc * kPointerSize));
577 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); 565 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state);
578 GenerateMiss(masm, argc, extra_ic_state); 566 GenerateMiss(masm, argc, extra_ic_state);
579 } 567 }
580 568
581 569
582 void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
583 // ----------- S t a t e -------------
584 // -- a2 : name
585 // -- ra : return address
586 // -----------------------------------
587
588 GenerateCallNormal(masm, argc);
589 GenerateMiss(masm, argc, Code::kNoExtraICState);
590 }
591
592
593 void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) {
594 // ----------- S t a t e -------------
595 // -- a2 : name
596 // -- ra : return address
597 // -----------------------------------
598
599 GenerateCallMiss(masm, argc, IC::kKeyedCallIC_Miss, Code::kNoExtraICState);
600 }
601
602
603 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { 570 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
604 // ----------- S t a t e ------------- 571 // ----------- S t a t e -------------
605 // -- a2 : name 572 // -- a2 : name
606 // -- ra : return address 573 // -- ra : return address
607 // ----------------------------------- 574 // -----------------------------------
608 575
609 // Get the receiver of the function from the stack into a1. 576 // Get the receiver of the function from the stack into a1.
610 __ lw(a1, MemOperand(sp, argc * kPointerSize)); 577 __ lw(a1, MemOperand(sp, argc * kPointerSize));
611 578
612 Label do_call, slow_call, slow_load, slow_reload_receiver; 579 Label do_call, slow_call, slow_load, slow_reload_receiver;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // ----------- S t a t e ------------- 676 // ----------- S t a t e -------------
710 // -- a2 : name 677 // -- a2 : name
711 // -- ra : return address 678 // -- ra : return address
712 // ----------------------------------- 679 // -----------------------------------
713 680
714 // Check if the name is a string. 681 // Check if the name is a string.
715 Label miss; 682 Label miss;
716 __ JumpIfSmi(a2, &miss); 683 __ JumpIfSmi(a2, &miss);
717 __ IsObjectJSStringType(a2, a0, &miss); 684 __ IsObjectJSStringType(a2, a0, &miss);
718 685
719 GenerateCallNormal(masm, argc); 686 CallICBase::GenerateNormal(masm, argc);
720 __ bind(&miss); 687 __ bind(&miss);
721 GenerateMiss(masm, argc); 688 GenerateMiss(masm, argc);
722 } 689 }
723 690
724 691
725 // Defined in ic.cc. 692 // Defined in ic.cc.
726 Object* LoadIC_Miss(Arguments args); 693 Object* LoadIC_Miss(Arguments args);
727 694
728 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 695 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
729 // ----------- S t a t e ------------- 696 // ----------- S t a t e -------------
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 1381
1415 // The slow case calls into the runtime to complete the store without causing 1382 // The slow case calls into the runtime to complete the store without causing
1416 // an IC miss that would otherwise cause a transition to the generic stub. 1383 // an IC miss that would otherwise cause a transition to the generic stub.
1417 ExternalReference ref = 1384 ExternalReference ref =
1418 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); 1385 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
1419 1386
1420 __ TailCallExternalReference(ref, 3, 1); 1387 __ TailCallExternalReference(ref, 3, 1);
1421 } 1388 }
1422 1389
1423 1390
1391 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) {
1392 // ---------- S t a t e --------------
1393 // -- a2 : receiver
1394 // -- a3 : target map
1395 // -- ra : return address
1396 // -----------------------------------
1397 // Must return the modified receiver in v0.
1398 if (!FLAG_trace_elements_transitions) {
1399 Label fail;
1400 ElementsTransitionGenerator::GenerateSmiOnlyToDouble(masm, &fail);
1401 __ Ret(USE_DELAY_SLOT);
1402 __ mov(v0, a2);
1403 __ bind(&fail);
1404 }
1405
1406 __ push(a2);
1407 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1);
1408 }
1409
1410
1411 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject(
1412 MacroAssembler* masm) {
1413 // ---------- S t a t e --------------
1414 // -- a2 : receiver
1415 // -- a3 : target map
1416 // -- ra : return address
1417 // -----------------------------------
1418 // Must return the modified receiver in v0.
1419 if (!FLAG_trace_elements_transitions) {
1420 Label fail;
1421 ElementsTransitionGenerator::GenerateDoubleToObject(masm, &fail);
1422 __ Ret(USE_DELAY_SLOT);
1423 __ mov(v0, a2);
1424 __ bind(&fail);
1425 }
1426
1427 __ push(a2);
1428 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1);
1429 }
1430
1431
1424 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1432 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1425 StrictModeFlag strict_mode) { 1433 StrictModeFlag strict_mode) {
1426 // ----------- S t a t e ------------- 1434 // ----------- S t a t e -------------
1427 // -- a0 : value 1435 // -- a0 : value
1428 // -- a1 : receiver 1436 // -- a1 : receiver
1429 // -- a2 : name 1437 // -- a2 : name
1430 // -- ra : return address 1438 // -- ra : return address
1431 // ----------------------------------- 1439 // -----------------------------------
1432 1440
1433 // Get the receiver from the stack and probe the stub cache. 1441 // Get the receiver from the stack and probe the stub cache.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 1561
1554 1562
1555 Condition CompareIC::ComputeCondition(Token::Value op) { 1563 Condition CompareIC::ComputeCondition(Token::Value op) {
1556 switch (op) { 1564 switch (op) {
1557 case Token::EQ_STRICT: 1565 case Token::EQ_STRICT:
1558 case Token::EQ: 1566 case Token::EQ:
1559 return eq; 1567 return eq;
1560 case Token::LT: 1568 case Token::LT:
1561 return lt; 1569 return lt;
1562 case Token::GT: 1570 case Token::GT:
1563 // Reverse left and right operands to obtain ECMA-262 conversion order. 1571 return gt;
1564 return lt;
1565 case Token::LTE: 1572 case Token::LTE:
1566 // Reverse left and right operands to obtain ECMA-262 conversion order. 1573 return le;
1567 return ge;
1568 case Token::GTE: 1574 case Token::GTE:
1569 return ge; 1575 return ge;
1570 default: 1576 default:
1571 UNREACHABLE(); 1577 UNREACHABLE();
1572 return kNoCondition; 1578 return kNoCondition;
1573 } 1579 }
1574 } 1580 }
1575 1581
1576 1582
1577 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 1583 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); 1672 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch));
1667 patcher.masm()->andi(at, reg, kSmiTagMask); 1673 patcher.masm()->andi(at, reg, kSmiTagMask);
1668 patcher.ChangeBranchCondition(eq); 1674 patcher.ChangeBranchCondition(eq);
1669 } 1675 }
1670 } 1676 }
1671 1677
1672 1678
1673 } } // namespace v8::internal 1679 } } // namespace v8::internal
1674 1680
1675 #endif // V8_TARGET_ARCH_MIPS 1681 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698