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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 ]); | 1367 ]); |
1368 | 1368 |
1369 | 1369 |
1370 // ---------------------------------------------------------------------------- | 1370 // ---------------------------------------------------------------------------- |
1371 // Number | 1371 // Number |
1372 | 1372 |
1373 function NumberConstructor(x) { | 1373 function NumberConstructor(x) { |
1374 // TODO(bmeurer): Move this to toplevel. | 1374 // TODO(bmeurer): Move this to toplevel. |
1375 "use strict"; | 1375 "use strict"; |
1376 var value = %_ArgumentsLength() == 0 ? 0 : TO_NUMBER(x); | 1376 var value = %_ArgumentsLength() == 0 ? 0 : TO_NUMBER(x); |
1377 if (%_IsConstructCall()) { | 1377 if (IS_UNDEFINED(new.target)) return value; |
1378 %_SetValueOf(this, value); | 1378 |
1379 } else { | 1379 var result = %NewObject(GlobalNumber, new.target); |
1380 return value; | 1380 %_SetValueOf(result, value); |
1381 } | 1381 return result; |
1382 } | 1382 } |
1383 | 1383 |
1384 | 1384 |
1385 // ECMA-262 section 15.7.4.2. | 1385 // ECMA-262 section 15.7.4.2. |
1386 function NumberToStringJS(radix) { | 1386 function NumberToStringJS(radix) { |
1387 // NOTE: Both Number objects and values can enter here as | 1387 // NOTE: Both Number objects and values can enter here as |
1388 // 'this'. This is not as dictated by ECMA-262. | 1388 // 'this'. This is not as dictated by ECMA-262. |
1389 var number = this; | 1389 var number = this; |
1390 if (!IS_NUMBER(this)) { | 1390 if (!IS_NUMBER(this)) { |
1391 if (!IS_NUMBER_WRAPPER(this)) { | 1391 if (!IS_NUMBER_WRAPPER(this)) { |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1794 |
1795 %InstallToContext([ | 1795 %InstallToContext([ |
1796 "global_eval_fun", GlobalEval, | 1796 "global_eval_fun", GlobalEval, |
1797 "object_value_of", ObjectValueOf, | 1797 "object_value_of", ObjectValueOf, |
1798 "object_to_string", ObjectToString, | 1798 "object_to_string", ObjectToString, |
1799 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1799 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
1800 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1800 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
1801 ]); | 1801 ]); |
1802 | 1802 |
1803 }) | 1803 }) |
OLD | NEW |