Commit 98b1ef80 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

Expose the %ObjProto_valueOf% intrinsic object to embedders

https://html.spec.whatwg.org/multipage/history.html#the-location-interface
HTML Location platform objects need to be initialized with using
the %ObjProto_valueOf% intrinsic object.

This patch exposes the %ObjProto_valueOf% intrinsic object to
embedders.

Example usage is: https://crrev.com/c/2102306

Change-Id: Iec58135773e01aed5de330c0c5dea89a49835a52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2102408Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66747}
parent a65fa9bb
......@@ -5977,13 +5977,14 @@ class V8_EXPORT External : public Value {
static void CheckCast(v8::Value* obj);
};
#define V8_INTRINSICS_LIST(F) \
F(ArrayProto_entries, array_entries_iterator) \
F(ArrayProto_forEach, array_for_each_iterator) \
F(ArrayProto_keys, array_keys_iterator) \
F(ArrayProto_values, array_values_iterator) \
F(ErrorPrototype, initial_error_prototype) \
F(IteratorPrototype, initial_iterator_prototype)
#define V8_INTRINSICS_LIST(F) \
F(ArrayProto_entries, array_entries_iterator) \
F(ArrayProto_forEach, array_for_each_iterator) \
F(ArrayProto_keys, array_keys_iterator) \
F(ArrayProto_values, array_values_iterator) \
F(ErrorPrototype, initial_error_prototype) \
F(IteratorPrototype, initial_iterator_prototype) \
F(ObjProto_valueOf, object_value_of_function)
enum Intrinsic {
#define V8_DECL_INTRINSIC(name, iname) k##name,
......
......@@ -1553,9 +1553,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate_, isolate_->initial_object_prototype(), "toString",
Builtins::kObjectPrototypeToString, 0, true);
native_context()->set_object_to_string(*object_to_string);
SimpleInstallFunction(isolate_, isolate_->initial_object_prototype(),
"valueOf", Builtins::kObjectPrototypeValueOf, 0,
true);
Handle<JSFunction> object_value_of = SimpleInstallFunction(
isolate_, isolate_->initial_object_prototype(), "valueOf",
Builtins::kObjectPrototypeValueOf, 0, true);
native_context()->set_object_value_of_function(*object_value_of);
SimpleInstallGetterSetter(
isolate_, isolate_->initial_object_prototype(), factory->proto_string(),
......
......@@ -350,6 +350,7 @@ enum ContextLookupFlags {
V(MAP_SET_INDEX, JSFunction, map_set) \
V(FUNCTION_HAS_INSTANCE_INDEX, JSFunction, function_has_instance) \
V(OBJECT_TO_STRING, JSFunction, object_to_string) \
V(OBJECT_VALUE_OF_FUNCTION_INDEX, JSFunction, object_value_of_function) \
V(PROMISE_ALL_INDEX, JSFunction, promise_all) \
V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \
V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment