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

Side by Side Diff: src/scopes.cc

Issue 42009: Fix issue 267: Functions now called with global object as receiver. (Closed)
Patch Set: Now with regression test Created 11 years, 9 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 if (MustAllocate(var)) { 815 if (MustAllocate(var)) {
816 if (MustAllocateInContext(var)) { 816 if (MustAllocateInContext(var)) {
817 // It is ok to set this only now, because arguments is a local 817 // It is ok to set this only now, because arguments is a local
818 // variable that is allocated after the parameters have been 818 // variable that is allocated after the parameters have been
819 // allocated. 819 // allocated.
820 arguments_shadow->is_accessed_from_inner_scope_ = true; 820 arguments_shadow->is_accessed_from_inner_scope_ = true;
821 } 821 }
822 var->rewrite_ = 822 var->rewrite_ =
823 new Property(arguments_shadow_, 823 new Property(arguments_shadow_,
824 new Literal(Handle<Object>(Smi::FromInt(i))), 824 new Literal(Handle<Object>(Smi::FromInt(i))),
825 RelocInfo::kNoPosition); 825 RelocInfo::kNoPosition,
826 Property::SYNTHETIC);
826 arguments_shadow->var_uses()->RecordUses(var->var_uses()); 827 arguments_shadow->var_uses()->RecordUses(var->var_uses());
827 } 828 }
828 } 829 }
829 830
830 } else { 831 } else {
831 // The arguments object is not used, so we can access parameters directly. 832 // The arguments object is not used, so we can access parameters directly.
832 // The same parameter may occur multiple times in the parameters_ list. 833 // The same parameter may occur multiple times in the parameters_ list.
833 // If it does, and if it is not copied into the context object, it must 834 // If it does, and if it is not copied into the context object, it must
834 // receive the highest parameter index for that parameter; thus iteration 835 // receive the highest parameter index for that parameter; thus iteration
835 // order is relevant! 836 // order is relevant!
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && 937 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS &&
937 !must_have_local_context) { 938 !must_have_local_context) {
938 num_heap_slots_ = 0; 939 num_heap_slots_ = 0;
939 } 940 }
940 941
941 // Allocation done. 942 // Allocation done.
942 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); 943 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS);
943 } 944 }
944 945
945 } } // namespace v8::internal 946 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698