Commit 054f5f69 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Revert "Add counter to track `Date::getTimezoneOffset()`."

This reverts commit 14ebea15.

Reason for revert: CountUsage() can't be called without a C entry frame.

Note this counter was never hooked up in chromium. Besides removing the
problematic CountUsage() call, this CL also makes the call path more
robust against similar future issues by adding {gc,handle,js} disallow
scopes.

Original change's description:
> Add counter to track `Date::getTimezoneOffset()`.
>
> Bug: chromium:915620
> Change-Id: I75579080098632639b125b2252b3ab9615c7ea95
> Reviewed-on: https://chromium-review.googlesource.com/c/1379876
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Mike West <mkwst@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58306}

TBR=yangguo@chromium.org,mkwst@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Tbr: ulan@chromium.org
Bug: chromium:915620,v8:10460
Change-Id: I2dd2e14947fe527de24ea644b4b33897f437a119
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2165790
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67399}
parent 7ae30cb7
......@@ -8447,7 +8447,7 @@ class V8_EXPORT Isolate {
kOptimizedFunctionWithOneShotBytecode = 71,
kRegExpMatchIsTrueishOnNonJSRegExp = 72,
kRegExpMatchIsFalseishOnJSRegExp = 73,
kDateGetTimezoneOffset = 74,
kDateGetTimezoneOffset = 74, // Unused.
kStringNormalize = 75,
kCallSiteAPIGetFunctionSloppyCall = 76,
kCallSiteAPIGetThisSloppyCall = 77,
......
......@@ -50,11 +50,14 @@ void DateBuiltinsAssembler::Generate_DatePrototype_GetField(
BIND(&stamp_mismatch);
}
TNode<ExternalReference> isolate_ptr =
ExternalConstant(ExternalReference::isolate_address(isolate()));
TNode<Smi> field_index_smi = SmiConstant(field_index);
TNode<ExternalReference> function =
ExternalConstant(ExternalReference::get_date_field_function());
TNode<Object> result = CAST(CallCFunction(
function, MachineType::AnyTagged(),
std::make_pair(MachineType::Pointer(), isolate_ptr),
std::make_pair(MachineType::AnyTagged(), date_receiver),
std::make_pair(MachineType::AnyTagged(), field_index_smi)));
Return(result);
......
......@@ -5714,18 +5714,24 @@ double JSDate::CurrentTimeValue(Isolate* isolate) {
}
// static
Address JSDate::GetField(Address raw_object, Address smi_index) {
Address JSDate::GetField(Isolate* isolate, Address raw_object,
Address smi_index) {
// Called through CallCFunction.
DisallowHeapAllocation no_gc;
DisallowHandleAllocation no_handles;
DisallowJavascriptExecution no_js(isolate);
Object object(raw_object);
Smi index(smi_index);
return JSDate::cast(object)
.DoGetField(static_cast<FieldIndex>(index.value()))
.DoGetField(isolate, static_cast<FieldIndex>(index.value()))
.ptr();
}
Object JSDate::DoGetField(FieldIndex index) {
Object JSDate::DoGetField(Isolate* isolate, FieldIndex index) {
DCHECK_NE(index, kDateValue);
DateCache* date_cache = GetIsolate()->date_cache();
DateCache* date_cache = isolate->date_cache();
if (index < kFirstUncachedField) {
Object stamp = cache_stamp();
......@@ -5782,7 +5788,6 @@ Object JSDate::GetUTCField(FieldIndex index, double value,
int64_t time_ms = static_cast<int64_t>(value);
if (index == kTimezoneOffset) {
GetIsolate()->CountUsage(v8::Isolate::kDateGetTimezoneOffset);
return Smi::FromInt(date_cache->TimezoneOffset(time_ms));
}
......
......@@ -1280,7 +1280,8 @@ class JSDate : public TorqueGeneratedJSDate<JSDate, JSObject> {
// {raw_date} is a tagged Object pointer.
// {smi_index} is a tagged Smi.
// The return value is a tagged Object pointer.
static Address GetField(Address raw_date, Address smi_index);
static Address GetField(Isolate* isolate, Address raw_date,
Address smi_index);
static Handle<Object> SetValue(Handle<JSDate> date, double v);
......@@ -1320,8 +1321,7 @@ class JSDate : public TorqueGeneratedJSDate<JSDate, JSObject> {
};
private:
inline Object DoGetField(FieldIndex index);
Object DoGetField(Isolate* isolate, FieldIndex index);
Object GetUTCField(FieldIndex index, double value, DateCache* date_cache);
// Computes and caches the cacheable fields of the date.
......
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