OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 | 1615 |
1616 function FunctionSourceString(func) { | 1616 function FunctionSourceString(func) { |
1617 while (%IsJSFunctionProxy(func)) { | 1617 while (%IsJSFunctionProxy(func)) { |
1618 func = %GetCallTrap(func); | 1618 func = %GetCallTrap(func); |
1619 } | 1619 } |
1620 | 1620 |
1621 if (!IS_FUNCTION(func)) { | 1621 if (!IS_FUNCTION(func)) { |
1622 throw MakeTypeError(kNotGeneric, 'Function.prototype.toString'); | 1622 throw MakeTypeError(kNotGeneric, 'Function.prototype.toString'); |
1623 } | 1623 } |
1624 | 1624 |
1625 if (%FunctionIsBuiltin(func)) { | 1625 if (%FunctionHidesSource(func)) { |
1626 return NativeCodeFunctionSourceString(func); | 1626 return NativeCodeFunctionSourceString(func); |
1627 } | 1627 } |
1628 | 1628 |
1629 var classSource = %ClassGetSourceCode(func); | 1629 var classSource = %ClassGetSourceCode(func); |
1630 if (IS_STRING(classSource)) { | 1630 if (IS_STRING(classSource)) { |
1631 return classSource; | 1631 return classSource; |
1632 } | 1632 } |
1633 | 1633 |
1634 var source = %FunctionGetSourceCode(func); | 1634 var source = %FunctionGetSourceCode(func); |
1635 if (!IS_STRING(source)) { | 1635 if (!IS_STRING(source)) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 }); | 1810 }); |
1811 | 1811 |
1812 utils.ExportToRuntime(function(to) { | 1812 utils.ExportToRuntime(function(to) { |
1813 to.GlobalEval = GlobalEval; | 1813 to.GlobalEval = GlobalEval; |
1814 to.ObjectDefineOwnProperty = DefineOwnPropertyFromAPI; | 1814 to.ObjectDefineOwnProperty = DefineOwnPropertyFromAPI; |
1815 to.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; | 1815 to.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor; |
1816 to.ToCompletePropertyDescriptor = ToCompletePropertyDescriptor; | 1816 to.ToCompletePropertyDescriptor = ToCompletePropertyDescriptor; |
1817 }); | 1817 }); |
1818 | 1818 |
1819 }) | 1819 }) |
OLD | NEW |