Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 29553002: Move privateTemplateUniqueKey / sharedTemplateUniqueKey to .bss section (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update sharedTemplateUniqueKey as well Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestActiveDOMObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 $signature = "v8::Local<v8::Signature>()"; 1179 $signature = "v8::Local<v8::Signature>()";
1180 } 1180 }
1181 1181
1182 my $newTemplateParams = "${implClassName}V8Internal::${funcName}MethodCallba ck, v8Undefined(), $signature"; 1182 my $newTemplateParams = "${implClassName}V8Internal::${funcName}MethodCallba ck, v8Undefined(), $signature";
1183 1183
1184 AddToImplIncludes("bindings/v8/BindingSecurity.h"); 1184 AddToImplIncludes("bindings/v8/BindingSecurity.h");
1185 $implementation{nameSpaceInternal}->add(<<END); 1185 $implementation{nameSpaceInternal}->add(<<END);
1186 static void ${funcName}AttributeGetter(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Value>& info) 1186 static void ${funcName}AttributeGetter(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Value>& info)
1187 { 1187 {
1188 // This is only for getting a unique pointer which we can pass to privateTem plate. 1188 // This is only for getting a unique pointer which we can pass to privateTem plate.
1189 static const char* privateTemplateUniqueKey = "${funcName}PrivateTemplate"; 1189 static const int privateTemplateUniqueKey = 0;
digit1 2013/10/19 08:04:17 This looks really good. For the record, you can a
Inactive 2013/10/22 14:25:42 So it looks like msvc optimizes out the static var
1190 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 1190 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
1191 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 1191 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
1192 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, $newTemplateParams, $functionLength); 1192 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, $newTemplateParams, $functionLength);
1193 1193
1194 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${ v8ClassName}::GetTemplate(info.GetIsolate(), currentWorldType)); 1194 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${ v8ClassName}::GetTemplate(info.GetIsolate(), currentWorldType));
1195 if (holder.IsEmpty()) { 1195 if (holder.IsEmpty()) {
1196 // can only reach here by 'object.__proto__.func', and it should passed 1196 // can only reach here by 'object.__proto__.func', and it should passed
1197 // domain security check already 1197 // domain security check already
1198 v8SetReturnValue(info, privateTemplate->GetFunction()); 1198 v8SetReturnValue(info, privateTemplate->GetFunction());
1199 return; 1199 return;
1200 } 1200 }
1201 ${implClassName}* imp = ${v8ClassName}::toNative(holder); 1201 ${implClassName}* imp = ${v8ClassName}::toNative(holder);
1202 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 1202 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
1203 static const char* sharedTemplateUniqueKey = "${funcName}SharedTemplate" ; 1203 static const int sharedTemplateUniqueKey = 0;
1204 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams, $functionLength) ; 1204 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, $newTemplateParams, $functionLength) ;
1205 v8SetReturnValue(info, sharedTemplate->GetFunction()); 1205 v8SetReturnValue(info, sharedTemplate->GetFunction());
1206 return; 1206 return;
1207 } 1207 }
1208 1208
1209 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name); 1209 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name);
1210 if (!hiddenValue.IsEmpty()) { 1210 if (!hiddenValue.IsEmpty()) {
1211 v8SetReturnValue(info, hiddenValue); 1211 v8SetReturnValue(info, hiddenValue);
1212 return; 1212 return;
1213 } 1213 }
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 args.GetReturnValue().Set(wrapper); 2987 args.GetReturnValue().Set(wrapper);
2988 } 2988 }
2989 2989
2990 END 2990 END
2991 $implementation{nameSpaceWebCore}->add($code); 2991 $implementation{nameSpaceWebCore}->add($code);
2992 2992
2993 $code = <<END; 2993 $code = <<END;
2994 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol ate* isolate, WrapperWorldType currentWorldType) 2994 v8::Handle<v8::FunctionTemplate> ${v8ClassName}Constructor::GetTemplate(v8::Isol ate* isolate, WrapperWorldType currentWorldType)
2995 { 2995 {
2996 // This is only for getting a unique pointer which we can pass to privateTem plate. 2996 // This is only for getting a unique pointer which we can pass to privateTem plate.
2997 static const char* privateTemplateUniqueKey = "${v8ClassName}Constructor::Ge tTemplatePrivateTemplate"; 2997 static const int privateTemplateUniqueKey = 0;
2998 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 2998 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
2999 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr entWorldType, &privateTemplateUniqueKey); 2999 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr entWorldType, &privateTemplateUniqueKey);
3000 if (!result.IsEmpty()) 3000 if (!result.IsEmpty())
3001 return result; 3001 return result;
3002 3002
3003 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink\", \"BuildDOMTemplate"); 3003 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink\", \"BuildDOMTemplate");
3004 v8::HandleScope scope(isolate); 3004 v8::HandleScope scope(isolate);
3005 result = v8::FunctionTemplate::New(${v8ClassName}ConstructorCallback); 3005 result = v8::FunctionTemplate::New(${v8ClassName}ConstructorCallback);
3006 3006
3007 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate(); 3007 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after
6228 my $interface = shift; 6228 my $interface = shift;
6229 6229
6230 return 1 if $interface->extendedAttributes->{"CustomToV8"}; 6230 return 1 if $interface->extendedAttributes->{"CustomToV8"};
6231 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; 6231 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"};
6232 return 1 if InheritsInterface($interface, "Document"); 6232 return 1 if InheritsInterface($interface, "Document");
6233 6233
6234 return 0; 6234 return 0;
6235 } 6235 }
6236 6236
6237 1; 6237 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestActiveDOMObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698