Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 // Find previously called non-toplevel function. | 744 // Find previously called non-toplevel function. |
| 745 JSFunction* caller; | 745 JSFunction* caller; |
| 746 do { | 746 do { |
| 747 caller = it.next(); | 747 caller = it.next(); |
| 748 if (caller == NULL) return isolate->heap()->null_value(); | 748 if (caller == NULL) return isolate->heap()->null_value(); |
| 749 } while (caller->shared()->is_toplevel()); | 749 } while (caller->shared()->is_toplevel()); |
| 750 | 750 |
| 751 // If caller is a built-in function and caller's caller is also built-in, | 751 // If caller is a built-in function and caller's caller is also built-in, |
| 752 // use that instead. | 752 // use that instead. |
| 753 JSFunction* potential_caller = caller; | 753 JSFunction* potential_caller = caller; |
| 754 while (potential_caller != NULL && potential_caller->IsBuiltin()) { | 754 while (potential_caller != NULL && potential_caller->IsBuiltin()) { |
|
Yang
2012/09/04 12:43:57
This suggest that potential_caller can become NULL
Erik Corry
2012/09/05 07:22:33
I think it can't happen, but I will check for NULL
| |
| 755 caller = potential_caller; | 755 caller = potential_caller; |
| 756 potential_caller = it.next(); | 756 potential_caller = it.next(); |
| 757 } | 757 } |
| 758 if (!caller->shared()->native()) { | |
| 759 caller = potential_caller; | |
| 760 } | |
| 758 // If caller is bound, return null. This is compatible with JSC, and | 761 // If caller is bound, return null. This is compatible with JSC, and |
| 759 // allows us to make bound functions use the strict function map | 762 // allows us to make bound functions use the strict function map |
| 760 // and its associated throwing caller and arguments. | 763 // and its associated throwing caller and arguments. |
| 761 if (caller->shared()->bound()) { | 764 if (caller->shared()->bound()) { |
| 762 return isolate->heap()->null_value(); | 765 return isolate->heap()->null_value(); |
| 763 } | 766 } |
| 764 return CheckNonStrictCallerOrThrow(isolate, caller); | 767 return CheckNonStrictCallerOrThrow(isolate, caller); |
| 765 } | 768 } |
| 766 | 769 |
| 767 | 770 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 info->set_data(Smi::FromInt(index)); | 864 info->set_data(Smi::FromInt(index)); |
| 862 Handle<Object> getter = v8::FromCData(&ModuleGetExport); | 865 Handle<Object> getter = v8::FromCData(&ModuleGetExport); |
| 863 Handle<Object> setter = v8::FromCData(&ModuleSetExport); | 866 Handle<Object> setter = v8::FromCData(&ModuleSetExport); |
| 864 info->set_getter(*getter); | 867 info->set_getter(*getter); |
| 865 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 868 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 866 return info; | 869 return info; |
| 867 } | 870 } |
| 868 | 871 |
| 869 | 872 |
| 870 } } // namespace v8::internal | 873 } } // namespace v8::internal |
| OLD | NEW |