Chromium Code Reviews

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.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.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 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...)
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 fun = GET_PRIVATE(this, CallSiteFunctionKey);
828 var name = %GetDataProperty(fun, "displayName");
829 if (name && IS_STRING(name)) {
Yang 2015/02/12 14:15:29 I think a single IS_STRING(name) would suffice, as
kozy 2015/02/12 14:59:57 Done.
830 return name;
831 }
826 // See if the function knows its own name 832 // See if the function knows its own name
827 var name = GET_PRIVATE(this, CallSiteFunctionKey).name; 833 name = fun.name;
828 if (name) { 834 if (name) {
829 return name; 835 return name;
830 } 836 }
831 name = %FunctionGetInferredName(GET_PRIVATE(this, CallSiteFunctionKey)); 837 name = %FunctionGetInferredName(GET_PRIVATE(this, CallSiteFunctionKey));
832 if (name) { 838 if (name) {
833 return name; 839 return name;
834 } 840 }
835 // Maybe this is an evaluation? 841 // Maybe this is an evaluation?
836 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey)); 842 var script = %FunctionGetScript(GET_PRIVATE(this, CallSiteFunctionKey));
837 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) { 843 if (script && script.compilation_type == COMPILATION_TYPE_EVAL) {
(...skipping 476 matching lines...)
1314 function SetUpStackOverflowBoilerplate() { 1320 function SetUpStackOverflowBoilerplate() {
1315 var boilerplate = MakeRangeError('stack_overflow', []); 1321 var boilerplate = MakeRangeError('stack_overflow', []);
1316 1322
1317 %DefineAccessorPropertyUnchecked( 1323 %DefineAccessorPropertyUnchecked(
1318 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); 1324 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM);
1319 1325
1320 return boilerplate; 1326 return boilerplate;
1321 } 1327 }
1322 1328
1323 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); 1329 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/stack-traces.js » ('j') | no next file with comments »

Powered by Google App Engine