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

Unified Diff: src/builtins.cc

Issue 1612323003: Introduce {FAST,SLOW}_STRING_WRAPPER_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more DCHECK fix Created 4 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/bootstrapper.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index de5817188d95db5b9c63cb773f8592b0e08ad5ab..e05a4dd45a98a38c8fc11e8f95f4ca1685a769cd 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -835,14 +835,20 @@ uint32_t EstimateElementCount(Handle<JSArray> array) {
}
break;
}
- case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
- case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) case TYPE##_ELEMENTS:
TYPED_ARRAYS(TYPED_ARRAY_CASE)
#undef TYPED_ARRAY_CASE
// External arrays are always dense.
return length;
+ case NO_ELEMENTS:
+ return 0;
+ case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
+ case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
+ case FAST_STRING_WRAPPER_ELEMENTS:
+ case SLOW_STRING_WRAPPER_ELEMENTS:
+ UNREACHABLE();
+ return 0;
}
// As an estimate, we assume that the prototype doesn't contain any
// inherited elements.
@@ -983,6 +989,28 @@ void CollectElementIndices(Handle<JSObject> object, uint32_t range,
}
break;
}
+ case FAST_STRING_WRAPPER_ELEMENTS:
+ case SLOW_STRING_WRAPPER_ELEMENTS: {
+ DCHECK(object->IsJSValue());
+ Handle<JSValue> js_value = Handle<JSValue>::cast(object);
+ DCHECK(js_value->value()->IsString());
+ Handle<String> string(String::cast(js_value->value()), isolate);
+ uint32_t length = static_cast<uint32_t>(string->length());
+ uint32_t i = 0;
+ uint32_t limit = Min(length, range);
+ for (; i < limit; i++) {
+ indices->Add(i);
+ }
+ ElementsAccessor* accessor = object->GetElementsAccessor();
+ for (; i < range; i++) {
+ if (accessor->HasElement(object, i)) {
+ indices->Add(i);
+ }
+ }
+ break;
+ }
+ case NO_ELEMENTS:
+ break;
}
PrototypeIterator iter(isolate, object);
@@ -1218,6 +1246,13 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
}
break;
}
+ case NO_ELEMENTS:
+ break;
+ case FAST_STRING_WRAPPER_ELEMENTS:
+ case SLOW_STRING_WRAPPER_ELEMENTS:
+ // |array| is guaranteed to be an array or typed array.
+ UNREACHABLE();
+ break;
}
visitor->increase_index_offset(length);
return true;
@@ -1367,6 +1402,7 @@ Object* Slow_ArrayConcat(Arguments* args, Handle<Object> species,
case FAST_HOLEY_ELEMENTS:
case FAST_ELEMENTS:
case DICTIONARY_ELEMENTS:
+ case NO_ELEMENTS:
DCHECK_EQ(0u, length);
break;
default:
@@ -1728,7 +1764,7 @@ BUILTIN(ObjectValues) {
CONVERT_TO_STRING));
for (int i = 0; i < keys->length(); ++i) {
- auto key = Handle<Name>::cast(FixedArray::get(keys, i));
+ auto key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate));
Handle<Object> value;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
@@ -1754,7 +1790,7 @@ BUILTIN(ObjectEntries) {
CONVERT_TO_STRING));
for (int i = 0; i < keys->length(); ++i) {
- auto key = Handle<Name>::cast(FixedArray::get(keys, i));
+ auto key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate));
Handle<Object> value;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698