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

Side by Side Diff: src/apinatives.js

Issue 7229007: Add possibility to configure 'prototype' property via FunctionTemplate (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years, 6 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 | « src/api.cc ('k') | src/macros.py » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 var serialNumber = %GetTemplateField(data, kApiSerialNumberOffset); 66 var serialNumber = %GetTemplateField(data, kApiSerialNumberOffset);
67 var isFunctionCached = 67 var isFunctionCached =
68 (serialNumber in cache) && (cache[serialNumber] != kUninitialized); 68 (serialNumber in cache) && (cache[serialNumber] != kUninitialized);
69 if (!isFunctionCached) { 69 if (!isFunctionCached) {
70 try { 70 try {
71 cache[serialNumber] = null; 71 cache[serialNumber] = null;
72 var fun = %CreateApiFunction(data); 72 var fun = %CreateApiFunction(data);
73 if (name) %FunctionSetName(fun, name); 73 if (name) %FunctionSetName(fun, name);
74 cache[serialNumber] = fun; 74 cache[serialNumber] = fun;
75 var prototype = %GetTemplateField(data, kApiPrototypeTemplateOffset); 75 var prototype = %GetTemplateField(data, kApiPrototypeTemplateOffset);
76 fun.prototype = prototype ? Instantiate(prototype) : {}; 76 var attributes = %GetTemplateField(data, kApiPrototypeAttributesOffset);
77 if (attributes != NONE) {
78 %IgnoreAttributesAndSetProperty(
79 fun, "prototype",
80 prototype ? Instantiate(prototype) : {},
81 attributes);
82 } else {
83 fun.prototype = prototype ? Instantiate(prototype) : {};
84 }
77 %SetProperty(fun.prototype, "constructor", fun, DONT_ENUM); 85 %SetProperty(fun.prototype, "constructor", fun, DONT_ENUM);
78 var parent = %GetTemplateField(data, kApiParentTemplateOffset); 86 var parent = %GetTemplateField(data, kApiParentTemplateOffset);
79 if (parent) { 87 if (parent) {
80 var parent_fun = Instantiate(parent); 88 var parent_fun = Instantiate(parent);
81 fun.prototype.__proto__ = parent_fun.prototype; 89 fun.prototype.__proto__ = parent_fun.prototype;
82 } 90 }
83 ConfigureTemplateInstance(fun, data); 91 ConfigureTemplateInstance(fun, data);
84 } catch (e) { 92 } catch (e) {
85 cache[serialNumber] = kUninitialized; 93 cache[serialNumber] = kUninitialized;
86 throw e; 94 throw e;
(...skipping 14 matching lines...) Expand all
101 var prop_data = properties[i + 2]; 109 var prop_data = properties[i + 2];
102 var attributes = properties[i + 3]; 110 var attributes = properties[i + 3];
103 var value = Instantiate(prop_data, name); 111 var value = Instantiate(prop_data, name);
104 %SetProperty(obj, name, value, attributes); 112 %SetProperty(obj, name, value, attributes);
105 } 113 }
106 } finally { 114 } finally {
107 if (requires_access_checks) %EnableAccessChecks(obj); 115 if (requires_access_checks) %EnableAccessChecks(obj);
108 } 116 }
109 } 117 }
110 } 118 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698