| 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 (function(global, utils) { | 7 (function(global, utils) { |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 case 'int8x16': return %_Call(Int8x16ToString, obj); | 136 case 'int8x16': return %_Call(Int8x16ToString, obj); |
| 137 case 'uint32x4': return %_Call(Uint32x4ToString, obj); | 137 case 'uint32x4': return %_Call(Uint32x4ToString, obj); |
| 138 case 'uint16x8': return %_Call(Uint16x8ToString, obj); | 138 case 'uint16x8': return %_Call(Uint16x8ToString, obj); |
| 139 case 'uint8x16': return %_Call(Uint8x16ToString, obj); | 139 case 'uint8x16': return %_Call(Uint8x16ToString, obj); |
| 140 case 'bool32x4': return %_Call(Bool32x4ToString, obj); | 140 case 'bool32x4': return %_Call(Bool32x4ToString, obj); |
| 141 case 'bool16x8': return %_Call(Bool16x8ToString, obj); | 141 case 'bool16x8': return %_Call(Bool16x8ToString, obj); |
| 142 case 'bool8x16': return %_Call(Bool8x16ToString, obj); | 142 case 'bool8x16': return %_Call(Bool8x16ToString, obj); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (IS_SPEC_OBJECT(obj)) { | 146 if (IS_RECEIVER(obj)) { |
| 147 // When internally formatting error objects, use a side-effects-free version | 147 // When internally formatting error objects, use a side-effects-free version |
| 148 // of Error.prototype.toString independent of the actually installed | 148 // of Error.prototype.toString independent of the actually installed |
| 149 // toString method. | 149 // toString method. |
| 150 if (IsErrorObject(obj) || | 150 if (IsErrorObject(obj) || |
| 151 %GetDataProperty(obj, "toString") === ErrorToString) { | 151 %GetDataProperty(obj, "toString") === ErrorToString) { |
| 152 return %_Call(NoSideEffectsErrorToString, obj); | 152 return %_Call(NoSideEffectsErrorToString, obj); |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (%GetDataProperty(obj, "toString") === ObjectToString) { | 155 if (%GetDataProperty(obj, "toString") === ObjectToString) { |
| 156 var constructor = %GetDataProperty(obj, "constructor"); | 156 var constructor = %GetDataProperty(obj, "constructor"); |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 GlobalRangeError = SetUpError(global.RangeError); | 932 GlobalRangeError = SetUpError(global.RangeError); |
| 933 GlobalReferenceError = SetUpError(global.ReferenceError); | 933 GlobalReferenceError = SetUpError(global.ReferenceError); |
| 934 GlobalSyntaxError = SetUpError(global.SyntaxError); | 934 GlobalSyntaxError = SetUpError(global.SyntaxError); |
| 935 GlobalTypeError = SetUpError(global.TypeError); | 935 GlobalTypeError = SetUpError(global.TypeError); |
| 936 GlobalURIError = SetUpError(global.URIError); | 936 GlobalURIError = SetUpError(global.URIError); |
| 937 | 937 |
| 938 utils.InstallFunctions(GlobalError.prototype, DONT_ENUM, | 938 utils.InstallFunctions(GlobalError.prototype, DONT_ENUM, |
| 939 ['toString', ErrorToString]); | 939 ['toString', ErrorToString]); |
| 940 | 940 |
| 941 function ErrorToString() { | 941 function ErrorToString() { |
| 942 if (!IS_SPEC_OBJECT(this)) { | 942 if (!IS_RECEIVER(this)) { |
| 943 throw MakeTypeError(kCalledOnNonObject, "Error.prototype.toString"); | 943 throw MakeTypeError(kCalledOnNonObject, "Error.prototype.toString"); |
| 944 } | 944 } |
| 945 | 945 |
| 946 var name = this.name; | 946 var name = this.name; |
| 947 name = IS_UNDEFINED(name) ? "Error" : TO_STRING(name); | 947 name = IS_UNDEFINED(name) ? "Error" : TO_STRING(name); |
| 948 | 948 |
| 949 var message = this.message; | 949 var message = this.message; |
| 950 message = IS_UNDEFINED(message) ? "" : TO_STRING(message); | 950 message = IS_UNDEFINED(message) ? "" : TO_STRING(message); |
| 951 | 951 |
| 952 if (name == "") return message; | 952 if (name == "") return message; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 utils.Export(function(to) { | 1006 utils.Export(function(to) { |
| 1007 to.ErrorToString = ErrorToString; | 1007 to.ErrorToString = ErrorToString; |
| 1008 to.MakeError = MakeError; | 1008 to.MakeError = MakeError; |
| 1009 to.MakeRangeError = MakeRangeError; | 1009 to.MakeRangeError = MakeRangeError; |
| 1010 to.MakeSyntaxError = MakeSyntaxError; | 1010 to.MakeSyntaxError = MakeSyntaxError; |
| 1011 to.MakeTypeError = MakeTypeError; | 1011 to.MakeTypeError = MakeTypeError; |
| 1012 to.MakeURIError = MakeURIError; | 1012 to.MakeURIError = MakeURIError; |
| 1013 }); | 1013 }); |
| 1014 | 1014 |
| 1015 }); | 1015 }); |
| OLD | NEW |