2008-06-22 23:54:19 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sw=4 et tw=0 ft=C:
|
|
|
|
*
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
|
|
|
|
* June 22, 2008.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Andreas Gal <gal@uci.edu>
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2008-09-02 15:37:22 -07:00
|
|
|
/*
|
|
|
|
* NB: bool FASTCALL is not compatible with Nanojit's calling convention usage.
|
|
|
|
* Do not use bool FASTCALL, use JSBool only!
|
|
|
|
*/
|
|
|
|
|
2008-08-21 16:35:05 -07:00
|
|
|
BUILTIN2(BoxDouble, LO, F, P, jsval, JSContext*, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(BoxInt32, LO, LO, P, jsval, JSContext*, jsint, 1, 1)
|
|
|
|
BUILTIN1(UnboxDouble, LO, F, jsdouble, jsval, 1, 1)
|
|
|
|
BUILTIN1(UnboxInt32, LO, LO, int32, jsval, 1, 1)
|
|
|
|
BUILTIN2(dmod, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(DoubleToInt32, F, LO, int32, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(DoubleToUint32, F, LO, int32, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(Math_sin, F, F, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(Math_cos, F, F, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(Math_pow, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(Math_sqrt, F, F, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(Math_floor, F, F, jsdouble, jsdouble, 1, 1)
|
2008-08-25 16:54:02 -07:00
|
|
|
BUILTIN1(Math_ceil, F, F, jsdouble, jsdouble, 1, 1)
|
2008-09-05 14:25:01 -07:00
|
|
|
BUILTIN1(Math_log, F, F, jsdouble, jsdouble, 1, 1)
|
2008-09-08 20:06:58 -07:00
|
|
|
BUILTIN2(Math_max, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN4(Array_dense_setelem, LO, LO, LO, LO, LO, bool, JSContext*, JSObject*, jsint, jsval, 0, 0)
|
|
|
|
BUILTIN3(Array_p_join, LO, LO, LO, P, JSString*, JSContext*, JSObject*, JSString*, 0, 0)
|
2008-09-18 16:53:09 -07:00
|
|
|
BUILTIN3(Array_p_push1, LO, LO, LO, LO, jsval, JSContext*, JSObject*, jsval, 0, 0)
|
|
|
|
BUILTIN2(Array_p_pop, LO, LO, LO, jsval, JSContext*, JSObject*, 0, 0)
|
2008-08-19 17:19:19 -07:00
|
|
|
BUILTIN4(String_p_substring, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, jsint, jsint, 1, 1)
|
|
|
|
BUILTIN3(String_p_substring_1, LO, LO, LO, P, JSString*, JSContext*, JSString*, jsint, 1, 1)
|
|
|
|
BUILTIN3(ConcatStrings, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSString*, 1, 1)
|
|
|
|
BUILTIN3(String_getelem, LO, LO, LO, P, JSString*, JSContext*, JSString*, jsint, 1, 1)
|
|
|
|
BUILTIN2(String_fromCharCode, LO, LO, P, JSString*, JSContext*, jsint, 1, 1)
|
2008-07-30 15:19:25 -07:00
|
|
|
BUILTIN2(String_p_charCodeAt, LO, LO, LO, jsint, JSString*, jsint, 1, 1)
|
2008-09-15 14:30:05 -07:00
|
|
|
BUILTIN3(String_p_concat_1int, LO, LO, LO, P, JSString*, JSContext*, JSString*, jsint, 1, 1)
|
|
|
|
BUILTIN4(String_p_concat_2str, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSString*, JSString*, 1, 1)
|
|
|
|
BUILTIN5(String_p_concat_3str, LO, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSString*, JSString*, JSString*, 1, 1)
|
2008-08-19 17:19:19 -07:00
|
|
|
BUILTIN4(String_p_match, LO, LO, LO, LO, P, JSObject*, JSContext*, JSString*, jsbytecode*, JSObject*, 1, 1)
|
|
|
|
BUILTIN4(String_p_replace_str, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSObject*, JSString*, 1, 1)
|
2008-08-29 17:35:00 -07:00
|
|
|
BUILTIN4(String_p_replace_str2, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSString*, JSString*, 1, 1)
|
2008-08-19 17:19:19 -07:00
|
|
|
BUILTIN5(String_p_replace_str3, LO, LO, LO, LO, LO, P, JSString*, JSContext*, JSString*, JSString*, JSString*, JSString*, 1, 1)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN3(String_p_split, LO, LO, LO, P, JSObject*, JSContext*, JSString*, JSString*, 0, 0)
|
2008-08-29 17:35:00 -07:00
|
|
|
BUILTIN2(toLowerCase, LO, LO, P, JSString*, JSContext*, JSString*, 1, 1)
|
|
|
|
BUILTIN2(toUpperCase, LO, LO, P, JSString*, JSContext*, JSString*, 1, 1)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN1(Math_random, LO, F, jsdouble, JSRuntime*, 0, 0)
|
2008-07-30 17:28:59 -07:00
|
|
|
BUILTIN2(EqualStrings, LO, LO, LO, bool, JSString*, JSString*, 1, 1)
|
2008-08-09 18:50:52 -07:00
|
|
|
BUILTIN2(CompareStrings, LO, LO, LO, bool, JSString*, JSString*, 1, 1)
|
2008-07-31 07:41:58 -07:00
|
|
|
BUILTIN2(StringToNumber, LO, LO, F, jsdouble, JSContext*, JSString*, 1, 1)
|
2008-07-31 11:35:08 -07:00
|
|
|
BUILTIN2(StringToInt32, LO, LO, LO, jsint, JSContext*, JSString*, 1, 1)
|
2008-08-14 15:13:39 -07:00
|
|
|
BUILTIN2(ParseInt, LO, LO, F, jsdouble, JSContext*, JSString*, 1, 1)
|
2008-09-07 00:41:10 -07:00
|
|
|
BUILTIN1(ParseIntDouble, F, F, jsdouble, jsdouble, 1, 1)
|
2008-08-14 15:13:39 -07:00
|
|
|
BUILTIN2(ParseFloat, LO, LO, F, jsdouble, JSContext*, JSString*, 1, 1)
|
2008-09-15 00:54:28 -07:00
|
|
|
BUILTIN3(Any_getprop, LO, LO, LO, P, jsval, JSContext*, JSObject*, JSString*, 0, 0)
|
|
|
|
BUILTIN4(Any_setprop, LO, LO, LO, LO, LO, bool, JSContext*, JSObject*, JSString*, jsval, 0, 0)
|
2008-09-15 15:00:40 -07:00
|
|
|
BUILTIN3(Any_getelem, LO, LO, F, P, jsval, JSContext*, JSObject*, jsdouble, 0, 0)
|
|
|
|
BUILTIN4(Any_setelem, LO, LO, F, LO, LO, bool, JSContext*, JSObject*, jsdouble, jsval, 0, 0)
|
|
|
|
BUILTIN3(Any_getelem_int, LO, LO, LO, P, jsval, JSContext*, JSObject*, jsuint, 0, 0)
|
|
|
|
BUILTIN4(Any_setelem_int, LO, LO, LO, LO, LO, bool, JSContext*, JSObject*, jsuint, jsval, 0, 0)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN3(FastValueToIterator, LO, LO, LO, P, JSObject*, JSContext*, jsuint, jsval, 0, 0)
|
|
|
|
BUILTIN2(FastCallIteratorNext, LO, LO, P, JSObject*, JSContext*, JSObject*, 0, 0)
|
|
|
|
BUILTIN2(CloseIterator, LO, LO, LO, bool, JSContext*, jsval, 0, 0)
|
2008-08-19 17:19:19 -07:00
|
|
|
BUILTIN2(CallTree, LO, LO, P, nanojit::GuardRecord*, avmplus::InterpState*, nanojit::Fragment*, 0, 0)
|
Kind of an Array initialiser tour-de-force for bug 452878:
1. Split FastNewArray from FastNewObject built-in for greater speed/specialization and further splitting into Array_1str, etc.
2. Add Array_1str, Array_2obj, and Array_3num builtins for benchmarked new Array(...) constructions.
3. Export ARRAY_SET_DENSE_LENGTH and ARRAY_GROWBY via jsarray.h to jstracer.cpp.
4. Tweaked SetArrayElement to make common/best case code be the predicted/prefetched path.
5. js_MakeArraySlow now preserves the pre-slow length in JSSLOT_ARRAY_COUTN as a jsval-tagged int if possible -- this will help the tracer avoid aborting on dense arrays that turned slow but not sparse by addition of a named property.
6. Export js_fun_apply and js_Object from their respective .cpp files, in these cases just to jstracer.cpp via local prototypes (no .h files involved).
7. More INS_CONSTPTR and INS_CONST macrology for better names in trace debug spew.
8. Fix TraceRecorder::test_property_cache to avoid aborting on JSOP_SETNAME that creates a new global, by setting it to undefined so it can be lazily imported. This helps 3d-raytrace.js, which has an unintended global loop control variable in a function.
9. JSTraceableNative loses its premature-deadwood tclasp member (my bad).
10. TraceRecorder::record_JSOP_NEW() handles 'new Object' now along with the 'new Array' variations. I also cut down the copy-paste code from JSOP_CALL's record method to mostly what is needed now.
11. Add KNOWN_NATIVE_DECL macro for concise prototype of library-private js_* native functions, and alphabetized the lists (too long for any other order to be winning).
12. Big honking special case for foo.apply(obj, [str]), which we can generalize as needed. Helps string-tagcloud.js. What's cool is how tracing allows us to rewrite this to foo(str) with this set to obj, eliminating the Function.prototype.apply. This requires some rewriting in JSOP_ENDINIT's record method.
2008-09-01 01:24:58 -07:00
|
|
|
BUILTIN2(FastNewArray, LO, LO, P, JSObject*, JSContext*, JSObject*, 0, 0)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN2(FastNewObject, LO, LO, P, JSObject*, JSContext*, JSObject*, 0, 0)
|
|
|
|
BUILTIN3(AddProperty, LO, LO, LO, LO, bool, JSContext*, JSObject*, JSScopeProperty*, 0, 0)
|
2008-08-27 23:00:43 -07:00
|
|
|
BUILTIN3(HasNamedProperty, LO, LO, LO, LO, bool, JSContext*, JSObject*, JSString*, 0, 0)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN3(CallGetter, LO, LO, LO, P, jsval, JSContext*, JSObject*, JSScopeProperty*, 0, 0)
|
2008-08-19 17:19:19 -07:00
|
|
|
BUILTIN2(TypeOfObject, LO, LO, P, JSString*, JSContext*, JSObject*, 1, 1)
|
|
|
|
BUILTIN2(TypeOfBoolean, LO, LO, P, JSString*, JSContext*, jsint, 1, 1)
|
|
|
|
BUILTIN2(NumberToString, LO, F, P, JSString*, JSContext*, jsdouble, 1, 1)
|
2008-08-11 17:47:05 -07:00
|
|
|
BUILTIN3(Object_p_hasOwnProperty,
|
2008-08-21 16:49:51 -07:00
|
|
|
LO, LO, LO, LO, jsint, JSContext*, JSObject*, JSString*, 0, 0)
|
2008-08-11 17:47:05 -07:00
|
|
|
BUILTIN3(Object_p_propertyIsEnumerable,
|
2008-08-21 16:49:51 -07:00
|
|
|
LO, LO, LO, LO, jsint, JSContext*, JSObject*, JSString*, 0, 0)
|
2008-08-11 22:05:33 -07:00
|
|
|
BUILTIN2(BooleanToNumber, LO, LO, F, jsdouble, JSContext*, jsint, 1, 1)
|
2008-08-21 16:49:51 -07:00
|
|
|
BUILTIN2(ObjectToString, LO, LO, P, JSString*, JSContext*, JSObject*, 0, 0)
|
|
|
|
BUILTIN3(Array_1int, LO, LO, LO, P, JSObject*, JSContext*, JSObject*, jsint, 0, 0)
|
2008-09-05 18:29:08 -07:00
|
|
|
BUILTIN3(Array_1str, LO, LO, LO, P, JSObject*, JSContext*, JSObject*, JSString*, 0, 0)
|
|
|
|
BUILTIN4(Array_2obj, LO, LO, LO, LO, P, JSObject*, JSContext*, JSObject*, JSObject*, JSObject**, 0, 0)
|
|
|
|
BUILTIN5(Array_3num, LO, LO, F, F, F, P, JSObject*, JSContext*, JSObject*, jsdouble, jsdouble, jsdouble, 0, 0)
|
|
|
|
BUILTIN1(Arguments, LO, P, JSObject*, JSContext*, 0, 0)
|
2008-09-15 19:59:06 -07:00
|
|
|
BUILTIN2(imod, LO, LO, LO, jsint, jsint, jsint, 1, 1)
|
2008-09-02 22:29:23 -07:00
|
|
|
|
|
|
|
// soft float
|
|
|
|
BUILTIN1(fneg, F, F, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN1(i2f, LO, F, jsdouble, jsint, 1, 1)
|
|
|
|
BUILTIN1(u2f, LO, F, jsdouble, jsuint, 1, 1)
|
|
|
|
BUILTIN2(fcmpeq, F, F, LO, jsint, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fcmplt, F, F, LO, jsint, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fcmple, F, F, LO, jsint, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fcmpgt, F, F, LO, jsint, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fcmpge, F, F, LO, jsint, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fmul, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fadd, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fdiv, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|
|
|
|
BUILTIN2(fsub, F, F, F, jsdouble, jsdouble, jsdouble, 1, 1)
|