Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index f89a5bc2b15d136d004bc32ac6d7024d2b4e3067..59d04f886107e42b6b31f768def44f673581ab34 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -458,6 +458,14 @@ BUILTIN(ArraySlice) { |
int relative_end = 0; |
bool is_sloppy_arguments = false; |
+ // TODO(littledan): Look up @@species only once, not once here and |
+ // again in the JS builtin. Pass the species out? |
+ Handle<Object> species; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, species, Object::ArraySpeciesConstructor(isolate, receiver)); |
+ if (*species != isolate->context()->native_context()->array_function()) { |
+ return CallJsIntrinsic(isolate, isolate->array_slice(), args); |
+ } |
if (receiver->IsJSArray()) { |
DisallowHeapAllocation no_gc; |
JSArray* array = JSArray::cast(*receiver); |
@@ -543,6 +551,14 @@ BUILTIN(ArraySplice) { |
if (!maybe_elms_obj.ToHandle(&elms_obj)) { |
return CallJsIntrinsic(isolate, isolate->array_splice(), args); |
} |
+ // TODO(littledan): Look up @@species only once, not once here and |
+ // again in the JS builtin. Pass the species out? |
+ Handle<Object> species; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, species, Object::ArraySpeciesConstructor(isolate, receiver)); |
+ if (*species != isolate->context()->native_context()->array_function()) { |
+ return CallJsIntrinsic(isolate, isolate->array_splice(), args); |
+ } |
Handle<JSArray> array = Handle<JSArray>::cast(receiver); |
DCHECK(!array->map()->is_observed()); |