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

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

Issue 2724833002: Migrate Object.prototype.valueOf to CSA (Closed)
Patch Set: Separate CL & fixes Created 3 years, 9 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
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 13 matching lines...) Expand all
24 // ---------------------------------------------------------------------------- 24 // ----------------------------------------------------------------------------
25 // Object 25 // Object
26 26
27 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]]) 27 // ES6 19.1.3.5 Object.prototype.toLocaleString([reserved1 [,reserved2]])
28 function ObjectToLocaleString() { 28 function ObjectToLocaleString() {
29 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString"); 29 CHECK_OBJECT_COERCIBLE(this, "Object.prototype.toLocaleString");
30 return this.toString(); 30 return this.toString();
31 } 31 }
32 32
33 33
34 // ES6 19.1.3.7 Object.prototype.valueOf()
35 function ObjectValueOf() {
36 return TO_OBJECT(this);
37 }
38
39
40 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V) 34 // ES6 19.1.3.3 Object.prototype.isPrototypeOf(V)
41 function ObjectIsPrototypeOf(V) { 35 function ObjectIsPrototypeOf(V) {
42 if (!IS_RECEIVER(V)) return false; 36 if (!IS_RECEIVER(V)) return false;
43 var O = TO_OBJECT(this); 37 var O = TO_OBJECT(this);
44 return %HasInPrototypeChain(V, O); 38 return %HasInPrototypeChain(V, O);
45 } 39 }
46 40
47 41
48 // ES6 7.3.9 42 // ES6 7.3.9
49 function GetMethod(obj, p) { 43 function GetMethod(obj, p) {
(...skipping 19 matching lines...) Expand all
69 %SetNativeFlag(GlobalObject); 63 %SetNativeFlag(GlobalObject);
70 %SetCode(GlobalObject, ObjectConstructor); 64 %SetCode(GlobalObject, ObjectConstructor);
71 65
72 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject, 66 %AddNamedProperty(GlobalObject.prototype, "constructor", GlobalObject,
73 DONT_ENUM); 67 DONT_ENUM);
74 68
75 // Set up non-enumerable functions on the Object.prototype object. 69 // Set up non-enumerable functions on the Object.prototype object.
76 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [ 70 utils.InstallFunctions(GlobalObject.prototype, DONT_ENUM, [
77 "toString", ObjectToString, 71 "toString", ObjectToString,
78 "toLocaleString", ObjectToLocaleString, 72 "toLocaleString", ObjectToLocaleString,
79 "valueOf", ObjectValueOf, 73 // valueOf is added in bootstrapper.cc.
80 "isPrototypeOf", ObjectIsPrototypeOf, 74 "isPrototypeOf", ObjectIsPrototypeOf,
81 // propertyIsEnumerable is added in bootstrapper.cc. 75 // propertyIsEnumerable is added in bootstrapper.cc.
82 // __defineGetter__ is added in bootstrapper.cc. 76 // __defineGetter__ is added in bootstrapper.cc.
83 // __lookupGetter__ is added in bootstrapper.cc. 77 // __lookupGetter__ is added in bootstrapper.cc.
84 // __defineSetter__ is added in bootstrapper.cc. 78 // __defineSetter__ is added in bootstrapper.cc.
85 // __lookupSetter__ is added in bootstrapper.cc. 79 // __lookupSetter__ is added in bootstrapper.cc.
86 ]); 80 ]);
87 81
88 82
89 // ---------------------------------------------------------------------------- 83 // ----------------------------------------------------------------------------
(...skipping 16 matching lines...) Expand all
106 100
107 // ---------------------------------------------------------------------------- 101 // ----------------------------------------------------------------------------
108 // Exports 102 // Exports
109 103
110 utils.Export(function(to) { 104 utils.Export(function(to) {
111 to.GetIterator = GetIterator; 105 to.GetIterator = GetIterator;
112 to.GetMethod = GetMethod; 106 to.GetMethod = GetMethod;
113 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty; 107 to.ObjectHasOwnProperty = GlobalObject.prototype.hasOwnProperty;
114 }); 108 });
115 109
116 %InstallToContext([
117 "object_value_of", ObjectValueOf,
118 ]);
119
120 }) 110 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698