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

Side by Side Diff: src/messages.js

Issue 919653002: [V8] Use Function.name in Error.stack (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | test/mjsunit/stack-traces.js » ('j') | test/mjsunit/stack-traces.js » ('J')
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 // ------------------------------------------------------------------- 5 // -------------------------------------------------------------------
6 6
7 var kMessages = { 7 var kMessages = {
8 // Error 8 // Error
9 cyclic_proto: ["Cyclic __proto__ value"], 9 cyclic_proto: ["Cyclic __proto__ value"],
10 code_gen_from_strings: ["%0"], 10 code_gen_from_strings: ["%0"],
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey)); 816 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey));
817 return script ? script.nameOrSourceURL() : null; 817 return script ? script.nameOrSourceURL() : null;
818 } 818 }
819 819
820 function CallSiteGetFunction() { 820 function CallSiteGetFunction() {
821 return GET_PRIVATE(this, CallSiteStrictModeKey) 821 return GET_PRIVATE(this, CallSiteStrictModeKey)
822 ? UNDEFINED : GET_PRIVATE(this, CallSiteFunctionKey); 822 ? UNDEFINED : GET_PRIVATE(this, CallSiteFunctionKey);
823 } 823 }
824 824
825 function CallSiteGetFunctionName() { 825 function CallSiteGetFunctionName() {
826 // See if the function has displayName
827 var name = GET_PRIVATE(this, CallSiteFunctionKey).displayName;
aandrey 2015/02/11 15:47:39 unlike Function.name, this can throw. you can use
kozy 2015/02/11 16:11:56 Done.
828 if (name && IS_STRING(name)) {
829 return name;
830 }
826 // See if the function knows its own name 831 // See if the function knows its own name
827 var name = GET_PRIVATE(this, CallSiteFunctionKey).name; 832 name = GET_PRIVATE(this, CallSiteFunctionKey).name;
828 if (name) { 833 if (name) {
829 return name; 834 return name;
830 } 835 }
831 name = %FunctionGetInferredName(GET_PRIVATE(this, CallSiteFunctionKey)); 836 name = %FunctionGetInferredName(GET_PRIVATE(this, CallSiteFunctionKey));
832 if (name) { 837 if (name) {
833 return name; 838 return name;
834 } 839 }
835 // Maybe this is an evaluation? 840 // Maybe this is an evaluation?
836 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey)); 841 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey));
837 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) { 842 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 function SetUpStackOverflowBoilerplate() { 1319 function SetUpStackOverflowBoilerplate() {
1315 var boilerplate = MakeRangeError('stack_overflow', []); 1320 var boilerplate = MakeRangeError('stack_overflow', []);
1316 1321
1317 %DefineAccessorPropertyUnchecked( 1322 %DefineAccessorPropertyUnchecked(
1318 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); 1323 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM);
1319 1324
1320 return boilerplate; 1325 return boilerplate;
1321 } 1326 }
1322 1327
1323 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); 1328 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.js » ('j') | test/mjsunit/stack-traces.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698