Revision: 21036
Author: [email protected]
Date: Tue Apr 29 07:02:11 2014 UTC
Log: Refactor calls to CALL_HEAP_FUNCTION.
[email protected]
Review URL: https://codereview.chromium.org/258953009
http://code.google.com/p/v8/source/detail?r=21036
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/test/cctest/test-heap.cc
=======================================
--- /branches/bleeding_edge/src/api.cc Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Tue Apr 29 07:02:11 2014 UTC
@@ -3560,7 +3560,7 @@
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);
@@ -5774,7 +5774,8 @@
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);
=======================================
--- /branches/bleeding_edge/src/factory.cc Mon Apr 28 15:33:16 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Tue Apr 29 07:02:11 2014 UTC
@@ -416,13 +416,6 @@
String::WriteToFlat(*second, sink + first->length(), 0,
second->length());
return 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,
@@ -494,10 +487,9 @@
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);
@@ -521,13 +513,6 @@
NewRawTwoByteString(total_length).ToHandleChecked(), first,
second);
}
}
-
-
-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,
@@ -581,9 +566,9 @@
}
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);
@@ -951,6 +936,24 @@
return prototype;
}
+
+
+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,
=======================================
--- /branches/bleeding_edge/src/factory.h Mon Apr 28 15:33:16 2014 UTC
+++ /branches/bleeding_edge/src/factory.h Tue Apr 29 07:02:11 2014 UTC
@@ -179,8 +179,6 @@
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);
@@ -195,8 +193,6 @@
if (begin == 0 && end == str->length()) return str;
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
@@ -300,6 +296,11 @@
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);
=======================================
--- /branches/bleeding_edge/src/isolate.cc Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc Tue Apr 29 07:02:11 2014 UTC
@@ -792,7 +792,7 @@
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.
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Tue Apr 29 07:02:11 2014 UTC
@@ -5968,25 +5968,6 @@
}
JSObject::MigrateToMap(object, new_map);
}
-
-
-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,
@@ -6057,7 +6038,8 @@
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;
}
=======================================
--- /branches/bleeding_edge/src/objects.h Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Tue Apr 29 07:02:11 2014 UTC
@@ -2630,8 +2630,6 @@
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,
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Fri Apr 25 11:00:37
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Apr 29 07:02:11
2014 UTC
@@ -818,7 +818,7 @@
// 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();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.