OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 var BIT_XOR_STRONG; | 42 var BIT_XOR_STRONG; |
43 var SHL; | 43 var SHL; |
44 var SHL_STRONG; | 44 var SHL_STRONG; |
45 var SAR; | 45 var SAR; |
46 var SAR_STRONG; | 46 var SAR_STRONG; |
47 var SHR; | 47 var SHR; |
48 var SHR_STRONG; | 48 var SHR_STRONG; |
49 var DELETE; | 49 var DELETE; |
50 var IN; | 50 var IN; |
51 var INSTANCE_OF; | 51 var INSTANCE_OF; |
52 var FILTER_KEY; | |
53 var CALL_NON_FUNCTION; | 52 var CALL_NON_FUNCTION; |
54 var CALL_NON_FUNCTION_AS_CONSTRUCTOR; | 53 var CALL_NON_FUNCTION_AS_CONSTRUCTOR; |
55 var CALL_FUNCTION_PROXY; | 54 var CALL_FUNCTION_PROXY; |
56 var CALL_FUNCTION_PROXY_AS_CONSTRUCTOR; | 55 var CALL_FUNCTION_PROXY_AS_CONSTRUCTOR; |
57 var CONCAT_ITERABLE_TO_ARRAY; | 56 var CONCAT_ITERABLE_TO_ARRAY; |
58 var APPLY_PREPARE; | 57 var APPLY_PREPARE; |
59 var REFLECT_APPLY_PREPARE; | 58 var REFLECT_APPLY_PREPARE; |
60 var REFLECT_CONSTRUCT_PREPARE; | 59 var REFLECT_CONSTRUCT_PREPARE; |
61 var STACK_OVERFLOW; | 60 var STACK_OVERFLOW; |
62 var TO_OBJECT; | 61 var TO_OBJECT; |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 var O = F.prototype; | 553 var O = F.prototype; |
555 if (!IS_SPEC_OBJECT(O)) { | 554 if (!IS_SPEC_OBJECT(O)) { |
556 throw %MakeTypeError(kInstanceofNonobjectProto, O); | 555 throw %MakeTypeError(kInstanceofNonobjectProto, O); |
557 } | 556 } |
558 | 557 |
559 // Return whether or not O is in the prototype chain of V. | 558 // Return whether or not O is in the prototype chain of V. |
560 return %IsInPrototypeChain(O, V) ? 0 : 1; | 559 return %IsInPrototypeChain(O, V) ? 0 : 1; |
561 } | 560 } |
562 | 561 |
563 | 562 |
564 // Filter a given key against an object by checking if the object | |
565 // has a property with the given key; return the key as a string if | |
566 // it has. Otherwise returns 0 (smi). Used in for-in statements. | |
567 FILTER_KEY = function FILTER_KEY(key) { | |
568 var string = %$toName(key); | |
569 if (%HasProperty(this, string)) return string; | |
570 return 0; | |
571 } | |
572 | |
573 | |
574 CALL_NON_FUNCTION = function CALL_NON_FUNCTION() { | 563 CALL_NON_FUNCTION = function CALL_NON_FUNCTION() { |
575 var delegate = %GetFunctionDelegate(this); | 564 var delegate = %GetFunctionDelegate(this); |
576 if (!IS_FUNCTION(delegate)) { | 565 if (!IS_FUNCTION(delegate)) { |
577 var callsite = %RenderCallSite(); | 566 var callsite = %RenderCallSite(); |
578 if (callsite == "") callsite = typeof this; | 567 if (callsite == "") callsite = typeof this; |
579 throw %MakeTypeError(kCalledNonCallable, callsite); | 568 throw %MakeTypeError(kCalledNonCallable, callsite); |
580 } | 569 } |
581 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength()); | 570 return %Apply(delegate, this, arguments, 0, %_ArgumentsLength()); |
582 } | 571 } |
583 | 572 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 $toLength = ToLength; | 1041 $toLength = ToLength; |
1053 $toName = ToName; | 1042 $toName = ToName; |
1054 $toNumber = ToNumber; | 1043 $toNumber = ToNumber; |
1055 $toObject = ToObject; | 1044 $toObject = ToObject; |
1056 $toPositiveInteger = ToPositiveInteger; | 1045 $toPositiveInteger = ToPositiveInteger; |
1057 $toPrimitive = ToPrimitive; | 1046 $toPrimitive = ToPrimitive; |
1058 $toString = ToString; | 1047 $toString = ToString; |
1059 $toUint32 = ToUint32; | 1048 $toUint32 = ToUint32; |
1060 | 1049 |
1061 }) | 1050 }) |
OLD | NEW |