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

Side by Side Diff: src/elements.cc

Issue 9460004: Fix redefining of attributes on aliased arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 8 years, 10 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 | « include/v8.h ('k') | src/heap.h » ('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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 Object* receiver) { 698 Object* receiver) {
699 Object* probe = GetParameterMapArg(parameter_map, key); 699 Object* probe = GetParameterMapArg(parameter_map, key);
700 if (!probe->IsTheHole()) { 700 if (!probe->IsTheHole()) {
701 Context* context = Context::cast(parameter_map->get(0)); 701 Context* context = Context::cast(parameter_map->get(0));
702 int context_index = Smi::cast(probe)->value(); 702 int context_index = Smi::cast(probe)->value();
703 ASSERT(!context->get(context_index)->IsTheHole()); 703 ASSERT(!context->get(context_index)->IsTheHole());
704 return context->get(context_index); 704 return context->get(context_index);
705 } else { 705 } else {
706 // Object is not mapped, defer to the arguments. 706 // Object is not mapped, defer to the arguments.
707 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 707 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
708 return ElementsAccessor::ForArray(arguments)->Get(arguments, 708 MaybeObject* maybe_result = ElementsAccessor::ForArray(arguments)->Get(
709 key, 709 arguments, key, obj, receiver);
710 obj, 710 Object* result;
711 receiver); 711 if (!maybe_result->ToObject(&result)) return maybe_result;
712 // Elements of the arguments object in slow mode might be slow aliases.
713 if (result->IsAliasedArgumentsEntry()) {
714 AliasedArgumentsEntry* entry = AliasedArgumentsEntry::cast(result);
715 Context* context = Context::cast(parameter_map->get(0));
716 int context_index = entry->aliased_context_slot();
717 ASSERT(!context->get(context_index)->IsTheHole());
718 return context->get(context_index);
719 } else {
720 return result;
721 }
712 } 722 }
713 } 723 }
714 724
715 static MaybeObject* SetLengthImpl(FixedArray* parameter_map, 725 static MaybeObject* SetLengthImpl(FixedArray* parameter_map,
716 JSObject* obj, 726 JSObject* obj,
717 Object* length) { 727 Object* length) {
718 // TODO(mstarzinger): This was never implemented but will be used once we 728 // TODO(mstarzinger): This was never implemented but will be used once we
719 // correctly implement [[DefineOwnProperty]] on arrays. 729 // correctly implement [[DefineOwnProperty]] on arrays.
720 UNIMPLEMENTED(); 730 UNIMPLEMENTED();
721 return obj; 731 return obj;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; 922 if (!maybe_obj->To(&new_backing_store)) return maybe_obj;
913 new_backing_store->set(0, length); 923 new_backing_store->set(0, length);
914 { MaybeObject* result = array->SetContent(new_backing_store); 924 { MaybeObject* result = array->SetContent(new_backing_store);
915 if (result->IsFailure()) return result; 925 if (result->IsFailure()) return result;
916 } 926 }
917 return array; 927 return array;
918 } 928 }
919 929
920 930
921 } } // namespace v8::internal 931 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698