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

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

Issue 2639333004: [pattern rewriter] Only desugar to call %ToName on computed properties (Closed)
Patch Set: 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
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 9c675d0ce61f7d9c96de1b5d92474dab1d000d6e..1d7c6fedac253aa35b152edc8dcfa4d47bb44f1f 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -771,9 +771,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 =

Powered by Google App Engine
This is Rietveld 408576698