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 669 matching lines...) Loading... |
680 }; | 680 }; |
681 | 681 |
682 | 682 |
683 // | 683 // |
684 // Accessors::FunctionCaller | 684 // Accessors::FunctionCaller |
685 // | 685 // |
686 | 686 |
687 | 687 |
688 class FrameFunctionIterator { | 688 class FrameFunctionIterator { |
689 public: | 689 public: |
690 FrameFunctionIterator(Isolate* isolate, const AssertNoAllocation& promise) | 690 FrameFunctionIterator(Isolate* isolate, const DisallowHeapAllocation& promise) |
691 : frame_iterator_(isolate), | 691 : frame_iterator_(isolate), |
692 functions_(2), | 692 functions_(2), |
693 index_(0) { | 693 index_(0) { |
694 GetFunctions(); | 694 GetFunctions(); |
695 } | 695 } |
696 JSFunction* next() { | 696 JSFunction* next() { |
697 if (functions_.length() == 0) return NULL; | 697 if (functions_.length() == 0) return NULL; |
698 JSFunction* next_function = functions_[index_]; | 698 JSFunction* next_function = functions_[index_]; |
699 index_--; | 699 index_--; |
700 if (index_ < 0) { | 700 if (index_ < 0) { |
(...skipping 26 matching lines...) Loading... |
727 } | 727 } |
728 JavaScriptFrameIterator frame_iterator_; | 728 JavaScriptFrameIterator frame_iterator_; |
729 List<JSFunction*> functions_; | 729 List<JSFunction*> functions_; |
730 int index_; | 730 int index_; |
731 }; | 731 }; |
732 | 732 |
733 | 733 |
734 MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) { | 734 MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) { |
735 Isolate* isolate = Isolate::Current(); | 735 Isolate* isolate = Isolate::Current(); |
736 HandleScope scope(isolate); | 736 HandleScope scope(isolate); |
737 AssertNoAllocation no_alloc; | 737 DisallowHeapAllocation no_allocation; |
738 JSFunction* holder = FindInstanceOf<JSFunction>(isolate, object); | 738 JSFunction* holder = FindInstanceOf<JSFunction>(isolate, object); |
739 if (holder == NULL) return isolate->heap()->undefined_value(); | 739 if (holder == NULL) return isolate->heap()->undefined_value(); |
740 if (holder->shared()->native()) return isolate->heap()->null_value(); | 740 if (holder->shared()->native()) return isolate->heap()->null_value(); |
741 Handle<JSFunction> function(holder, isolate); | 741 Handle<JSFunction> function(holder, isolate); |
742 | 742 |
743 FrameFunctionIterator it(isolate, no_alloc); | 743 FrameFunctionIterator it(isolate, no_allocation); |
744 | 744 |
745 // Find the function from the frames. | 745 // Find the function from the frames. |
746 if (!it.Find(*function)) { | 746 if (!it.Find(*function)) { |
747 // No frame corresponding to the given function found. Return null. | 747 // No frame corresponding to the given function found. Return null. |
748 return isolate->heap()->null_value(); | 748 return isolate->heap()->null_value(); |
749 } | 749 } |
750 | 750 |
751 // Find previously called non-toplevel function. | 751 // Find previously called non-toplevel function. |
752 JSFunction* caller; | 752 JSFunction* caller; |
753 do { | 753 do { |
(...skipping 93 matching lines...) Loading... |
847 info->set_data(Smi::FromInt(index)); | 847 info->set_data(Smi::FromInt(index)); |
848 Handle<Object> getter = v8::FromCData(&ModuleGetExport); | 848 Handle<Object> getter = v8::FromCData(&ModuleGetExport); |
849 Handle<Object> setter = v8::FromCData(&ModuleSetExport); | 849 Handle<Object> setter = v8::FromCData(&ModuleSetExport); |
850 info->set_getter(*getter); | 850 info->set_getter(*getter); |
851 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 851 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
852 return info; | 852 return info; |
853 } | 853 } |
854 | 854 |
855 | 855 |
856 } } // namespace v8::internal | 856 } } // namespace v8::internal |
OLD | NEW |