Commit c0cbd328 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

Revert "IDL compiler: Stop creating copies of primitive objects."

This reverts commit 92159b3b.

Reason for revert: All the listed primitive types support __hash__, and they're memoized.  It turned out that we've not created copies of them too much aggressively.  The patch doesn't make sense.

Original change's description:
> IDL compiler: Stop creating copies of primitive objects.
> 
> A lot of copies of 'str' are just waste of memory in the
> current design/implementation, so this patch stops creating
> copies of primitive objects.
> 
> Bug: 839389
> Change-Id: I9873986dab0a13340768badfc119100c88eea733
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1774004
> Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
> Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#691200}

TBR=peria@chromium.org,yukishiino@chromium.org

Change-Id: Ief2ede9d61045c4e3649be01265cb92956988d5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 839389
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775650Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691536}
parent 95437a4c
...@@ -26,12 +26,13 @@ def make_copy(obj, memo=None): ...@@ -26,12 +26,13 @@ def make_copy(obj, memo=None):
if copy is not None: if copy is not None:
return copy return copy
if isinstance(obj, (bool, int, long, float, complex, basestring)):
# Do not create a copy of a primitive (and its subclasses) object.
return obj
cls = type(obj) cls = type(obj)
if isinstance(obj, (bool, int, long, float, complex, basestring)):
# Subclasses of simple builtin types are expected to have a copy
# constructor.
return cls.__new__(cls, obj)
if isinstance(obj, (list, tuple, set, frozenset)): if isinstance(obj, (list, tuple, set, frozenset)):
return cls(map(lambda x: make_copy(x, memo), obj)) return cls(map(lambda x: make_copy(x, memo), obj))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment