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

Unified Diff: src/objects.cc

Issue 1642223003: [api] Make ObjectTemplate::SetNativeDataProperty() work even if the ObjectTemplate does not have a … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« src/builtins.cc ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ab6fa54859416d80a4601f1d25358bfe2cbd5221..b2609ba8304b50d57226f7ed5790fae5e5c2bf9d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -8236,6 +8236,25 @@ MaybeHandle<JSObject> JSObject::DeepCopy(
return copy;
}
+class DummyContextObject : public AllocationSiteContext {
+ public:
+ explicit DummyContextObject(Isolate* isolate)
+ : AllocationSiteContext(isolate) {}
+
+ bool ShouldCreateMemento(Handle<JSObject> object) { return false; }
+ Handle<AllocationSite> EnterNewScope() { return Handle<AllocationSite>(); }
+ void ExitScope(Handle<AllocationSite> site, Handle<JSObject> object) {}
+};
+
+MaybeHandle<JSObject> JSObject::DeepCopy(Handle<JSObject> object,
+ DeepCopyHints hints) {
+ DummyContextObject dummy_context_object(object->GetIsolate());
+ JSObjectWalkVisitor<DummyContextObject> v(&dummy_context_object, true, hints);
+ MaybeHandle<JSObject> copy = v.StructureWalk(object);
+ Handle<JSObject> for_assert;
+ DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object));
+ return copy;
+}
// static
MaybeHandle<Object> JSReceiver::ToPrimitive(Handle<JSReceiver> receiver,
« src/builtins.cc ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698