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

Side by Side Diff: src/js/v8natives.js

Issue 2415173003: Revert of [builtins] Also port the Object.prototype.__proto__ accessors to C++. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/runtime/runtime.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 98
99 // ES6 7.3.9 99 // ES6 7.3.9
100 function GetMethod(obj, p) { 100 function GetMethod(obj, p) {
101 var func = obj[p]; 101 var func = obj[p];
102 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; 102 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED;
103 if (IS_CALLABLE(func)) return func; 103 if (IS_CALLABLE(func)) return func;
104 throw %make_type_error(kCalledNonCallable, typeof func); 104 throw %make_type_error(kCalledNonCallable, typeof func);
105 } 105 }
106 106
107 // ES6 B.2.2.1.1
108 function ObjectGetProto() {
109 return %object_get_prototype_of(this);
110 }
111
112
113 // ES6 B.2.2.1.2
114 function ObjectSetProto(proto) {
115 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.__proto__");
116
117 if ((IS_RECEIVER(proto) || IS_NULL(proto)) && IS_RECEIVER(this)) {
118 %SetPrototype(this, proto);
119 }
120 }
121
122
107 // ES6 19.1.1.1 123 // ES6 19.1.1.1
108 function ObjectConstructor(x) { 124 function ObjectConstructor(x) {
109 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) { 125 if (GlobalObject != new.target && !IS_UNDEFINED(new.target)) {
110 return this; 126 return this;
111 } 127 }
112 if (IS_NULL(x) || IS_UNDEFINED(x)) return {}; 128 if (IS_NULL(x) || IS_UNDEFINED(x)) return {};
113 return TO_OBJECT(x); 129 return TO_OBJECT(x);
114 } 130 }
115 131
116 132
(...skipping 11 matching lines...) Expand all
128 "toString", ObjectToString, 144 "toString", ObjectToString,
129 "toLocaleString", ObjectToLocaleString, 145 "toLocaleString", ObjectToLocaleString,
130 "valueOf", ObjectValueOf, 146 "valueOf", ObjectValueOf,
131 "isPrototypeOf", ObjectIsPrototypeOf, 147 "isPrototypeOf", ObjectIsPrototypeOf,
132 // propertyIsEnumerable is added in bootstrapper.cc. 148 // propertyIsEnumerable is added in bootstrapper.cc.
133 // __defineGetter__ is added in bootstrapper.cc. 149 // __defineGetter__ is added in bootstrapper.cc.
134 // __lookupGetter__ is added in bootstrapper.cc. 150 // __lookupGetter__ is added in bootstrapper.cc.
135 // __defineSetter__ is added in bootstrapper.cc. 151 // __defineSetter__ is added in bootstrapper.cc.
136 // __lookupSetter__ is added in bootstrapper.cc. 152 // __lookupSetter__ is added in bootstrapper.cc.
137 ]); 153 ]);
154 utils.InstallGetterSetter(
155 GlobalObject.prototype, "__proto__", ObjectGetProto, ObjectSetProto);
138 156
139 157
140 // ---------------------------------------------------------------------------- 158 // ----------------------------------------------------------------------------
141 // Number 159 // Number
142 160
143 utils.InstallConstants(GlobalNumber, [ 161 utils.InstallConstants(GlobalNumber, [
144 // ECMA-262 section 15.7.3.1. 162 // ECMA-262 section 15.7.3.1.
145 "MAX_VALUE", 1.7976931348623157e+308, 163 "MAX_VALUE", 1.7976931348623157e+308,
146 // ECMA-262 section 15.7.3.2. 164 // ECMA-262 section 15.7.3.2.
147 "MIN_VALUE", 5e-324, 165 "MIN_VALUE", 5e-324,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 to.GetIterator = GetIterator; 209 to.GetIterator = GetIterator;
192 to.GetMethod = GetMethod; 210 to.GetMethod = GetMethod;
193 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; 211 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty;
194 }); 212 });
195 213
196 %InstallToContext([ 214 %InstallToContext([
197 "object_value_of", ObjectValueOf, 215 "object_value_of", ObjectValueOf,
198 ]); 216 ]);
199 217
200 }) 218 })
OLDNEW
« no previous file with comments | « src/builtins/builtins-object.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698