Changeset 126237 in webkit
- Timestamp:
- Aug 21, 2012 5:32:46 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126236 r126237 1 2012-08-20 Kentaro Hara <haraken@chromium.org> 2 3 [V8] Remove getToStringName() and getToStringTemplate() from V8Binding 4 https://bugs.webkit.org/show_bug.cgi?id=94573 5 6 Reviewed by Adam Barth. 7 8 - Remove V8Binding::getToStringName() and V8Binding::getToStringTemplate(). 9 10 - Replace getToStringName() with String::NewSymbol("toString"). 11 12 - Fix V8PerIsolateData::getToStringTemplate() so that it caches a persistent 13 handle of a created FunctionTemplate. Before this patch, a FunctionTemplate 14 had been created for each toString(). 15 16 No tests. No change in behavior. 17 18 * bindings/v8/V8Binding.cpp: 19 (WebCore::constructorToString): 20 * bindings/v8/V8Binding.h: 21 (WebCore): 22 * bindings/scripts/CodeGeneratorV8.pm: 23 (GenerateImplementation): 24 * bindings/scripts/test/V8/V8Float64Array.cpp: 25 (WebCore::ConfigureV8Float64ArrayTemplate): 26 * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: 27 (WebCore::ConfigureV8TestActiveDOMObjectTemplate): 28 * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: 29 (WebCore::ConfigureV8TestCustomNamedGetterTemplate): 30 * bindings/scripts/test/V8/V8TestEventConstructor.cpp: 31 (WebCore::ConfigureV8TestEventConstructorTemplate): 32 * bindings/scripts/test/V8/V8TestEventTarget.cpp: 33 (WebCore::ConfigureV8TestEventTargetTemplate): 34 * bindings/scripts/test/V8/V8TestException.cpp: 35 (WebCore::ConfigureV8TestExceptionTemplate): 36 * bindings/scripts/test/V8/V8TestInterface.cpp: 37 (WebCore::ConfigureV8TestInterfaceTemplate): 38 * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: 39 (WebCore::ConfigureV8TestMediaQueryListListenerTemplate): 40 * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: 41 (WebCore::ConfigureV8TestNamedConstructorTemplate): 42 * bindings/scripts/test/V8/V8TestNode.cpp: 43 (WebCore::ConfigureV8TestNodeTemplate): 44 * bindings/scripts/test/V8/V8TestObj.cpp: 45 (WebCore::ConfigureV8TestObjTemplate): 46 * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: 47 (WebCore::ConfigureV8TestSerializedScriptValueInterfaceTemplate): 48 * bindings/v8/V8PerIsolateData.h: 49 (V8PerIsolateData): 50 1 51 2012-08-21 Arvid Nilsson <anilsson@rim.com> 2 52 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r126141 r126237 2962 2962 2963 2963 // Custom toString template 2964 desc->Set( getToStringName(), getToStringTemplate());2964 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 2965 2965 return desc; 2966 2966 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
r126141 r126237 111 111 112 112 // Custom toString template 113 desc->Set( getToStringName(), getToStringTemplate());113 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 114 114 return desc; 115 115 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
r126141 r126237 141 141 142 142 // Custom toString template 143 desc->Set( getToStringName(), getToStringTemplate());143 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 144 144 return desc; 145 145 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
r125495 r126237 74 74 75 75 // Custom toString template 76 desc->Set( getToStringName(), getToStringTemplate());76 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 77 77 return desc; 78 78 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
r125495 r126237 111 111 112 112 // Custom toString template 113 desc->Set( getToStringName(), getToStringTemplate());113 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 114 114 return desc; 115 115 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
r126141 r126237 135 135 136 136 // Custom toString template 137 desc->Set( getToStringName(), getToStringTemplate());137 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 138 138 return desc; 139 139 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
r125295 r126237 65 65 66 66 // Custom toString template 67 desc->Set( getToStringName(), getToStringTemplate());67 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 68 68 return desc; 69 69 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r126141 r126237 304 304 305 305 // Custom toString template 306 desc->Set( getToStringName(), getToStringTemplate());306 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 307 307 return desc; 308 308 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
r125495 r126237 74 74 75 75 // Custom toString template 76 desc->Set( getToStringName(), getToStringTemplate());76 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 77 77 return desc; 78 78 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
r126141 r126237 115 115 116 116 // Custom toString template 117 desc->Set( getToStringName(), getToStringTemplate());117 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 118 118 return desc; 119 119 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
r125495 r126237 74 74 75 75 // Custom toString template 76 desc->Set( getToStringName(), getToStringTemplate());76 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 77 77 return desc; 78 78 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r126141 r126237 2255 2255 2256 2256 // Custom toString template 2257 desc->Set( getToStringName(), getToStringTemplate());2257 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 2258 2258 return desc; 2259 2259 } -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
r125495 r126237 257 257 258 258 // Custom toString template 259 desc->Set( getToStringName(), getToStringTemplate());259 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate()); 260 260 return desc; 261 261 } -
trunk/Source/WebCore/bindings/v8/V8Binding.cpp
r126218 r126237 326 326 } 327 327 328 v8::Persistent<v8::String> getToStringName()329 {330 v8::Persistent<v8::String>& toStringName = V8PerIsolateData::current()->toStringName();331 if (toStringName.IsEmpty())332 toStringName = v8::Persistent<v8::String>::New(v8::String::New("toString"));333 return *toStringName;334 335 }336 337 static v8::Handle<v8::Value> constructorToString(const v8::Arguments& args)338 {339 // The DOM constructors' toString functions grab the current toString340 // for Functions by taking the toString function of itself and then341 // calling it with the constructor as its receiver. This means that342 // changes to the Function prototype chain or toString function are343 // reflected when printing DOM constructors. The only wart is that344 // changes to a DOM constructor's toString's toString will cause the345 // toString of the DOM constructor itself to change. This is extremely346 // obscure and unlikely to be a problem.347 v8::Handle<v8::Value> value = args.Callee()->Get(getToStringName());348 if (!value->IsFunction())349 return v8::String::New("");350 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0);351 }352 353 v8::Persistent<v8::FunctionTemplate> getToStringTemplate()354 {355 v8::Persistent<v8::FunctionTemplate>& toStringTemplate = V8PerIsolateData::current()->toStringTemplate();356 if (toStringTemplate.IsEmpty())357 toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(constructorToString));358 return toStringTemplate;359 }360 361 328 void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 362 329 { -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r126222 r126237 355 355 v8::Persistent<v8::FunctionTemplate> createRawTemplate(); 356 356 357 v8::Persistent<v8::String> getToStringName();358 v8::Persistent<v8::FunctionTemplate> getToStringTemplate();359 360 357 String int32ToWebCoreString(int value); 361 358 -
trunk/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
r125494 r126237 107 107 #endif 108 108 109 v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Arguments& args) 110 { 111 // The DOM constructors' toString functions grab the current toString 112 // for Functions by taking the toString function of itself and then 113 // calling it with the constructor as its receiver. This means that 114 // changes to the Function prototype chain or toString function are 115 // reflected when printing DOM constructors. The only wart is that 116 // changes to a DOM constructor's toString's toString will cause the 117 // toString of the DOM constructor itself to change. This is extremely 118 // obscure and unlikely to be a problem. 119 v8::Handle<v8::Value> value = args.Callee()->Get(v8::String::NewSymbol("toString")); 120 if (!value->IsFunction()) 121 return v8::String::New(""); 122 return v8::Handle<v8::Function>::Cast(value)->Call(args.This(), 0, 0); 123 } 124 109 125 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/V8PerIsolateData.h
r126066 r126237 70 70 TemplateMap& rawTemplateMap() { return m_rawTemplates; } 71 71 TemplateMap& templateMap() { return m_templates; } 72 v8::Persistent<v8::String>& toStringName() { return m_toStringName; } 73 v8::Persistent<v8::FunctionTemplate>& toStringTemplate() { return m_toStringTemplate; } 72 73 v8::Persistent<v8::FunctionTemplate>& toStringTemplate() 74 { 75 if (m_toStringTemplate.IsEmpty()) 76 m_toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(constructorOfToString)); 77 return m_toStringTemplate; 78 } 74 79 75 80 v8::Persistent<v8::FunctionTemplate>& lazyEventListenerToStringTemplate() … … 131 136 explicit V8PerIsolateData(v8::Isolate*); 132 137 ~V8PerIsolateData(); 138 static v8::Handle<v8::Value> constructorOfToString(const v8::Arguments&); 133 139 134 140 TemplateMap m_rawTemplates; 135 141 TemplateMap m_templates; 136 v8::Persistent<v8::String> m_toStringName;137 142 v8::Persistent<v8::FunctionTemplate> m_toStringTemplate; 138 143 v8::Persistent<v8::FunctionTemplate> m_lazyEventListenerToStringTemplate;
Note: See TracChangeset
for help on using the changeset viewer.