Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 79dda37866f3e452ed6d1a33862e8375d5fe68b5..75b096b6c3b6bdfc70120344ecf0a93ff42f1c77 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -7936,9 +7936,7 @@ Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object, |
return Object::WrapForRead(isolate, raw_value, representation); |
} |
-enum class BoilerplateKind { kNormalBoilerplate, kApiBoilerplate }; |
- |
-template <class ContextObject, BoilerplateKind boilerplate_kind> |
+template <class ContextObject> |
class JSObjectWalkVisitor { |
public: |
JSObjectWalkVisitor(ContextObject* site_context, bool copying, |
@@ -7970,9 +7968,9 @@ class JSObjectWalkVisitor { |
const JSObject::DeepCopyHints hints_; |
}; |
-template <class ContextObject, BoilerplateKind boilerplate_kind> |
-MaybeHandle<JSObject> JSObjectWalkVisitor< |
- ContextObject, boilerplate_kind>::StructureWalk(Handle<JSObject> object) { |
+template <class ContextObject> |
+MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( |
+ Handle<JSObject> object) { |
Isolate* isolate = this->isolate(); |
bool copying = this->copying(); |
bool shallow = hints_ == JSObject::kObjectIsShallow; |
@@ -7992,29 +7990,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor< |
Handle<JSObject> copy; |
if (copying) { |
- if (boilerplate_kind == BoilerplateKind::kApiBoilerplate) { |
- if (object->IsJSFunction()) { |
-#ifdef DEBUG |
- // Ensure that it is an Api function and template_instantiations_cache |
- // contains an entry for function's FunctionTemplateInfo. |
- JSFunction* function = JSFunction::cast(*object); |
- CHECK(function->shared()->IsApiFunction()); |
- FunctionTemplateInfo* data = function->shared()->get_api_func_data(); |
- auto serial_number = handle(Smi::cast(data->serial_number()), isolate); |
- CHECK(serial_number->value()); |
- auto cache = isolate->template_instantiations_cache(); |
- int entry = |
- cache->FindEntry(static_cast<uint32_t>(serial_number->value())); |
- CHECK(entry != UnseededNumberDictionary::kNotFound); |
- Object* element = cache->ValueAt(entry); |
- CHECK_EQ(function, element); |
-#endif |
- return object; |
- } |
- } else { |
- // JSFunction objects are not allowed to be in normal boilerplates at all. |
- DCHECK(!object->IsJSFunction()); |
- } |
+ // JSFunction objects are not allowed to be in normal boilerplates at all. |
+ DCHECK(!object->IsJSFunction()); |
Handle<AllocationSite> site_to_pass; |
if (site_context()->ShouldCreateMemento(object)) { |
site_to_pass = site_context()->current(); |
@@ -8183,9 +8160,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor< |
MaybeHandle<JSObject> JSObject::DeepWalk( |
Handle<JSObject> object, |
AllocationSiteCreationContext* site_context) { |
- JSObjectWalkVisitor<AllocationSiteCreationContext, |
- BoilerplateKind::kNormalBoilerplate> v(site_context, |
- false, kNoHints); |
+ JSObjectWalkVisitor<AllocationSiteCreationContext> v(site_context, false, |
+ kNoHints); |
MaybeHandle<JSObject> result = v.StructureWalk(object); |
Handle<JSObject> for_assert; |
DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(object)); |
@@ -8197,30 +8173,7 @@ MaybeHandle<JSObject> JSObject::DeepCopy( |
Handle<JSObject> object, |
AllocationSiteUsageContext* site_context, |
DeepCopyHints hints) { |
- JSObjectWalkVisitor<AllocationSiteUsageContext, |
- BoilerplateKind::kNormalBoilerplate> v(site_context, 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; |
-} |
- |
-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::DeepCopyApiBoilerplate( |
- Handle<JSObject> object) { |
- DummyContextObject dummy_context_object(object->GetIsolate()); |
- JSObjectWalkVisitor<DummyContextObject, BoilerplateKind::kApiBoilerplate> v( |
- &dummy_context_object, true, kNoHints); |
+ JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context, true, hints); |
MaybeHandle<JSObject> copy = v.StructureWalk(object); |
Handle<JSObject> for_assert; |
DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object)); |