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

Unified Diff: src/runtime/runtime-object.cc

Issue 2639333004: [pattern rewriter] Only desugar to call %ToName on computed properties (Closed)
Patch Set: add dcheck Created 3 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
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/harmony/object-rest-basic.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 6a02b79f8fab2ad16a4cbb229707e35dc02c561f..0df94a2653dcceea3a64378f720cb5551ba3a277 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -779,9 +779,20 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
return isolate->heap()->undefined_value();
}
- ScopedVector<Handle<Name>> excluded_properties(args.length() - 1);
+ ScopedVector<Handle<Object>> excluded_properties(args.length() - 1);
for (int i = 1; i < args.length(); i++) {
- excluded_properties[i - 1] = args.at<Name>(i);
+ Handle<Object> property = args.at(i);
+ uint32_t property_num;
+ // We convert string to number if possible, in cases of computed
+ // properties resolving to numbers, which would've been strings
+ // instead because of our call to %ToName() in the desugaring for
+ // computed properties.
+ if (property->IsString() &&
+ String::cast(*property)->AsArrayIndex(&property_num)) {
+ property = isolate->factory()->NewNumberFromUint(property_num);
+ }
+
+ excluded_properties[i - 1] = property;
}
Handle<JSObject> target =
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/harmony/object-rest-basic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698