ENTER_V8(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
EXCEPTION_PREAMBLE(isolate);
- i::Handle<i::JSObject> result = i::JSObject::Copy(self);
+ i::Handle<i::JSObject> result = isolate->factory()->CopyJSObject(self);
has_pending_exception = result.is_null();
EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
return Utils::ToLocal(result);
i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
EXCEPTION_PREAMBLE(isolate);
ENTER_V8(isolate);
- i::Handle<i::JSObject> result = i::JSObject::Copy(paragon_handle);
+ i::Handle<i::JSObject> result =
+ isolate->factory()->CopyJSObject(paragon_handle);
has_pending_exception = result.is_null();
EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
return Utils::ToLocal(result);
}
-Handle<ConsString> Factory::NewRawConsString(String::Encoding encoding) {
- Handle<Map> map = (encoding == String::ONE_BYTE_ENCODING)
- ? cons_ascii_string_map() : cons_string_map();
- return New<ConsString>(map, NEW_SPACE);
-}
-
-
MaybeHandle<String> Factory::NewConsString(Handle<String> left,
Handle<String> right) {
int left_length = left->length();
NewRawTwoByteString(length).ToHandleChecked(), left, right);
}
- Handle<ConsString> result = NewRawConsString(
- (is_one_byte || is_one_byte_data_in_two_byte_string)
- ? String::ONE_BYTE_ENCODING
- : String::TWO_BYTE_ENCODING);
+ Handle<Map> map = (is_one_byte || is_one_byte_data_in_two_byte_string)
+ ? cons_ascii_string_map() : cons_string_map();
+ Handle<ConsString> result = New<ConsString>(map, NEW_SPACE);
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
}
-Handle<SlicedString> Factory::NewRawSlicedString(String::Encoding encoding) {
- Handle<Map> map = (encoding == String::ONE_BYTE_ENCODING)
- ? sliced_ascii_string_map() : sliced_string_map();
- return New<SlicedString>(map, NEW_SPACE);
-}
-
-
Handle<String> Factory::NewProperSubString(Handle<String> str,
int begin,
int end) {
}
ASSERT(str->IsSeqString() || str->IsExternalString());
- Handle<SlicedString> slice = NewRawSlicedString(
- str->IsOneByteRepresentation() ? String::ONE_BYTE_ENCODING
- : String::TWO_BYTE_ENCODING);
+ Handle<Map> map = str->IsOneByteRepresentation() ? sliced_ascii_string_map()
+ : sliced_string_map();
+ Handle<SlicedString> slice = New<SlicedString>(map, NEW_SPACE);
slice->set_hash_field(String::kEmptyHashField);
slice->set_length(length);
}
+Handle<JSObject> Factory::CopyJSObject(Handle<JSObject> object) {
+ CALL_HEAP_FUNCTION(isolate(),
+ isolate()->heap()->CopyJSObject(*object, NULL),
+ JSObject);
+}
+
+
+Handle<JSObject> Factory::CopyJSObjectWithAllocationSite(
+ Handle<JSObject> object,
+ Handle<AllocationSite> site) {
+ CALL_HEAP_FUNCTION(isolate(),
+ isolate()->heap()->CopyJSObject(
+ *object,
+ site.is_null() ? NULL : *site),
+ JSObject);
+}
+
+
Handle<FixedArray> Factory::CopyFixedArrayWithMap(Handle<FixedArray> array,
Handle<Map> map) {
CALL_HEAP_FUNCTION(isolate(),
MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left,
Handle<String> right);
- Handle<ConsString> NewRawConsString(String::Encoding encoding);
-
// Create a new sequential string containing the concatenation of the inputs.
Handle<String> NewFlatConcatString(Handle<String> first,
Handle<String> second);
return NewProperSubString(str, begin, end);
}
- Handle<SlicedString> NewRawSlicedString(String::Encoding encoding);
-
// 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,
Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function);
+ Handle<JSObject> CopyJSObject(Handle<JSObject> object);
+
+ Handle<JSObject> CopyJSObjectWithAllocationSite(Handle<JSObject> object,
+ Handle<AllocationSite> site);
+
Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array,
Handle<Map> map);
Handle<String> key = factory()->stack_overflow_string();
Handle<JSObject> boilerplate = Handle<JSObject>::cast(
Object::GetProperty(js_builtins_object(), key).ToHandleChecked());
- Handle<JSObject> exception = JSObject::Copy(boilerplate);
+ Handle<JSObject> exception = factory()->CopyJSObject(boilerplate);
DoThrow(*exception, NULL);
// Get stack trace limit.
}
-Handle<JSObject> JSObject::Copy(Handle<JSObject> object,
- Handle<AllocationSite> site) {
- Isolate* isolate = object->GetIsolate();
- CALL_HEAP_FUNCTION(isolate,
- isolate->heap()->CopyJSObject(
- *object,
- site.is_null() ? NULL : *site),
- JSObject);
-}
-
-
-Handle<JSObject> JSObject::Copy(Handle<JSObject> object) {
- Isolate* isolate = object->GetIsolate();
- CALL_HEAP_FUNCTION(isolate,
- isolate->heap()->CopyJSObject(*object, NULL),
- JSObject);
-}
-
-
Handle<Object> JSObject::FastPropertyAt(Handle<JSObject> object,
Representation representation,
int index) {
if (site_context()->ShouldCreateMemento(object)) {
site_to_pass = site_context()->current();
}
- copy = JSObject::Copy(object, site_to_pass);
+ copy = isolate->factory()->CopyJSObjectWithAllocationSite(
+ object, site_to_pass);
} else {
copy = object;
}
kObjectIsShallowArray = 1
};
- static Handle<JSObject> Copy(Handle<JSObject> object,
- Handle<AllocationSite> site);
static Handle<JSObject> Copy(Handle<JSObject> object);
MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy(
Handle<JSObject> object,
// Make the clone.
Handle<Object> value1, value2;
- Handle<JSObject> clone = JSObject::Copy(obj);
+ Handle<JSObject> clone = factory->CopyJSObject(obj);
CHECK(!clone.is_identical_to(obj));
value1 = Object::GetElement(isolate, obj, 0).ToHandleChecked();