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

Side by Side Diff: src/debug/mirrors.js

Issue 1540953004: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typos. Created 5 years 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.cc ('k') | src/elements.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 2006-2012 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 "use strict"; 6 "use strict";
7 7
8 // ---------------------------------------------------------------------------- 8 // ----------------------------------------------------------------------------
9 // Imports 9 // Imports
10 10
11 var ErrorToString; 11 var ErrorToString;
12 var FunctionSourceString;
13 var GlobalArray = global.Array; 12 var GlobalArray = global.Array;
14 var IsNaN = global.isNaN; 13 var IsNaN = global.isNaN;
15 var JSONStringify = global.JSON.stringify; 14 var JSONStringify = global.JSON.stringify;
16 var MakeError; 15 var MakeError;
17 var MapEntries; 16 var MapEntries;
18 var MapIteratorNext; 17 var MapIteratorNext;
19 var MathMin = global.Math.min; 18 var MathMin = global.Math.min;
20 var promiseStatusSymbol = utils.ImportNow("promise_status_symbol"); 19 var promiseStatusSymbol = utils.ImportNow("promise_status_symbol");
21 var promiseValueSymbol = utils.ImportNow("promise_value_symbol"); 20 var promiseValueSymbol = utils.ImportNow("promise_value_symbol");
22 var SetIteratorNext; 21 var SetIteratorNext;
23 var SetValues; 22 var SetValues;
24 var SymbolToString; 23 var SymbolToString;
25 24
26 utils.Import(function(from) { 25 utils.Import(function(from) {
27 ErrorToString = from.ErrorToString; 26 ErrorToString = from.ErrorToString;
28 FunctionSourceString = from.FunctionSourceString;
29 MakeError = from.MakeError; 27 MakeError = from.MakeError;
30 MapEntries = from.MapEntries; 28 MapEntries = from.MapEntries;
31 MapIteratorNext = from.MapIteratorNext; 29 MapIteratorNext = from.MapIteratorNext;
32 SetIteratorNext = from.SetIteratorNext; 30 SetIteratorNext = from.SetIteratorNext;
33 SetValues = from.SetValues; 31 SetValues = from.SetValues;
34 SymbolToString = from.SymbolToString; 32 SymbolToString = from.SymbolToString;
35 }); 33 });
36 34
37 // ---------------------------------------------------------------------------- 35 // ----------------------------------------------------------------------------
38 36
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 929
932 /** 930 /**
933 * Returns the source code for the function. 931 * Returns the source code for the function.
934 * @return {string or undefined} The source code for the function. If the 932 * @return {string or undefined} The source code for the function. If the
935 * function is not resolved undefined will be returned. 933 * function is not resolved undefined will be returned.
936 */ 934 */
937 FunctionMirror.prototype.source = function() { 935 FunctionMirror.prototype.source = function() {
938 // Return source if function is resolved. Otherwise just fall through to 936 // Return source if function is resolved. Otherwise just fall through to
939 // return undefined. 937 // return undefined.
940 if (this.resolved()) { 938 if (this.resolved()) {
941 return FunctionSourceString(this.value_); 939 return %FunctionToString(this.value_);
Yang 2015/12/22 06:19:22 Alternatively, you could import global.Function.pr
Benedikt Meurer 2015/12/22 06:30:35 As per offline discussion: This doesn't work with
942 } 940 }
943 }; 941 };
944 942
945 943
946 /** 944 /**
947 * Returns the script object for the function. 945 * Returns the script object for the function.
948 * @return {ScriptMirror or undefined} Script object for the function or 946 * @return {ScriptMirror or undefined} Script object for the function or
949 * undefined if the function has no script 947 * undefined if the function has no script
950 */ 948 */
951 FunctionMirror.prototype.script = function() { 949 FunctionMirror.prototype.script = function() {
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 // Functions needed by the debugger runtime. 3044 // Functions needed by the debugger runtime.
3047 utils.InstallFunctions(utils, DONT_ENUM, [ 3045 utils.InstallFunctions(utils, DONT_ENUM, [
3048 "ClearMirrorCache", ClearMirrorCache 3046 "ClearMirrorCache", ClearMirrorCache
3049 ]); 3047 ]);
3050 3048
3051 // Export to debug.js 3049 // Export to debug.js
3052 utils.Export(function(to) { 3050 utils.Export(function(to) {
3053 to.MirrorType = MirrorType; 3051 to.MirrorType = MirrorType;
3054 }); 3052 });
3055 }) 3053 })
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698