OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 // Convert calls on global objects to be calls on the global | 74 // Convert calls on global objects to be calls on the global |
75 // receiver instead to avoid having a 'this' pointer which refers | 75 // receiver instead to avoid having a 'this' pointer which refers |
76 // directly to a global object. | 76 // directly to a global object. |
77 if (receiver->IsGlobalObject()) { | 77 if (receiver->IsGlobalObject()) { |
78 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 78 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
79 receiver = Handle<JSObject>(global->global_receiver()); | 79 receiver = Handle<JSObject>(global->global_receiver()); |
80 } | 80 } |
81 | 81 |
| 82 // Make sure that the global object of the context we're about to |
| 83 // make the current one is indeed a global object. |
| 84 ASSERT(func->context()->global()->IsGlobalObject()); |
| 85 |
82 { | 86 { |
83 // Save and restore context around invocation and block the | 87 // Save and restore context around invocation and block the |
84 // allocation of handles without explicit handle scopes. | 88 // allocation of handles without explicit handle scopes. |
85 SaveContext save; | 89 SaveContext save; |
86 NoHandleAllocation na; | 90 NoHandleAllocation na; |
87 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); | 91 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); |
88 | 92 |
89 // Call the function through the right JS entry stub. | 93 // Call the function through the right JS entry stub. |
90 byte* entry_address= func->code()->entry(); | 94 byte* entry_address= func->code()->entry(); |
91 JSFunction* function = *func; | 95 JSFunction* function = *func; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // All allocation spaces other than NEW_SPACE have the same effect. | 692 // All allocation spaces other than NEW_SPACE have the same effect. |
689 Heap::CollectAllGarbage(false); | 693 Heap::CollectAllGarbage(false); |
690 return v8::Undefined(); | 694 return v8::Undefined(); |
691 } | 695 } |
692 | 696 |
693 | 697 |
694 static GCExtension kGCExtension; | 698 static GCExtension kGCExtension; |
695 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); | 699 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); |
696 | 700 |
697 } } // namespace v8::internal | 701 } } // namespace v8::internal |
OLD | NEW |