Changeset 62650 in webkit
- Timestamp:
- Jul 7, 2010 3:27:46 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r62647 r62650 1 2010-07-07 Steve Block <steveblock@google.com> 2 3 Reviewed by Adam Barth. 4 5 JavaInstanceV8 needs to push a local reference frame to avoid table overflow. 6 https://bugs.webkit.org/show_bug.cgi?id=41516 7 8 This change is required to help prevent the Java virtual machine from 9 running out of local references. The Java virtual machine supports only 10 a limited number of local references. Normally, local references are 11 cleared when the native method returns. 12 13 This change adds calls to PushLocalFrame() and PopLocalFrame() around 14 each invocation of a method on JavaInstance. These calls instruct the 15 virtual machine to clear local references when the frame is popped. 16 This means that in the case where many calls to JavaInstance methods 17 are made within the same native call, local references are cleared as 18 soon as they are no longer needed, thus conserving references. 19 20 This change mirrors exactly JavaInstanceJSC. 21 22 No new tests. 23 24 * bridge/jni/v8/JavaInstanceV8.cpp: 25 (JavaInstance::virtualBegin): 26 (JavaInstance::virtualEnd): 27 * bridge/jni/v8/JavaInstanceV8.h: 28 1 29 2010-07-06 Yury Semikhatsky <yurys@chromium.org> 2 30 -
trunk/WebCore/bridge/jni/v8/JavaInstanceV8.cpp
r54165 r62650 33 33 34 34 #include <assert.h> 35 #include <utils/Log.h>36 37 #define LOG_TAG "v8binding"38 35 39 36 using namespace JSC::Bindings; … … 49 46 m_instance = 0; 50 47 delete m_class; 48 } 49 50 #define NUM_LOCAL_REFS 64 51 52 void JavaInstance::virtualBegin() 53 { 54 getJNIEnv()->PushLocalFrame(NUM_LOCAL_REFS); 55 } 56 57 void JavaInstance::virtualEnd() 58 { 59 getJNIEnv()->PopLocalFrame(0); 51 60 } 52 61 … … 80 89 } 81 90 } 82 if (!method) { 83 LOGW("unable to find an appropiate method\n"); 91 if (!method) 84 92 return false; 85 }86 93 87 94 const JavaMethod* jMethod = static_cast<const JavaMethod*>(method); … … 157 164 m_instance = m_env->NewGlobalRef(instance); 158 165 159 LOGV("new global ref %p for %p\n", m_instance, instance);160 161 166 if (!m_instance) 162 167 fprintf(stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance); … … 165 170 JObjectWrapper::~JObjectWrapper() 166 171 { 167 LOGV("deleting global ref %p\n", m_instance);168 172 m_env->DeleteGlobalRef(m_instance); 169 173 } -
trunk/WebCore/bridge/jni/v8/JavaInstanceV8.h
r54596 r62650 90 90 mutable JavaClass* m_class; 91 91 92 virtual void virtualBegin() {}93 virtual void virtualEnd() {}92 virtual void virtualBegin(); 93 virtual void virtualEnd(); 94 94 }; 95 95
Note: See TracChangeset
for help on using the changeset viewer.