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

Side by Side Diff: src/runtime.cc

Issue 12398010: Add workaround for redefinition of __proto__ property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/regress/regress-2565.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 4073 matching lines...) Expand 10 before | Expand all | Expand 10 after
4084 4084
4085 // Special case for callback properties. 4085 // Special case for callback properties.
4086 if (result.IsPropertyCallbacks()) { 4086 if (result.IsPropertyCallbacks()) {
4087 Object* callback = result.GetCallbackObject(); 4087 Object* callback = result.GetCallbackObject();
4088 // To be compatible with Safari we do not change the value on API objects 4088 // To be compatible with Safari we do not change the value on API objects
4089 // in Object.defineProperty(). Firefox disagrees here, and actually changes 4089 // in Object.defineProperty(). Firefox disagrees here, and actually changes
4090 // the value. 4090 // the value.
4091 if (callback->IsAccessorInfo()) { 4091 if (callback->IsAccessorInfo()) {
4092 return isolate->heap()->undefined_value(); 4092 return isolate->heap()->undefined_value();
4093 } 4093 }
4094 // TODO(mstarzinger): The __proto__ property should actually be a real
4095 // JavaScript accessor instead of a foreign callback. But for now we just
4096 // avoid changing the writability and configurability attribute of this
4097 // property.
4098 Handle<String> proto_string = isolate->factory()->proto_string();
4099 if (callback->IsForeign() && proto_string->Equals(*name)) {
4100 attr = static_cast<PropertyAttributes>(attr & ~(READ_ONLY | DONT_DELETE));
4101 }
4094 // Avoid redefining foreign callback as data property, just use the stored 4102 // Avoid redefining foreign callback as data property, just use the stored
4095 // setter to update the value instead. 4103 // setter to update the value instead.
4096 // TODO(mstarzinger): So far this only works if property attributes don't 4104 // TODO(mstarzinger): So far this only works if property attributes don't
4097 // change, this should be fixed once we cleanup the underlying code. 4105 // change, this should be fixed once we cleanup the underlying code.
4098 if (callback->IsForeign() && result.GetAttributes() == attr) { 4106 if (callback->IsForeign() && result.GetAttributes() == attr) {
4099 return js_object->SetPropertyWithCallback(callback, 4107 return js_object->SetPropertyWithCallback(callback,
4100 *name, 4108 *name,
4101 *obj_value, 4109 *obj_value,
4102 result.holder(), 4110 result.holder(),
4103 kStrictMode); 4111 kStrictMode);
(...skipping 9206 matching lines...) Expand 10 before | Expand all | Expand 10 after
13310 // Handle last resort GC and make sure to allow future allocations 13318 // Handle last resort GC and make sure to allow future allocations
13311 // to grow the heap without causing GCs (if possible). 13319 // to grow the heap without causing GCs (if possible).
13312 isolate->counters()->gc_last_resort_from_js()->Increment(); 13320 isolate->counters()->gc_last_resort_from_js()->Increment();
13313 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13321 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13314 "Runtime::PerformGC"); 13322 "Runtime::PerformGC");
13315 } 13323 }
13316 } 13324 }
13317 13325
13318 13326
13319 } } // namespace v8::internal 13327 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/regress/regress-2565.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698