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

Side by Side Diff: src/prologue.js

Issue 1343113003: Implement V8 extras utils object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove call/apply helpers Created 5 years, 3 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/contexts.h ('k') | src/promise.js » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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, extrasUtils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ----------------------------------------------------------------------- 11 // -----------------------------------------------------------------------
12 // Utils 12 // Utils
13 13
14 var imports = UNDEFINED; 14 var imports = UNDEFINED;
15 var imports_from_experimental = UNDEFINED; 15 var imports_from_experimental = UNDEFINED;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 utils.InstallFunctions = InstallFunctions; 260 utils.InstallFunctions = InstallFunctions;
261 utils.InstallGetter = InstallGetter; 261 utils.InstallGetter = InstallGetter;
262 utils.InstallGetterSetter = InstallGetterSetter; 262 utils.InstallGetterSetter = InstallGetterSetter;
263 utils.SetUpLockedPrototype = SetUpLockedPrototype; 263 utils.SetUpLockedPrototype = SetUpLockedPrototype;
264 utils.PostNatives = PostNatives; 264 utils.PostNatives = PostNatives;
265 utils.PostExperimentals = PostExperimentals; 265 utils.PostExperimentals = PostExperimentals;
266 utils.PostDebug = PostDebug; 266 utils.PostDebug = PostDebug;
267 267
268 %ToFastProperties(utils); 268 %ToFastProperties(utils);
269 269
270 // -----------------------------------------------------------------------
271
272 %OptimizeObjectForAddingMultipleProperties(extrasUtils, 5);
273
274 extrasUtils.logStackTrace = function logStackTrace() {
275 %DebugTrace();
276 };
277
278 extrasUtils.log = function log() {
279 let message = '';
280 for (const arg of arguments) {
281 message += arg;
282 }
283
284 %GlobalPrint(message);
285 };
286
287 // Extras need the ability to store private state on their objects without
288 // exposing it to the outside world.
289
290 extrasUtils.createPrivateSymbol = function createPrivateSymbol(name) {
291 return %CreatePrivateSymbol(name);
292 };
293
294 // These functions are key for safe meta-programming:
295 // http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
296 //
297 // Technically they could all be derived from combinations of
298 // Function.prototype.{bind,call,apply} but that introduces lots of layers of
299 // indirection and slowness given how un-optimized bind is.
300
301 extrasUtils.simpleBind = function simpleBind(func, thisArg) {
302 return function() {
303 return %Apply(func, thisArg, arguments, 0, arguments.length);
304 };
305 };
306
307 extrasUtils.uncurryThis = function uncurryThis(func) {
308 return function(thisArg) {
309 return %Apply(func, thisArg, arguments, 1, arguments.length - 1);
310 };
311 };
312
313 %ToFastProperties(extrasUtils);
314
270 }) 315 })
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698