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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 6902104: Don't exchange null and undefined with the global object in function.prototype.{call, apply} for ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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/date.js ('k') | src/messages.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 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 { Label convert_to_object, use_global_receiver, patch_receiver; 592 { Label convert_to_object, use_global_receiver, patch_receiver;
593 // Change context eagerly in case we need the global receiver. 593 // Change context eagerly in case we need the global receiver.
594 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 594 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
595 595
596 // Do not transform the receiver for strict mode functions. 596 // Do not transform the receiver for strict mode functions.
597 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 597 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
598 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset), 598 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset),
599 1 << SharedFunctionInfo::kStrictModeBitWithinByte); 599 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
600 __ j(not_equal, &shift_arguments); 600 __ j(not_equal, &shift_arguments);
601 601
602 // Do not transform the receiver for natives (shared already in ebx).
603 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kScriptOffset));
604 __ cmp(ebx, factory->undefined_value());
605 __ j(equal, &shift_arguments);
606 __ mov(ebx, FieldOperand(ebx, Script::kTypeOffset));
607 __ SmiUntag(ebx);
608 __ cmp(ebx, Script::TYPE_NATIVE);
609 __ j(equal, &shift_arguments);
610
602 // Compute the receiver in non-strict mode. 611 // Compute the receiver in non-strict mode.
603 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. 612 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument.
604 __ test(ebx, Immediate(kSmiTagMask)); 613 __ test(ebx, Immediate(kSmiTagMask));
605 __ j(zero, &convert_to_object); 614 __ j(zero, &convert_to_object);
606 615
607 __ cmp(ebx, factory->null_value()); 616 __ cmp(ebx, factory->null_value());
608 __ j(equal, &use_global_receiver); 617 __ j(equal, &use_global_receiver);
609 __ cmp(ebx, factory->undefined_value()); 618 __ cmp(ebx, factory->undefined_value());
610 __ j(equal, &use_global_receiver); 619 __ j(equal, &use_global_receiver);
611 620
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Compute the receiver. 757 // Compute the receiver.
749 Label call_to_object, use_global_receiver, push_receiver; 758 Label call_to_object, use_global_receiver, push_receiver;
750 __ mov(ebx, Operand(ebp, 3 * kPointerSize)); 759 __ mov(ebx, Operand(ebp, 3 * kPointerSize));
751 760
752 // Do not transform the receiver for strict mode functions. 761 // Do not transform the receiver for strict mode functions.
753 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 762 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
754 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset), 763 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset),
755 1 << SharedFunctionInfo::kStrictModeBitWithinByte); 764 1 << SharedFunctionInfo::kStrictModeBitWithinByte);
756 __ j(not_equal, &push_receiver); 765 __ j(not_equal, &push_receiver);
757 766
767 Factory* factory = masm->isolate()->factory();
768
769 // Do not transform the receiver for natives (shared already in ecx).
770 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kScriptOffset));
771 __ cmp(ecx, factory->undefined_value());
772 __ j(equal, &push_receiver);
773 __ mov(ecx, FieldOperand(ecx, Script::kTypeOffset));
774 __ SmiUntag(ecx);
775 __ cmp(ecx, Script::TYPE_NATIVE);
776 __ j(equal, &push_receiver);
777
758 // Compute the receiver in non-strict mode. 778 // Compute the receiver in non-strict mode.
759 __ test(ebx, Immediate(kSmiTagMask)); 779 __ test(ebx, Immediate(kSmiTagMask));
760 __ j(zero, &call_to_object); 780 __ j(zero, &call_to_object);
761 Factory* factory = masm->isolate()->factory();
762 __ cmp(ebx, factory->null_value()); 781 __ cmp(ebx, factory->null_value());
763 __ j(equal, &use_global_receiver); 782 __ j(equal, &use_global_receiver);
764 __ cmp(ebx, factory->undefined_value()); 783 __ cmp(ebx, factory->undefined_value());
765 __ j(equal, &use_global_receiver); 784 __ j(equal, &use_global_receiver);
766 785
767 // If given receiver is already a JavaScript object then there's no 786 // If given receiver is already a JavaScript object then there's no
768 // reason for converting it. 787 // reason for converting it.
769 // We don't use IsObjectJSObjectType here because we jump on success. 788 // We don't use IsObjectJSObjectType here because we jump on success.
770 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); 789 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
771 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 790 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1606 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1588 generator.Generate(); 1607 generator.Generate();
1589 } 1608 }
1590 1609
1591 1610
1592 #undef __ 1611 #undef __
1593 } 1612 }
1594 } // namespace v8::internal 1613 } // namespace v8::internal
1595 1614
1596 #endif // V8_TARGET_ARCH_IA32 1615 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/date.js ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698