OLD | NEW |
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 $errorToString; | 7 var $errorToString; |
8 var $getStackTraceLine; | 8 var $getStackTraceLine; |
9 var $messageGetPositionInLine; | 9 var $messageGetPositionInLine; |
10 var $messageGetLineNumber; | 10 var $messageGetLineNumber; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 | 538 |
539 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 539 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
540 return new CallSite(recv, fun, pos, false).toString(); | 540 return new CallSite(recv, fun, pos, false).toString(); |
541 } | 541 } |
542 | 542 |
543 // ---------------------------------------------------------------------------- | 543 // ---------------------------------------------------------------------------- |
544 // Error implementation | 544 // Error implementation |
545 | 545 |
546 var CallSiteReceiverKey = NEW_PRIVATE_OWN("CallSite#receiver"); | 546 var CallSiteReceiverKey = NEW_PRIVATE("CallSite#receiver"); |
547 var CallSiteFunctionKey = NEW_PRIVATE_OWN("CallSite#function"); | 547 var CallSiteFunctionKey = NEW_PRIVATE("CallSite#function"); |
548 var CallSitePositionKey = NEW_PRIVATE_OWN("CallSite#position"); | 548 var CallSitePositionKey = NEW_PRIVATE("CallSite#position"); |
549 var CallSiteStrictModeKey = NEW_PRIVATE_OWN("CallSite#strict_mode"); | 549 var CallSiteStrictModeKey = NEW_PRIVATE("CallSite#strict_mode"); |
550 | 550 |
551 function CallSite(receiver, fun, pos, strict_mode) { | 551 function CallSite(receiver, fun, pos, strict_mode) { |
552 SET_PRIVATE(this, CallSiteReceiverKey, receiver); | 552 SET_PRIVATE(this, CallSiteReceiverKey, receiver); |
553 SET_PRIVATE(this, CallSiteFunctionKey, fun); | 553 SET_PRIVATE(this, CallSiteFunctionKey, fun); |
554 SET_PRIVATE(this, CallSitePositionKey, pos); | 554 SET_PRIVATE(this, CallSitePositionKey, pos); |
555 SET_PRIVATE(this, CallSiteStrictModeKey, strict_mode); | 555 SET_PRIVATE(this, CallSiteStrictModeKey, strict_mode); |
556 } | 556 } |
557 | 557 |
558 function CallSiteGetThis() { | 558 function CallSiteGetThis() { |
559 return GET_PRIVATE(this, CallSiteStrictModeKey) | 559 return GET_PRIVATE(this, CallSiteStrictModeKey) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 %_CallFunction(receiver, NoSideEffectsObjectToString); | 856 %_CallFunction(receiver, NoSideEffectsObjectToString); |
857 } | 857 } |
858 var constructorName = constructor.name; | 858 var constructorName = constructor.name; |
859 if (!constructorName) { | 859 if (!constructorName) { |
860 return requireConstructor ? null : | 860 return requireConstructor ? null : |
861 %_CallFunction(receiver, NoSideEffectsObjectToString); | 861 %_CallFunction(receiver, NoSideEffectsObjectToString); |
862 } | 862 } |
863 return constructorName; | 863 return constructorName; |
864 } | 864 } |
865 | 865 |
866 var formatted_stack_trace_symbol = NEW_PRIVATE_OWN("formatted stack trace"); | 866 var formatted_stack_trace_symbol = NEW_PRIVATE("formatted stack trace"); |
867 | 867 |
868 | 868 |
869 // Format the stack trace if not yet done, and return it. | 869 // Format the stack trace if not yet done, and return it. |
870 // Cache the formatted stack trace on the holder. | 870 // Cache the formatted stack trace on the holder. |
871 var StackTraceGetter = function() { | 871 var StackTraceGetter = function() { |
872 var formatted_stack_trace = UNDEFINED; | 872 var formatted_stack_trace = UNDEFINED; |
873 var holder = this; | 873 var holder = this; |
874 while (holder) { | 874 while (holder) { |
875 var formatted_stack_trace = | 875 var formatted_stack_trace = |
876 GET_PRIVATE(holder, formatted_stack_trace_symbol); | 876 GET_PRIVATE(holder, formatted_stack_trace_symbol); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 // Define accessors first, as this may fail and throw. | 1083 // Define accessors first, as this may fail and throw. |
1084 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1084 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
1085 set: StackTraceSetter, | 1085 set: StackTraceSetter, |
1086 configurable: true }); | 1086 configurable: true }); |
1087 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1087 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
1088 }; | 1088 }; |
1089 | 1089 |
1090 GlobalError.captureStackTrace = captureStackTrace; | 1090 GlobalError.captureStackTrace = captureStackTrace; |
1091 | 1091 |
1092 }); | 1092 }); |
OLD | NEW |