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

Side by Side Diff: src/objects.cc

Issue 9420045: After assignment return right hand side value instead of undefined when Object.isExtensible(o) === … (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 1749
1750 MaybeObject* JSObject::AddProperty(String* name, 1750 MaybeObject* JSObject::AddProperty(String* name,
1751 Object* value, 1751 Object* value,
1752 PropertyAttributes attributes, 1752 PropertyAttributes attributes,
1753 StrictModeFlag strict_mode) { 1753 StrictModeFlag strict_mode) {
1754 ASSERT(!IsJSGlobalProxy()); 1754 ASSERT(!IsJSGlobalProxy());
1755 Map* map_of_this = map(); 1755 Map* map_of_this = map();
1756 Heap* heap = GetHeap(); 1756 Heap* heap = GetHeap();
1757 if (!map_of_this->is_extensible()) { 1757 if (!map_of_this->is_extensible()) {
1758 if (strict_mode == kNonStrictMode) { 1758 if (strict_mode == kNonStrictMode) {
1759 return heap->undefined_value(); 1759 return value;
1760 } else { 1760 } else {
1761 Handle<Object> args[1] = {Handle<String>(name)}; 1761 Handle<Object> args[1] = {Handle<String>(name)};
1762 return heap->isolate()->Throw( 1762 return heap->isolate()->Throw(
1763 *FACTORY->NewTypeError("object_not_extensible", 1763 *FACTORY->NewTypeError("object_not_extensible",
1764 HandleVector(args, 1))); 1764 HandleVector(args, 1)));
1765 } 1765 }
1766 } 1766 }
1767 if (HasFastProperties()) { 1767 if (HasFastProperties()) {
1768 // Ensure the descriptor array does not get too big. 1768 // Ensure the descriptor array does not get too big.
1769 if (map_of_this->instance_descriptors()->number_of_descriptors() < 1769 if (map_of_this->instance_descriptors()->number_of_descriptors() <
(...skipping 11301 matching lines...) Expand 10 before | Expand all | Expand 10 after
13071 if (break_point_objects()->IsUndefined()) return 0; 13071 if (break_point_objects()->IsUndefined()) return 0;
13072 // Single break point. 13072 // Single break point.
13073 if (!break_point_objects()->IsFixedArray()) return 1; 13073 if (!break_point_objects()->IsFixedArray()) return 1;
13074 // Multiple break points. 13074 // Multiple break points.
13075 return FixedArray::cast(break_point_objects())->length(); 13075 return FixedArray::cast(break_point_objects())->length();
13076 } 13076 }
13077 #endif // ENABLE_DEBUGGER_SUPPORT 13077 #endif // ENABLE_DEBUGGER_SUPPORT
13078 13078
13079 13079
13080 } } // namespace v8::internal 13080 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/object-prevent-extensions.js » ('j') | test/mjsunit/object-prevent-extensions.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698