| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index 324dfa9f76a4f1965a85d7da1ea36accdb3ab474..f154bad23adb3248959846787eabaf28a29fad34 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -307,6 +307,37 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
|
|
|
|
|
| template <>
|
| +HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() {
|
| + HValue* value = GetParameter(0);
|
| +
|
| + // Check if the parameter is already a SMI or heap number.
|
| + IfBuilder if_number(this);
|
| + if_number.If<HIsSmiAndBranch>(value);
|
| + if_number.OrIf<HCompareMap>(value, isolate()->factory()->heap_number_map());
|
| + if_number.Then();
|
| +
|
| + // Return the number.
|
| + Push(value);
|
| +
|
| + if_number.Else();
|
| +
|
| + // Convert the parameter to number using the builtin.
|
| + HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER, context());
|
| + Add<HPushArgument>(value);
|
| + Push(Add<HInvokeFunction>(context(), function, 1));
|
| +
|
| + if_number.End();
|
| +
|
| + return Pop();
|
| +}
|
| +
|
| +
|
| +Handle<Code> ToNumberStub::GenerateCode() {
|
| + return DoGenerateCode(this);
|
| +}
|
| +
|
| +
|
| +template <>
|
| HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
|
| Zone* zone = this->zone();
|
| Factory* factory = isolate()->factory();
|
|
|