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

Unified Diff: src/elements.cc

Issue 2769673002: Move Oddball/String to %Typearray%.prototype.fill fast path (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | test/mjsunit/es6/typedarray-fill.js » ('j') | test/mjsunit/es6/typedarray-fill.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index a72158f7d2884584ef4ff50a23c49c193774c4f3..06b65253c2bad3e9312fd0d7a5a43eb119479a9e 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -2863,16 +2863,20 @@ class TypedElementsAccessor
Handle<JSTypedArray> array = Handle<JSTypedArray>::cast(receiver);
DCHECK(!array->WasNeutered());
- if (!obj_value->IsNumber()) {
- return FillNumberSlowPath(isolate, array, obj_value, start, end);
- }
-
ctype value = 0;
if (obj_value->IsSmi()) {
value = BackingStore::from_int(Smi::cast(*obj_value)->value());
- } else {
- DCHECK(obj_value->IsHeapNumber());
+ } else if (obj_value->IsHeapNumber()) {
caitp 2017/03/22 13:11:42 Oh nvm, I thought we had a fast path in CSA. This
Camillo Bruni 2017/03/22 21:26:50 Given that we now perform additional checks, let's
rongjie 2017/03/23 00:01:49 Done.
value = BackingStore::from_double(HeapNumber::cast(*obj_value)->value());
+ } else if (obj_value->IsUndefined(isolate)) {
+ value =
+ BackingStore::from_double(std::numeric_limits<double>::quiet_NaN());
+ } else if (obj_value->IsNull(isolate)) {
+ value = static_cast<ctype>(+0.0);
+ } else if (obj_value->IsBoolean()) {
+ value = static_cast<ctype>(obj_value->IsTrue(isolate));
+ } else {
+ return FillNumberSlowPath(isolate, array, obj_value, start, end);
}
// Ensure indexes are within array bounds
« no previous file with comments | « no previous file | test/mjsunit/es6/typedarray-fill.js » ('j') | test/mjsunit/es6/typedarray-fill.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698