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

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

Issue 1510833003: Improve the CallSite constructor (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 | « no previous file | src/messages.h » ('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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 560
561 function GetStackTraceLine(recv, fun, pos, isGlobal) { 561 function GetStackTraceLine(recv, fun, pos, isGlobal) {
562 return new CallSite(recv, fun, pos, false).toString(); 562 return new CallSite(recv, fun, pos, false).toString();
563 } 563 }
564 564
565 // ---------------------------------------------------------------------------- 565 // ----------------------------------------------------------------------------
566 // Error implementation 566 // Error implementation
567 567
568 function CallSite(receiver, fun, pos, strict_mode) { 568 function CallSite(receiver, fun, pos, strict_mode) {
569 if (!IS_FUNCTION(fun)) {
570 throw MakeTypeError(kCallSiteExpectsFunction, typeof fun);
571 }
572
573 if (IS_UNDEFINED(new.target)) {
574 return new CallSite(receiver, fun, pos, strict_mode);
575 }
576
569 SET_PRIVATE(this, callSiteReceiverSymbol, receiver); 577 SET_PRIVATE(this, callSiteReceiverSymbol, receiver);
570 SET_PRIVATE(this, callSiteFunctionSymbol, fun); 578 SET_PRIVATE(this, callSiteFunctionSymbol, fun);
571 SET_PRIVATE(this, callSitePositionSymbol, pos); 579 SET_PRIVATE(this, callSitePositionSymbol, TO_INT32(pos));
572 SET_PRIVATE(this, callSiteStrictSymbol, strict_mode); 580 SET_PRIVATE(this, callSiteStrictSymbol, TO_BOOLEAN(strict_mode));
573 } 581 }
574 582
575 function CallSiteGetThis() { 583 function CallSiteGetThis() {
576 return GET_PRIVATE(this, callSiteStrictSymbol) 584 return GET_PRIVATE(this, callSiteStrictSymbol)
577 ? UNDEFINED : GET_PRIVATE(this, callSiteReceiverSymbol); 585 ? UNDEFINED : GET_PRIVATE(this, callSiteReceiverSymbol);
578 } 586 }
579 587
580 function CallSiteGetFunction() { 588 function CallSiteGetFunction() {
581 return GET_PRIVATE(this, callSiteStrictSymbol) 589 return GET_PRIVATE(this, callSiteStrictSymbol)
582 ? UNDEFINED : GET_PRIVATE(this, callSiteFunctionSymbol); 590 ? UNDEFINED : GET_PRIVATE(this, callSiteFunctionSymbol);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 utils.Export(function(to) { 1007 utils.Export(function(to) {
1000 to.ErrorToString = ErrorToString; 1008 to.ErrorToString = ErrorToString;
1001 to.MakeError = MakeError; 1009 to.MakeError = MakeError;
1002 to.MakeRangeError = MakeRangeError; 1010 to.MakeRangeError = MakeRangeError;
1003 to.MakeSyntaxError = MakeSyntaxError; 1011 to.MakeSyntaxError = MakeSyntaxError;
1004 to.MakeTypeError = MakeTypeError; 1012 to.MakeTypeError = MakeTypeError;
1005 to.MakeURIError = MakeURIError; 1013 to.MakeURIError = MakeURIError;
1006 }); 1014 });
1007 1015
1008 }); 1016 });
OLDNEW
« no previous file with comments | « no previous file | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698