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

Side by Side Diff: src/runtime.js

Issue 1213203007: Create a internal, global native context used only for generated code stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 5 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
« no previous file with comments | « src/isolate.cc ('k') | src/runtime/runtime.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 // This files contains runtime support implemented in JavaScript. 5 // This files contains runtime support implemented in JavaScript.
6 6
7 // CAUTION: Some of the functions specified in this file are called 7 // CAUTION: Some of the functions specified in this file are called
8 // directly from compiled code. These are the functions with names in 8 // directly from compiled code. These are the functions with names in
9 // ALL CAPS. The compiled code passes the first argument in 'this'. 9 // ALL CAPS. The compiled code passes the first argument in 'this'.
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 var CONCAT_ITERABLE_TO_ARRAY; 56 var CONCAT_ITERABLE_TO_ARRAY;
57 var APPLY_PREPARE; 57 var APPLY_PREPARE;
58 var REFLECT_APPLY_PREPARE; 58 var REFLECT_APPLY_PREPARE;
59 var REFLECT_CONSTRUCT_PREPARE; 59 var REFLECT_CONSTRUCT_PREPARE;
60 var STACK_OVERFLOW; 60 var STACK_OVERFLOW;
61 var TO_OBJECT; 61 var TO_OBJECT;
62 var TO_NUMBER; 62 var TO_NUMBER;
63 var TO_STRING; 63 var TO_STRING;
64 var TO_NAME; 64 var TO_NAME;
65 65
66 var StringLengthTFStub;
67 var StringAddTFStub;
68 var MathFloorStub;
69
70 var $defaultNumber; 66 var $defaultNumber;
71 var $defaultString; 67 var $defaultString;
72 var $NaN; 68 var $NaN;
73 var $nonNumberToNumber; 69 var $nonNumberToNumber;
74 var $nonStringToString; 70 var $nonStringToString;
75 var $sameValue; 71 var $sameValue;
76 var $sameValueZero; 72 var $sameValueZero;
77 var $toBoolean; 73 var $toBoolean;
78 var $toInt32; 74 var $toInt32;
79 var $toInteger; 75 var $toInteger;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 return %$toString(this); 740 return %$toString(this);
745 } 741 }
746 742
747 743
748 // Convert the receiver to a string or symbol - forward to ToName. 744 // Convert the receiver to a string or symbol - forward to ToName.
749 TO_NAME = function TO_NAME() { 745 TO_NAME = function TO_NAME() {
750 return %$toName(this); 746 return %$toName(this);
751 } 747 }
752 748
753 749
754 /* -----------------------------------------------
755 - - - J a v a S c r i p t S t u b s - - -
756 -----------------------------------------------
757 */
758
759 StringLengthTFStub = function StringLengthTFStub(call_conv, minor_key) {
760 var stub = function(receiver, name, i, v) {
761 // i and v are dummy parameters mandated by the InterfaceDescriptor,
762 // (LoadWithVectorDescriptor).
763 return %_StringGetLength(%_JSValueGetValue(receiver));
764 }
765 return stub;
766 }
767
768 StringAddTFStub = function StringAddTFStub(call_conv, minor_key) {
769 var stub = function(left, right) {
770 return %StringAdd(left, right);
771 }
772 return stub;
773 }
774
775 var kTurboFanICCallModeMask = 1;
776 var kTurboFanICCallForUnptimizedCode = 0;
777 var kTurboFanICCallForOptimizedCode = 1;
778
779 MathFloorStub = function MathFloorStub(call_conv, minor_key) {
780 var call_from_optimized_ic = function(f, i, tv, receiver, v) {
781 "use strict";
782 // |f| is this function's JSFunction
783 // |i| is TypeFeedbackVector slot # of callee's CallIC for Math.floor call
784 // |receiver| is receiver, should not be used
785 // |tv| is the calling function's type vector
786 // |v| is the value to floor
787 if (f !== %_FixedArrayGet(tv, i|0)) {
788 return %_CallFunction(receiver, v, f);
789 }
790 var r = %_MathFloor(+v);
791 if (%_IsMinusZero(r)) {
792 // Collect type feedback when the result of the floor is -0. This is
793 // accomplished by storing a sentinel in the second, "extra"
794 // TypeFeedbackVector slot corresponding to the Math.floor CallIC call in
795 // the caller's TypeVector.
796 %_FixedArraySet(tv, ((i|0)+1)|0, 1);
797 return -0;
798 }
799 // Return integers in smi range as smis.
800 var trunc = r|0;
801 if (trunc === r) {
802 return trunc;
803 }
804 return r;
805 }
806 var call_mode = (minor_key & kTurboFanICCallModeMask);
807 if (call_mode == kTurboFanICCallForOptimizedCode) {
808 return call_from_optimized_ic;
809 } else {
810 %SetForceInlineFlag(call_from_optimized_ic);
811 var call_from_unoptimized_ic = function(f, i, receiver, v) {
812 var tv = %_GetTypeFeedbackVector(%_GetCallerJSFunction());
813 return call_from_optimized_ic(f, i, tv, receiver, v);
814 }
815 return call_from_unoptimized_ic;
816 }
817 }
818
819
820 /* ------------------------------------- 750 /* -------------------------------------
821 - - - C o n v e r s i o n s - - - 751 - - - C o n v e r s i o n s - - -
822 ------------------------------------- 752 -------------------------------------
823 */ 753 */
824 754
825 // ECMA-262, section 9.1, page 30. Use null/undefined for no hint, 755 // ECMA-262, section 9.1, page 30. Use null/undefined for no hint,
826 // (1) for number hint, and (2) for string hint. 756 // (1) for number hint, and (2) for string hint.
827 function ToPrimitive(x, hint) { 757 function ToPrimitive(x, hint) {
828 // Fast case check. 758 // Fast case check.
829 if (IS_STRING(x)) return x; 759 if (IS_STRING(x)) return x;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 $toLength = ToLength; 991 $toLength = ToLength;
1062 $toName = ToName; 992 $toName = ToName;
1063 $toNumber = ToNumber; 993 $toNumber = ToNumber;
1064 $toObject = ToObject; 994 $toObject = ToObject;
1065 $toPositiveInteger = ToPositiveInteger; 995 $toPositiveInteger = ToPositiveInteger;
1066 $toPrimitive = ToPrimitive; 996 $toPrimitive = ToPrimitive;
1067 $toString = ToString; 997 $toString = ToString;
1068 $toUint32 = ToUint32; 998 $toUint32 = ToUint32;
1069 999
1070 }) 1000 })
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698