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

Side by Side Diff: src/js/messages.js

Issue 1477073005: Use new.target in favor of %_IsConstructCall intrinsic (1). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/js/harmony-simd.js ('k') | src/js/proxy.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 (function(global, utils) { 7 (function(global, utils) {
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); 930 %FunctionSetInstanceClassName(ErrorPrototype, 'Error');
931 %FunctionSetPrototype(f, new ErrorPrototype()); 931 %FunctionSetPrototype(f, new ErrorPrototype());
932 } else { 932 } else {
933 %FunctionSetPrototype(f, new GlobalError()); 933 %FunctionSetPrototype(f, new GlobalError());
934 %InternalSetPrototype(f, GlobalError); 934 %InternalSetPrototype(f, GlobalError);
935 } 935 }
936 %FunctionSetInstanceClassName(f, 'Error'); 936 %FunctionSetInstanceClassName(f, 'Error');
937 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); 937 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM);
938 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM); 938 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM);
939 %SetCode(f, function(m) { 939 %SetCode(f, function(m) {
940 if (%_IsConstructCall()) { 940 if (!IS_UNDEFINED(new.target)) {
941 try { captureStackTrace(this, f); } catch (e) { } 941 try { captureStackTrace(this, f); } catch (e) { }
942 // Define all the expected properties directly on the error 942 // Define all the expected properties directly on the error
943 // object. This avoids going through getters and setters defined 943 // object. This avoids going through getters and setters defined
944 // on prototype objects. 944 // on prototype objects.
945 if (!IS_UNDEFINED(m)) { 945 if (!IS_UNDEFINED(m)) {
946 %AddNamedProperty(this, 'message', TO_STRING(m), DONT_ENUM); 946 %AddNamedProperty(this, 'message', TO_STRING(m), DONT_ENUM);
947 } 947 }
948 } else { 948 } else {
949 return new f(m); 949 return new f(m);
950 } 950 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 utils.Export(function(to) { 1034 utils.Export(function(to) {
1035 to.ErrorToString = ErrorToString; 1035 to.ErrorToString = ErrorToString;
1036 to.MakeError = MakeError; 1036 to.MakeError = MakeError;
1037 to.MakeRangeError = MakeRangeError; 1037 to.MakeRangeError = MakeRangeError;
1038 to.MakeSyntaxError = MakeSyntaxError; 1038 to.MakeSyntaxError = MakeSyntaxError;
1039 to.MakeTypeError = MakeTypeError; 1039 to.MakeTypeError = MakeTypeError;
1040 to.MakeURIError = MakeURIError; 1040 to.MakeURIError = MakeURIError;
1041 }); 1041 });
1042 1042
1043 }); 1043 });
OLDNEW
« no previous file with comments | « src/js/harmony-simd.js ('k') | src/js/proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698