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

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

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

Powered by Google App Engine
This is Rietveld 408576698