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

Unified Diff: src/apinatives.js

Issue 6223: Make sure that the name accessor on functions return the expected... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/array.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/apinatives.js
===================================================================
--- src/apinatives.js (revision 413)
+++ src/apinatives.js (working copy)
@@ -34,19 +34,19 @@
var date = new ORIGINAL_DATE();
date.setTime(time);
return date;
-};
+}
const kApiFunctionCache = {};
const functionCache = kApiFunctionCache;
-function Instantiate(data) {
+function Instantiate(data, name) {
if (!%IsTemplate(data)) return data;
var tag = %GetTemplateField(data, kApiTagOffset);
switch (tag) {
case kFunctionTag:
- return InstantiateFunction(data);
+ return InstantiateFunction(data, name);
case kNewObjectTag:
var Constructor = %GetTemplateField(data, kApiConstructorOffset);
var result = Constructor ? new (Instantiate(Constructor))() : {};
@@ -55,14 +55,15 @@
default:
throw 'Unknown API tag <' + tag + '>';
}
-};
+}
-function InstantiateFunction(data) {
+function InstantiateFunction(data, name) {
var serialNumber = %GetTemplateField(data, kApiSerialNumberOffset);
if (!(serialNumber in kApiFunctionCache)) {
kApiFunctionCache[serialNumber] = null;
var fun = %CreateApiFunction(data);
+ if (name) %FunctionSetName(fun, name);
kApiFunctionCache[serialNumber] = fun;
var prototype = %GetTemplateField(data, kApiPrototypeTemplateOffset);
fun.prototype = prototype ? Instantiate(prototype) : {};
@@ -75,7 +76,7 @@
ConfigureTemplateInstance(fun, data);
}
return kApiFunctionCache[serialNumber];
-};
+}
function ConfigureTemplateInstance(obj, data) {
@@ -85,8 +86,8 @@
var name = properties[i + 1];
var prop_data = properties[i + 2];
var attributes = properties[i + 3];
- var value = Instantiate(prop_data);
+ var value = Instantiate(prop_data, name);
%SetProperty(obj, name, value, attributes);
}
}
-};
+}
« no previous file with comments | « no previous file | src/array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698