| Index: src/code-stubs.js
|
| diff --git a/src/code-stubs.js b/src/code-stubs.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7aadf634147966eed897234c17fb4ff7fb28edef
|
| --- /dev/null
|
| +++ b/src/code-stubs.js
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +(function(global, code_stubs) {
|
| +
|
| +
|
| +code_stubs.StringLengthTFStub = function StringLengthTFStub(call_conv,
|
| + minor_key) {
|
| + var stub = function(receiver, name, i, v) {
|
| + // i and v are dummy parameters mandated by the InterfaceDescriptor,
|
| + // (LoadWithVectorDescriptor).
|
| + return %_StringGetLength(%_JSValueGetValue(receiver));
|
| + }
|
| + return stub;
|
| +}
|
| +
|
| +
|
| +code_stubs.StringAddTFStub = function StringAddTFStub(call_conv, minor_key) {
|
| + var stub = function(left, right) {
|
| + return %StringAdd(left, right);
|
| + }
|
| + return stub;
|
| +}
|
| +
|
| +
|
| +code_stubs.MathFloorStub = function MathFloorStub(call_conv, minor_key) {
|
| + var stub = function(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;
|
| + }
|
| + return stub;
|
| +}
|
| +
|
| +})
|
|
|