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

Unified Diff: src/bootstrapper.cc

Issue 2039093005: Revert of [builtins] Properly optimize TypedArray/DataView accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | src/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index c70cd1d28bc1e77a65f14f5f1ebd9e6a273703b2..5e6ff7a9f6b910716221a63f4295137072d74b6b 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -379,16 +379,6 @@
InstallFunction(target, name, function, name_string, attributes);
}
-Handle<JSFunction> InstallGetter(Handle<JSObject> target,
- Handle<Name> property_name,
- Handle<JSFunction> getter,
- PropertyAttributes attributes = DONT_ENUM) {
- Handle<Object> setter = target->GetIsolate()->factory()->undefined_value();
- JSObject::DefineAccessor(target, property_name, getter, setter, attributes)
- .Check();
- return getter;
-}
-
Handle<JSFunction> CreateFunction(Isolate* isolate, Handle<String> name,
InstanceType type, int instance_size,
MaybeHandle<JSObject> maybe_prototype,
@@ -464,27 +454,6 @@
Factory* const factory = base->GetIsolate()->factory();
return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call,
len, adapt);
-}
-
-Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base,
- Handle<String> name, Builtins::Name call,
- bool adapt) {
- Isolate* const isolate = base->GetIsolate();
- Handle<String> fun_name =
- Name::ToFunctionName(name, isolate->factory()->get_string())
- .ToHandleChecked();
- Handle<JSFunction> fun =
- SimpleCreateFunction(isolate, fun_name, call, 0, adapt);
- InstallGetter(base, name, fun);
- return fun;
-}
-
-Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base,
- Handle<String> name, Builtins::Name call,
- bool adapt, BuiltinFunctionId id) {
- Handle<JSFunction> fun = SimpleInstallGetter(base, name, call, adapt);
- fun->shared()->set_builtin_function_id(id);
- return fun;
}
} // namespace
@@ -1685,32 +1654,6 @@
Context::ARRAY_BUFFER_FUN_INDEX);
}
- { // -- T y p e d A r r a y
- Handle<JSObject> prototype =
- factory->NewJSObject(isolate->object_function(), TENURED);
- Handle<JSFunction> typed_array_fun =
- InstallFunction(global, "TypedArray", JS_TYPED_ARRAY_TYPE,
- JSTypedArray::kSize, prototype, Builtins::kIllegal);
-
- // Install the "constructor" property on the {prototype}.
- JSObject::AddProperty(prototype, factory->constructor_string(),
- typed_array_fun, DONT_ENUM);
-
- // Install the "buffer", "byteOffset", "byteLength" and "length"
- // getters on the {prototype}.
- SimpleInstallGetter(prototype, factory->buffer_string(),
- Builtins::kTypedArrayPrototypeBuffer, false);
- SimpleInstallGetter(prototype, factory->byte_length_string(),
- Builtins::kTypedArrayPrototypeByteLength, true,
- kTypedArrayByteLength);
- SimpleInstallGetter(prototype, factory->byte_offset_string(),
- Builtins::kTypedArrayPrototypeByteOffset, true,
- kTypedArrayByteOffset);
- SimpleInstallGetter(prototype, factory->length_string(),
- Builtins::kTypedArrayPrototypeLength, true,
- kTypedArrayLength);
- }
-
{ // -- T y p e d A r r a y s
#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
{ \
@@ -1721,43 +1664,17 @@
}
TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
#undef INSTALL_TYPED_ARRAY
- }
-
- { // -- D a t a V i e w
- Handle<JSObject> prototype =
- factory->NewJSObject(isolate->object_function(), TENURED);
- Handle<JSFunction> data_view_fun =
- InstallFunction(global, "DataView", JS_DATA_VIEW_TYPE,
- JSDataView::kSizeWithInternalFields, prototype,
- Builtins::kDataViewConstructor);
+
+ Handle<JSFunction> data_view_fun = InstallFunction(
+ global, "DataView", JS_DATA_VIEW_TYPE,
+ JSDataView::kSizeWithInternalFields,
+ isolate->initial_object_prototype(), Builtins::kDataViewConstructor);
InstallWithIntrinsicDefaultProto(isolate, data_view_fun,
Context::DATA_VIEW_FUN_INDEX);
data_view_fun->shared()->set_construct_stub(
*isolate->builtins()->DataViewConstructor_ConstructStub());
data_view_fun->shared()->set_length(3);
data_view_fun->shared()->DontAdaptArguments();
-
- // Install the @@toStringTag property on the {prototype}.
- JSObject::AddProperty(
- prototype, factory->to_string_tag_symbol(),
- factory->NewStringFromAsciiChecked("DataView"),
- static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
-
- // Install the "constructor" property on the {prototype}.
- JSObject::AddProperty(prototype, factory->constructor_string(),
- data_view_fun, DONT_ENUM);
-
- // Install the "buffer", "byteOffset" and "byteLength" getters
- // on the {prototype}.
- SimpleInstallGetter(prototype, factory->buffer_string(),
- Builtins::kDataViewPrototypeGetBuffer, false,
- kDataViewBuffer);
- SimpleInstallGetter(prototype, factory->byte_length_string(),
- Builtins::kDataViewPrototypeGetByteLength, false,
- kDataViewByteLength);
- SimpleInstallGetter(prototype, factory->byte_offset_string(),
- Builtins::kDataViewPrototypeGetByteOffset, false,
- kDataViewByteOffset);
}
{ // -- M a p
« no previous file with comments | « no previous file | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698