Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Unified Diff: src/factory.cc

Issue 258953009: Refactor calls to CALL_HEAP_FUNCTION. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase and addressed comment Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index a085bbab799722e11d193118c0bdf779b342539d..22b6489e56d07dd76eb26355752833ff7b72330c 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -418,13 +418,6 @@ Handle<String> ConcatStringContent(Handle<StringType> 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();
@@ -494,10 +487,9 @@ MaybeHandle<String> Factory::NewConsString(Handle<String> left,
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);
@@ -523,13 +515,6 @@ Handle<String> Factory::NewFlatConcatString(Handle<String> first,
}
-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) {
@@ -581,9 +566,9 @@ Handle<String> Factory::NewProperSubString(Handle<String> str,
}
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);
@@ -953,6 +938,24 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
}
+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(),
« no previous file with comments | « src/factory.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698