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

Side by Side Diff: src/messages.js

Issue 564035: Remove lazy loading of natives files and the natives cache.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/macros.py ('k') | src/mirror-debugger.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 // ------------------------------------------------------------------- 29 // -------------------------------------------------------------------
30 //
31 // Matches Script::Type from objects.h
32 var TYPE_NATIVE = 0;
33 var TYPE_EXTENSION = 1;
34 var TYPE_NORMAL = 2;
35
36 // Matches Script::CompilationType from objects.h
37 var COMPILATION_TYPE_HOST = 0;
38 var COMPILATION_TYPE_EVAL = 1;
39 var COMPILATION_TYPE_JSON = 2;
30 40
31 // Lazily initialized. 41 // Lazily initialized.
32 var kVowelSounds = 0; 42 var kVowelSounds = 0;
33 var kCapitalVowelSounds = 0; 43 var kCapitalVowelSounds = 0;
34 44
35 // If this object gets passed to an error constructor the error will 45 // If this object gets passed to an error constructor the error will
36 // get an accessor for .message that constructs a descriptive error 46 // get an accessor for .message that constructs a descriptive error
37 // message on access. 47 // message on access.
38 var kAddMessageAccessorsMarker = { }; 48 var kAddMessageAccessorsMarker = { };
39 49
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 }; 633 };
624 634
625 CallSite.prototype.isToplevel = function () { 635 CallSite.prototype.isToplevel = function () {
626 if (this.receiver == null) 636 if (this.receiver == null)
627 return true; 637 return true;
628 return IS_GLOBAL(this.receiver); 638 return IS_GLOBAL(this.receiver);
629 }; 639 };
630 640
631 CallSite.prototype.isEval = function () { 641 CallSite.prototype.isEval = function () {
632 var script = %FunctionGetScript(this.fun); 642 var script = %FunctionGetScript(this.fun);
633 return script && script.compilation_type == 1; 643 return script && script.compilation_type == COMPILATION_TYPE_EVAL;
634 }; 644 };
635 645
636 CallSite.prototype.getEvalOrigin = function () { 646 CallSite.prototype.getEvalOrigin = function () {
637 var script = %FunctionGetScript(this.fun); 647 var script = %FunctionGetScript(this.fun);
638 return FormatEvalOrigin(script); 648 return FormatEvalOrigin(script);
639 }; 649 };
640 650
641 CallSite.prototype.getFunction = function () { 651 CallSite.prototype.getFunction = function () {
642 return this.fun; 652 return this.fun;
643 }; 653 };
644 654
645 CallSite.prototype.getFunctionName = function () { 655 CallSite.prototype.getFunctionName = function () {
646 // See if the function knows its own name 656 // See if the function knows its own name
647 var name = this.fun.name; 657 var name = this.fun.name;
648 if (name) { 658 if (name) {
649 return name; 659 return name;
650 } else { 660 } else {
651 return %FunctionGetInferredName(this.fun); 661 return %FunctionGetInferredName(this.fun);
652 } 662 }
653 // Maybe this is an evaluation? 663 // Maybe this is an evaluation?
654 var script = %FunctionGetScript(this.fun); 664 var script = %FunctionGetScript(this.fun);
655 if (script && script.compilation_type == 1) 665 if (script && script.compilation_type == COMPILATION_TYPE_EVAL)
656 return "eval"; 666 return "eval";
657 return null; 667 return null;
658 }; 668 };
659 669
660 CallSite.prototype.getMethodName = function () { 670 CallSite.prototype.getMethodName = function () {
661 // See if we can find a unique property on the receiver that holds 671 // See if we can find a unique property on the receiver that holds
662 // this function. 672 // this function.
663 var ownName = this.fun.name; 673 var ownName = this.fun.name;
664 if (ownName && this.receiver && this.receiver[ownName] === this.fun) 674 if (ownName && this.receiver && this.receiver[ownName] === this.fun)
665 // To handle DontEnum properties we guess that the method has 675 // To handle DontEnum properties we guess that the method has
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 var script = %FunctionGetScript(this.fun); 711 var script = %FunctionGetScript(this.fun);
702 var location = null; 712 var location = null;
703 if (script) { 713 if (script) {
704 location = script.locationFromPosition(this.pos, true); 714 location = script.locationFromPosition(this.pos, true);
705 } 715 }
706 return location ? location.column + 1: null; 716 return location ? location.column + 1: null;
707 }; 717 };
708 718
709 CallSite.prototype.isNative = function () { 719 CallSite.prototype.isNative = function () {
710 var script = %FunctionGetScript(this.fun); 720 var script = %FunctionGetScript(this.fun);
711 return script ? (script.type == 0) : false; 721 return script ? (script.type == TYPE_NATIVE) : false;
712 }; 722 };
713 723
714 CallSite.prototype.getPosition = function () { 724 CallSite.prototype.getPosition = function () {
715 return this.pos; 725 return this.pos;
716 }; 726 };
717 727
718 CallSite.prototype.isConstructor = function () { 728 CallSite.prototype.isConstructor = function () {
719 var constructor = this.receiver ? this.receiver.constructor : null; 729 var constructor = this.receiver ? this.receiver.constructor : null;
720 if (!constructor) 730 if (!constructor)
721 return false; 731 return false;
722 return this.fun === constructor; 732 return this.fun === constructor;
723 }; 733 };
724 734
725 function FormatEvalOrigin(script) { 735 function FormatEvalOrigin(script) {
726 var eval_origin = ""; 736 var eval_origin = "";
727 if (script.eval_from_function_name) { 737 if (script.eval_from_function_name) {
728 eval_origin += script.eval_from_function_name; 738 eval_origin += script.eval_from_function_name;
729 } else { 739 } else {
730 eval_origin += "<anonymous>"; 740 eval_origin += "<anonymous>";
731 } 741 }
732 742
733 var eval_from_script = script.eval_from_script; 743 var eval_from_script = script.eval_from_script;
734 if (eval_from_script) { 744 if (eval_from_script) {
735 if (eval_from_script.compilation_type == 1) { 745 if (eval_from_script.compilation_type == COMPILATION_TYPE_EVAL) {
736 // eval script originated from another eval. 746 // eval script originated from another eval.
737 eval_origin += " (eval at " + FormatEvalOrigin(eval_from_script) + ")"; 747 eval_origin += " (eval at " + FormatEvalOrigin(eval_from_script) + ")";
738 } else { 748 } else {
739 // eval script originated from "real" scource. 749 // eval script originated from "real" scource.
740 if (eval_from_script.name) { 750 if (eval_from_script.name) {
741 eval_origin += " (" + eval_from_script.name; 751 eval_origin += " (" + eval_from_script.name;
742 var location = eval_from_script.locationFromPosition(script.eval_from_sc ript_position, true); 752 var location = eval_from_script.locationFromPosition(script.eval_from_sc ript_position, true);
743 if (location) { 753 if (location) {
744 eval_origin += ":" + (location.line + 1); 754 eval_origin += ":" + (location.line + 1);
745 eval_origin += ":" + (location.column + 1); 755 eval_origin += ":" + (location.column + 1);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 return this.name + ": " + FormatMessage({ type: type, args: this.arguments } ); 937 return this.name + ": " + FormatMessage({ type: type, args: this.arguments } );
928 } 938 }
929 var message = this.message; 939 var message = this.message;
930 return this.name + (message ? (": " + message) : ""); 940 return this.name + (message ? (": " + message) : "");
931 }, DONT_ENUM); 941 }, DONT_ENUM);
932 942
933 943
934 // Boilerplate for exceptions for stack overflows. Used from 944 // Boilerplate for exceptions for stack overflows. Used from
935 // Top::StackOverflow(). 945 // Top::StackOverflow().
936 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); 946 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []);
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/mirror-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698