Commit 3ed9f606 authored by Ujjwal Sharma's avatar Ujjwal Sharma Committed by Commit Bot

[Intl] Add a CreateBoundFunction helper function

Add a C++ helper function called "CreateBoundFunction" as a static
function to the Intl class, and change all existing builtins involving
the creation of a bound function to use it instead.

Also remove the redundant ContextSlot enums on all Intl objects in favor
of a single BoundFunctionContextSlot enum in the Intl class.

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ibd541f5e79828cd1e2cd573a0e23fc93b348a8ad
Reviewed-on: https://chromium-review.googlesource.com/1194817
Commit-Queue: Ujjwal Sharma <usharma1998@gmail.com>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55508}
parent cd7f9c63
This diff is collapsed.
...@@ -90,14 +90,6 @@ class DateFormat { ...@@ -90,14 +90,6 @@ class DateFormat {
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, DATE_FORMAT_FIELDS) DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, DATE_FORMAT_FIELDS)
#undef DATE_FORMAT_FIELDS #undef DATE_FORMAT_FIELDS
// ContextSlot defines the context structure for the bound
// DateTimeFormat.prototype.format function
enum ContextSlot {
kDateFormat = Context::MIN_CONTEXT_SLOTS,
kLength
};
// TODO(ryzokuken): Remove this and use regular accessors once DateFormat is a // TODO(ryzokuken): Remove this and use regular accessors once DateFormat is a
// subclass of JSObject // subclass of JSObject
// //
...@@ -150,16 +142,6 @@ class NumberFormat { ...@@ -150,16 +142,6 @@ class NumberFormat {
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, NUMBER_FORMAT_FIELDS) DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, NUMBER_FORMAT_FIELDS)
#undef NUMBER_FORMAT_FIELDS #undef NUMBER_FORMAT_FIELDS
// ContextSlot defines the context structure for the bound
// NumberFormat.prototype.format function.
enum ContextSlot {
// The number format instance that the function holding this
// context is bound to.
kNumberFormat = Context::MIN_CONTEXT_SLOTS,
kLength
};
// TODO(gsathya): Remove this and use regular accessors once // TODO(gsathya): Remove this and use regular accessors once
// NumberFormat is a sub class of JSObject. // NumberFormat is a sub class of JSObject.
// //
...@@ -206,14 +188,6 @@ class V8BreakIterator { ...@@ -206,14 +188,6 @@ class V8BreakIterator {
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, BREAK_ITERATOR_FIELDS) DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, BREAK_ITERATOR_FIELDS)
#undef BREAK_ITERATOR_FIELDS #undef BREAK_ITERATOR_FIELDS
// ContextSlot defines the context structure for the bound
// v8BreakIterator.prototype.adoptText function
enum class ContextSlot {
kV8BreakIterator = Context::MIN_CONTEXT_SLOTS,
kLength
};
// TODO(ryzokuken): Remove this and use regular accessors once v8BreakIterator // TODO(ryzokuken): Remove this and use regular accessors once v8BreakIterator
// is a subclass of JSObject // is a subclass of JSObject
// //
...@@ -243,6 +217,11 @@ class Intl { ...@@ -243,6 +217,11 @@ class Intl {
kTypeCount kTypeCount
}; };
enum class BoundFunctionContextSlot {
kBoundFunction = Context::MIN_CONTEXT_SLOTS,
kLength
};
inline static Intl::Type TypeFromInt(int type); inline static Intl::Type TypeFromInt(int type);
inline static Intl::Type TypeFromSmi(Smi* type); inline static Intl::Type TypeFromSmi(Smi* type);
......
...@@ -46,14 +46,6 @@ class JSCollator : public JSObject { ...@@ -46,14 +46,6 @@ class JSCollator : public JSObject {
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_COLLATOR_FIELDS) DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_COLLATOR_FIELDS)
#undef JS_COLLATOR_FIELDS #undef JS_COLLATOR_FIELDS
// ContextSlot defines the context structure for the bound
// Collator.prototype.compare function.
enum ContextSlot {
// The collator instance that the function holding this context is bound to.
kCollator = Context::MIN_CONTEXT_SLOTS,
kLength
};
DECL_ACCESSORS(icu_collator, Managed<icu::Collator>) DECL_ACCESSORS(icu_collator, Managed<icu::Collator>)
DECL_ACCESSORS(bound_compare, Object); DECL_ACCESSORS(bound_compare, Object);
......
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