Reviewers: ulan,
Message:
PTAL
Description:
Remove Factory::CopyMap(map) in favor of Map::Copy(map)
BUG=
Please review this at https://codereview.chromium.org/219963009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+13, -24 lines):
M src/api.cc
M src/bootstrapper.cc
M src/factory.h
M src/factory.cc
M src/runtime.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
2e46136bd6c2ae02d752d488a3c469d82f83899b..34a431d9b748846dc38768cb2298e1b75b45e30c
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3597,8 +3597,7 @@ void v8::Object::TurnOnAccessCheck() {
// as optimized code does not always handle access checks.
i::Deoptimizer::DeoptimizeGlobalObject(*obj);
- i::Handle<i::Map> new_map =
- isolate->factory()->CopyMap(i::Handle<i::Map>(obj->map()));
+ i::Handle<i::Map> new_map = i::Map::Copy(i::Handle<i::Map>(obj->map()));
new_map->set_is_access_check_needed(true);
obj->set_map(*new_map);
}
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
be594419be88cc8bb74ed91db0f3130636498dd6..9a42e36fbd695b422cb27699a249e8cc187d4d06
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -328,9 +328,8 @@ Handle<Context> Bootstrapper::CreateEnvironment(
static void SetObjectPrototype(Handle<JSObject> object, Handle<Object>
proto) {
// object.__proto__ = proto;
- Factory* factory = object->GetIsolate()->factory();
Handle<Map> old_to_map = Handle<Map>(object->map());
- Handle<Map> new_to_map = factory->CopyMap(old_to_map);
+ Handle<Map> new_to_map = Map::Copy(old_to_map);
new_to_map->set_prototype(*proto);
object->set_map(*new_to_map);
}
@@ -1017,7 +1016,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject>
inner_global,
initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
// RegExp prototype object is itself a RegExp.
- Handle<Map> proto_map = factory->CopyMap(initial_map);
+ Handle<Map> proto_map = Map::Copy(initial_map);
proto_map->set_prototype(native_context()->initial_object_prototype());
Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map);
proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex,
@@ -1150,7 +1149,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject>
inner_global,
Handle<Map> old_map(
native_context()->sloppy_arguments_boilerplate()->map());
- Handle<Map> new_map = factory->CopyMap(old_map);
+ Handle<Map> new_map = Map::Copy(old_map);
new_map->set_pre_allocated_property_fields(2);
Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
// Set elements kind after allocating the object because
@@ -1359,15 +1358,15 @@ void Genesis::InitializeExperimentalGlobal() {
// Create maps for generator functions and their prototypes. Store
those
// maps in the native context.
Handle<Map> function_map(native_context()->sloppy_function_map());
- Handle<Map> generator_function_map = factory()->CopyMap(function_map);
+ Handle<Map> generator_function_map = Map::Copy(function_map);
generator_function_map->set_prototype(*generator_function_prototype);
native_context()->set_sloppy_generator_function_map(
*generator_function_map);
Handle<Map> strict_mode_function_map(
native_context()->strict_function_map());
- Handle<Map> strict_mode_generator_function_map = factory()->CopyMap(
- strict_mode_function_map);
+ Handle<Map> strict_mode_generator_function_map =
+ Map::Copy(strict_mode_function_map);
strict_mode_generator_function_map->set_prototype(
*generator_function_prototype);
native_context()->set_strict_generator_function_map(
@@ -1612,7 +1611,7 @@ Handle<JSFunction> Genesis::InstallInternalArray(
array_function->shared()->DontAdaptArguments();
Handle<Map> original_map(array_function->initial_map());
- Handle<Map> initial_map = factory()->CopyMap(original_map);
+ Handle<Map> initial_map = Map::Copy(original_map);
initial_map->set_elements_kind(elements_kind);
array_function->set_initial_map(*initial_map);
@@ -2524,7 +2523,7 @@ void Genesis::TransferObject(Handle<JSObject> from,
Handle<JSObject> to) {
// Transfer the prototype (new map is needed).
Handle<Map> old_to_map = Handle<Map>(to->map());
- Handle<Map> new_to_map = factory()->CopyMap(old_to_map);
+ Handle<Map> new_to_map = Map::Copy(old_to_map);
new_to_map->set_prototype(from->map()->prototype());
to->set_map(*new_to_map);
}
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index
cd30743d73182450186ed53d81bad26c9ab987bf..86b72f645697f8f144406d420cd30127a1d624a3
100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -845,11 +845,6 @@ Handle<Map> Factory::CopyMap(Handle<Map> src,
}
-Handle<Map> Factory::CopyMap(Handle<Map> src) {
- CALL_HEAP_FUNCTION(isolate(), src->Copy(), Map);
-}
-
-
Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) {
CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray);
}
Index: src/factory.h
diff --git a/src/factory.h b/src/factory.h
index
da58a71bc111d80a127d6a010458806ba3f76bab..8b3d2aa60dd1edf6e165d18e83ac6ceb2736e7e5
100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -261,7 +261,6 @@ class Factory V8_FINAL {
// Copy the map adding more inobject properties if possible without
// overflowing the instance size.
Handle<Map> CopyMap(Handle<Map> map, int extra_inobject_props);
- Handle<Map> CopyMap(Handle<Map> map);
Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array);
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
53a7919ba5c4b432ae286de6db6f783fb9cc89ab..67810ef1524303f463c9b3b3775d11796a3f62c7
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -3087,9 +3087,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_SetExpectedNumberOfProperties) {
if (!func->shared()->live_objects_may_exist()) {
func->shared()->set_expected_nof_properties(num);
if (func->has_initial_map()) {
- Handle<Map> new_initial_map =
- func->GetIsolate()->factory()->CopyMap(
- Handle<Map>(func->initial_map()));
+ Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map()));
new_initial_map->set_unused_property_fields(num);
func->set_initial_map(*new_initial_map);
}
@@ -7993,11 +7991,10 @@ RUNTIME_FUNCTION(MaybeObject*,
RuntimeHidden_NewArgumentsFast) {
parameter_map->set_map(
isolate->heap()->sloppy_arguments_elements_map());
- Handle<Map> old_map(result->map());
- Handle<Map> new_map = isolate->factory()->CopyMap(old_map);
- new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
+ Handle<Map> map = Map::Copy(handle(result->map()));
+ map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
- result->set_map(*new_map);
+ result->set_map(*map);
result->set_elements(*parameter_map);
// Store the context and the arguments array at the beginning of the
--
--
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.