Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 5e7e956c22a7b96458a308e44d48d1fe0ce2b511..7fab3cace4fc887d819a72508f1e39b25aa08284 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -62,7 +62,8 @@ var TO_NUMBER; |
var TO_STRING; |
var TO_NAME; |
-var STRING_LENGTH_STUB; |
+var StringLengthTF_STUB; |
+var MathFloor_STUB; |
var $defaultNumber; |
var $defaultString; |
@@ -750,11 +751,31 @@ TO_NAME = function TO_NAME() { |
----------------------------------------------- |
*/ |
-STRING_LENGTH_STUB = function STRING_LENGTH_STUB(name) { |
- var receiver = this; // implicit first parameter |
+StringLengthTF_STUB = function StringLengthTF_STUB(receiver, name) { |
return %_StringGetLength(%_JSValueGetValue(receiver)); |
} |
+MathFloor_STUB = function MathFloor_STUB(f, i, v) { |
+ // |f| is calling function's JSFunction |
+ // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call |
+ // |v| is the value to floor |
+ var r = %_MathFloor(+v); |
+ if (%_IsMinusZero(r)) { |
+ // Collect type feedback when the result of the floor is -0. This is |
+ // accomplished by storing a sentinel in the second, "extra" |
+ // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in |
+ // the caller's TypeVector. |
+ %_FixedArraySet(%_GetTypeFeedbackVector(f), ((i|0)+1)|0, 1); |
+ return -0; |
+ } |
+ // Return integers in smi range as smis. |
+ var trunc = r|0; |
+ if (trunc === r) { |
+ return trunc; |
+ } |
+ return r; |
+} |
+ |
/* ------------------------------------- |
- - - C o n v e r s i o n s - - - |