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

Side by Side Diff: src/accessors.cc

Issue 8333019: Make bound functions have poisoned .caller and .arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « no previous file | src/bootstrapper.cc » ('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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 if (caller == NULL) return isolate->heap()->null_value(); 752 if (caller == NULL) return isolate->heap()->null_value();
753 } while (caller->shared()->is_toplevel()); 753 } while (caller->shared()->is_toplevel());
754 754
755 // If caller is a built-in function and caller's caller is also built-in, 755 // If caller is a built-in function and caller's caller is also built-in,
756 // use that instead. 756 // use that instead.
757 JSFunction* potential_caller = caller; 757 JSFunction* potential_caller = caller;
758 while (potential_caller != NULL && potential_caller->IsBuiltin()) { 758 while (potential_caller != NULL && potential_caller->IsBuiltin()) {
759 caller = potential_caller; 759 caller = potential_caller;
760 potential_caller = it.next(); 760 potential_caller = it.next();
761 } 761 }
762 762 // If caller is bound, return null. This is compatible with JSC, and
763 // allows us to make bound functions use the strict function map
764 // and its associated throwing caller and arguments.
765 if (caller->shared()->bound()) {
766 return isolate->heap()->null_value();
767 }
763 return CheckNonStrictCallerOrThrow(isolate, caller); 768 return CheckNonStrictCallerOrThrow(isolate, caller);
764 } 769 }
765 770
766 771
767 const AccessorDescriptor Accessors::FunctionCaller = { 772 const AccessorDescriptor Accessors::FunctionCaller = {
768 FunctionGetCaller, 773 FunctionGetCaller,
769 ReadOnlySetAccessor, 774 ReadOnlySetAccessor,
770 0 775 0
771 }; 776 };
772 777
(...skipping 22 matching lines...) Expand all
795 } 800 }
796 801
797 802
798 const AccessorDescriptor Accessors::ObjectPrototype = { 803 const AccessorDescriptor Accessors::ObjectPrototype = {
799 ObjectGetPrototype, 804 ObjectGetPrototype,
800 ObjectSetPrototype, 805 ObjectSetPrototype,
801 0 806 0
802 }; 807 };
803 808
804 } } // namespace v8::internal 809 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698