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

Side by Side Diff: src/apinatives.js

Issue 7324027: Fix: FunctionTemplate::SetPrototypeAttributes broke prototype object (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | src/objects.cc » ('j') | src/objects.cc » ('J')
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 var attributes = %GetTemplateField(data, kApiPrototypeAttributesOffset); 76 var attributes = %GetTemplateField(data, kApiPrototypeAttributesOffset);
77 fun.prototype = prototype ? Instantiate(prototype) : {};
77 if (attributes != NONE) { 78 if (attributes != NONE) {
78 %IgnoreAttributesAndSetProperty( 79 // This will fail to set the prototype (so we can just pass in '{}'),
79 fun, "prototype", 80 // but it *will* set its attributes :-)
80 prototype ? Instantiate(prototype) : {}, 81 %IgnoreAttributesAndSetProperty(fun, "prototype", {}, attributes);
Mads Ager (chromium) 2011/07/11 10:12:54 Let's create a runtime function %SetPropertyAttrib
81 attributes);
82 } else {
83 fun.prototype = prototype ? Instantiate(prototype) : {};
84 } 82 }
85 %SetProperty(fun.prototype, "constructor", fun, DONT_ENUM); 83 %SetProperty(fun.prototype, "constructor", fun, DONT_ENUM);
86 var parent = %GetTemplateField(data, kApiParentTemplateOffset); 84 var parent = %GetTemplateField(data, kApiParentTemplateOffset);
87 if (parent) { 85 if (parent) {
88 var parent_fun = Instantiate(parent); 86 var parent_fun = Instantiate(parent);
89 fun.prototype.__proto__ = parent_fun.prototype; 87 fun.prototype.__proto__ = parent_fun.prototype;
90 } 88 }
91 ConfigureTemplateInstance(fun, data); 89 ConfigureTemplateInstance(fun, data);
92 } catch (e) { 90 } catch (e) {
93 cache[serialNumber] = kUninitialized; 91 cache[serialNumber] = kUninitialized;
(...skipping 15 matching lines...) Expand all
109 var prop_data = properties[i + 2]; 107 var prop_data = properties[i + 2];
110 var attributes = properties[i + 3]; 108 var attributes = properties[i + 3];
111 var value = Instantiate(prop_data, name); 109 var value = Instantiate(prop_data, name);
112 %SetProperty(obj, name, value, attributes); 110 %SetProperty(obj, name, value, attributes);
113 } 111 }
114 } finally { 112 } finally {
115 if (requires_access_checks) %EnableAccessChecks(obj); 113 if (requires_access_checks) %EnableAccessChecks(obj);
116 } 114 }
117 } 115 }
118 } 116 }
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698