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

Side by Side Diff: src/runtime.cc

Issue 24096017: Handlify JSObject::SetNormalizedProperty methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Yang Guo. Created 7 years, 3 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 | « src/objects.cc ('k') | no next file » | 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 5019 matching lines...) Expand 10 before | Expand all | Expand 10 after
5030 // in Object.defineProperty(). Firefox disagrees here, and actually changes 5030 // in Object.defineProperty(). Firefox disagrees here, and actually changes
5031 // the value. 5031 // the value.
5032 if (callback->IsAccessorInfo()) { 5032 if (callback->IsAccessorInfo()) {
5033 return isolate->heap()->undefined_value(); 5033 return isolate->heap()->undefined_value();
5034 } 5034 }
5035 // Avoid redefining foreign callback as data property, just use the stored 5035 // Avoid redefining foreign callback as data property, just use the stored
5036 // setter to update the value instead. 5036 // setter to update the value instead.
5037 // TODO(mstarzinger): So far this only works if property attributes don't 5037 // TODO(mstarzinger): So far this only works if property attributes don't
5038 // change, this should be fixed once we cleanup the underlying code. 5038 // change, this should be fixed once we cleanup the underlying code.
5039 if (callback->IsForeign() && result.GetAttributes() == attr) { 5039 if (callback->IsForeign() && result.GetAttributes() == attr) {
5040 return js_object->SetPropertyWithCallback(callback, 5040 Handle<Object> result_object =
5041 *name, 5041 JSObject::SetPropertyWithCallback(js_object,
5042 *obj_value, 5042 handle(callback, isolate),
5043 result.holder(), 5043 name,
5044 kStrictMode); 5044 obj_value,
5045 handle(result.holder()),
5046 kStrictMode);
5047 RETURN_IF_EMPTY_HANDLE(isolate, result_object);
5048 return *result_object;
5045 } 5049 }
5046 } 5050 }
5047 5051
5048 // Take special care when attributes are different and there is already 5052 // Take special care when attributes are different and there is already
5049 // a property. For simplicity we normalize the property which enables us 5053 // a property. For simplicity we normalize the property which enables us
5050 // to not worry about changing the instance_descriptor and creating a new 5054 // to not worry about changing the instance_descriptor and creating a new
5051 // map. The current version of SetObjectProperty does not handle attributes 5055 // map. The current version of SetObjectProperty does not handle attributes
5052 // correctly in the case where a property is a field and is reset with 5056 // correctly in the case where a property is a field and is reset with
5053 // new attributes. 5057 // new attributes.
5054 if (result.IsFound() && 5058 if (result.IsFound() &&
(...skipping 9765 matching lines...) Expand 10 before | Expand all | Expand 10 after
14820 // Handle last resort GC and make sure to allow future allocations 14824 // Handle last resort GC and make sure to allow future allocations
14821 // to grow the heap without causing GCs (if possible). 14825 // to grow the heap without causing GCs (if possible).
14822 isolate->counters()->gc_last_resort_from_js()->Increment(); 14826 isolate->counters()->gc_last_resort_from_js()->Increment();
14823 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14827 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14824 "Runtime::PerformGC"); 14828 "Runtime::PerformGC");
14825 } 14829 }
14826 } 14830 }
14827 14831
14828 14832
14829 } } // namespace v8::internal 14833 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698