diff options
Diffstat (limited to 'chromium/v8/src/factory.h')
-rw-r--r-- | chromium/v8/src/factory.h | 138 |
1 files changed, 34 insertions, 104 deletions
diff --git a/chromium/v8/src/factory.h b/chromium/v8/src/factory.h index 1bdf474337c..92086d4b304 100644 --- a/chromium/v8/src/factory.h +++ b/chromium/v8/src/factory.h @@ -59,6 +59,11 @@ class Factory { int size, PretenureFlag pretenure = NOT_TENURED); + Handle<ConstantPoolArray> NewConstantPoolArray( + int number_of_int64_entries, + int number_of_ptr_entries, + int number_of_int32_entries); + Handle<SeededNumberDictionary> NewSeededNumberDictionary( int at_least_space_for); @@ -69,7 +74,11 @@ class Factory { Handle<ObjectHashSet> NewObjectHashSet(int at_least_space_for); - Handle<ObjectHashTable> NewObjectHashTable(int at_least_space_for); + Handle<ObjectHashTable> NewObjectHashTable( + int at_least_space_for, + MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY); + + Handle<WeakHashTable> NewWeakHashTable(int at_least_space_for); Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors, int slack = 0); @@ -177,6 +186,7 @@ class Factory { // Create a symbol. Handle<Symbol> NewSymbol(); + Handle<Symbol> NewPrivateSymbol(); // Create a global (but otherwise uninitialized) context. Handle<Context> NewNativeContext(); @@ -214,6 +224,9 @@ class Factory { // the old generation). Handle<Struct> NewStruct(InstanceType type); + Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry( + int aliased_context_slot); + Handle<DeclaredAccessorDescriptor> NewDeclaredAccessorDescriptor(); Handle<DeclaredAccessorInfo> NewDeclaredAccessorInfo(); @@ -241,6 +254,8 @@ class Factory { Handle<Cell> NewCell(Handle<Object> value); + Handle<PropertyCell> NewPropertyCellWithHole(); + Handle<PropertyCell> NewPropertyCell(Handle<Object> value); Handle<AllocationSite> NewAllocationSite(); @@ -265,11 +280,15 @@ class Factory { Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); Handle<FixedArray> CopySizeFixedArray(Handle<FixedArray> array, - int new_length); + int new_length, + PretenureFlag pretenure = NOT_TENURED); Handle<FixedDoubleArray> CopyFixedDoubleArray( Handle<FixedDoubleArray> array); + Handle<ConstantPoolArray> CopyConstantPoolArray( + Handle<ConstantPoolArray> array); + // Numbers (e.g. literals) are pretenured by the parser. Handle<Object> NewNumber(double value, PretenureFlag pretenure = NOT_TENURED); @@ -295,7 +314,7 @@ class Factory { Handle<JSObject> NewJSObject(Handle<JSFunction> constructor, PretenureFlag pretenure = NOT_TENURED); - // Global objects are pretenured. + // Global objects are pretenured and initialized based on a constructor. Handle<GlobalObject> NewGlobalObject(Handle<JSFunction> constructor); // JS objects are pretenured when allocated by the bootstrapper and @@ -328,10 +347,7 @@ class Factory { void SetContent(Handle<JSArray> array, Handle<FixedArrayBase> elements); - void EnsureCanContainElements(Handle<JSArray> array, - Handle<FixedArrayBase> elements, - uint32_t length, - EnsureElementsMode mode); + Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); Handle<JSArrayBuffer> NewJSArrayBuffer(); @@ -372,7 +388,8 @@ class Factory { Code::Flags flags, Handle<Object> self_reference, bool immovable = false, - bool crankshafted = false); + bool crankshafted = false, + int prologue_offset = Code::kPrologueOffsetNotSet); Handle<Code> CopyCode(Handle<Code> code); @@ -462,7 +479,15 @@ class Factory { &isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \ } ROOT_LIST(ROOT_ACCESSOR) -#undef ROOT_ACCESSOR_ACCESSOR +#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 #define STRING_ACCESSOR(name, str) \ inline Handle<String> name() { \ @@ -567,101 +592,6 @@ Handle<Object> Factory::NewNumberFromSize(size_t value, } -// Used to "safely" transition from pointer-based runtime code to Handle-based -// runtime code. When a GC happens during the called Handle-based code, a -// failure object is returned to the pointer-based code to cause it abort and -// re-trigger a gc of it's own. Since this double-gc will cause the Handle-based -// code to be called twice, it must be idempotent. -class IdempotentPointerToHandleCodeTrampoline { - public: - explicit IdempotentPointerToHandleCodeTrampoline(Isolate* isolate) - : isolate_(isolate) {} - - template<typename R> - MUST_USE_RESULT MaybeObject* Call(R (*function)()) { - int collections = isolate_->heap()->gc_count(); - (*function)(); - return (collections == isolate_->heap()->gc_count()) - ? isolate_->heap()->true_value() - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R> - MUST_USE_RESULT MaybeObject* CallWithReturnValue(R (*function)()) { - int collections = isolate_->heap()->gc_count(); - Object* result = (*function)(); - return (collections == isolate_->heap()->gc_count()) - ? result - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R, typename P1> - MUST_USE_RESULT MaybeObject* Call(R (*function)(P1), P1 p1) { - int collections = isolate_->heap()->gc_count(); - (*function)(p1); - return (collections == isolate_->heap()->gc_count()) - ? isolate_->heap()->true_value() - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R, typename P1> - MUST_USE_RESULT MaybeObject* CallWithReturnValue( - R (*function)(P1), - P1 p1) { - int collections = isolate_->heap()->gc_count(); - Object* result = (*function)(p1); - return (collections == isolate_->heap()->gc_count()) - ? result - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R, typename P1, typename P2> - MUST_USE_RESULT MaybeObject* Call( - R (*function)(P1, P2), - P1 p1, - P2 p2) { - int collections = isolate_->heap()->gc_count(); - (*function)(p1, p2); - return (collections == isolate_->heap()->gc_count()) - ? isolate_->heap()->true_value() - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R, typename P1, typename P2> - MUST_USE_RESULT MaybeObject* CallWithReturnValue( - R (*function)(P1, P2), - P1 p1, - P2 p2) { - int collections = isolate_->heap()->gc_count(); - Object* result = (*function)(p1, p2); - return (collections == isolate_->heap()->gc_count()) - ? result - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - template<typename R, typename P1, typename P2, typename P3, typename P4, - typename P5, typename P6, typename P7> - MUST_USE_RESULT MaybeObject* CallWithReturnValue( - R (*function)(P1, P2, P3, P4, P5, P6, P7), - P1 p1, - P2 p2, - P3 p3, - P4 p4, - P5 p5, - P6 p6, - P7 p7) { - int collections = isolate_->heap()->gc_count(); - Handle<Object> result = (*function)(p1, p2, p3, p4, p5, p6, p7); - return (collections == isolate_->heap()->gc_count()) - ? *result - : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); - } - - private: - Isolate* isolate_; -}; - - } } // namespace v8::internal #endif // V8_FACTORY_H_ |