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

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

Issue 1628003: Port string stub for keyed loads to x64 and ARM (http://code.google.com/p/v8/... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 8 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
« no previous file with comments | « src/arm/ic-arm.cc ('k') | test/mjsunit/string-index.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 518
519 519
520 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 520 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
521 // ----------- S t a t e ------------- 521 // ----------- S t a t e -------------
522 // -- rsp[0] : return address 522 // -- rsp[0] : return address
523 // -- rsp[8] : name 523 // -- rsp[8] : name
524 // -- rsp[16] : receiver 524 // -- rsp[16] : receiver
525 // ----------------------------------- 525 // -----------------------------------
526 526
527 GenerateGeneric(masm); 527 Label miss, index_ok;
528
529 // Check that the receiver isn't a smi.
530 __ movq(rcx, Operand(rsp, 2 * kPointerSize));
531 __ JumpIfSmi(rcx, &miss);
532
533 // Check that the receiver is a string.
534 Condition is_string = masm->IsObjectStringType(rcx, rax, rbx);
535 __ j(NegateCondition(is_string), &miss);
536
537 // Check if key is a smi or a heap number.
538 __ movq(rax, Operand(rsp, kPointerSize));
539 __ JumpIfSmi(rax, &index_ok);
540 __ CheckMap(rax, Factory::heap_number_map(), &miss, false);
541
542 __ bind(&index_ok);
543 // Duplicate receiver and key since they are expected on the stack after
544 // the KeyedLoadIC call.
545 __ pop(rbx); // return address
546 __ push(rcx); // receiver
547 __ push(rax); // key
548 __ push(rbx); // return address
549 __ InvokeBuiltin(Builtins::STRING_CHAR_AT, JUMP_FUNCTION);
550
551 __ bind(&miss);
552 GenerateMiss(masm);
528 } 553 }
529 554
530 555
531 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, 556 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
532 ExternalArrayType array_type) { 557 ExternalArrayType array_type) {
533 // ----------- S t a t e ------------- 558 // ----------- S t a t e -------------
534 // -- rsp[0] : return address 559 // -- rsp[0] : return address
535 // -- rsp[8] : name 560 // -- rsp[8] : name
536 // -- rsp[16] : receiver 561 // -- rsp[16] : receiver
537 // ----------------------------------- 562 // -----------------------------------
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 __ bind(&miss); 1573 __ bind(&miss);
1549 1574
1550 GenerateMiss(masm); 1575 GenerateMiss(masm);
1551 } 1576 }
1552 1577
1553 1578
1554 #undef __ 1579 #undef __
1555 1580
1556 1581
1557 } } // namespace v8::internal 1582 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/ic-arm.cc ('k') | test/mjsunit/string-index.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698