OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 // in object-observe.js. | 1283 // in object-observe.js. |
1284 ]); | 1284 ]); |
1285 | 1285 |
1286 | 1286 |
1287 // ---------------------------------------------------------------------------- | 1287 // ---------------------------------------------------------------------------- |
1288 // Boolean | 1288 // Boolean |
1289 | 1289 |
1290 function BooleanConstructor(x) { | 1290 function BooleanConstructor(x) { |
1291 // TODO(bmeurer): Move this to toplevel. | 1291 // TODO(bmeurer): Move this to toplevel. |
1292 "use strict"; | 1292 "use strict"; |
1293 if (%_IsConstructCall()) { | 1293 if (!IS_UNDEFINED(new.target)) { |
1294 %_SetValueOf(this, TO_BOOLEAN(x)); | 1294 %_SetValueOf(this, TO_BOOLEAN(x)); |
1295 } else { | 1295 } else { |
1296 return TO_BOOLEAN(x); | 1296 return TO_BOOLEAN(x); |
1297 } | 1297 } |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
1301 function BooleanToString() { | 1301 function BooleanToString() { |
1302 // NOTE: Both Boolean objects and values can enter here as | 1302 // NOTE: Both Boolean objects and values can enter here as |
1303 // 'this'. This is not as dictated by ECMA-262. | 1303 // 'this'. This is not as dictated by ECMA-262. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 | 1609 |
1610 // ES5 15.3.4.5 | 1610 // ES5 15.3.4.5 |
1611 function FunctionBind(this_arg) { // Length is 1. | 1611 function FunctionBind(this_arg) { // Length is 1. |
1612 if (!IS_CALLABLE(this)) throw MakeTypeError(kFunctionBind); | 1612 if (!IS_CALLABLE(this)) throw MakeTypeError(kFunctionBind); |
1613 | 1613 |
1614 var boundFunction = function () { | 1614 var boundFunction = function () { |
1615 // Poison .arguments and .caller, but is otherwise not detectable. | 1615 // Poison .arguments and .caller, but is otherwise not detectable. |
1616 "use strict"; | 1616 "use strict"; |
1617 // This function must not use any object literals (Object, Array, RegExp), | 1617 // This function must not use any object literals (Object, Array, RegExp), |
1618 // since the literals-array is being used to store the bound data. | 1618 // since the literals-array is being used to store the bound data. |
1619 if (%_IsConstructCall()) { | 1619 if (!IS_UNDEFINED(new.target)) { |
1620 return %NewObjectFromBound(boundFunction); | 1620 return %NewObjectFromBound(boundFunction); |
1621 } | 1621 } |
1622 var bindings = %BoundFunctionGetBindings(boundFunction); | 1622 var bindings = %BoundFunctionGetBindings(boundFunction); |
1623 | 1623 |
1624 var argc = %_ArgumentsLength(); | 1624 var argc = %_ArgumentsLength(); |
1625 if (argc == 0) { | 1625 if (argc == 0) { |
1626 return %Apply(bindings[0], bindings[1], bindings, 2, bindings.length - 2); | 1626 return %Apply(bindings[0], bindings[1], bindings, 2, bindings.length - 2); |
1627 } | 1627 } |
1628 if (bindings.length === 2) { | 1628 if (bindings.length === 2) { |
1629 return %Apply(bindings[0], bindings[1], arguments, 0, argc); | 1629 return %Apply(bindings[0], bindings[1], arguments, 0, argc); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 | 1762 |
1763 %InstallToContext([ | 1763 %InstallToContext([ |
1764 "global_eval_fun", GlobalEval, | 1764 "global_eval_fun", GlobalEval, |
1765 "object_value_of", ObjectValueOf, | 1765 "object_value_of", ObjectValueOf, |
1766 "object_to_string", ObjectToString, | 1766 "object_to_string", ObjectToString, |
1767 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1767 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
1768 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1768 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
1769 ]); | 1769 ]); |
1770 | 1770 |
1771 }) | 1771 }) |
OLD | NEW |