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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 542087: Ensure correct boxing of values when calling functions on them... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 // Patch the receiver on the stack with the global proxy if 631 // Patch the receiver on the stack with the global proxy if
632 // necessary. 632 // necessary.
633 if (object->IsGlobalObject()) { 633 if (object->IsGlobalObject()) {
634 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 634 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
635 __ str(r3, MemOperand(sp, argc * kPointerSize)); 635 __ str(r3, MemOperand(sp, argc * kPointerSize));
636 } 636 }
637 break; 637 break;
638 638
639 case STRING_CHECK: 639 case STRING_CHECK:
640 // Check that the object is a two-byte string or a symbol. 640 if (!function->IsBuiltin()) {
641 __ CompareObjectType(r1, r2, r2, FIRST_NONSTRING_TYPE); 641 // Calling non-builtins with a value as receiver requires boxing.
642 __ b(hs, &miss); 642 __ jmp(&miss);
643 // Check that the maps starting from the prototype haven't changed. 643 } else {
644 GenerateLoadGlobalFunctionPrototype(masm(), 644 // Check that the object is a two-byte string or a symbol.
645 Context::STRING_FUNCTION_INDEX, 645 __ CompareObjectType(r1, r2, r2, FIRST_NONSTRING_TYPE);
646 r2); 646 __ b(hs, &miss);
647 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3, 647 // Check that the maps starting from the prototype haven't changed.
648 r1, name, &miss); 648 GenerateLoadGlobalFunctionPrototype(masm(),
649 Context::STRING_FUNCTION_INDEX,
650 r2);
651 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3,
652 r1, name, &miss);
653 }
649 break; 654 break;
650 655
651 case NUMBER_CHECK: { 656 case NUMBER_CHECK: {
652 Label fast; 657 if (!function->IsBuiltin()) {
653 // Check that the object is a smi or a heap number. 658 // Calling non-builtins with a value as receiver requires boxing.
654 __ tst(r1, Operand(kSmiTagMask)); 659 __ jmp(&miss);
655 __ b(eq, &fast); 660 } else {
656 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE); 661 Label fast;
657 __ b(ne, &miss); 662 // Check that the object is a smi or a heap number.
658 __ bind(&fast); 663 __ tst(r1, Operand(kSmiTagMask));
659 // Check that the maps starting from the prototype haven't changed. 664 __ b(eq, &fast);
660 GenerateLoadGlobalFunctionPrototype(masm(), 665 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE);
661 Context::NUMBER_FUNCTION_INDEX, 666 __ b(ne, &miss);
662 r2); 667 __ bind(&fast);
663 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3, 668 // Check that the maps starting from the prototype haven't changed.
664 r1, name, &miss); 669 GenerateLoadGlobalFunctionPrototype(masm(),
670 Context::NUMBER_FUNCTION_INDEX,
671 r2);
672 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3,
673 r1, name, &miss);
674 }
665 break; 675 break;
666 } 676 }
667 677
668 case BOOLEAN_CHECK: { 678 case BOOLEAN_CHECK: {
669 Label fast; 679 if (!function->IsBuiltin()) {
670 // Check that the object is a boolean. 680 // Calling non-builtins with a value as receiver requires boxing.
671 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 681 __ jmp(&miss);
672 __ cmp(r1, ip); 682 } else {
673 __ b(eq, &fast); 683 Label fast;
674 __ LoadRoot(ip, Heap::kFalseValueRootIndex); 684 // Check that the object is a boolean.
675 __ cmp(r1, ip); 685 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
676 __ b(ne, &miss); 686 __ cmp(r1, ip);
677 __ bind(&fast); 687 __ b(eq, &fast);
678 // Check that the maps starting from the prototype haven't changed. 688 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
679 GenerateLoadGlobalFunctionPrototype(masm(), 689 __ cmp(r1, ip);
680 Context::BOOLEAN_FUNCTION_INDEX, 690 __ b(ne, &miss);
681 r2); 691 __ bind(&fast);
682 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3, 692 // Check that the maps starting from the prototype haven't changed.
683 r1, name, &miss); 693 GenerateLoadGlobalFunctionPrototype(masm(),
694 Context::BOOLEAN_FUNCTION_INDEX,
695 r2);
696 CheckPrototypes(JSObject::cast(object->GetPrototype()), r2, holder, r3,
697 r1, name, &miss);
698 }
684 break; 699 break;
685 } 700 }
686 701
687 case JSARRAY_HAS_FAST_ELEMENTS_CHECK: 702 case JSARRAY_HAS_FAST_ELEMENTS_CHECK:
688 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r2, name, &miss); 703 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r2, name, &miss);
689 // Make sure object->HasFastElements(). 704 // Make sure object->HasFastElements().
690 // Get the elements array of the object. 705 // Get the elements array of the object.
691 __ ldr(r3, FieldMemOperand(r1, JSObject::kElementsOffset)); 706 __ ldr(r3, FieldMemOperand(r1, JSObject::kElementsOffset));
692 // Check that the object is in fast mode (not dictionary). 707 // Check that the object is in fast mode (not dictionary).
693 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); 708 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset));
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1522 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1508 1523
1509 // Return the generated code. 1524 // Return the generated code.
1510 return GetCode(); 1525 return GetCode();
1511 } 1526 }
1512 1527
1513 1528
1514 #undef __ 1529 #undef __
1515 1530
1516 } } // namespace v8::internal 1531 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/codegen.h » ('j') | test/mjsunit/value-wrapper.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698