Skip to content

Commit 98b1ef8

Browse files
yuki3Commit Bot
authored andcommitted
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/+/2102408 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Yuki Shiino <yukishiino@chromium.org> Cr-Commit-Position: refs/heads/master@{#66747}
1 parent a65fa9b commit 98b1ef8

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

include/v8.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5977,13 +5977,14 @@ class V8_EXPORT External : public Value {
59775977
static void CheckCast(v8::Value* obj);
59785978
};
59795979

5980-
#define V8_INTRINSICS_LIST(F) \
5981-
F(ArrayProto_entries, array_entries_iterator) \
5982-
F(ArrayProto_forEach, array_for_each_iterator) \
5983-
F(ArrayProto_keys, array_keys_iterator) \
5984-
F(ArrayProto_values, array_values_iterator) \
5985-
F(ErrorPrototype, initial_error_prototype) \
5986-
F(IteratorPrototype, initial_iterator_prototype)
5980+
#define V8_INTRINSICS_LIST(F) \
5981+
F(ArrayProto_entries, array_entries_iterator) \
5982+
F(ArrayProto_forEach, array_for_each_iterator) \
5983+
F(ArrayProto_keys, array_keys_iterator) \
5984+
F(ArrayProto_values, array_values_iterator) \
5985+
F(ErrorPrototype, initial_error_prototype) \
5986+
F(IteratorPrototype, initial_iterator_prototype) \
5987+
F(ObjProto_valueOf, object_value_of_function)
59875988

59885989
enum Intrinsic {
59895990
#define V8_DECL_INTRINSIC(name, iname) k##name,

src/init/bootstrapper.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,9 +1553,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
15531553
isolate_, isolate_->initial_object_prototype(), "toString",
15541554
Builtins::kObjectPrototypeToString, 0, true);
15551555
native_context()->set_object_to_string(*object_to_string);
1556-
SimpleInstallFunction(isolate_, isolate_->initial_object_prototype(),
1557-
"valueOf", Builtins::kObjectPrototypeValueOf, 0,
1558-
true);
1556+
Handle<JSFunction> object_value_of = SimpleInstallFunction(
1557+
isolate_, isolate_->initial_object_prototype(), "valueOf",
1558+
Builtins::kObjectPrototypeValueOf, 0, true);
1559+
native_context()->set_object_value_of_function(*object_value_of);
15591560

15601561
SimpleInstallGetterSetter(
15611562
isolate_, isolate_->initial_object_prototype(), factory->proto_string(),

src/objects/contexts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ enum ContextLookupFlags {
350350
V(MAP_SET_INDEX, JSFunction, map_set) \
351351
V(FUNCTION_HAS_INSTANCE_INDEX, JSFunction, function_has_instance) \
352352
V(OBJECT_TO_STRING, JSFunction, object_to_string) \
353+
V(OBJECT_VALUE_OF_FUNCTION_INDEX, JSFunction, object_value_of_function) \
353354
V(PROMISE_ALL_INDEX, JSFunction, promise_all) \
354355
V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \
355356
V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function) \

0 commit comments

Comments
 (0)