Make sure FunctionToMethod is lazily compiled.

R=arv@chromium.org
BUG=v8:3330
LOG=N

Review URL: https://codereview.chromium.org/808723002

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#25847}
// Copyright 2014 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.
//
// This file relies on the fact that the following declarations have been made
// in runtime.js:
// var $Function = global.Function;
// var $Array = global.Array;

"use strict";

function FunctionToMethod(homeObject) {
  if (!IS_SPEC_FUNCTION(this)) {
    throw MakeTypeError('toMethod_non_function',
                        [%ToString(this), typeof this]);

  }

  if (!IS_SPEC_OBJECT(homeObject)) {
    throw MakeTypeError('toMethod_non_object',
                        [%ToString(homeObject)]);
  }

  return %ToMethod(this, homeObject);
}

function SetupHarmonyClasses() {
  %CheckIsBootstrapping();

  InstallFunctions($Function.prototype, DONT_ENUM, $Array(
      "toMethod", FunctionToMethod
  ));
}

SetupHarmonyClasses();

// Copyright 2014 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.
//
// This file relies on the fact that the following declarations have been made
// in runtime.js:
// var $Function = global.Function;
// var $Array = global.Array;

"use strict";


(function() {
  function FunctionToMethod(homeObject) {
    if (!IS_SPEC_FUNCTION(this)) {
      throw MakeTypeError('toMethod_non_function',
                          [%ToString(this), typeof this]);

    }

    if (!IS_SPEC_OBJECT(homeObject)) {
      throw MakeTypeError('toMethod_non_object',
                          [%ToString(homeObject)]);
    }

    return %ToMethod(this, homeObject);
  }

  %CheckIsBootstrapping();

  InstallFunctions($Function.prototype, DONT_ENUM, $Array(
      "toMethod", FunctionToMethod
  ));
}());
