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

Side by Side Diff: src/objects.cc

Issue 9429002: After assignment return right hand side value instead of undefined (Closed) Base URL: https://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
« no previous file with comments | « no previous file | test/mjsunit/object-prevent-extensions.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 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 11305 matching lines...) Expand 10 before | Expand all | Expand 10 after
13075 if (break_point_objects()->IsUndefined()) return 0; 13075 if (break_point_objects()->IsUndefined()) return 0;
13076 // Single break point. 13076 // Single break point.
13077 if (!break_point_objects()->IsFixedArray()) return 1; 13077 if (!break_point_objects()->IsFixedArray()) return 1;
13078 // Multiple break points. 13078 // Multiple break points.
13079 return FixedArray::cast(break_point_objects())->length(); 13079 return FixedArray::cast(break_point_objects())->length();
13080 } 13080 }
13081 #endif // ENABLE_DEBUGGER_SUPPORT 13081 #endif // ENABLE_DEBUGGER_SUPPORT
13082 13082
13083 13083
13084 } } // namespace v8::internal 13084 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/object-prevent-extensions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698