Title: [135322] trunk/Source/WebCore
- Revision
- 135322
- Author
- hara...@chromium.org
- Date
- 2012-11-20 15:42:16 -0800 (Tue, 20 Nov 2012)
Log Message
[V8] Introduce GenerateConstructorHeader() to CodeGeneratorV8.pm
https://bugs.webkit.org/show_bug.cgi?id=102806
Reviewed by Adam Barth.
This is an incremental step for introducing constructorCallbackCustom().
(See bug 102763.) This patch adds GenerateConstructorHeader()
that generates a common code for constructors.
No tests. No change in behavior.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateOverloadedConstructorCallback):
(GenerateSingleConstructorCallback):
(GenerateEventConstructorCallback):
(GenerateNamedConstructorCallback):
(GenerateConstructorHeader):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135321 => 135322)
--- trunk/Source/WebCore/ChangeLog 2012-11-20 23:40:49 UTC (rev 135321)
+++ trunk/Source/WebCore/ChangeLog 2012-11-20 23:42:16 UTC (rev 135322)
@@ -1,3 +1,23 @@
+2012-11-20 Kentaro Hara <hara...@chromium.org>
+
+ [V8] Introduce GenerateConstructorHeader() to CodeGeneratorV8.pm
+ https://bugs.webkit.org/show_bug.cgi?id=102806
+
+ Reviewed by Adam Barth.
+
+ This is an incremental step for introducing constructorCallbackCustom().
+ (See bug 102763.) This patch adds GenerateConstructorHeader()
+ that generates a common code for constructors.
+
+ No tests. No change in behavior.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateOverloadedConstructorCallback):
+ (GenerateSingleConstructorCallback):
+ (GenerateEventConstructorCallback):
+ (GenerateNamedConstructorCallback):
+ (GenerateConstructorHeader):
+
2012-11-20 Ryosuke Niwa <rn...@webkit.org>
HTMLCollection's cache should not be invalidated when id or name attributes are changed
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (135321 => 135322)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-20 23:40:49 UTC (rev 135321)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-11-20 23:42:16 UTC (rev 135322)
@@ -1855,13 +1855,8 @@
v8::Handle<v8::Value> V8${interfaceName}::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.${interfaceName}.Constructor");
- if (!args.IsConstructCall())
- return throwTypeError("DOM object constructor cannot be called as a function.");
-
- if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
- return args.Holder();
-
END
+ push(@implContent, GenerateConstructorHeader());
my $leastNumMandatoryParams = 255;
foreach my $constructor (@{$interface->constructors}) {
@@ -1916,13 +1911,7 @@
END
if ($function->{overloadedIndex} == 0) {
- push(@implContent, <<END);
- if (!args.IsConstructCall())
- return throwTypeError("DOM object constructor cannot be called as a function.");
-
- if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
- return args.Holder();
-END
+ push(@implContent, GenerateConstructorHeader());
push(@implContent, GenerateArgumentsCountCheck($function, $interface));
}
@@ -2011,13 +2000,10 @@
v8::Handle<v8::Value> V8${interfaceName}::constructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.${interfaceName}.Constructor");
+END
+ push(@implContent, GenerateConstructorHeader());
- if (!args.IsConstructCall())
- return throwTypeError("DOM object constructor cannot be called as a function.");
-
- if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
- return args.Holder();
-
+ push(@implContent, <<END);
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
@@ -2118,12 +2104,9 @@
{
INC_STATS("DOM.${interfaceName}.Constructor");
${maybeObserveFeature}
- if (!args.IsConstructCall())
- return throwTypeError("DOM object constructor cannot be called as a function.");
-
- if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
- return args.Holder();
-
+END
+ push(@implContent, GenerateConstructorHeader());
+ push(@implContent, <<END);
Document* document = currentDocument(BindingState::instance());
// Make sure the document is added to the DOM Node map. Otherwise, the ${interfaceName} instance
@@ -2207,6 +2190,18 @@
END
}
+sub GenerateConstructorHeader
+{
+ my $content = <<END;
+ if (!args.IsConstructCall())
+ return throwTypeError("DOM object constructor cannot be called as a function.");
+
+ if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
+ return args.Holder();
+END
+ return $content;
+}
+
sub GenerateBatchedAttributeData
{
my $interface = shift;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes