| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 Handle<Code> code; | 72 Handle<Code> code; |
| 73 if (construct) { | 73 if (construct) { |
| 74 JSConstructEntryStub stub; | 74 JSConstructEntryStub stub; |
| 75 code = stub.GetCode(); | 75 code = stub.GetCode(); |
| 76 } else { | 76 } else { |
| 77 JSEntryStub stub; | 77 JSEntryStub stub; |
| 78 code = stub.GetCode(); | 78 code = stub.GetCode(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Convert calls on global objects to be calls on the global |
| 82 // receiver instead to avoid having a 'this' pointer which refers |
| 83 // directly to a global object. |
| 84 if (receiver->IsGlobalObject()) { |
| 85 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
| 86 receiver = Handle<JSObject>(global->global_receiver()); |
| 87 } |
| 88 |
| 81 { | 89 { |
| 82 // Save and restore context around invocation and block the | 90 // Save and restore context around invocation and block the |
| 83 // allocation of handles without explicit handle scopes. | 91 // allocation of handles without explicit handle scopes. |
| 84 SaveContext save; | 92 SaveContext save; |
| 85 NoHandleAllocation na; | 93 NoHandleAllocation na; |
| 86 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); | 94 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); |
| 87 | 95 |
| 88 // Call the function through the right JS entry stub. | 96 // Call the function through the right JS entry stub. |
| 89 value = CALL_GENERATED_CODE(entry, func->code()->entry(), *func, | 97 value = CALL_GENERATED_CODE(entry, func->code()->entry(), *func, |
| 90 *receiver, argc, args); | 98 *receiver, argc, args); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 // All allocation spaces other than NEW_SPACE have the same effect. | 636 // All allocation spaces other than NEW_SPACE have the same effect. |
| 629 Heap::CollectGarbage(0, OLD_DATA_SPACE); | 637 Heap::CollectGarbage(0, OLD_DATA_SPACE); |
| 630 return v8::Undefined(); | 638 return v8::Undefined(); |
| 631 } | 639 } |
| 632 | 640 |
| 633 | 641 |
| 634 static GCExtension kGCExtension; | 642 static GCExtension kGCExtension; |
| 635 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); | 643 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); |
| 636 | 644 |
| 637 } } // namespace v8::internal | 645 } } // namespace v8::internal |
| OLD | NEW |