OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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, code_stubs) { | 5 (function(global, code_stubs) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 code_stubs.StringLengthTFStub = function StringLengthTFStub(call_conv, minor_key
) { | 9 code_stubs.StringLengthTFStub = function StringLengthTFStub(call_conv, minor_key
) { |
10 var stub = function(receiver, name, i, v) { | 10 var stub = function(receiver, name, i, v) { |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 code_stubs.MathFloorStub = function MathFloorStub(call_conv, minor_key) { | 29 code_stubs.MathFloorStub = function MathFloorStub(call_conv, minor_key) { |
30 var call_from_optimized_ic = function(f, i, tv, receiver, v) { | 30 var call_from_optimized_ic = function(f, i, tv, receiver, v) { |
31 "use strict"; | 31 "use strict"; |
32 // |f| is this function's JSFunction | 32 // |f| is this function's JSFunction |
33 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call | 33 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call |
34 // |receiver| is receiver, should not be used | 34 // |receiver| is receiver, should not be used |
35 // |tv| is the calling function's type vector | 35 // |tv| is the calling function's type vector |
36 // |v| is the value to floor | 36 // |v| is the value to floor |
37 if (f !== %_FixedArrayGet(tv, i|0)) { | 37 if (f !== %_FixedArrayGet(tv, i|0)) { |
38 return %_CallFunction(receiver, v, f); | 38 return %_Call(f, receiver, v); |
39 } | 39 } |
40 var r = %_MathFloor(+v); | 40 var r = %_MathFloor(+v); |
41 if (%_IsMinusZero(r)) { | 41 if (%_IsMinusZero(r)) { |
42 // Collect type feedback when the result of the floor is -0. This is | 42 // Collect type feedback when the result of the floor is -0. This is |
43 // accomplished by storing a sentinel in the second, "extra" | 43 // accomplished by storing a sentinel in the second, "extra" |
44 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in | 44 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in |
45 // the caller's TypeVector. | 45 // the caller's TypeVector. |
46 %_FixedArraySet(tv, ((i|0)+1)|0, 1); | 46 %_FixedArraySet(tv, ((i|0)+1)|0, 1); |
47 return -0; | 47 return -0; |
48 } | 48 } |
(...skipping 11 matching lines...) Expand all Loading... |
60 %SetForceInlineFlag(call_from_optimized_ic); | 60 %SetForceInlineFlag(call_from_optimized_ic); |
61 var call_from_unoptimized_ic = function(f, i, receiver, v) { | 61 var call_from_unoptimized_ic = function(f, i, receiver, v) { |
62 var tv = %_GetTypeFeedbackVector(%_GetCallerJSFunction()); | 62 var tv = %_GetTypeFeedbackVector(%_GetCallerJSFunction()); |
63 return call_from_optimized_ic(f, i, tv, receiver, v); | 63 return call_from_optimized_ic(f, i, tv, receiver, v); |
64 } | 64 } |
65 return call_from_unoptimized_ic; | 65 return call_from_unoptimized_ic; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 }) | 69 }) |
OLD | NEW |