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

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, 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 | « no previous file | src/runtime/runtime.h » ('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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 return script ? script.nameOrSourceURL() : null; 825 return script ? script.nameOrSourceURL() : null;
826 } 826 }
827 827
828 function CallSiteGetFunction() { 828 function CallSiteGetFunction() {
829 return GET_PRIVATE(this, CallSiteStrictModeKey) 829 return GET_PRIVATE(this, CallSiteStrictModeKey)
830 ? UNDEFINED : GET_PRIVATE(this, CallSiteFunctionKey); 830 ? UNDEFINED : GET_PRIVATE(this, CallSiteFunctionKey);
831 } 831 }
832 832
833 function CallSiteGetFunctionName() { 833 function CallSiteGetFunctionName() {
834 // See if the function knows its own name 834 // See if the function knows its own name
835 var name = GET_PRIVATE(this, CallSiteFunctionKey).name; 835 var fun = GET_PRIVATE(this, CallSiteFunctionKey);
836 if (name) { 836 var name = %GetDataProperty(fun, 'name');
837 if (IS_STRING(name)) {
yurys 2015/03/06 11:11:26 Is it supposed to return in case of empty string?
kozy 2015/03/06 12:49:59 If user set empty function name then we show this
837 return name; 838 return name;
838 } 839 }
839 name = %FunctionGetInferredName(GET_PRIVATE(this, CallSiteFunctionKey)); 840 name = %FunctionGetDebugName(fun);
840 if (name) { 841 if (name) {
841 return name; 842 return name;
842 } 843 }
843 // Maybe this is an evaluation? 844 // Maybe this is an evaluation?
844 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey)); 845 var script = %FunctionGetScript(fun);
845 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) { 846 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) {
846 return "eval"; 847 return "eval";
847 } 848 }
848 return null; 849 return null;
849 } 850 }
850 851
851 function CallSiteGetMethodName() { 852 function CallSiteGetMethodName() {
852 // See if we can find a unique property on the receiver that holds 853 // See if we can find a unique property on the receiver that holds
853 // this function. 854 // this function.
854 var receiver = GET_PRIVATE(this, CallSiteReceiverKey); 855 var receiver = GET_PRIVATE(this, CallSiteReceiverKey);
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 function SetUpStackOverflowBoilerplate() { 1323 function SetUpStackOverflowBoilerplate() {
1323 var boilerplate = MakeRangeError('stack_overflow', []); 1324 var boilerplate = MakeRangeError('stack_overflow', []);
1324 1325
1325 %DefineAccessorPropertyUnchecked( 1326 %DefineAccessorPropertyUnchecked(
1326 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); 1327 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM);
1327 1328
1328 return boilerplate; 1329 return boilerplate;
1329 } 1330 }
1330 1331
1331 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); 1332 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate();
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | test/mjsunit/stack-traces.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698