The ES6 specification says that "Built-in functions that are ECMAScript
function objects must be strict mode functions", which in particular
means that you can never test for them using the "caller" field of a
sloppy mode function.
CQ_INCLUDE_TRYBOTS=tryserver.v8:v8_linux_layout_dbg,v8_linux_nosnap_dbg
R=mstarzinger@chromium.org
BUG=v8:105
LOG=n
Review URL: https://codereview.chromium.org/
1347663002
Cr-Commit-Position: refs/heads/master@{#30750}
//-------------------------------------------------------------------
function StringConstructor(x) {
+ // TODO(bmeurer): Move this to toplevel.
+ "use strict";
if (%_ArgumentsLength() == 0) x = '';
if (%_IsConstructCall()) {
%_SetValueOf(this, TO_STRING_INLINE(x));
// Boolean
function BooleanConstructor(x) {
+ // TODO(bmeurer): Move this to toplevel.
+ "use strict";
if (%_IsConstructCall()) {
%_SetValueOf(this, ToBoolean(x));
} else {
// Number
function NumberConstructor(x) {
+ // TODO(bmeurer): Move this to toplevel.
+ "use strict";
var value = %_ArgumentsLength() == 0 ? 0 : ToNumber(x);
if (%_IsConstructCall()) {
%_SetValueOf(this, value);
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var custom_valueOf = function() {
- assertEquals(Number, custom_valueOf.caller);
+ assertEquals(null, custom_valueOf.caller);
return 2;
}
var custom_toString = function() {
- assertEquals(String, custom_toString.caller);
+ assertEquals(null, custom_toString.caller);
return "I used to be an adventurer like you";
}