blob: 27fecf6d76f2a53a4dc9ba3eaf420fddb8d719dc [file] [log] [blame]
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module array {
extern macro GenerateFastArrayShift(Context, Object): Object labels Slow;
extern builtin ArrayShift(Context, JSFunction, Object, int32): void;
// https://tc39.github.io/ecma262/#sec-array.prototype.shift
javascript builtin ArrayPrototypeShift(
context: Context, receiver: Object, ...arguments): Object {
try {
return GenerateFastArrayShift(context, receiver) otherwise Slow;
}
label Slow {
// TODO(szuend): Move checks if FastElementsAccessor::shift can be used
// from the C++ builtin here.
tail ArrayShift(
context, LoadTargetFromFrame(), Undefined,
convert<int32>(arguments.length));
}
// TODO(szuend): Implement baseline Array.p.shift that replaces JS fallback.
}
}