2014-03-31 12:01:02 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_FACTORY_H_
|
|
|
|
#define V8_FACTORY_H_
|
|
|
|
|
2014-03-31 12:01:02 +00:00
|
|
|
#include "isolate.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Interface for handle based allocation.
|
|
|
|
|
2014-03-31 12:01:02 +00:00
|
|
|
class Factory V8_FINAL {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2014-03-20 13:01:08 +00:00
|
|
|
// Allocates a fixed array initialized with undefined values.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<FixedArray> NewFixedArray(
|
2008-07-03 15:10:15 +00:00
|
|
|
int size,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-10-29 10:02:09 +00:00
|
|
|
|
|
|
|
// Allocate a new fixed array with non-existing entries (the hole).
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<FixedArray> NewFixedArrayWithHoles(
|
2010-04-14 14:46:15 +00:00
|
|
|
int size,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-10-29 10:02:09 +00:00
|
|
|
|
2014-03-20 13:01:08 +00:00
|
|
|
// Allocates an uninitialized fixed array. It must be filled by the caller.
|
|
|
|
Handle<FixedArray> NewUninitializedFixedArray(int size);
|
|
|
|
|
2011-06-09 10:03:35 +00:00
|
|
|
// Allocate a new uninitialized fixed double array.
|
2011-10-19 11:36:55 +00:00
|
|
|
Handle<FixedDoubleArray> NewFixedDoubleArray(
|
2011-06-09 10:03:35 +00:00
|
|
|
int size,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2013-10-14 13:35:06 +00:00
|
|
|
Handle<ConstantPoolArray> NewConstantPoolArray(
|
|
|
|
int number_of_int64_entries,
|
2014-03-10 19:05:43 +00:00
|
|
|
int number_of_code_ptr_entries,
|
|
|
|
int number_of_heap_ptr_entries,
|
2013-10-14 13:35:06 +00:00
|
|
|
int number_of_int32_entries);
|
|
|
|
|
2012-01-16 09:44:35 +00:00
|
|
|
Handle<SeededNumberDictionary> NewSeededNumberDictionary(
|
|
|
|
int at_least_space_for);
|
|
|
|
|
|
|
|
Handle<UnseededNumberDictionary> NewUnseededNumberDictionary(
|
|
|
|
int at_least_space_for);
|
2009-07-02 06:50:43 +00:00
|
|
|
|
2013-03-04 15:00:57 +00:00
|
|
|
Handle<NameDictionary> NewNameDictionary(int at_least_space_for);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-11-05 11:47:11 +00:00
|
|
|
Handle<ObjectHashTable> NewObjectHashTable(
|
|
|
|
int at_least_space_for,
|
|
|
|
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY);
|
2011-07-28 17:21:22 +00:00
|
|
|
|
2014-04-04 20:41:57 +00:00
|
|
|
Handle<OrderedHashSet> NewOrderedHashSet();
|
|
|
|
Handle<OrderedHashMap> NewOrderedHashMap();
|
|
|
|
|
2013-10-04 07:25:24 +00:00
|
|
|
Handle<WeakHashTable> NewWeakHashTable(int at_least_space_for);
|
|
|
|
|
2012-09-18 13:25:12 +00:00
|
|
|
Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors,
|
|
|
|
int slack = 0);
|
2014-04-09 14:26:32 +00:00
|
|
|
Handle<TransitionArray> NewTransitionArray(int number_of_transitions);
|
|
|
|
Handle<TransitionArray> NewSimpleTransitionArray(Handle<Map> target);
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<DeoptimizationInputData> NewDeoptimizationInputData(
|
2010-12-07 11:31:57 +00:00
|
|
|
int deopt_entry_count,
|
|
|
|
PretenureFlag pretenure);
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<DeoptimizationOutputData> NewDeoptimizationOutputData(
|
2010-12-07 11:31:57 +00:00
|
|
|
int deopt_entry_count,
|
|
|
|
PretenureFlag pretenure);
|
2014-04-07 10:12:54 +00:00
|
|
|
|
2014-04-07 12:43:35 +00:00
|
|
|
// Create a new boxed value.
|
|
|
|
Handle<Box> NewBox(Handle<Object> value);
|
|
|
|
|
2014-04-07 10:12:54 +00:00
|
|
|
// Create a pre-tenured empty AccessorPair.
|
2012-01-10 16:11:33 +00:00
|
|
|
Handle<AccessorPair> NewAccessorPair();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-04-07 10:12:54 +00:00
|
|
|
// Create an empty TypeFeedbackInfo.
|
2012-02-20 12:57:23 +00:00
|
|
|
Handle<TypeFeedbackInfo> NewTypeFeedbackInfo();
|
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
Handle<String> InternalizeUtf8String(Vector<const char> str);
|
|
|
|
Handle<String> InternalizeUtf8String(const char* str) {
|
|
|
|
return InternalizeUtf8String(CStrVector(str));
|
2012-12-17 15:56:16 +00:00
|
|
|
}
|
2013-02-28 17:03:34 +00:00
|
|
|
Handle<String> InternalizeString(Handle<String> str);
|
|
|
|
Handle<String> InternalizeOneByteString(Vector<const uint8_t> str);
|
2014-01-29 14:31:34 +00:00
|
|
|
Handle<String> InternalizeOneByteString(
|
|
|
|
Handle<SeqOneByteString>, int from, int length);
|
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
Handle<String> InternalizeTwoByteString(Vector<const uc16> str);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-01-17 10:27:57 +00:00
|
|
|
template<class StringTableKey>
|
|
|
|
Handle<String> InternalizeStringWithKey(StringTableKey* key);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// String creation functions. Most of the string creation functions take
|
|
|
|
// a Heap::PretenureFlag argument to optionally request that they be
|
|
|
|
// allocated in the old generation. The pretenure flag defaults to
|
|
|
|
// DONT_TENURE.
|
|
|
|
//
|
|
|
|
// Creates a new String object. There are two String encodings: ASCII and
|
|
|
|
// two byte. One should choose between the three string factory functions
|
|
|
|
// based on the encoding of the string buffer that the string is
|
|
|
|
// initialized from.
|
|
|
|
// - ...FromAscii initializes the string from a buffer that is ASCII
|
|
|
|
// encoded (it does not check that the buffer is ASCII encoded) and
|
|
|
|
// the result will be ASCII encoded.
|
|
|
|
// - ...FromUtf8 initializes the string from a buffer that is UTF-8
|
|
|
|
// encoded. If the characters are all single-byte characters, the
|
|
|
|
// result will be ASCII encoded, otherwise it will converted to two
|
|
|
|
// byte.
|
|
|
|
// - ...FromTwoByte initializes the string from a buffer that is two
|
|
|
|
// byte encoded. If the characters are all single-byte characters,
|
|
|
|
// the result will be converted to ASCII, otherwise it will be left as
|
|
|
|
// two byte.
|
|
|
|
//
|
|
|
|
// ASCII strings are pretenured when used as keys in the SourceCodeCache.
|
2013-01-09 10:30:54 +00:00
|
|
|
Handle<String> NewStringFromOneByte(
|
|
|
|
Vector<const uint8_t> str,
|
2008-07-03 15:10:15 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2013-01-09 10:30:54 +00:00
|
|
|
// TODO(dcarney): remove this function.
|
|
|
|
inline Handle<String> NewStringFromAscii(
|
|
|
|
Vector<const char> str,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED) {
|
|
|
|
return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure);
|
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// UTF8 strings are pretenured when used for regexp literal patterns and
|
|
|
|
// flags in the parser.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<String> NewStringFromUtf8(
|
2008-07-03 15:10:15 +00:00
|
|
|
Vector<const char> str,
|
2012-09-04 12:23:22 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<String> NewStringFromTwoByte(
|
2010-07-05 12:49:00 +00:00
|
|
|
Vector<const uc16> str,
|
2009-08-18 07:14:02 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-07-05 12:49:00 +00:00
|
|
|
// Allocates and partially initializes an ASCII or TwoByte String. The
|
|
|
|
// characters of the string are uninitialized. Currently used in regexp code
|
|
|
|
// only, where they are pretenured.
|
2014-04-04 12:06:11 +00:00
|
|
|
MUST_USE_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString(
|
2010-07-05 12:49:00 +00:00
|
|
|
int length,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2014-04-04 12:06:11 +00:00
|
|
|
MUST_USE_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString(
|
2008-07-03 15:10:15 +00:00
|
|
|
int length,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2014-04-08 06:45:53 +00:00
|
|
|
Handle<String> LookupSingleCharacterStringFromCode(uint32_t index);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Create a new cons string object which consists of a pair of strings.
|
2014-04-03 12:30:37 +00:00
|
|
|
MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left,
|
|
|
|
Handle<String> right);
|
2013-12-23 12:37:56 +00:00
|
|
|
|
|
|
|
Handle<ConsString> NewRawConsString(String::Encoding encoding);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-21 09:24:30 +00:00
|
|
|
// Create a new sequential string containing the concatenation of the inputs.
|
|
|
|
Handle<String> NewFlatConcatString(Handle<String> first,
|
|
|
|
Handle<String> second);
|
|
|
|
|
2011-06-27 09:02:34 +00:00
|
|
|
// Create a new string object which holds a proper substring of a string.
|
|
|
|
Handle<String> NewProperSubString(Handle<String> str,
|
2011-06-22 14:20:23 +00:00
|
|
|
int begin,
|
|
|
|
int end);
|
|
|
|
|
2013-12-23 12:37:56 +00:00
|
|
|
// Create a new string object which holds a substring of a string.
|
|
|
|
Handle<String> NewSubString(Handle<String> str, int begin, int end) {
|
|
|
|
if (begin == 0 && end == str->length()) return str;
|
|
|
|
return NewProperSubString(str, begin, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
Handle<SlicedString> NewRawSlicedString(String::Encoding encoding);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Creates a new external String object. There are two String encodings
|
|
|
|
// in the system: ASCII and two byte. Unlike other String types, it does
|
|
|
|
// not make sense to have a UTF-8 factory function for external strings,
|
|
|
|
// because we cannot change the underlying buffer.
|
2014-04-04 12:06:11 +00:00
|
|
|
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii(
|
2011-09-21 13:28:09 +00:00
|
|
|
const ExternalAsciiString::Resource* resource);
|
2014-04-04 12:06:11 +00:00
|
|
|
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte(
|
2011-09-21 13:28:09 +00:00
|
|
|
const ExternalTwoByteString::Resource* resource);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-03-01 10:34:31 +00:00
|
|
|
// Create a symbol.
|
|
|
|
Handle<Symbol> NewSymbol();
|
Provide private symbols through internal APIs
Adds a notion of private symbols, mainly intended for internal use, especially, self-hosting of built-in types that would otherwise require new C++ classes.
On the JS side (i.e., in built-ins), private properties can be created and accessed through a set of macros:
NEW_PRIVATE(print_name)
HAS_PRIVATE(obj, sym)
GET_PRIVATE(obj, sym)
SET_PRIVATE(obj, sym, val)
DELETE_PRIVATE(obj, sym)
In the V8 API, they are accessible via a new class Private, and respective HasPrivate/Get/Private/SetPrivate/DeletePrivate methods on calss Object.
These APIs are designed and restricted such that their implementation can later be replaced by whatever ES7+ will officially provide.
R=yangguo@chromium.org
BUG=
Review URL: https://codereview.chromium.org/48923002
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17683 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2013-11-13 10:34:06 +00:00
|
|
|
Handle<Symbol> NewPrivateSymbol();
|
2013-03-01 10:34:31 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Create a global (but otherwise uninitialized) context.
|
2012-08-17 09:03:08 +00:00
|
|
|
Handle<Context> NewNativeContext();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-08-27 09:40:26 +00:00
|
|
|
// Create a global context.
|
|
|
|
Handle<Context> NewGlobalContext(Handle<JSFunction> function,
|
|
|
|
Handle<ScopeInfo> scope_info);
|
|
|
|
|
2012-04-16 14:43:27 +00:00
|
|
|
// Create a module context.
|
2012-07-09 08:59:03 +00:00
|
|
|
Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info);
|
2012-04-16 14:43:27 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Create a function context.
|
2012-04-16 14:43:27 +00:00
|
|
|
Handle<Context> NewFunctionContext(int length, Handle<JSFunction> function);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-06-09 11:26:01 +00:00
|
|
|
// Create a catch context.
|
2011-06-29 07:41:42 +00:00
|
|
|
Handle<Context> NewCatchContext(Handle<JSFunction> function,
|
|
|
|
Handle<Context> previous,
|
2011-06-16 06:37:49 +00:00
|
|
|
Handle<String> name,
|
|
|
|
Handle<Object> thrown_object);
|
2011-06-09 11:26:01 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Create a 'with' context.
|
2011-06-29 07:41:42 +00:00
|
|
|
Handle<Context> NewWithContext(Handle<JSFunction> function,
|
|
|
|
Handle<Context> previous,
|
2014-04-09 08:51:46 +00:00
|
|
|
Handle<JSReceiver> extension);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-04-16 14:43:27 +00:00
|
|
|
// Create a block context.
|
2011-08-11 16:29:28 +00:00
|
|
|
Handle<Context> NewBlockContext(Handle<JSFunction> function,
|
|
|
|
Handle<Context> previous,
|
2011-11-03 10:36:55 +00:00
|
|
|
Handle<ScopeInfo> scope_info);
|
2011-08-11 16:29:28 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Allocate a new struct. The struct is pretenured (allocated directly in
|
|
|
|
// the old generation).
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Struct> NewStruct(InstanceType type);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-11-14 17:30:48 +00:00
|
|
|
Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
|
|
|
|
int aliased_context_slot);
|
|
|
|
|
2013-03-07 11:42:58 +00:00
|
|
|
Handle<DeclaredAccessorDescriptor> NewDeclaredAccessorDescriptor();
|
|
|
|
|
2013-02-12 14:33:08 +00:00
|
|
|
Handle<DeclaredAccessorInfo> NewDeclaredAccessorInfo();
|
|
|
|
|
|
|
|
Handle<ExecutableAccessorInfo> NewExecutableAccessorInfo();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Script> NewScript(Handle<String> source);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-05-19 11:47:34 +00:00
|
|
|
// Foreign objects are pretenured when allocated by the bootstrapper.
|
|
|
|
Handle<Foreign> NewForeign(Address addr,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-05-19 11:47:34 +00:00
|
|
|
// Allocate a new foreign object. The foreign is pretenured (allocated
|
|
|
|
// directly in the old generation).
|
|
|
|
Handle<Foreign> NewForeign(const AccessorDescriptor* foreign);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<ByteArray> NewByteArray(int length,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2009-07-28 08:43:51 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<ExternalArray> NewExternalArray(
|
2009-10-20 15:26:17 +00:00
|
|
|
int length,
|
|
|
|
ExternalArrayType array_type,
|
|
|
|
void* external_pointer,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2014-01-16 17:08:45 +00:00
|
|
|
|
|
|
|
Handle<FixedTypedArrayBase> NewFixedTypedArray(
|
|
|
|
int length,
|
|
|
|
ExternalArrayType array_type,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2009-10-20 15:26:17 +00:00
|
|
|
|
2013-06-12 15:03:44 +00:00
|
|
|
Handle<Cell> NewCell(Handle<Object> value);
|
|
|
|
|
2013-10-21 13:55:24 +00:00
|
|
|
Handle<PropertyCell> NewPropertyCellWithHole();
|
|
|
|
|
2013-06-14 16:06:12 +00:00
|
|
|
Handle<PropertyCell> NewPropertyCell(Handle<Object> value);
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2013-07-08 10:02:16 +00:00
|
|
|
Handle<AllocationSite> NewAllocationSite();
|
|
|
|
|
2012-05-23 14:24:29 +00:00
|
|
|
Handle<Map> NewMap(
|
|
|
|
InstanceType type,
|
|
|
|
int instance_size,
|
|
|
|
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-03-17 13:42:37 +00:00
|
|
|
// This method expects a COW array in new space, and creates a copy
|
|
|
|
// of it in old space.
|
|
|
|
Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array);
|
|
|
|
|
2012-11-13 12:27:03 +00:00
|
|
|
Handle<FixedArray> CopySizeFixedArray(Handle<FixedArray> array,
|
2013-10-04 07:25:24 +00:00
|
|
|
int new_length,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2012-11-13 12:27:03 +00:00
|
|
|
|
2011-10-19 11:36:55 +00:00
|
|
|
Handle<FixedDoubleArray> CopyFixedDoubleArray(
|
|
|
|
Handle<FixedDoubleArray> array);
|
|
|
|
|
2013-10-14 13:35:06 +00:00
|
|
|
Handle<ConstantPoolArray> CopyConstantPoolArray(
|
|
|
|
Handle<ConstantPoolArray> array);
|
|
|
|
|
2012-01-16 12:38:59 +00:00
|
|
|
// Numbers (e.g. literals) are pretenured by the parser.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Object> NewNumber(double value,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-11-21 10:18:47 +00:00
|
|
|
Handle<Object> NewNumberFromInt(int32_t value,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
Handle<Object> NewNumberFromUint(uint32_t value,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2014-03-31 12:01:02 +00:00
|
|
|
Handle<Object> NewNumberFromSize(size_t value,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED) {
|
|
|
|
if (Smi::IsValid(static_cast<intptr_t>(value))) {
|
|
|
|
return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
|
|
|
|
isolate());
|
|
|
|
}
|
|
|
|
return NewNumber(static_cast<double>(value), pretenure);
|
|
|
|
}
|
2013-05-08 15:02:08 +00:00
|
|
|
Handle<HeapNumber> NewHeapNumber(double value,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2013-05-14 15:03:27 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// These objects are used by the api to create env-independent data
|
|
|
|
// structures in the heap.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSObject> NewNeanderObject();
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSObject> NewArgumentsObject(Handle<Object> callee, int length);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// JS objects are pretenured when allocated by the bootstrapper and
|
|
|
|
// runtime.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSObject> NewJSObject(Handle<JSFunction> constructor,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2014-03-19 13:39:09 +00:00
|
|
|
// JSObject that should have a memento pointing to the allocation site.
|
|
|
|
Handle<JSObject> NewJSObjectWithMemento(Handle<JSFunction> constructor,
|
|
|
|
Handle<AllocationSite> site);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-10-21 13:55:24 +00:00
|
|
|
// Global objects are pretenured and initialized based on a constructor.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<GlobalObject> NewGlobalObject(Handle<JSFunction> constructor);
|
2009-06-30 10:05:36 +00:00
|
|
|
|
2008-09-25 07:46:07 +00:00
|
|
|
// JS objects are pretenured when allocated by the bootstrapper and
|
|
|
|
// runtime.
|
2014-03-17 15:01:45 +00:00
|
|
|
Handle<JSObject> NewJSObjectFromMap(
|
|
|
|
Handle<Map> map,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED,
|
|
|
|
bool allocate_properties = true,
|
|
|
|
Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null());
|
2013-08-07 11:24:14 +00:00
|
|
|
|
2014-04-08 06:15:20 +00:00
|
|
|
Handle<JSObject> NewJSObjectFromMapForDeoptimizer(
|
|
|
|
Handle<Map> map, PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2012-04-16 14:43:27 +00:00
|
|
|
// JS modules are pretenured.
|
2012-07-09 08:59:03 +00:00
|
|
|
Handle<JSModule> NewJSModule(Handle<Context> context,
|
|
|
|
Handle<ScopeInfo> scope_info);
|
2012-04-16 14:43:27 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// JS arrays are pretenured when allocated by the parser.
|
2014-04-07 10:00:14 +00:00
|
|
|
|
2014-04-07 12:43:35 +00:00
|
|
|
// Create a JSArray with no elements.
|
2014-04-07 10:00:14 +00:00
|
|
|
Handle<JSArray> NewJSArray(
|
|
|
|
ElementsKind elements_kind,
|
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2014-04-07 12:43:35 +00:00
|
|
|
// Create a JSArray with a specified length and elements initialized
|
|
|
|
// according to the specified mode.
|
2014-03-21 11:22:16 +00:00
|
|
|
Handle<JSArray> NewJSArray(
|
|
|
|
ElementsKind elements_kind,
|
|
|
|
int length,
|
|
|
|
int capacity,
|
2014-03-27 16:41:09 +00:00
|
|
|
ArrayStorageAllocationMode mode = INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE,
|
2014-03-21 11:22:16 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
|
|
|
|
2012-05-23 14:24:29 +00:00
|
|
|
Handle<JSArray> NewJSArray(
|
|
|
|
int capacity,
|
|
|
|
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
|
2014-03-21 11:22:16 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED) {
|
2014-04-03 09:12:59 +00:00
|
|
|
if (capacity != 0) {
|
|
|
|
elements_kind = GetHoleyElementsKind(elements_kind);
|
|
|
|
}
|
2014-03-27 16:41:09 +00:00
|
|
|
return NewJSArray(elements_kind, 0, capacity,
|
|
|
|
INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure);
|
2014-03-21 11:22:16 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 12:43:35 +00:00
|
|
|
// Create a JSArray with the given elements.
|
2014-03-21 11:22:16 +00:00
|
|
|
Handle<JSArray> NewJSArrayWithElements(
|
|
|
|
Handle<FixedArrayBase> elements,
|
|
|
|
ElementsKind elements_kind,
|
|
|
|
int length,
|
2012-05-23 14:24:29 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSArray> NewJSArrayWithElements(
|
2011-12-09 08:50:19 +00:00
|
|
|
Handle<FixedArrayBase> elements,
|
2012-05-23 14:24:29 +00:00
|
|
|
ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
|
2014-03-21 11:22:16 +00:00
|
|
|
PretenureFlag pretenure = NOT_TENURED) {
|
|
|
|
return NewJSArrayWithElements(
|
|
|
|
elements, elements_kind, elements->length(), pretenure);
|
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-03-17 15:01:45 +00:00
|
|
|
void NewJSArrayStorage(
|
|
|
|
Handle<JSArray> array,
|
|
|
|
int length,
|
|
|
|
int capacity,
|
|
|
|
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS);
|
|
|
|
|
2013-11-05 12:11:27 +00:00
|
|
|
Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function);
|
|
|
|
|
2013-04-25 12:02:23 +00:00
|
|
|
Handle<JSArrayBuffer> NewJSArrayBuffer();
|
|
|
|
|
2013-04-29 11:09:03 +00:00
|
|
|
Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type);
|
|
|
|
|
2013-06-21 13:02:38 +00:00
|
|
|
Handle<JSDataView> NewJSDataView();
|
|
|
|
|
2011-05-13 10:58:25 +00:00
|
|
|
Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype);
|
|
|
|
|
2011-09-13 11:42:57 +00:00
|
|
|
// Change the type of the argument into a JS object/function and reinitialize.
|
|
|
|
void BecomeJSObject(Handle<JSReceiver> object);
|
|
|
|
void BecomeJSFunction(Handle<JSReceiver> object);
|
2011-07-18 13:04:52 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunction(Handle<String> name,
|
|
|
|
Handle<Object> prototype);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunctionWithoutPrototype(
|
2011-03-17 20:28:17 +00:00
|
|
|
Handle<String> name,
|
2014-03-11 14:41:22 +00:00
|
|
|
StrictMode strict_mode);
|
2010-04-28 12:05:40 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunction(Handle<Object> super, bool is_global);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> BaseNewFunctionFromSharedFunctionInfo(
|
2010-03-23 06:04:44 +00:00
|
|
|
Handle<SharedFunctionInfo> function_info,
|
|
|
|
Handle<Map> function_map,
|
|
|
|
PretenureFlag pretenure);
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
|
2010-03-23 06:04:44 +00:00
|
|
|
Handle<SharedFunctionInfo> function_info,
|
2009-12-16 15:43:20 +00:00
|
|
|
Handle<Context> context,
|
|
|
|
PretenureFlag pretenure = TENURED);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-04-07 10:12:54 +00:00
|
|
|
// Create a serialized scope info.
|
2011-11-03 10:36:55 +00:00
|
|
|
Handle<ScopeInfo> NewScopeInfo(int length);
|
2011-08-11 16:29:28 +00:00
|
|
|
|
2014-04-07 10:12:54 +00:00
|
|
|
// Create an External object for V8's external API.
|
2012-11-13 12:27:03 +00:00
|
|
|
Handle<JSObject> NewExternal(void* value);
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Code> NewCode(const CodeDesc& desc,
|
|
|
|
Code::Flags flags,
|
|
|
|
Handle<Object> self_reference,
|
2013-04-18 09:50:46 +00:00
|
|
|
bool immovable = false,
|
2013-10-23 13:48:04 +00:00
|
|
|
bool crankshafted = false,
|
|
|
|
int prologue_offset = Code::kPrologueOffsetNotSet);
|
2008-11-25 11:07:48 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Code> CopyCode(Handle<Code> code);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info);
|
2010-03-15 21:06:51 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Object> ToObject(Handle<Object> object);
|
|
|
|
Handle<Object> ToObject(Handle<Object> object,
|
2012-08-17 09:03:08 +00:00
|
|
|
Handle<Context> native_context);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Interface for creating error objects.
|
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewError(const char* maker, const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSArray> args);
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<String> EmergencyNewError(const char* message, Handle<JSArray> args);
|
|
|
|
Handle<Object> NewError(const char* maker, const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewError(const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
|
|
|
Handle<Object> NewError(Handle<String> message);
|
|
|
|
Handle<Object> NewError(const char* constructor,
|
|
|
|
Handle<String> message);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewTypeError(const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
|
|
|
Handle<Object> NewTypeError(Handle<String> message);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewRangeError(const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
|
|
|
Handle<Object> NewRangeError(Handle<String> message);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-04-03 12:30:37 +00:00
|
|
|
Handle<Object> NewInvalidStringLengthError() {
|
|
|
|
return NewRangeError("invalid_string_length",
|
|
|
|
HandleVector<Object>(NULL, 0));
|
|
|
|
}
|
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewSyntaxError(const char* message, Handle<JSArray> args);
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Object> NewSyntaxError(Handle<String> message);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewReferenceError(const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
2014-03-17 10:21:01 +00:00
|
|
|
Handle<Object> NewReferenceError(const char* message, Handle<JSArray> args);
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Object> NewReferenceError(Handle<String> message);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-06 13:28:22 +00:00
|
|
|
Handle<Object> NewEvalError(const char* message,
|
2011-03-18 20:35:07 +00:00
|
|
|
Vector< Handle<Object> > args);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunction(Handle<String> name,
|
|
|
|
InstanceType type,
|
|
|
|
int instance_size,
|
|
|
|
Handle<Code> code,
|
|
|
|
bool force_initial_map);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunction(Handle<Map> function_map,
|
2008-07-03 15:10:15 +00:00
|
|
|
Handle<SharedFunctionInfo> shared, Handle<Object> prototype);
|
|
|
|
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunctionWithPrototype(Handle<String> name,
|
|
|
|
InstanceType type,
|
|
|
|
int instance_size,
|
|
|
|
Handle<JSObject> prototype,
|
|
|
|
Handle<Code> code,
|
|
|
|
bool force_initial_map);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
|
|
|
|
Handle<Code> code);
|
2010-04-28 12:05:40 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<String> NumberToString(Handle<Object> number);
|
2011-09-22 10:45:37 +00:00
|
|
|
Handle<String> Uint32ToString(uint32_t value);
|
2009-10-02 13:43:16 +00:00
|
|
|
|
Split window support from V8.
Here is a description of the background and design of split window in Chrome and V8:
https://docs.google.com/a/google.com/Doc?id=chhjkpg_47fwddxbfr
This change list splits the window object into two parts: 1) an inner window object used as the global object of contexts; 2) an outer window object exposed to JavaScript and accessible by the name 'window'. Firefox did it awhile ago, here are some discussions: https://wiki.mozilla.org/Gecko:SplitWindow. One additional benefit of splitting window in Chrome is that accessing global variables don't need security checks anymore, it can improve applications that use many global variables.
V8 support of split window:
There are a small number of changes on V8 api to support split window:
Security context is removed from V8, so does related API functions;
A global object can be detached from its context and reused by a new context;
Access checks on an object template can be turned on/off by default;
An object can turn on its access checks later;
V8 has a new object type, ApiGlobalObject, which is the outer window object type. The existing JSGlobalObject becomes the inner window object type. Security checks are moved from JSGlobalObject to ApiGlobalObject. ApiGlobalObject is the one exposed to JavaScript, it is accessible through Context::Global(). ApiGlobalObject's prototype is set to JSGlobalObject so that property lookups are forwarded to JSGlobalObject. ApiGlobalObject forwards all other property access requests to JSGlobalObject, such as SetProperty, DeleteProperty, etc.
Security token is moved to a global context, and ApiGlobalObject has a reference to its global context. JSGlobalObject has a reference to its global context as well. When accessing properties on a global object in JavaScript, the domain security check is performed by comparing the security token of the lexical context (Top::global_context()) to the token of global object's context. The check is only needed when the receiver is a window object, such as 'window.document'. Accessing global variables, such as 'var foo = 3; foo' does not need checks because the receiver is the inner window object.
When an outer window is detached from its global context (when a frame navigates away from a page), it is completely detached from the inner window. A new context is created for the new page, and the outer global object is reused. At this point, the access check on the DOMWindow wrapper of the old context is turned on. The code in old context is still able to access DOMWindow properties, but it has to go through domain security checks.
It is debatable on how to implement the outer window object. Currently each property access function has to check if the receiver is ApiGlobalObject type. This approach might be error-prone that one may forget to check the receiver when adding new functions. It is unlikely a performance issue because accessing global variables are more common than 'window.foo' style coding.
I am still working on the ARM port, and I'd like to hear comments and suggestions on the best way to support it in V8.
Review URL: http://codereview.chromium.org/7366
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@540 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-21 19:07:58 +00:00
|
|
|
enum ApiInstanceType {
|
|
|
|
JavaScriptObject,
|
|
|
|
InnerGlobalObject,
|
|
|
|
OuterGlobalObject
|
|
|
|
};
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> CreateApiFunction(
|
Split window support from V8.
Here is a description of the background and design of split window in Chrome and V8:
https://docs.google.com/a/google.com/Doc?id=chhjkpg_47fwddxbfr
This change list splits the window object into two parts: 1) an inner window object used as the global object of contexts; 2) an outer window object exposed to JavaScript and accessible by the name 'window'. Firefox did it awhile ago, here are some discussions: https://wiki.mozilla.org/Gecko:SplitWindow. One additional benefit of splitting window in Chrome is that accessing global variables don't need security checks anymore, it can improve applications that use many global variables.
V8 support of split window:
There are a small number of changes on V8 api to support split window:
Security context is removed from V8, so does related API functions;
A global object can be detached from its context and reused by a new context;
Access checks on an object template can be turned on/off by default;
An object can turn on its access checks later;
V8 has a new object type, ApiGlobalObject, which is the outer window object type. The existing JSGlobalObject becomes the inner window object type. Security checks are moved from JSGlobalObject to ApiGlobalObject. ApiGlobalObject is the one exposed to JavaScript, it is accessible through Context::Global(). ApiGlobalObject's prototype is set to JSGlobalObject so that property lookups are forwarded to JSGlobalObject. ApiGlobalObject forwards all other property access requests to JSGlobalObject, such as SetProperty, DeleteProperty, etc.
Security token is moved to a global context, and ApiGlobalObject has a reference to its global context. JSGlobalObject has a reference to its global context as well. When accessing properties on a global object in JavaScript, the domain security check is performed by comparing the security token of the lexical context (Top::global_context()) to the token of global object's context. The check is only needed when the receiver is a window object, such as 'window.document'. Accessing global variables, such as 'var foo = 3; foo' does not need checks because the receiver is the inner window object.
When an outer window is detached from its global context (when a frame navigates away from a page), it is completely detached from the inner window. A new context is created for the new page, and the outer global object is reused. At this point, the access check on the DOMWindow wrapper of the old context is turned on. The code in old context is still able to access DOMWindow properties, but it has to go through domain security checks.
It is debatable on how to implement the outer window object. Currently each property access function has to check if the receiver is ApiGlobalObject type. This approach might be error-prone that one may forget to check the receiver when adding new functions. It is unlikely a performance issue because accessing global variables are more common than 'window.foo' style coding.
I am still working on the ARM port, and I'd like to hear comments and suggestions on the best way to support it in V8.
Review URL: http://codereview.chromium.org/7366
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@540 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2008-10-21 19:07:58 +00:00
|
|
|
Handle<FunctionTemplateInfo> data,
|
|
|
|
ApiInstanceType type = JavaScriptObject);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> InstallMembers(Handle<JSFunction> function);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Installs interceptors on the instance. 'desc' is a function template,
|
|
|
|
// and instance is an object instance created by the function of this
|
2009-01-15 19:08:34 +00:00
|
|
|
// function template.
|
2011-03-18 20:35:07 +00:00
|
|
|
void ConfigureInstance(Handle<FunctionTemplateInfo> desc,
|
|
|
|
Handle<JSObject> instance,
|
|
|
|
bool* pending_exception);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-07-08 19:12:58 +00:00
|
|
|
#define ROOT_ACCESSOR(type, name, camel_name) \
|
2011-03-18 20:35:07 +00:00
|
|
|
inline Handle<type> name() { \
|
2010-08-11 10:52:34 +00:00
|
|
|
return Handle<type>(BitCast<type**>( \
|
2011-03-18 20:35:07 +00:00
|
|
|
&isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \
|
2009-07-08 19:12:58 +00:00
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
ROOT_LIST(ROOT_ACCESSOR)
|
2013-09-20 09:27:40 +00:00
|
|
|
#undef ROOT_ACCESSOR
|
|
|
|
|
|
|
|
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
|
|
|
|
inline Handle<Map> name##_map() { \
|
|
|
|
return Handle<Map>(BitCast<Map**>( \
|
|
|
|
&isolate()->heap()->roots_[Heap::k##Name##MapRootIndex])); \
|
|
|
|
}
|
|
|
|
STRUCT_LIST(STRUCT_MAP_ACCESSOR)
|
|
|
|
#undef STRUCT_MAP_ACCESSOR
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
#define STRING_ACCESSOR(name, str) \
|
2011-03-18 20:35:07 +00:00
|
|
|
inline Handle<String> name() { \
|
2010-08-11 10:52:34 +00:00
|
|
|
return Handle<String>(BitCast<String**>( \
|
2011-03-18 20:35:07 +00:00
|
|
|
&isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
|
2009-07-08 19:12:58 +00:00
|
|
|
}
|
2013-02-28 17:03:34 +00:00
|
|
|
INTERNALIZED_STRING_LIST(STRING_ACCESSOR)
|
|
|
|
#undef STRING_ACCESSOR
|
2009-03-19 19:29:23 +00:00
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
Handle<String> hidden_string() {
|
|
|
|
return Handle<String>(&isolate()->heap()->hidden_string_);
|
2009-03-19 18:50:00 +00:00
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<SharedFunctionInfo> NewSharedFunctionInfo(
|
2010-07-13 13:06:33 +00:00
|
|
|
Handle<String> name,
|
|
|
|
int number_of_literals,
|
2013-04-17 15:01:25 +00:00
|
|
|
bool is_generator,
|
2010-07-13 13:06:33 +00:00
|
|
|
Handle<Code> code,
|
2014-03-17 08:31:21 +00:00
|
|
|
Handle<ScopeInfo> scope_info);
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSMessageObject> NewJSMessageObject(
|
2011-02-02 13:31:52 +00:00
|
|
|
Handle<String> type,
|
|
|
|
Handle<JSArray> arguments,
|
|
|
|
int start_position,
|
|
|
|
int end_position,
|
|
|
|
Handle<Object> script,
|
|
|
|
Handle<Object> stack_frames);
|
|
|
|
|
2012-01-16 09:44:35 +00:00
|
|
|
Handle<SeededNumberDictionary> DictionaryAtNumberPut(
|
|
|
|
Handle<SeededNumberDictionary>,
|
|
|
|
uint32_t key,
|
|
|
|
Handle<Object> value);
|
|
|
|
|
|
|
|
Handle<UnseededNumberDictionary> DictionaryAtNumberPut(
|
|
|
|
Handle<UnseededNumberDictionary>,
|
2009-07-02 06:50:43 +00:00
|
|
|
uint32_t key,
|
|
|
|
Handle<Object> value);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-04-20 16:36:13 +00:00
|
|
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
|
2009-04-20 16:36:13 +00:00
|
|
|
#endif
|
2008-09-25 07:46:07 +00:00
|
|
|
|
2012-08-17 09:03:08 +00:00
|
|
|
// Return a map using the map cache in the native context.
|
2008-09-25 07:46:07 +00:00
|
|
|
// The key the an ordered set of property names.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context,
|
|
|
|
Handle<FixedArray> keys);
|
2008-09-25 07:46:07 +00:00
|
|
|
|
2008-10-24 08:40:02 +00:00
|
|
|
// Creates a new FixedArray that holds the data associated with the
|
2009-03-11 14:00:55 +00:00
|
|
|
// atom regexp and stores it in the regexp.
|
2011-03-18 20:35:07 +00:00
|
|
|
void SetRegExpAtomData(Handle<JSRegExp> regexp,
|
|
|
|
JSRegExp::Type type,
|
|
|
|
Handle<String> source,
|
|
|
|
JSRegExp::Flags flags,
|
|
|
|
Handle<Object> match_pattern);
|
2009-03-11 14:00:55 +00:00
|
|
|
|
|
|
|
// Creates a new FixedArray that holds the data associated with the
|
|
|
|
// irregexp regexp and stores it in the regexp.
|
2011-03-18 20:35:07 +00:00
|
|
|
void SetRegExpIrregexpData(Handle<JSRegExp> regexp,
|
|
|
|
JSRegExp::Type type,
|
|
|
|
Handle<String> source,
|
|
|
|
JSRegExp::Flags flags,
|
|
|
|
int capture_count);
|
2008-10-24 08:40:02 +00:00
|
|
|
|
2011-09-23 08:00:06 +00:00
|
|
|
// Returns the value for a known global constant (a property of the global
|
|
|
|
// object which is neither configurable nor writable) like 'undefined'.
|
|
|
|
// Returns a null handle when the given name is unknown.
|
|
|
|
Handle<Object> GlobalConstantFor(Handle<String> name);
|
|
|
|
|
2011-10-10 09:21:48 +00:00
|
|
|
// Converts the given boolean condition to JavaScript boolean value.
|
|
|
|
Handle<Object> ToBoolean(bool value);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2011-03-18 20:35:07 +00:00
|
|
|
Isolate* isolate() { return reinterpret_cast<Isolate*>(this); }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<JSFunction> NewFunctionHelper(Handle<String> name,
|
|
|
|
Handle<Object> prototype);
|
|
|
|
|
|
|
|
Handle<JSFunction> NewFunctionWithoutPrototypeHelper(
|
2011-03-17 20:28:17 +00:00
|
|
|
Handle<String> name,
|
2014-03-11 14:41:22 +00:00
|
|
|
StrictMode strict_mode);
|
2010-04-28 12:05:40 +00:00
|
|
|
|
2008-09-25 07:46:07 +00:00
|
|
|
// Create a new map cache.
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<MapCache> NewMapCache(int at_least_space_for);
|
2008-09-25 07:46:07 +00:00
|
|
|
|
2012-08-17 09:03:08 +00:00
|
|
|
// Update the map cache in the native context with (keys, map)
|
2011-03-18 20:35:07 +00:00
|
|
|
Handle<MapCache> AddToMapCache(Handle<Context> context,
|
|
|
|
Handle<FixedArray> keys,
|
|
|
|
Handle<Map> map);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_FACTORY_H_
|