| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. | 5 // This files contains runtime support implemented in JavaScript. |
| 6 | 6 |
| 7 // CAUTION: Some of the functions specified in this file are called | 7 // CAUTION: Some of the functions specified in this file are called |
| 8 // directly from compiled code. These are the functions with names in | 8 // directly from compiled code. These are the functions with names in |
| 9 // ALL CAPS. The compiled code passes the first argument in 'this'. | 9 // ALL CAPS. The compiled code passes the first argument in 'this'. |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 var CONCAT_ITERABLE_TO_ARRAY; | 57 var CONCAT_ITERABLE_TO_ARRAY; |
| 58 var APPLY_PREPARE; | 58 var APPLY_PREPARE; |
| 59 var REFLECT_APPLY_PREPARE; | 59 var REFLECT_APPLY_PREPARE; |
| 60 var REFLECT_CONSTRUCT_PREPARE; | 60 var REFLECT_CONSTRUCT_PREPARE; |
| 61 var STACK_OVERFLOW; | 61 var STACK_OVERFLOW; |
| 62 var TO_OBJECT; | 62 var TO_OBJECT; |
| 63 var TO_NUMBER; | 63 var TO_NUMBER; |
| 64 var TO_STRING; | 64 var TO_STRING; |
| 65 var TO_NAME; | 65 var TO_NAME; |
| 66 | 66 |
| 67 var StringLengthTF_STUB; | 67 var StringLengthTFStub; |
| 68 var StringAddTF_STUB; | 68 var StringAddTFStub; |
| 69 var MathFloor_STUB; | 69 var MathFloorStub; |
| 70 | 70 |
| 71 var $defaultNumber; | 71 var $defaultNumber; |
| 72 var $defaultString; | 72 var $defaultString; |
| 73 var $NaN; | 73 var $NaN; |
| 74 var $nonNumberToNumber; | 74 var $nonNumberToNumber; |
| 75 var $nonStringToString; | 75 var $nonStringToString; |
| 76 var $sameValue; | 76 var $sameValue; |
| 77 var $sameValueZero; | 77 var $sameValueZero; |
| 78 var $toBoolean; | 78 var $toBoolean; |
| 79 var $toInt32; | 79 var $toInt32; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 TO_NAME = function TO_NAME() { | 760 TO_NAME = function TO_NAME() { |
| 761 return %$toName(this); | 761 return %$toName(this); |
| 762 } | 762 } |
| 763 | 763 |
| 764 | 764 |
| 765 /* ----------------------------------------------- | 765 /* ----------------------------------------------- |
| 766 - - - J a v a S c r i p t S t u b s - - - | 766 - - - J a v a S c r i p t S t u b s - - - |
| 767 ----------------------------------------------- | 767 ----------------------------------------------- |
| 768 */ | 768 */ |
| 769 | 769 |
| 770 StringLengthTF_STUB = function StringLengthTF_STUB(receiver, name, i, v) { | 770 StringLengthTFStub = function StringLengthTFStub(call_conv, minor_key) { |
| 771 // i and v are dummy parameters mandated by the InterfaceDescriptor, | 771 var stub = function(receiver, name, i, v) { |
| 772 // (LoadWithVectorDescriptor). | 772 // i and v are dummy parameters mandated by the InterfaceDescriptor, |
| 773 return %_StringGetLength(%_JSValueGetValue(receiver)); | 773 // (LoadWithVectorDescriptor). |
| 774 return %_StringGetLength(%_JSValueGetValue(receiver)); |
| 775 } |
| 776 return stub; |
| 774 } | 777 } |
| 775 | 778 |
| 776 StringAddTF_STUB = function StringAddTF_STUB(left, right) { | 779 StringAddTFStub = function StringAddTFStub(call_conv, minor_key) { |
| 777 return %StringAdd(left, right); | 780 var stub = function(left, right) { |
| 781 return %StringAdd(left, right); |
| 782 } |
| 783 return stub; |
| 778 } | 784 } |
| 779 | 785 |
| 780 MathFloor_STUB = function MathFloor_STUB(f, i, v) { | 786 MathFloorStub = function MathFloorStub(call_conv, minor_key) { |
| 781 // |f| is calling function's JSFunction | 787 var stub = function(f, i, v) { |
| 782 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call | 788 // |f| is calling function's JSFunction |
| 783 // |v| is the value to floor | 789 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call |
| 784 var r = %_MathFloor(+v); | 790 // |v| is the value to floor |
| 785 if (%_IsMinusZero(r)) { | 791 var r = %_MathFloor(+v); |
| 786 // Collect type feedback when the result of the floor is -0. This is | 792 if (%_IsMinusZero(r)) { |
| 787 // accomplished by storing a sentinel in the second, "extra" | 793 // Collect type feedback when the result of the floor is -0. This is |
| 788 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in | 794 // accomplished by storing a sentinel in the second, "extra" |
| 789 // the caller's TypeVector. | 795 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in |
| 790 %_FixedArraySet(%_GetTypeFeedbackVector(f), ((i|0)+1)|0, 1); | 796 // the caller's TypeVector. |
| 791 return -0; | 797 %_FixedArraySet(%_GetTypeFeedbackVector(f), ((i|0)+1)|0, 1); |
| 798 return -0; |
| 799 } |
| 800 // Return integers in smi range as smis. |
| 801 var trunc = r|0; |
| 802 if (trunc === r) { |
| 803 return trunc; |
| 804 } |
| 805 return r; |
| 792 } | 806 } |
| 793 // Return integers in smi range as smis. | 807 return stub; |
| 794 var trunc = r|0; | |
| 795 if (trunc === r) { | |
| 796 return trunc; | |
| 797 } | |
| 798 return r; | |
| 799 } | 808 } |
| 800 | 809 |
| 801 | 810 |
| 802 /* ------------------------------------- | 811 /* ------------------------------------- |
| 803 - - - C o n v e r s i o n s - - - | 812 - - - C o n v e r s i o n s - - - |
| 804 ------------------------------------- | 813 ------------------------------------- |
| 805 */ | 814 */ |
| 806 | 815 |
| 807 // ECMA-262, section 9.1, page 30. Use null/undefined for no hint, | 816 // ECMA-262, section 9.1, page 30. Use null/undefined for no hint, |
| 808 // (1) for number hint, and (2) for string hint. | 817 // (1) for number hint, and (2) for string hint. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 $toLength = ToLength; | 1052 $toLength = ToLength; |
| 1044 $toName = ToName; | 1053 $toName = ToName; |
| 1045 $toNumber = ToNumber; | 1054 $toNumber = ToNumber; |
| 1046 $toObject = ToObject; | 1055 $toObject = ToObject; |
| 1047 $toPositiveInteger = ToPositiveInteger; | 1056 $toPositiveInteger = ToPositiveInteger; |
| 1048 $toPrimitive = ToPrimitive; | 1057 $toPrimitive = ToPrimitive; |
| 1049 $toString = ToString; | 1058 $toString = ToString; |
| 1050 $toUint32 = ToUint32; | 1059 $toUint32 = ToUint32; |
| 1051 | 1060 |
| 1052 }) | 1061 }) |
| OLD | NEW |