2012-02-14 14:00:31 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2008-07-03 15:10:15 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#ifndef V8_RUNTIME_H_
|
|
|
|
#define V8_RUNTIME_H_
|
|
|
|
|
2011-05-06 06:50:20 +00:00
|
|
|
#include "allocation.h"
|
2011-03-18 20:35:07 +00:00
|
|
|
#include "zone.h"
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// The interface to C++ runtime functions.
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2008-07-25 07:37:58 +00:00
|
|
|
// RUNTIME_FUNCTION_LIST_ALWAYS defines runtime calls available in both
|
|
|
|
// release and debug mode.
|
|
|
|
// This macro should only be used by the macro RUNTIME_FUNCTION_LIST.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-05-13 05:46:51 +00:00
|
|
|
// WARNING: RUNTIME_FUNCTION_LIST_ALWAYS_* is a very large macro that caused
|
|
|
|
// MSVC Intellisense to crash. It was broken into two macros to work around
|
|
|
|
// this problem. Please avoid large recursive macros whenever possible.
|
|
|
|
#define RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Property access */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GetProperty, 2, 1) \
|
|
|
|
F(KeyedGetProperty, 2, 1) \
|
2011-02-14 23:41:47 +00:00
|
|
|
F(DeleteProperty, 3, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(HasLocalProperty, 2, 1) \
|
|
|
|
F(HasProperty, 2, 1) \
|
|
|
|
F(HasElement, 2, 1) \
|
|
|
|
F(IsPropertyEnumerable, 2, 1) \
|
|
|
|
F(GetPropertyNames, 1, 1) \
|
|
|
|
F(GetPropertyNamesFast, 1, 1) \
|
2013-03-22 17:27:44 +00:00
|
|
|
F(GetLocalPropertyNames, 2, 1) \
|
2010-01-15 15:34:32 +00:00
|
|
|
F(GetLocalElementNames, 1, 1) \
|
|
|
|
F(GetInterceptorInfo, 1, 1) \
|
|
|
|
F(GetNamedInterceptorPropertyNames, 1, 1) \
|
|
|
|
F(GetIndexedInterceptorElementNames, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GetArgumentsProperty, 1, 1) \
|
|
|
|
F(ToFastProperties, 1, 1) \
|
2010-03-01 15:33:30 +00:00
|
|
|
F(FinishArrayPrototypeSetup, 1, 1) \
|
2010-03-11 16:24:31 +00:00
|
|
|
F(SpecialArrayFunctions, 1, 1) \
|
2013-04-05 11:57:02 +00:00
|
|
|
F(IsClassicModeFunction, 1, 1) \
|
2011-08-26 13:53:00 +00:00
|
|
|
F(GetDefaultReceiver, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
\
|
2011-06-03 10:15:49 +00:00
|
|
|
F(GetPrototype, 1, 1) \
|
2013-03-04 16:05:12 +00:00
|
|
|
F(SetPrototype, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(IsInPrototypeChain, 2, 1) \
|
|
|
|
\
|
2010-01-13 12:10:57 +00:00
|
|
|
F(GetOwnProperty, 2, 1) \
|
|
|
|
\
|
2010-01-19 12:56:36 +00:00
|
|
|
F(IsExtensible, 1, 1) \
|
2010-07-02 14:36:34 +00:00
|
|
|
F(PreventExtensions, 1, 1)\
|
2010-01-19 12:56:36 +00:00
|
|
|
\
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Utilities */ \
|
2011-09-05 07:30:35 +00:00
|
|
|
F(CheckIsBootstrapping, 0, 1) \
|
2012-04-20 14:12:49 +00:00
|
|
|
F(GetRootNaN, 0, 1) \
|
2011-11-08 14:39:37 +00:00
|
|
|
F(Call, -1 /* >= 2 */, 1) \
|
2011-09-13 11:42:57 +00:00
|
|
|
F(Apply, 5, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GetFunctionDelegate, 1, 1) \
|
|
|
|
F(GetConstructorDelegate, 1, 1) \
|
|
|
|
F(NewArgumentsFast, 3, 1) \
|
2011-06-16 14:12:58 +00:00
|
|
|
F(NewStrictArgumentsFast, 3, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(LazyCompile, 1, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(LazyRecompile, 1, 1) \
|
2012-11-16 10:57:50 +00:00
|
|
|
F(ParallelRecompile, 1, 1) \
|
|
|
|
F(InstallRecompiledCode, 1, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(NotifyDeoptimized, 1, 1) \
|
2013-01-07 10:06:11 +00:00
|
|
|
F(NotifyStubFailure, 0, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(NotifyOSR, 0, 1) \
|
2011-04-11 13:24:50 +00:00
|
|
|
F(DeoptimizeFunction, 1, 1) \
|
2012-05-04 09:16:38 +00:00
|
|
|
F(ClearFunctionTypeFeedback, 1, 1) \
|
2011-06-09 14:52:58 +00:00
|
|
|
F(RunningInSimulator, 0, 1) \
|
2013-06-17 16:27:18 +00:00
|
|
|
F(IsParallelRecompilationSupported, 0, 1) \
|
2012-02-22 16:45:35 +00:00
|
|
|
F(OptimizeFunctionOnNextCall, -1, 1) \
|
2013-07-19 08:25:44 +00:00
|
|
|
F(NeverOptimizeFunction, 1, 1) \
|
2013-07-22 09:16:33 +00:00
|
|
|
F(GetOptimizationStatus, -1, 1) \
|
2011-05-09 08:58:57 +00:00
|
|
|
F(GetOptimizationCount, 1, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(CompileForOnStackReplacement, 1, 1) \
|
2010-08-06 13:04:27 +00:00
|
|
|
F(AllocateInNewSpace, 1, 1) \
|
2013-03-14 08:32:52 +00:00
|
|
|
F(AllocateInOldPointerSpace, 1, 1) \
|
2013-05-28 09:38:28 +00:00
|
|
|
F(AllocateInOldDataSpace, 1, 1) \
|
2011-05-30 13:49:22 +00:00
|
|
|
F(SetNativeFlag, 1, 1) \
|
2011-10-31 14:42:06 +00:00
|
|
|
F(StoreArrayLiteralElement, 5, 1) \
|
2012-04-20 11:06:12 +00:00
|
|
|
F(DebugCallbackSupportsStepping, 1, 1) \
|
|
|
|
F(DebugPrepareStepInIfStepping, 1, 1) \
|
2013-01-09 09:32:12 +00:00
|
|
|
F(FlattenString, 1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2008-09-09 07:38:00 +00:00
|
|
|
/* Array join support */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(PushIfAbsent, 2, 1) \
|
|
|
|
F(ArrayConcat, 1, 1) \
|
2008-09-09 07:38:00 +00:00
|
|
|
\
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Conversions */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(ToBool, 1, 1) \
|
|
|
|
F(Typeof, 1, 1) \
|
|
|
|
\
|
|
|
|
F(StringToNumber, 1, 1) \
|
|
|
|
F(StringParseInt, 2, 1) \
|
|
|
|
F(StringParseFloat, 1, 1) \
|
|
|
|
F(StringToLowerCase, 1, 1) \
|
|
|
|
F(StringToUpperCase, 1, 1) \
|
2010-03-15 15:27:11 +00:00
|
|
|
F(StringSplit, 3, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(CharFromCode, 1, 1) \
|
|
|
|
F(URIEscape, 1, 1) \
|
|
|
|
F(URIUnescape, 1, 1) \
|
|
|
|
\
|
|
|
|
F(NumberToString, 1, 1) \
|
2010-04-07 11:13:05 +00:00
|
|
|
F(NumberToStringSkipCache, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberToInteger, 1, 1) \
|
2013-03-28 12:50:18 +00:00
|
|
|
F(NumberToPositiveInteger, 1, 1) \
|
2010-05-26 16:11:30 +00:00
|
|
|
F(NumberToIntegerMapMinusZero, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberToJSUint32, 1, 1) \
|
|
|
|
F(NumberToJSInt32, 1, 1) \
|
|
|
|
F(NumberToSmi, 1, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(AllocateHeapNumber, 0, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Arithmetic operations */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberAdd, 2, 1) \
|
|
|
|
F(NumberSub, 2, 1) \
|
|
|
|
F(NumberMul, 2, 1) \
|
|
|
|
F(NumberDiv, 2, 1) \
|
|
|
|
F(NumberMod, 2, 1) \
|
|
|
|
F(NumberUnaryMinus, 1, 1) \
|
2010-07-08 13:16:51 +00:00
|
|
|
F(NumberAlloc, 0, 1) \
|
2013-04-26 08:52:35 +00:00
|
|
|
F(NumberImul, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2009-09-08 11:52:05 +00:00
|
|
|
F(StringAdd, 2, 1) \
|
2010-01-06 14:40:21 +00:00
|
|
|
F(StringBuilderConcat, 3, 1) \
|
2011-02-14 17:25:12 +00:00
|
|
|
F(StringBuilderJoin, 3, 1) \
|
2011-11-15 09:44:57 +00:00
|
|
|
F(SparseJoinWithSeparator, 3, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Bit operations */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberOr, 2, 1) \
|
|
|
|
F(NumberAnd, 2, 1) \
|
|
|
|
F(NumberXor, 2, 1) \
|
|
|
|
F(NumberNot, 1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberShl, 2, 1) \
|
|
|
|
F(NumberShr, 2, 1) \
|
|
|
|
F(NumberSar, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Comparisons */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberEquals, 2, 1) \
|
|
|
|
F(StringEquals, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberCompare, 3, 1) \
|
|
|
|
F(SmiLexicographicCompare, 2, 1) \
|
|
|
|
F(StringCompare, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Math */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(Math_acos, 1, 1) \
|
|
|
|
F(Math_asin, 1, 1) \
|
|
|
|
F(Math_atan, 1, 1) \
|
|
|
|
F(Math_atan2, 2, 1) \
|
|
|
|
F(Math_ceil, 1, 1) \
|
|
|
|
F(Math_cos, 1, 1) \
|
|
|
|
F(Math_exp, 1, 1) \
|
|
|
|
F(Math_floor, 1, 1) \
|
|
|
|
F(Math_log, 1, 1) \
|
|
|
|
F(Math_pow, 2, 1) \
|
2010-02-26 10:24:58 +00:00
|
|
|
F(Math_pow_cfunction, 2, 1) \
|
2010-03-18 13:00:57 +00:00
|
|
|
F(RoundNumber, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(Math_sin, 1, 1) \
|
|
|
|
F(Math_sqrt, 1, 1) \
|
|
|
|
F(Math_tan, 1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Regular expressions */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(RegExpCompile, 3, 1) \
|
|
|
|
F(RegExpExec, 4, 1) \
|
2010-03-25 12:57:58 +00:00
|
|
|
F(RegExpExecMultiple, 4, 1) \
|
2010-03-26 14:19:47 +00:00
|
|
|
F(RegExpInitializeObject, 5, 1) \
|
2010-04-13 09:31:03 +00:00
|
|
|
F(RegExpConstructResult, 3, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2010-10-27 09:19:43 +00:00
|
|
|
/* JSON */ \
|
|
|
|
F(ParseJson, 1, 1) \
|
2012-12-05 15:49:22 +00:00
|
|
|
F(BasicJSONStringify, 1, 1) \
|
|
|
|
F(QuoteJSONString, 1, 1) \
|
2010-10-27 09:19:43 +00:00
|
|
|
\
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Strings */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(StringCharCodeAt, 2, 1) \
|
|
|
|
F(StringIndexOf, 3, 1) \
|
|
|
|
F(StringLastIndexOf, 3, 1) \
|
|
|
|
F(StringLocaleCompare, 2, 1) \
|
2009-11-10 13:23:05 +00:00
|
|
|
F(SubString, 3, 1) \
|
2013-02-27 14:14:45 +00:00
|
|
|
F(StringReplaceGlobalRegExpWithString, 4, 1) \
|
2012-01-16 15:21:38 +00:00
|
|
|
F(StringReplaceOneCharWithString, 3, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(StringMatch, 3, 1) \
|
2009-10-13 08:13:45 +00:00
|
|
|
F(StringTrim, 3, 1) \
|
2010-11-10 12:34:28 +00:00
|
|
|
F(StringToArray, 2, 1) \
|
2010-08-26 13:59:37 +00:00
|
|
|
F(NewStringWrapper, 1, 1) \
|
2012-12-05 15:49:22 +00:00
|
|
|
F(NewString, 2, 1) \
|
|
|
|
F(TruncateString, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Numbers */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NumberToRadixString, 2, 1) \
|
|
|
|
F(NumberToFixed, 2, 1) \
|
|
|
|
F(NumberToExponential, 2, 1) \
|
|
|
|
F(NumberToPrecision, 2, 1)
|
2009-05-13 05:46:51 +00:00
|
|
|
|
2013-04-16 14:16:30 +00:00
|
|
|
|
2009-05-13 05:46:51 +00:00
|
|
|
#define RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Reflection */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(FunctionSetInstanceClassName, 2, 1) \
|
|
|
|
F(FunctionSetLength, 2, 1) \
|
|
|
|
F(FunctionSetPrototype, 2, 1) \
|
2011-07-25 15:01:45 +00:00
|
|
|
F(FunctionSetReadOnlyPrototype, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(FunctionGetName, 1, 1) \
|
|
|
|
F(FunctionSetName, 2, 1) \
|
2011-08-08 16:14:46 +00:00
|
|
|
F(FunctionNameShouldPrintAsAnonymous, 1, 1) \
|
|
|
|
F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1) \
|
2013-05-03 13:01:28 +00:00
|
|
|
F(FunctionIsGenerator, 1, 1) \
|
2011-10-17 12:44:16 +00:00
|
|
|
F(FunctionBindArguments, 4, 1) \
|
|
|
|
F(BoundFunctionGetBindings, 1, 1) \
|
2010-04-28 12:05:40 +00:00
|
|
|
F(FunctionRemovePrototype, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(FunctionGetSourceCode, 1, 1) \
|
|
|
|
F(FunctionGetScript, 1, 1) \
|
|
|
|
F(FunctionGetScriptSourcePosition, 1, 1) \
|
|
|
|
F(FunctionGetPositionForOffset, 2, 1) \
|
|
|
|
F(FunctionIsAPIFunction, 1, 1) \
|
2009-09-17 11:11:01 +00:00
|
|
|
F(FunctionIsBuiltin, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GetScript, 1, 1) \
|
2012-02-07 09:31:06 +00:00
|
|
|
F(CollectStackTrace, 3, 1) \
|
2013-07-24 12:16:02 +00:00
|
|
|
F(GetAndClearOverflowedStackTrace, 1, 1) \
|
2009-10-21 17:07:43 +00:00
|
|
|
F(GetV8Version, 0, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
\
|
|
|
|
F(ClassOf, 1, 1) \
|
|
|
|
F(SetCode, 2, 1) \
|
2010-08-25 17:50:37 +00:00
|
|
|
F(SetExpectedNumberOfProperties, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
\
|
|
|
|
F(CreateApiFunction, 1, 1) \
|
|
|
|
F(IsTemplate, 1, 1) \
|
|
|
|
F(GetTemplateField, 2, 1) \
|
|
|
|
F(DisableAccessChecks, 1, 1) \
|
|
|
|
F(EnableAccessChecks, 1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Dates */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DateCurrentTime, 0, 1) \
|
|
|
|
F(DateParseString, 2, 1) \
|
|
|
|
F(DateLocalTimezone, 1, 1) \
|
2012-03-09 12:07:29 +00:00
|
|
|
F(DateToUTC, 1, 1) \
|
2011-10-28 08:45:04 +00:00
|
|
|
F(DateMakeDay, 2, 1) \
|
2012-03-09 12:07:29 +00:00
|
|
|
F(DateSetValue, 3, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Numbers */ \
|
|
|
|
\
|
|
|
|
/* Globals */ \
|
2013-03-07 15:46:14 +00:00
|
|
|
F(CompileString, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GlobalPrint, 1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Eval */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(GlobalReceiver, 1, 1) \
|
2011-11-14 08:58:47 +00:00
|
|
|
F(ResolvePossiblyDirectEval, 5, 2) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2011-03-02 04:53:43 +00:00
|
|
|
F(SetProperty, -1 /* 4 or 5 */, 1) \
|
2010-02-03 13:10:03 +00:00
|
|
|
F(DefineOrRedefineDataProperty, 4, 1) \
|
|
|
|
F(DefineOrRedefineAccessorProperty, 5, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \
|
2012-11-12 10:33:20 +00:00
|
|
|
F(GetDataProperty, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Arrays */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(RemoveArrayHoles, 2, 1) \
|
|
|
|
F(GetArrayKeys, 2, 1) \
|
|
|
|
F(MoveArrayContents, 2, 1) \
|
|
|
|
F(EstimateNumberOfElements, 1, 1) \
|
2013-06-06 13:22:42 +00:00
|
|
|
F(ArrayConstructor, -1, 1) \
|
|
|
|
F(InternalArrayConstructor, -1, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Getters and Setters */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(LookupAccessor, 3, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Literals */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(MaterializeRegExpLiteral, 4, 1)\
|
2010-03-11 10:34:29 +00:00
|
|
|
F(CreateObjectLiteral, 4, 1) \
|
|
|
|
F(CreateObjectLiteralShallow, 4, 1) \
|
2009-12-09 13:06:08 +00:00
|
|
|
F(CreateArrayLiteral, 3, 1) \
|
|
|
|
F(CreateArrayLiteralShallow, 3, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2013-04-15 12:29:44 +00:00
|
|
|
/* Harmony generators */ \
|
|
|
|
F(CreateJSGeneratorObject, 0, 1) \
|
2013-04-19 14:11:23 +00:00
|
|
|
F(SuspendJSGeneratorObject, 1, 1) \
|
2013-04-24 13:00:16 +00:00
|
|
|
F(ResumeJSGeneratorObject, 3, 1) \
|
|
|
|
F(ThrowGeneratorStateError, 1, 1) \
|
2013-04-15 12:29:44 +00:00
|
|
|
\
|
2013-05-23 07:05:58 +00:00
|
|
|
/* ES5 */ \
|
|
|
|
F(ObjectFreeze, 1, 1) \
|
|
|
|
\
|
2012-07-09 08:59:03 +00:00
|
|
|
/* Harmony modules */ \
|
|
|
|
F(IsJSModule, 1, 1) \
|
|
|
|
\
|
2013-03-01 13:28:55 +00:00
|
|
|
/* Harmony symbols */ \
|
2013-03-22 16:51:28 +00:00
|
|
|
F(CreateSymbol, 1, 1) \
|
|
|
|
F(SymbolName, 1, 1) \
|
2013-03-01 13:28:55 +00:00
|
|
|
\
|
2011-05-13 10:58:25 +00:00
|
|
|
/* Harmony proxies */ \
|
|
|
|
F(CreateJSProxy, 2, 1) \
|
2011-09-13 11:42:57 +00:00
|
|
|
F(CreateJSFunctionProxy, 4, 1) \
|
2011-06-03 10:15:49 +00:00
|
|
|
F(IsJSProxy, 1, 1) \
|
2011-09-13 11:42:57 +00:00
|
|
|
F(IsJSFunctionProxy, 1, 1) \
|
2011-06-03 10:15:49 +00:00
|
|
|
F(GetHandler, 1, 1) \
|
2011-09-13 11:42:57 +00:00
|
|
|
F(GetCallTrap, 1, 1) \
|
|
|
|
F(GetConstructTrap, 1, 1) \
|
2011-07-18 13:04:52 +00:00
|
|
|
F(Fix, 1, 1) \
|
2011-05-13 10:58:25 +00:00
|
|
|
\
|
2011-10-25 14:14:56 +00:00
|
|
|
/* Harmony sets */ \
|
|
|
|
F(SetInitialize, 1, 1) \
|
|
|
|
F(SetAdd, 2, 1) \
|
|
|
|
F(SetHas, 2, 1) \
|
|
|
|
F(SetDelete, 2, 1) \
|
2012-11-06 18:14:45 +00:00
|
|
|
F(SetGetSize, 1, 1) \
|
2011-10-25 14:14:56 +00:00
|
|
|
\
|
|
|
|
/* Harmony maps */ \
|
|
|
|
F(MapInitialize, 1, 1) \
|
|
|
|
F(MapGet, 2, 1) \
|
2012-06-25 13:33:48 +00:00
|
|
|
F(MapHas, 2, 1) \
|
|
|
|
F(MapDelete, 2, 1) \
|
2011-10-25 14:14:56 +00:00
|
|
|
F(MapSet, 3, 1) \
|
2012-11-06 18:14:45 +00:00
|
|
|
F(MapGetSize, 1, 1) \
|
2011-10-25 14:14:56 +00:00
|
|
|
\
|
2013-07-22 08:32:24 +00:00
|
|
|
/* Harmony weak maps and sets */ \
|
|
|
|
F(WeakCollectionInitialize, 1, 1) \
|
|
|
|
F(WeakCollectionGet, 2, 1) \
|
|
|
|
F(WeakCollectionHas, 2, 1) \
|
|
|
|
F(WeakCollectionDelete, 2, 1) \
|
|
|
|
F(WeakCollectionSet, 3, 1) \
|
2011-08-03 11:55:13 +00:00
|
|
|
\
|
2012-11-06 12:30:22 +00:00
|
|
|
/* Harmony observe */ \
|
|
|
|
F(IsObserved, 1, 1) \
|
2013-07-13 00:20:40 +00:00
|
|
|
F(SetIsObserved, 1, 1) \
|
2012-11-08 13:44:59 +00:00
|
|
|
F(SetObserverDeliveryPending, 0, 1) \
|
2012-11-06 16:47:15 +00:00
|
|
|
F(GetObservationState, 0, 1) \
|
2013-02-04 20:24:11 +00:00
|
|
|
F(ObservationWeakMapCreate, 0, 1) \
|
|
|
|
F(UnwrapGlobalProxy, 1, 1) \
|
2012-11-06 12:30:22 +00:00
|
|
|
\
|
2013-03-28 12:50:18 +00:00
|
|
|
/* Harmony typed arrays */ \
|
|
|
|
F(ArrayBufferInitialize, 2, 1)\
|
|
|
|
F(ArrayBufferGetByteLength, 1, 1)\
|
|
|
|
F(ArrayBufferSliceImpl, 3, 1) \
|
|
|
|
\
|
2013-04-16 14:16:30 +00:00
|
|
|
F(TypedArrayInitialize, 5, 1) \
|
2013-08-01 08:52:21 +00:00
|
|
|
F(TypedArrayInitializeFromArrayLike, 4, 1) \
|
2013-04-16 14:16:30 +00:00
|
|
|
F(TypedArrayGetBuffer, 1, 1) \
|
|
|
|
F(TypedArrayGetByteLength, 1, 1) \
|
|
|
|
F(TypedArrayGetByteOffset, 1, 1) \
|
|
|
|
F(TypedArrayGetLength, 1, 1) \
|
2013-05-07 14:42:17 +00:00
|
|
|
F(TypedArraySetFastCases, 3, 1) \
|
2013-04-16 14:16:30 +00:00
|
|
|
\
|
2013-06-21 13:02:38 +00:00
|
|
|
F(DataViewInitialize, 4, 1) \
|
|
|
|
F(DataViewGetBuffer, 1, 1) \
|
|
|
|
F(DataViewGetByteLength, 1, 1) \
|
|
|
|
F(DataViewGetByteOffset, 1, 1) \
|
|
|
|
F(DataViewGetInt8, 3, 1) \
|
|
|
|
F(DataViewGetUint8, 3, 1) \
|
|
|
|
F(DataViewGetInt16, 3, 1) \
|
|
|
|
F(DataViewGetUint16, 3, 1) \
|
|
|
|
F(DataViewGetInt32, 3, 1) \
|
|
|
|
F(DataViewGetUint32, 3, 1) \
|
|
|
|
F(DataViewGetFloat32, 3, 1) \
|
|
|
|
F(DataViewGetFloat64, 3, 1) \
|
|
|
|
\
|
|
|
|
F(DataViewSetInt8, 4, 1) \
|
|
|
|
F(DataViewSetUint8, 4, 1) \
|
|
|
|
F(DataViewSetInt16, 4, 1) \
|
|
|
|
F(DataViewSetUint16, 4, 1) \
|
|
|
|
F(DataViewSetInt32, 4, 1) \
|
|
|
|
F(DataViewSetUint32, 4, 1) \
|
|
|
|
F(DataViewSetFloat32, 4, 1) \
|
|
|
|
F(DataViewSetFloat64, 4, 1) \
|
|
|
|
\
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Statements */ \
|
2010-11-22 09:57:21 +00:00
|
|
|
F(NewClosure, 3, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(NewObject, 1, 1) \
|
2011-10-17 12:44:16 +00:00
|
|
|
F(NewObjectFromBound, 1, 1) \
|
2010-09-23 09:15:26 +00:00
|
|
|
F(FinalizeInstanceSize, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(Throw, 1, 1) \
|
|
|
|
F(ReThrow, 1, 1) \
|
|
|
|
F(ThrowReferenceError, 1, 1) \
|
2012-09-10 08:35:26 +00:00
|
|
|
F(ThrowNotDateError, 0, 1) \
|
2010-10-19 11:14:03 +00:00
|
|
|
F(StackGuard, 0, 1) \
|
2012-02-14 14:00:31 +00:00
|
|
|
F(Interrupt, 0, 1) \
|
2009-11-04 08:51:48 +00:00
|
|
|
F(PromoteScheduledException, 0, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Contexts */ \
|
2012-08-27 09:40:26 +00:00
|
|
|
F(NewGlobalContext, 2, 1) \
|
2011-06-09 11:26:01 +00:00
|
|
|
F(NewFunctionContext, 1, 1) \
|
2011-06-29 07:41:42 +00:00
|
|
|
F(PushWithContext, 2, 1) \
|
|
|
|
F(PushCatchContext, 3, 1) \
|
2011-08-11 16:29:28 +00:00
|
|
|
F(PushBlockContext, 2, 1) \
|
Get rid of static module allocation, do it in code.
Modules now have their own local scope, represented by their own context.
Module instance objects have an accessor for every export that forwards
access to the respective slot from the module's context. (Exports that are
modules themselves, however, are simple data properties.)
All modules have a _hosting_ scope/context, which (currently) is the
(innermost) enclosing global scope. To deal with recursion, nested modules
are hosted by the same scope as global ones.
For every (global or nested) module literal, the hosting context has an
internal slot that points directly to the respective module context. This
enables quick access to (statically resolved) module members by 2-dimensional
access through the hosting context. For example,
module A {
let x;
module B { let y; }
}
module C { let z; }
allocates contexts as follows:
[header| .A | .B | .C | A | C ] (global)
| | |
| | +-- [header| z ] (module)
| |
| +------- [header| y ] (module)
|
+------------ [header| x | B ] (module)
Here, .A, .B, .C are the internal slots pointing to the hosted module
contexts, whereas A, B, C hold the actual instance objects (note that every
module context also points to the respective instance object through its
extension slot in the header).
To deal with arbitrary recursion and aliases between modules,
they are created and initialized in several stages. Each stage applies to
all modules in the hosting global scope, including nested ones.
1. Allocate: for each module _literal_, allocate the module contexts and
respective instance object and wire them up. This happens in the
PushModuleContext runtime function, as generated by AllocateModules
(invoked by VisitDeclarations in the hosting scope).
2. Bind: for each module _declaration_ (i.e. literals as well as aliases),
assign the respective instance object to respective local variables. This
happens in VisitModuleDeclaration, and uses the instance objects created
in the previous stage.
For each module _literal_, this phase also constructs a module descriptor
for the next stage. This happens in VisitModuleLiteral.
3. Populate: invoke the DeclareModules runtime function to populate each
_instance_ object with accessors for it exports. This is generated by
DeclareModules (invoked by VisitDeclarations in the hosting scope again),
and uses the descriptors generated in the previous stage.
4. Initialize: execute the module bodies (and other code) in sequence. This
happens by the separate statements generated for module bodies. To reenter
the module scopes properly, the parser inserted ModuleStatements.
R=mstarzinger@chromium.org,svenpanne@chromium.org
BUG=
Review URL: https://codereview.chromium.org/11093074
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13033 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-22 10:25:22 +00:00
|
|
|
F(PushModuleContext, 2, 1) \
|
2011-01-24 14:03:30 +00:00
|
|
|
F(DeleteContextSlot, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(LoadContextSlot, 2, 2) \
|
|
|
|
F(LoadContextSlotNoReferenceError, 2, 2) \
|
2011-03-02 04:53:43 +00:00
|
|
|
F(StoreContextSlot, 4, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Declarations and initialization */ \
|
2011-09-01 11:57:02 +00:00
|
|
|
F(DeclareGlobals, 3, 1) \
|
Get rid of static module allocation, do it in code.
Modules now have their own local scope, represented by their own context.
Module instance objects have an accessor for every export that forwards
access to the respective slot from the module's context. (Exports that are
modules themselves, however, are simple data properties.)
All modules have a _hosting_ scope/context, which (currently) is the
(innermost) enclosing global scope. To deal with recursion, nested modules
are hosted by the same scope as global ones.
For every (global or nested) module literal, the hosting context has an
internal slot that points directly to the respective module context. This
enables quick access to (statically resolved) module members by 2-dimensional
access through the hosting context. For example,
module A {
let x;
module B { let y; }
}
module C { let z; }
allocates contexts as follows:
[header| .A | .B | .C | A | C ] (global)
| | |
| | +-- [header| z ] (module)
| |
| +------- [header| y ] (module)
|
+------------ [header| x | B ] (module)
Here, .A, .B, .C are the internal slots pointing to the hosted module
contexts, whereas A, B, C hold the actual instance objects (note that every
module context also points to the respective instance object through its
extension slot in the header).
To deal with arbitrary recursion and aliases between modules,
they are created and initialized in several stages. Each stage applies to
all modules in the hosting global scope, including nested ones.
1. Allocate: for each module _literal_, allocate the module contexts and
respective instance object and wire them up. This happens in the
PushModuleContext runtime function, as generated by AllocateModules
(invoked by VisitDeclarations in the hosting scope).
2. Bind: for each module _declaration_ (i.e. literals as well as aliases),
assign the respective instance object to respective local variables. This
happens in VisitModuleDeclaration, and uses the instance objects created
in the previous stage.
For each module _literal_, this phase also constructs a module descriptor
for the next stage. This happens in VisitModuleLiteral.
3. Populate: invoke the DeclareModules runtime function to populate each
_instance_ object with accessors for it exports. This is generated by
DeclareModules (invoked by VisitDeclarations in the hosting scope again),
and uses the descriptors generated in the previous stage.
4. Initialize: execute the module bodies (and other code) in sequence. This
happens by the separate statements generated for module bodies. To reenter
the module scopes properly, the parser inserted ModuleStatements.
R=mstarzinger@chromium.org,svenpanne@chromium.org
BUG=
Review URL: https://codereview.chromium.org/11093074
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13033 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-11-22 10:25:22 +00:00
|
|
|
F(DeclareModules, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DeclareContextSlot, 4, 1) \
|
2011-03-02 04:53:43 +00:00
|
|
|
F(InitializeVarGlobal, -1 /* 2 or 3 */, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(InitializeConstGlobal, 2, 1) \
|
|
|
|
F(InitializeConstContextSlot, 3, 1) \
|
|
|
|
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
|
|
|
/* Debugging */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DebugPrint, 1, 1) \
|
|
|
|
F(DebugTrace, 0, 1) \
|
|
|
|
F(TraceEnter, 0, 1) \
|
|
|
|
F(TraceExit, 1, 1) \
|
|
|
|
F(Abort, 2, 1) \
|
2009-01-06 13:24:52 +00:00
|
|
|
/* Logging */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(Log, 2, 1) \
|
2009-09-15 11:51:40 +00:00
|
|
|
/* ES5 */ \
|
|
|
|
F(LocalKeys, 1, 1) \
|
2010-04-14 14:46:15 +00:00
|
|
|
/* Cache suport */ \
|
|
|
|
F(GetFromCache, 2, 1) \
|
2008-07-03 15:10:15 +00:00
|
|
|
\
|
2011-02-02 13:31:52 +00:00
|
|
|
/* Message objects */ \
|
|
|
|
F(MessageGetStartPosition, 1, 1) \
|
|
|
|
F(MessageGetScript, 1, 1) \
|
|
|
|
\
|
2008-07-03 15:10:15 +00:00
|
|
|
/* Pseudo functions - handled as macros by parser */ \
|
2011-07-01 11:47:55 +00:00
|
|
|
F(IS_VAR, 1, 1) \
|
|
|
|
\
|
|
|
|
/* expose boolean functions from objects-inl.h */ \
|
2012-05-23 14:24:29 +00:00
|
|
|
F(HasFastSmiElements, 1, 1) \
|
|
|
|
F(HasFastSmiOrObjectElements, 1, 1) \
|
|
|
|
F(HasFastObjectElements, 1, 1) \
|
2011-07-01 11:47:55 +00:00
|
|
|
F(HasFastDoubleElements, 1, 1) \
|
2012-05-23 14:24:29 +00:00
|
|
|
F(HasFastHoleyElements, 1, 1) \
|
2011-07-01 11:47:55 +00:00
|
|
|
F(HasDictionaryElements, 1, 1) \
|
2013-05-23 07:05:58 +00:00
|
|
|
F(HasNonStrictArgumentsElements, 1, 1) \
|
2011-07-01 11:47:55 +00:00
|
|
|
F(HasExternalPixelElements, 1, 1) \
|
|
|
|
F(HasExternalArrayElements, 1, 1) \
|
|
|
|
F(HasExternalByteElements, 1, 1) \
|
|
|
|
F(HasExternalUnsignedByteElements, 1, 1) \
|
|
|
|
F(HasExternalShortElements, 1, 1) \
|
|
|
|
F(HasExternalUnsignedShortElements, 1, 1) \
|
|
|
|
F(HasExternalIntElements, 1, 1) \
|
|
|
|
F(HasExternalUnsignedIntElements, 1, 1) \
|
|
|
|
F(HasExternalFloatElements, 1, 1) \
|
2011-07-13 09:09:04 +00:00
|
|
|
F(HasExternalDoubleElements, 1, 1) \
|
2012-06-06 10:17:26 +00:00
|
|
|
F(HasFastProperties, 1, 1) \
|
2013-02-04 12:01:59 +00:00
|
|
|
F(TransitionElementsKind, 2, 1) \
|
2013-07-23 13:44:15 +00:00
|
|
|
F(HaveSameMap, 2, 1)
|
2011-07-01 11:47:55 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-04-20 16:36:13 +00:00
|
|
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
|
|
|
#define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
|
|
|
|
/* Debugger support*/ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DebugBreak, 0, 1) \
|
|
|
|
F(SetDebugEventListener, 2, 1) \
|
|
|
|
F(Break, 0, 1) \
|
|
|
|
F(DebugGetPropertyDetails, 2, 1) \
|
|
|
|
F(DebugGetProperty, 2, 1) \
|
|
|
|
F(DebugPropertyTypeFromDetails, 1, 1) \
|
|
|
|
F(DebugPropertyAttributesFromDetails, 1, 1) \
|
|
|
|
F(DebugPropertyIndexFromDetails, 1, 1) \
|
|
|
|
F(DebugNamedInterceptorPropertyValue, 2, 1) \
|
|
|
|
F(DebugIndexedInterceptorElementValue, 2, 1) \
|
|
|
|
F(CheckExecutionState, 1, 1) \
|
|
|
|
F(GetFrameCount, 1, 1) \
|
|
|
|
F(GetFrameDetails, 2, 1) \
|
|
|
|
F(GetScopeCount, 2, 1) \
|
2013-06-25 13:42:44 +00:00
|
|
|
F(GetStepInPositions, 2, 1) \
|
2011-07-13 12:49:27 +00:00
|
|
|
F(GetScopeDetails, 4, 1) \
|
2012-04-26 20:16:53 +00:00
|
|
|
F(GetFunctionScopeCount, 1, 1) \
|
|
|
|
F(GetFunctionScopeDetails, 2, 1) \
|
2012-12-03 20:29:29 +00:00
|
|
|
F(SetScopeVariableValue, 6, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DebugPrintScopes, 0, 1) \
|
|
|
|
F(GetThreadCount, 1, 1) \
|
|
|
|
F(GetThreadDetails, 2, 1) \
|
2010-07-28 15:50:05 +00:00
|
|
|
F(SetDisableBreak, 1, 1) \
|
2013-07-01 13:44:10 +00:00
|
|
|
F(GetBreakLocations, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(SetFunctionBreakPoint, 3, 1) \
|
2013-07-01 13:44:10 +00:00
|
|
|
F(SetScriptBreakPoint, 4, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(ClearBreakPoint, 1, 1) \
|
|
|
|
F(ChangeBreakOnException, 2, 1) \
|
2010-09-16 21:40:42 +00:00
|
|
|
F(IsBreakOnException, 1, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(PrepareStep, 3, 1) \
|
|
|
|
F(ClearStepping, 0, 1) \
|
2011-07-13 12:49:27 +00:00
|
|
|
F(DebugEvaluate, 6, 1) \
|
2010-12-14 00:07:44 +00:00
|
|
|
F(DebugEvaluateGlobal, 4, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(DebugGetLoadedScripts, 0, 1) \
|
|
|
|
F(DebugReferencedBy, 3, 1) \
|
|
|
|
F(DebugConstructedBy, 2, 1) \
|
|
|
|
F(DebugGetPrototype, 1, 1) \
|
2012-03-15 11:51:26 +00:00
|
|
|
F(DebugSetScriptSource, 2, 1) \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(SystemBreak, 0, 1) \
|
|
|
|
F(DebugDisassembleFunction, 1, 1) \
|
|
|
|
F(DebugDisassembleConstructor, 1, 1) \
|
2010-03-05 22:08:58 +00:00
|
|
|
F(FunctionGetInferredName, 1, 1) \
|
|
|
|
F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \
|
|
|
|
F(LiveEditGatherCompileInfo, 2, 1) \
|
|
|
|
F(LiveEditReplaceScript, 3, 1) \
|
|
|
|
F(LiveEditReplaceFunctionCode, 2, 1) \
|
2010-12-07 11:31:57 +00:00
|
|
|
F(LiveEditFunctionSourceUpdated, 1, 1) \
|
2010-04-28 11:38:43 +00:00
|
|
|
F(LiveEditFunctionSetScript, 2, 1) \
|
|
|
|
F(LiveEditReplaceRefToNestedFunction, 3, 1) \
|
2010-03-09 21:45:24 +00:00
|
|
|
F(LiveEditPatchFunctionPositions, 2, 1) \
|
2010-04-06 17:58:28 +00:00
|
|
|
F(LiveEditCheckAndDropActivations, 2, 1) \
|
2011-01-11 14:55:47 +00:00
|
|
|
F(LiveEditCompareStrings, 2, 1) \
|
2012-06-15 16:52:03 +00:00
|
|
|
F(LiveEditRestartFrame, 2, 1) \
|
2010-04-06 17:58:28 +00:00
|
|
|
F(GetFunctionCodePositionFromSource, 2, 1) \
|
2011-01-06 13:14:32 +00:00
|
|
|
F(ExecuteInDebugContext, 2, 1) \
|
|
|
|
\
|
|
|
|
F(SetFlags, 1, 1) \
|
|
|
|
F(CollectGarbage, 1, 1) \
|
2011-03-02 08:10:38 +00:00
|
|
|
F(GetHeapUsage, 0, 1) \
|
2011-01-06 13:14:32 +00:00
|
|
|
|
2009-04-20 16:36:13 +00:00
|
|
|
#else
|
|
|
|
#define RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F)
|
|
|
|
#endif
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-08-01 19:25:27 +00:00
|
|
|
|
|
|
|
#ifdef V8_I18N_SUPPORT
|
|
|
|
#define RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F) \
|
|
|
|
/* i18n support */ \
|
|
|
|
/* Standalone, helper methods. */ \
|
|
|
|
F(CanonicalizeLanguageTag, 1, 1) \
|
|
|
|
F(AvailableLocalesOf, 1, 1) \
|
|
|
|
F(GetDefaultICULocale, 0, 1) \
|
|
|
|
F(GetLanguageTagVariants, 1, 1) \
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-07-25 07:37:58 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
#define RUNTIME_FUNCTION_LIST_DEBUG(F) \
|
|
|
|
/* Testing */ \
|
2009-09-08 11:52:05 +00:00
|
|
|
F(ListNatives, 0, 1)
|
2008-07-25 07:37:58 +00:00
|
|
|
#else
|
|
|
|
#define RUNTIME_FUNCTION_LIST_DEBUG(F)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// RUNTIME_FUNCTION_LIST defines all runtime functions accessed
|
|
|
|
// either directly by id (via the code generator), or indirectly
|
|
|
|
// via a native call by name (from within JS code).
|
|
|
|
|
|
|
|
#define RUNTIME_FUNCTION_LIST(F) \
|
2009-05-13 05:46:51 +00:00
|
|
|
RUNTIME_FUNCTION_LIST_ALWAYS_1(F) \
|
|
|
|
RUNTIME_FUNCTION_LIST_ALWAYS_2(F) \
|
2009-04-20 16:36:13 +00:00
|
|
|
RUNTIME_FUNCTION_LIST_DEBUG(F) \
|
2013-08-01 19:25:27 +00:00
|
|
|
RUNTIME_FUNCTION_LIST_DEBUGGER_SUPPORT(F) \
|
|
|
|
RUNTIME_FUNCTION_LIST_I18N_SUPPORT(F)
|
2008-07-25 07:37:58 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2010-09-14 14:52:53 +00:00
|
|
|
// INLINE_FUNCTION_LIST defines all inlined functions accessed
|
|
|
|
// with a native call of the form %_name from within JS code.
|
|
|
|
// Entries have the form F(name, number of arguments, number of return values).
|
|
|
|
#define INLINE_FUNCTION_LIST(F) \
|
|
|
|
F(IsSmi, 1, 1) \
|
|
|
|
F(IsNonNegativeSmi, 1, 1) \
|
|
|
|
F(IsArray, 1, 1) \
|
|
|
|
F(IsRegExp, 1, 1) \
|
2012-03-15 14:38:45 +00:00
|
|
|
F(IsConstructCall, 0, 1) \
|
2010-09-14 14:52:53 +00:00
|
|
|
F(CallFunction, -1 /* receiver + n args + function */, 1) \
|
|
|
|
F(ArgumentsLength, 0, 1) \
|
|
|
|
F(Arguments, 1, 1) \
|
|
|
|
F(ValueOf, 1, 1) \
|
|
|
|
F(SetValueOf, 2, 1) \
|
2012-03-15 14:38:45 +00:00
|
|
|
F(DateField, 2 /* date object, field index */, 1) \
|
2010-09-14 14:52:53 +00:00
|
|
|
F(StringCharFromCode, 1, 1) \
|
|
|
|
F(StringCharAt, 2, 1) \
|
2012-12-05 15:49:22 +00:00
|
|
|
F(OneByteSeqStringSetChar, 3, 1) \
|
|
|
|
F(TwoByteSeqStringSetChar, 3, 1) \
|
2010-09-14 14:52:53 +00:00
|
|
|
F(ObjectEquals, 2, 1) \
|
|
|
|
F(RandomHeapNumber, 0, 1) \
|
|
|
|
F(IsObject, 1, 1) \
|
|
|
|
F(IsFunction, 1, 1) \
|
|
|
|
F(IsUndetectableObject, 1, 1) \
|
|
|
|
F(IsSpecObject, 1, 1) \
|
|
|
|
F(IsStringWrapperSafeForDefaultValueOf, 1, 1) \
|
|
|
|
F(MathPow, 2, 1) \
|
|
|
|
F(MathSin, 1, 1) \
|
|
|
|
F(MathCos, 1, 1) \
|
2011-11-25 13:15:31 +00:00
|
|
|
F(MathTan, 1, 1) \
|
2010-09-14 14:52:53 +00:00
|
|
|
F(MathSqrt, 1, 1) \
|
2010-12-02 11:20:44 +00:00
|
|
|
F(MathLog, 1, 1) \
|
2010-09-14 14:52:53 +00:00
|
|
|
F(IsRegExpEquivalent, 2, 1) \
|
|
|
|
F(HasCachedArrayIndex, 1, 1) \
|
2010-11-19 09:25:46 +00:00
|
|
|
F(GetCachedArrayIndex, 1, 1) \
|
2013-04-24 13:00:16 +00:00
|
|
|
F(FastAsciiArrayJoin, 2, 1) \
|
2013-06-10 09:26:18 +00:00
|
|
|
F(GeneratorNext, 2, 1) \
|
2013-06-28 15:48:38 +00:00
|
|
|
F(GeneratorThrow, 2, 1) \
|
|
|
|
F(DebugBreakInOptimizedCode, 0, 1)
|
2010-09-14 14:52:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2013-03-01 13:28:55 +00:00
|
|
|
// INLINE_RUNTIME_FUNCTION_LIST defines all inlined functions accessed
|
2010-09-14 14:52:53 +00:00
|
|
|
// with a native call of the form %_name from within JS code that also have
|
2010-11-02 13:37:59 +00:00
|
|
|
// a corresponding runtime function, that is called for slow cases.
|
2010-09-14 14:52:53 +00:00
|
|
|
// Entries have the form F(name, number of arguments, number of return values).
|
|
|
|
#define INLINE_RUNTIME_FUNCTION_LIST(F) \
|
|
|
|
F(ClassOf, 1, 1) \
|
|
|
|
F(StringCharCodeAt, 2, 1) \
|
|
|
|
F(Log, 3, 1) \
|
|
|
|
F(StringAdd, 2, 1) \
|
|
|
|
F(SubString, 3, 1) \
|
|
|
|
F(StringCompare, 2, 1) \
|
|
|
|
F(RegExpExec, 4, 1) \
|
|
|
|
F(RegExpConstructResult, 3, 1) \
|
|
|
|
F(GetFromCache, 2, 1) \
|
2012-05-17 20:53:32 +00:00
|
|
|
F(NumberToString, 1, 1)
|
2010-09-14 14:52:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2008-07-03 15:10:15 +00:00
|
|
|
// Runtime provides access to all C++ runtime functions.
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
class RuntimeState {
|
|
|
|
public:
|
2012-12-31 11:13:50 +00:00
|
|
|
StaticResource<ConsStringIteratorOp>* string_iterator() {
|
|
|
|
return &string_iterator_;
|
2011-03-18 20:35:07 +00:00
|
|
|
}
|
|
|
|
unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
|
|
|
|
return &to_upper_mapping_;
|
|
|
|
}
|
|
|
|
unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
|
|
|
|
return &to_lower_mapping_;
|
|
|
|
}
|
2012-12-31 11:13:50 +00:00
|
|
|
ConsStringIteratorOp* string_iterator_compare_x() {
|
|
|
|
return &string_iterator_compare_x_;
|
2011-03-18 20:35:07 +00:00
|
|
|
}
|
2012-12-31 11:13:50 +00:00
|
|
|
ConsStringIteratorOp* string_iterator_compare_y() {
|
|
|
|
return &string_iterator_compare_y_;
|
2011-03-18 20:35:07 +00:00
|
|
|
}
|
2012-12-31 11:13:50 +00:00
|
|
|
ConsStringIteratorOp* string_locale_compare_it1() {
|
|
|
|
return &string_locale_compare_it1_;
|
2011-03-18 20:35:07 +00:00
|
|
|
}
|
2012-12-31 11:13:50 +00:00
|
|
|
ConsStringIteratorOp* string_locale_compare_it2() {
|
|
|
|
return &string_locale_compare_it2_;
|
2011-03-18 20:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
RuntimeState() {}
|
|
|
|
// Non-reentrant string buffer for efficient general use in the runtime.
|
2012-12-31 11:13:50 +00:00
|
|
|
StaticResource<ConsStringIteratorOp> string_iterator_;
|
2011-03-18 20:35:07 +00:00
|
|
|
unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
|
|
|
|
unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
|
2012-12-31 11:13:50 +00:00
|
|
|
ConsStringIteratorOp string_iterator_compare_x_;
|
|
|
|
ConsStringIteratorOp string_iterator_compare_y_;
|
|
|
|
ConsStringIteratorOp string_locale_compare_it1_;
|
|
|
|
ConsStringIteratorOp string_locale_compare_it2_;
|
2011-03-18 20:35:07 +00:00
|
|
|
|
|
|
|
friend class Isolate;
|
|
|
|
friend class Runtime;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(RuntimeState);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
class Runtime : public AllStatic {
|
|
|
|
public:
|
|
|
|
enum FunctionId {
|
2009-09-08 11:52:05 +00:00
|
|
|
#define F(name, nargs, ressize) k##name,
|
2008-07-03 15:10:15 +00:00
|
|
|
RUNTIME_FUNCTION_LIST(F)
|
|
|
|
#undef F
|
2010-09-14 14:52:53 +00:00
|
|
|
#define F(name, nargs, ressize) kInline##name,
|
|
|
|
INLINE_FUNCTION_LIST(F)
|
|
|
|
INLINE_RUNTIME_FUNCTION_LIST(F)
|
|
|
|
#undef F
|
|
|
|
kNumFunctions,
|
|
|
|
kFirstInlineFunction = kInlineIsSmi
|
|
|
|
};
|
|
|
|
|
|
|
|
enum IntrinsicType {
|
|
|
|
RUNTIME,
|
|
|
|
INLINE
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
// Intrinsic function descriptor.
|
2008-07-03 15:10:15 +00:00
|
|
|
struct Function {
|
2010-09-14 14:52:53 +00:00
|
|
|
FunctionId function_id;
|
|
|
|
IntrinsicType intrinsic_type;
|
2008-07-03 15:10:15 +00:00
|
|
|
// The JS name of the function.
|
|
|
|
const char* name;
|
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
// The C++ (native) entry point. NULL if the function is inlined.
|
2008-07-03 15:10:15 +00:00
|
|
|
byte* entry;
|
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
// The number of arguments expected. nargs is -1 if the function takes
|
|
|
|
// a variable number of arguments.
|
2008-07-03 15:10:15 +00:00
|
|
|
int nargs;
|
2010-09-14 14:52:53 +00:00
|
|
|
// Size of result. Most functions return a single pointer, size 1.
|
2009-09-08 11:52:05 +00:00
|
|
|
int result_size;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
static const int kNotFound = -1;
|
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
// Add internalized strings for all the intrinsic function names to a
|
|
|
|
// StringDictionary.
|
2010-09-14 14:52:53 +00:00
|
|
|
// Returns failure if an allocation fails. In this case, it must be
|
|
|
|
// retried with a new, empty StringDictionary, not with the same one.
|
|
|
|
// Alternatively, heap initialization can be completely restarted.
|
2010-10-25 15:22:03 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* InitializeIntrinsicFunctionNames(
|
2011-03-18 20:35:07 +00:00
|
|
|
Heap* heap, Object* dictionary);
|
2010-09-14 14:52:53 +00:00
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
// Get the intrinsic function with the given name, which must be internalized.
|
|
|
|
static const Function* FunctionForName(Handle<String> name);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
// Get the intrinsic function with the given FunctionId.
|
2011-03-18 20:35:07 +00:00
|
|
|
static const Function* FunctionForId(FunctionId id);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-09-14 14:52:53 +00:00
|
|
|
// General-purpose helper functions for runtime system.
|
2011-03-18 20:35:07 +00:00
|
|
|
static int StringMatch(Isolate* isolate,
|
|
|
|
Handle<String> sub,
|
|
|
|
Handle<String> pat,
|
|
|
|
int index);
|
2008-10-02 15:35:28 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
static bool IsUpperCaseChar(RuntimeState* runtime_state, uint16_t ch);
|
2009-04-14 00:51:59 +00:00
|
|
|
|
2011-10-19 12:04:16 +00:00
|
|
|
// TODO(1240886): Some of the following methods are *not* handle safe, but
|
|
|
|
// accept handle arguments. This seems fragile.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Support getting the characters in a string using [] notation as
|
|
|
|
// in Firefox/SpiderMonkey, Safari and Opera.
|
2011-03-18 20:35:07 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* GetElementOrCharAt(Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
2010-10-25 15:22:03 +00:00
|
|
|
uint32_t index);
|
|
|
|
|
2013-04-19 08:30:49 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* GetElementOrCharAtOrFail(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
uint32_t index);
|
|
|
|
|
2010-10-25 15:22:03 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* SetObjectProperty(
|
2011-03-18 20:35:07 +00:00
|
|
|
Isolate* isolate,
|
2010-10-25 15:22:03 +00:00
|
|
|
Handle<Object> object,
|
|
|
|
Handle<Object> key,
|
|
|
|
Handle<Object> value,
|
2011-03-02 04:53:43 +00:00
|
|
|
PropertyAttributes attr,
|
2011-03-03 16:17:28 +00:00
|
|
|
StrictModeFlag strict_mode);
|
2010-10-25 15:22:03 +00:00
|
|
|
|
2013-04-18 08:14:59 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* SetObjectPropertyOrFail(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
Handle<Object> key,
|
|
|
|
Handle<Object> value,
|
|
|
|
PropertyAttributes attr,
|
|
|
|
StrictModeFlag strict_mode);
|
|
|
|
|
2010-10-25 15:22:03 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty(
|
2011-03-18 20:35:07 +00:00
|
|
|
Isolate* isolate,
|
2010-10-25 15:22:03 +00:00
|
|
|
Handle<JSObject> object,
|
|
|
|
Handle<Object> key,
|
|
|
|
Handle<Object> value,
|
|
|
|
PropertyAttributes attr);
|
|
|
|
|
2013-04-10 12:16:29 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* DeleteObjectProperty(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<JSReceiver> object,
|
|
|
|
Handle<Object> key,
|
|
|
|
JSReceiver::DeleteMode mode);
|
|
|
|
|
|
|
|
MUST_USE_RESULT static MaybeObject* HasObjectProperty(
|
2011-03-18 20:35:07 +00:00
|
|
|
Isolate* isolate,
|
2011-07-15 09:10:20 +00:00
|
|
|
Handle<JSReceiver> object,
|
2010-10-25 15:22:03 +00:00
|
|
|
Handle<Object> key);
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* GetObjectProperty(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
Handle<Object> key);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-04-18 08:14:59 +00:00
|
|
|
MUST_USE_RESULT static MaybeObject* GetObjectPropertyOrFail(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
Handle<Object> key);
|
|
|
|
|
2013-05-23 10:01:42 +00:00
|
|
|
static void SetupArrayBuffer(Isolate* isolate,
|
2013-04-25 12:02:23 +00:00
|
|
|
Handle<JSArrayBuffer> array_buffer,
|
2013-05-23 10:01:42 +00:00
|
|
|
bool is_external,
|
2013-04-25 12:02:23 +00:00
|
|
|
void* data,
|
|
|
|
size_t allocated_length);
|
|
|
|
|
|
|
|
static bool SetupArrayBufferAllocatingData(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<JSArrayBuffer> array_buffer,
|
2013-08-01 08:52:21 +00:00
|
|
|
size_t allocated_length,
|
|
|
|
bool initialize = true);
|
2013-04-25 12:02:23 +00:00
|
|
|
|
2013-06-19 11:53:30 +00:00
|
|
|
static void FreeArrayBuffer(
|
|
|
|
Isolate* isolate,
|
|
|
|
JSArrayBuffer* phantom_array_buffer);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Helper functions used stubs.
|
|
|
|
static void PerformGC(Object* result);
|
2011-12-14 13:01:27 +00:00
|
|
|
|
|
|
|
// Used in runtime.cc and hydrogen's VisitArrayLiteral.
|
|
|
|
static Handle<Object> CreateArrayLiteralBoilerplate(
|
|
|
|
Isolate* isolate,
|
|
|
|
Handle<FixedArray> literals,
|
|
|
|
Handle<FixedArray> elements);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2011-09-01 11:57:02 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Constants used by interface to runtime functions.
|
|
|
|
|
2011-11-24 15:17:04 +00:00
|
|
|
class DeclareGlobalsEvalFlag: public BitField<bool, 0, 1> {};
|
|
|
|
class DeclareGlobalsNativeFlag: public BitField<bool, 1, 1> {};
|
|
|
|
class DeclareGlobalsLanguageMode: public BitField<LanguageMode, 2, 2> {};
|
2011-09-01 11:57:02 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_RUNTIME_H_
|