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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 // that is cloned when running the code. It is essential that the | 889 // that is cloned when running the code. It is essential that the |
890 // boilerplate gets the right prototype. | 890 // boilerplate gets the right prototype. |
891 %FunctionSetPrototype($Array, new $Array(0)); | 891 %FunctionSetPrototype($Array, new $Array(0)); |
892 | 892 |
893 | 893 |
894 /* ----------------------------------------------- | 894 /* ----------------------------------------------- |
895 - - - J a v a S c r i p t S t u b s - - - | 895 - - - J a v a S c r i p t S t u b s - - - |
896 ----------------------------------------------- | 896 ----------------------------------------------- |
897 */ | 897 */ |
898 | 898 |
899 function STRING_LENGTH_STUB(name) { | 899 function StringLengthTF_STUB(receiver, name) { |
900 var receiver = this; // implicit first parameter | |
901 return %_StringGetLength(%_JSValueGetValue(receiver)); | 900 return %_StringGetLength(%_JSValueGetValue(receiver)); |
902 } | 901 } |
902 | |
903 function MathFloor_STUB(f, i, v) { | |
904 var r = %_MathFloor(+v); | |
905 if (%_IsMinusZero(r)) { | |
906 %_FixedArraySet(%_GetTypeFeedbackVector(f), ((i|0)+1)|0, 1); | |
Benedikt Meurer
2015/05/11 04:40:12
Please add a comment explaining what this line doe
danno
2015/05/11 06:14:19
Done.
| |
907 return -0; | |
908 } | |
909 // Return integers in smi range as smis. | |
910 var trunc = r|0; | |
911 if (trunc === r) { | |
912 return trunc; | |
913 } | |
914 return r; | |
915 } | |
OLD | NEW |