Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 26c0b210feaa5fbcea9759f546a50fd027526217..ee34cdc360bbf08aebe661b61c1124bc9e97944f 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -438,7 +438,7 @@ BUILTIN(ArrayPop) { |
Handle<JSArray> array = Handle<JSArray>::cast(receiver); |
DCHECK(!array->map()->is_observed()); |
- int len = Smi::cast(array->length())->value(); |
+ uint32_t len = static_cast<uint32_t>(Smi::cast(array->length())->value()); |
if (len == 0) return isolate->heap()->undefined_value(); |
if (JSArray::HasReadOnlyLength(array)) { |
@@ -446,12 +446,11 @@ BUILTIN(ArrayPop) { |
} |
ElementsAccessor* accessor = array->GetElementsAccessor(); |
- int new_length = len - 1; |
- Handle<Object> element = |
- accessor->Get(array, array, new_length, elms_obj).ToHandleChecked(); |
- if (element->IsTheHole()) { |
- return CallJsBuiltin(isolate, "$arrayPop", args); |
- } |
+ uint32_t new_length = len - 1; |
+ Handle<Object> element; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, element, Object::GetElement(isolate, array, new_length)); |
+ |
RETURN_FAILURE_ON_EXCEPTION( |
isolate, |
accessor->SetLength(array, handle(Smi::FromInt(new_length), isolate))); |
@@ -481,12 +480,9 @@ BUILTIN(ArrayShift) { |
} |
// Get first element |
- ElementsAccessor* accessor = array->GetElementsAccessor(); |
- Handle<Object> first = |
- accessor->Get(array, array, 0, elms_obj).ToHandleChecked(); |
- if (first->IsTheHole()) { |
- return CallJsBuiltin(isolate, "$arrayShift", args); |
- } |
+ Handle<Object> first; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, first, |
+ Object::GetElement(isolate, array, 0)); |
if (heap->CanMoveObjectStart(*elms_obj)) { |
array->set_elements(heap->LeftTrimFixedArray(*elms_obj, 1)); |