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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 var name = %FunctionGetName(func); | 1535 var name = %FunctionGetName(func); |
1536 if (name) { | 1536 if (name) { |
1537 // Mimic what KJS does. | 1537 // Mimic what KJS does. |
1538 return 'function ' + name + '() { [native code] }'; | 1538 return 'function ' + name + '() { [native code] }'; |
1539 } | 1539 } |
1540 | 1540 |
1541 return 'function () { [native code] }'; | 1541 return 'function () { [native code] }'; |
1542 } | 1542 } |
1543 | 1543 |
1544 function FunctionSourceString(func) { | 1544 function FunctionSourceString(func) { |
1545 while (%IsJSFunctionProxy(func)) { | |
1546 func = %GetCallTrap(func); | |
1547 } | |
1548 | |
1549 if (!IS_FUNCTION(func)) { | 1545 if (!IS_FUNCTION(func)) { |
1550 throw MakeTypeError(kNotGeneric, 'Function.prototype.toString'); | 1546 throw MakeTypeError(kNotGeneric, 'Function.prototype.toString'); |
1551 } | 1547 } |
1552 | 1548 |
1553 if (%FunctionHidesSource(func)) { | 1549 if (%FunctionHidesSource(func)) { |
1554 return NativeCodeFunctionSourceString(func); | 1550 return NativeCodeFunctionSourceString(func); |
1555 } | 1551 } |
1556 | 1552 |
1557 var classSource = %ClassGetSourceCode(func); | 1553 var classSource = %ClassGetSourceCode(func); |
1558 if (IS_STRING(classSource)) { | 1554 if (IS_STRING(classSource)) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 | 1736 |
1741 %InstallToContext([ | 1737 %InstallToContext([ |
1742 "global_eval_fun", GlobalEval, | 1738 "global_eval_fun", GlobalEval, |
1743 "object_value_of", ObjectValueOf, | 1739 "object_value_of", ObjectValueOf, |
1744 "object_to_string", ObjectToString, | 1740 "object_to_string", ObjectToString, |
1745 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1741 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
1746 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1742 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
1747 ]); | 1743 ]); |
1748 | 1744 |
1749 }) | 1745 }) |
OLD | NEW |