| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 // This file contains infrastructure used by the API. See | 7 // This file contains infrastructure used by the API. See |
| 8 // v8natives.js for an explanation of these files are processed and | 8 // v8natives.js for an explanation of these files are processed and |
| 9 // loaded. | 9 // loaded. |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (!(flags & (1 << kRemovePrototypeBit))) { | 61 if (!(flags & (1 << kRemovePrototypeBit))) { |
| 62 var template = %GetTemplateField(data, kApiPrototypeTemplateOffset); | 62 var template = %GetTemplateField(data, kApiPrototypeTemplateOffset); |
| 63 prototype = typeof template === 'undefined' | 63 prototype = typeof template === 'undefined' |
| 64 ? {} : Instantiate(template); | 64 ? {} : Instantiate(template); |
| 65 | 65 |
| 66 var parent = %GetTemplateField(data, kApiParentTemplateOffset); | 66 var parent = %GetTemplateField(data, kApiParentTemplateOffset); |
| 67 // Note: Do not directly use a function template as a condition, our | 67 // Note: Do not directly use a function template as a condition, our |
| 68 // internal ToBoolean doesn't handle that! | 68 // internal ToBoolean doesn't handle that! |
| 69 if (typeof parent !== 'undefined') { | 69 if (typeof parent !== 'undefined') { |
| 70 var parent_fun = Instantiate(parent); | 70 var parent_fun = Instantiate(parent); |
| 71 %SetPrototype(prototype, parent_fun.prototype); | 71 %InternalSetPrototype(prototype, parent_fun.prototype); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 var fun = %CreateApiFunction(data, prototype); | 74 var fun = %CreateApiFunction(data, prototype); |
| 75 if (name) %FunctionSetName(fun, name); | 75 if (name) %FunctionSetName(fun, name); |
| 76 var doNotCache = flags & (1 << kDoNotCacheBit); | 76 var doNotCache = flags & (1 << kDoNotCacheBit); |
| 77 if (!doNotCache) cache[serialNumber] = fun; | 77 if (!doNotCache) cache[serialNumber] = fun; |
| 78 ConfigureTemplateInstance(fun, data); | 78 ConfigureTemplateInstance(fun, data); |
| 79 if (doNotCache) return fun; | 79 if (doNotCache) return fun; |
| 80 } catch (e) { | 80 } catch (e) { |
| 81 cache[serialNumber] = kUninitialized; | 81 cache[serialNumber] = kUninitialized; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 110 %DefineApiAccessorProperty(obj, name, getter, setter, attribute); | 110 %DefineApiAccessorProperty(obj, name, getter, setter, attribute); |
| 111 } else { | 111 } else { |
| 112 throw "Bad properties array"; | 112 throw "Bad properties array"; |
| 113 } | 113 } |
| 114 i += length + 1; | 114 i += length + 1; |
| 115 } | 115 } |
| 116 } finally { | 116 } finally { |
| 117 if (requires_access_checks) %EnableAccessChecks(obj); | 117 if (requires_access_checks) %EnableAccessChecks(obj); |
| 118 } | 118 } |
| 119 } | 119 } |
| OLD | NEW |