Commit 29308cf0 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Add boolean runtime checks for different element kinds.

This will be used for Array.p.sort benchmarks to ensure that the
arrays will have the correct element kind.

R=cbruni@chromium.org, jgruber@chromium.org

Bug: v8:7382
Change-Id: I4fe58d97d7f18fd193d4432964cf6b4f5335e0e7
Reviewed-on: https://chromium-review.googlesource.com/1004754
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52511}
parent 09212381
......@@ -874,6 +874,24 @@ RUNTIME_FUNCTION(Runtime_HasFastPackedElements) {
IsFastPackedElementsKind(obj->map()->elements_kind()));
}
#define RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(Name, Kind) \
RUNTIME_FUNCTION(Runtime_##Name) { \
SealHandleScope shs(isolate); \
DCHECK_EQ(1, args.length()); \
CONVERT_ARG_CHECKED(HeapObject, obj, 0); \
return isolate->heap()->ToBoolean(obj->map()->elements_kind() == Kind); \
}
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasPackedSmiElements, PACKED_SMI_ELEMENTS)
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasPackedDoubleElements,
PACKED_DOUBLE_ELEMENTS)
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasPackedObjectElements, PACKED_ELEMENTS)
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasHoleySmiElements, HOLEY_SMI_ELEMENTS)
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasHoleyDoubleElements,
HOLEY_DOUBLE_ELEMENTS)
RUNTIME_FUNCTION_CHECK_ELEMENT_KIND(HasHoleyObjectElements, HOLEY_ELEMENTS)
#undef RUNTIME_FUNCTION_CHECK_ELEMENT_KIND
RUNTIME_FUNCTION(Runtime_ValueOf) {
SealHandleScope shs(isolate);
......
......@@ -382,6 +382,12 @@ namespace internal {
F(GetOwnPropertyKeys, 2, 1) \
F(GetProperty, 2, 1) \
F(GetPrototype, 1, 1) \
F(HasPackedSmiElements, 1, 1) \
F(HasPackedDoubleElements, 1, 1) \
F(HasPackedObjectElements, 1, 1) \
F(HasHoleySmiElements, 1, 1) \
F(HasHoleyDoubleElements, 1, 1) \
F(HasHoleyObjectElements, 1, 1) \
F(HasFastPackedElements, 1, 1) \
F(HasInPrototypeChain, 2, 1) \
F(HasProperty, 2, 1) \
......
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