[counters] remove "override mistake" use counters
v8::Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy and v8::Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict are no longer incremented. BUG=v8:8175 R=gsathya@chromium.org, littledan@chromium.org Change-Id: Ia5f8f9226a54d88c15a3c3b4a5941d774eb1834a Reviewed-on: https://chromium-review.googlesource.com/c/1417381 Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Caitlin Potter <caitp@igalia.com> Cr-Commit-Position: refs/heads/master@{#58934}
This commit is contained in:
parent
242fd7ce42
commit
a62c96a014
@ -5429,15 +5429,6 @@ Maybe<bool> Object::CannotCreateProperty(Isolate* isolate,
|
||||
Maybe<bool> Object::WriteToReadOnlyProperty(LookupIterator* it,
|
||||
Handle<Object> value,
|
||||
ShouldThrow should_throw) {
|
||||
if (it->IsFound() && !it->HolderIsReceiver()) {
|
||||
// "Override mistake" attempted, record a use count to track this per
|
||||
// v8:8175
|
||||
v8::Isolate::UseCounterFeature feature =
|
||||
should_throw == kThrowOnError
|
||||
? v8::Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict
|
||||
: v8::Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy;
|
||||
it->isolate()->CountUsage(feature);
|
||||
}
|
||||
return WriteToReadOnlyProperty(it->isolate(), it->GetReceiver(),
|
||||
it->GetName(), value, should_throw);
|
||||
}
|
||||
|
@ -81,90 +81,6 @@ TEST(AtomicsWakeAndAtomicsNotify) {
|
||||
CHECK_EQ(1, use_counts[v8::Isolate::kAtomicsNotify]);
|
||||
}
|
||||
|
||||
TEST(OverrideReadOnlyPropertyOnPrototype) {
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
LocalContext env;
|
||||
int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
|
||||
global_use_counts = use_counts;
|
||||
CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
|
||||
using Isolate = v8::Isolate;
|
||||
|
||||
// Initial setup
|
||||
CompileRun(
|
||||
"Object.defineProperty(Object.prototype, 'readonly', "
|
||||
"{ enumerable: true, configurable: true, writable: false, "
|
||||
" value: 'readonly' });");
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
|
||||
// StoreIC Sloppy
|
||||
CompileRun(
|
||||
"function sloppy() { let sloppy = {}; sloppy.readonly = 'override'; }"
|
||||
"sloppy();");
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy] = 0;
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict] = 0;
|
||||
|
||||
// StoreIC Sloppy (one-shot)
|
||||
CompileRun("let sloppyob = {}; sloppyob.readonly = 'override';");
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy] = 0;
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict] = 0;
|
||||
|
||||
// StoreIC Strict
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun(
|
||||
"function strict() {"
|
||||
" 'use strict'; let strict = {}; strict.readonly = 'override';"
|
||||
"}"
|
||||
"strict();");
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy] = 0;
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict] = 0;
|
||||
|
||||
// StoreIC Strict (one-shot)
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun(
|
||||
"'use strict';"
|
||||
"let strictob = {}; strictob.readonly = 'override';");
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy] = 0;
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict] = 0;
|
||||
|
||||
// KeyedStoreIC Sloppy
|
||||
CompileRun(
|
||||
"function sloppy2() { let sloppy = {}; sloppy['readonly'] = 'override'; }"
|
||||
"sloppy2();");
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy] = 0;
|
||||
use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict] = 0;
|
||||
|
||||
// KeyedStoreIC Strict
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun(
|
||||
"function strict2() {"
|
||||
" 'use strict'; let strict = {}; strict['readonly'] = 'override';"
|
||||
"}"
|
||||
"strict2();");
|
||||
CHECK_EQ(0, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeSloppy]);
|
||||
CHECK_EQ(1, use_counts[Isolate::kAttemptOverrideReadOnlyOnPrototypeStrict]);
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RegExpMatchIsTrueishOnNonJSRegExp) {
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
|
Loading…
Reference in New Issue
Block a user