#include <stdlib.h>
#include <optional>
#include "include/v8-function.h"
#include "src/api/api-inl.h"
#include "src/codegen/compilation-cache.h"
#include "src/execution/execution.h"
#include "src/objects/objects-inl.h"
#include "src/objects/objects.h"
#include "src/runtime/runtime.h"
#include "src/strings/unicode-inl.h"
#include "test/cctest/heap/heap-utils.h"
#include "test/cctest/test-api.h"
Context;
Function;
FunctionTemplate;
Local;
Name;
Object;
ObjectTemplate;
Script;
String;
Symbol;
Value;
namespace {
void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void Return239Callback(Local<Name> name,
const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted EmptyInterceptorGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted EmptyInterceptorSetter(
Local<Name> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted EmptyInterceptorQuery(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted EmptyInterceptorDeleter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
void EmptyInterceptorEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
v8::Intercepted EmptyInterceptorDefinerWithSideEffect(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
void SimpleGetterImpl(Local<String> name_str,
const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void SimpleSetterImpl(Local<String> name_str,
const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void SimpleGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { … }
void SimpleSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void SymbolGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void SymbolSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptorGetter(
Local<Name> generic_name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptorSetter(Local<Name> generic_name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted GenericInterceptorGetter(
Local<Name> generic_name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted GenericInterceptorSetter(
Local<Name> generic_name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
void AddAccessor(v8::Isolate* isolate, Local<FunctionTemplate> templ,
Local<Name> name, v8::FunctionCallback getter,
v8::FunctionCallback setter) { … }
void AddStringOnlyInterceptor(Local<FunctionTemplate> templ,
v8::NamedPropertyGetterCallback getter,
v8::NamedPropertySetterCallback setter) { … }
void AddInterceptor(Local<FunctionTemplate> templ,
v8::NamedPropertyGetterCallback getter,
v8::NamedPropertySetterCallback setter) { … }
v8::Global<v8::Object> bottom_global;
v8::Intercepted CheckThisIndexedPropertyHandler(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted CheckThisNamedPropertyHandler(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted CheckThisIndexedPropertyDefiner(
uint32_t index, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckThisNamedPropertyDefiner(
Local<Name> property, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckThisIndexedPropertySetter(
uint32_t index, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckThisNamedPropertySetter(
Local<Name> property, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckThisIndexedPropertyDescriptor(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted CheckThisNamedPropertyDescriptor(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted CheckThisIndexedPropertyQuery(
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted CheckThisNamedPropertyQuery(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted CheckThisIndexedPropertyDeleter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
v8::Intercepted CheckThisNamedPropertyDeleter(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
void CheckThisIndexedPropertyEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
void CheckThisNamedPropertyEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
int echo_named_call_count;
v8::Intercepted EchoNamedProperty(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptorHasOwnPropertyGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptorHasOwnPropertyGetterGC(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
int query_counter_int = …;
v8::Intercepted QueryCallback(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(QueryInterceptor) { … }
namespace {
bool get_was_called = …;
bool set_was_called = …;
int set_was_called_counter = …;
v8::Intercepted GetterCallback(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted SetterCallback(Local<Name> property, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted InterceptingSetterCallback(
Local<Name> property, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(DefinerCallbackAccessorInterceptor) { … }
THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) { … }
namespace {
int descriptor_was_called;
v8::Intercepted PropertyDescriptorCallback(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(DescriptorCallbackOnGlobalObject) { … }
namespace {
v8::Intercepted QueryCallbackSetDontDelete(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(InterceptorFunctionRedeclareWithQueryCallback) { … }
THREADED_TEST(NonMaskingInterceptor) { … }
THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) { … }
namespace {
bool get_was_called_in_order = …;
bool define_was_called_in_order = …;
v8::Intercepted GetterCallbackOrder(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted DefinerCallbackOrder(
Local<Name> property, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(DefinerCallbackGetAndDefine) { … }
namespace {
bool context_is_done = …;
bool getter_callback_was_called = …;
v8::Intercepted ReturnUndefinedGetterCallback(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InObjectLiteralDefinitionWithInterceptor) { … }
THREADED_TEST(InterceptorHasOwnProperty) { … }
THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { … }
namespace {
void CheckInterceptorIC(v8::NamedPropertyGetterCallback getter,
v8::NamedPropertySetterCallback setter,
v8::NamedPropertyQueryCallback query,
v8::NamedPropertyDefinerCallback definer,
v8::PropertyHandlerFlags flags, const char* source,
std::optional<int> expected) { … }
void CheckInterceptorIC(v8::NamedPropertyGetterCallback getter,
v8::NamedPropertyQueryCallback query,
const char* source, std::optional<int> expected) { … }
void CheckInterceptorLoadIC(v8::NamedPropertyGetterCallback getter,
const char* source, int expected) { … }
v8::Intercepted InterceptorLoadICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorLoadIC) { … }
namespace {
v8::Intercepted InterceptorLoadXICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptorLoadXICGetterWithSideEffects(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorLoadICWithFieldOnHolder) { … }
THREADED_TEST(InterceptorLoadICWithSubstitutedProto) { … }
THREADED_TEST(InterceptorLoadICWithPropertyOnProto) { … }
THREADED_TEST(InterceptorLoadICUndefined) { … }
THREADED_TEST(InterceptorLoadICWithOverride) { … }
THREADED_TEST(InterceptorLoadICFieldNotNeeded) { … }
THREADED_TEST(InterceptorLoadICInvalidatedField) { … }
namespace {
int interceptor_load_not_handled_calls = …;
v8::Intercepted InterceptorLoadNotHandled(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorLoadICPostInterceptor) { … }
THREADED_TEST(InterceptorLoadICInvalidatedFieldViaGlobal) { … }
static void SetOnThis(Local<Name> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
THREADED_TEST(InterceptorLoadICWithCallbackOnHolder) { … }
THREADED_TEST(InterceptorLoadICWithCallbackOnProto) { … }
THREADED_TEST(InterceptorLoadICForCallbackWithOverride) { … }
THREADED_TEST(InterceptorLoadICCallbackNotNeeded) { … }
THREADED_TEST(InterceptorLoadICInvalidatedCallback) { … }
THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) { … }
THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) { … }
THREADED_TEST(InterceptorLoadICGlobalWithInterceptor) { … }
namespace {
v8::Intercepted InterceptorLoadICGetter0(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorReturningZero) { … }
namespace {
template <typename TKey, v8::internal::PropertyAttributes attribute>
v8::Intercepted HasICQuery(TKey name,
const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
template <typename TKey>
v8::Intercepted HasICQueryToggle(
TKey name, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
template <typename TKey, v8::internal::PropertyAttributes attribute>
v8::Intercepted HasICQuerySideEffect(
TKey name, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
int named_query_counter = …;
v8::Intercepted NamedQueryCallback(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(InterceptorHasIC) { … }
THREADED_TEST(InterceptorHasICQueryAbsent) { … }
THREADED_TEST(InterceptorHasICQueryNone) { … }
THREADED_TEST(InterceptorHasICGetter) { … }
THREADED_TEST(InterceptorHasICQueryGetter) { … }
THREADED_TEST(InterceptorHasICQueryToggle) { … }
THREADED_TEST(InterceptorStoreICWithSideEffectfulCallbacks1) { … }
TEST(Crash_InterceptorStoreICWithSideEffectfulCallbacks1) { … }
TEST(Crash_InterceptorStoreICWithSideEffectfulCallbacks2) { … }
THREADED_TEST(InterceptorDefineICWithSideEffectfulCallbacks) { … }
TEST(Crash_InterceptorDefineICWithSideEffectfulCallbacks) { … }
namespace {
v8::Intercepted InterceptorStoreICSetter(
Local<Name> key, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(InterceptorStoreIC) { … }
THREADED_TEST(InterceptorStoreICWithNoSetter) { … }
THREADED_TEST(EmptyInterceptorDoesNotShadowReadOnlyProperty) { … }
THREADED_TEST(InterceptorShadowsReadOnlyProperty) { … }
THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) { … }
THREADED_TEST(EmptyInterceptorVsStoreGlobalICs) { … }
THREADED_TEST(LegacyInterceptorDoesNotSeeSymbols) { … }
THREADED_TEST(GenericInterceptorDoesSeeSymbols) { … }
THREADED_TEST(NamedPropertyHandlerGetter) { … }
namespace {
v8::Intercepted NotInterceptingPropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted InterceptingPropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckDescriptorInDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallback) { … }
namespace {
v8::Intercepted NotInterceptingPropertyDefineCallbackIndexed(
uint32_t index, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted InterceptingPropertyDefineCallbackIndexed(
uint32_t index, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted CheckDescriptorInDefineCallbackIndexed(
uint32_t index, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackIndexed) { … }
THREADED_TEST(PropertyDefinerCallbackForFreeze) { … }
namespace {
v8::Intercepted CheckEnumerablePropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackEnumerable) { … }
namespace {
v8::Intercepted CheckConfigurablePropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackConfigurable) { … }
namespace {
v8::Intercepted CheckWritablePropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackWritable) { … }
namespace {
v8::Intercepted CheckGetterPropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackWithGetter) { … }
namespace {
v8::Intercepted CheckSetterPropertyDefineCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(PropertyDefinerCallbackWithSetter) { … }
namespace {
std::vector<std::string> definer_calls;
v8::Intercepted LogDefinerCallsAndContinueCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted LogDefinerCallsAndStopCallback(
Local<Name> name, const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
struct DefineNamedOwnICInterceptorConfig { … };
std::vector<DefineNamedOwnICInterceptorConfig> configs{
{
R"(
class ClassWithNormalField extends Base {
field = (() => {
Object.defineProperty(
this,
'normalField',
{ writable: true, configurable: true, value: 'initial'}
);
return 1;
})();
normalField = 'written';
constructor(arg) {
super(arg);
}
}
new ClassWithNormalField(obj);
stop ? (obj.field === undefined && obj.normalField === undefined)
: (obj.field === 1 && obj.normalField === 'written'))",
{"normalField", "field", "normalField"},
},
{
R"(
let setterCalled = false;
class ClassWithSetterField extends Base {
field = (() => {
Object.defineProperty(
this,
'setterField',
{ configurable: true, set(val) { setterCalled = true; } }
);
return 1;
})();
setterField = 'written';
constructor(arg) {
super(arg);
}
}
new ClassWithSetterField(obj);
!setterCalled &&
(stop ? (obj.field === undefined && obj.setterField === undefined)
: (obj.field === 1 && obj.setterField === 'written')))",
{"setterField", "field", "setterField"},
},
{
R"(
class ClassWithReadOnlyField extends Base {
field = (() => {
Object.defineProperty(
this,
'readOnlyField',
{ writable: false, configurable: true, value: 'initial'}
);
return 1;
})();
readOnlyField = 'written';
constructor(arg) {
super(arg);
}
}
new ClassWithReadOnlyField(obj);
stop ? (obj.field === undefined && obj.readOnlyField === undefined)
: (obj.field === 1 && obj.readOnlyField === 'written'))",
{"readOnlyField", "field", "readOnlyField"},
},
{
R"(
class ClassWithNonConfigurableField extends Base {
field = (() => {
Object.defineProperty(
this,
'nonConfigurableField',
{ writable: false, configurable: false, value: 'initial'}
);
return 1;
})();
nonConfigurableField = 'configured';
constructor(arg) {
super(arg);
}
}
let nonConfigurableThrown = false;
try { new ClassWithNonConfigurableField(obj); }
catch { nonConfigurableThrown = true; }
stop ? (!nonConfigurableThrown && obj.field === undefined
&& obj.nonConfigurableField === undefined)
: (nonConfigurableThrown && obj.field === 1
&& obj.nonConfigurableField === 'initial'))",
{"nonConfigurableField", "field", "nonConfigurableField"}}
};
}
void CheckPropertyDefinerCallbackInDefineNamedOwnIC(Local<Context> context,
bool stop) { … }
THREADED_TEST(PropertyDefinerCallbackInDefineNamedOwnIC) { … }
namespace {
v8::Intercepted EmptyPropertyDescriptorCallback(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted InterceptingPropertyDescriptorCallback(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(PropertyDescriptorCallback) { … }
namespace {
int echo_indexed_call_count = …;
v8::Intercepted EchoIndexedProperty(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(IndexedPropertyHandlerGetter) { … }
THREADED_TEST(PropertyHandlerInPrototype) { … }
TEST(PropertyHandlerInPrototypeWithDefine) { … }
namespace {
bool is_bootstrapping = …;
v8::Intercepted PrePropertyHandlerGet(
Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted PrePropertyHandlerQuery(
Local<Name> key, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(PrePropertyHandler) { … }
THREADED_TEST(EmptyInterceptorBreakTransitions) { … }
THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) { … }
THREADED_TEST(EmptyInterceptorDoesNotShadowApiAccessors) { … }
THREADED_TEST(EmptyInterceptorDoesNotAffectJSProperties) { … }
THREADED_TEST(SwitchFromInterceptorToAccessor) { … }
THREADED_TEST(SwitchFromAccessorToInterceptor) { … }
THREADED_TEST(SwitchFromInterceptorToAccessorWithInheritance) { … }
THREADED_TEST(SwitchFromAccessorToInterceptorWithInheritance) { … }
THREADED_TEST(SwitchFromInterceptorToJSAccessor) { … }
THREADED_TEST(SwitchFromJSAccessorToInterceptor) { … }
THREADED_TEST(SwitchFromInterceptorToProperty) { … }
THREADED_TEST(SwitchFromPropertyToInterceptor) { … }
namespace {
bool interceptor_for_hidden_properties_called;
v8::Intercepted InterceptorForHiddenProperties(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(NoSideEffectPropertyHandler) { … }
THREADED_TEST(HiddenPropertiesWithInterceptors) { … }
namespace {
v8::Intercepted XPropertyGetter(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(NamedInterceptorPropertyRead) { … }
THREADED_TEST(NamedInterceptorDictionaryIC) { … }
THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) { … }
namespace {
v8::Intercepted SetXOnPrototypeGetter(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(NamedInterceptorMapTransitionRead) { … }
namespace {
v8::Intercepted IndexedPropertyGetter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted IndexedPropertySetter(
uint32_t index, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(IndexedInterceptorWithIndexedAccessor) { … }
namespace {
v8::Intercepted UnboxedDoubleIndexedPropertyGetter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted UnboxedDoubleIndexedPropertySetter(
uint32_t index, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
void UnboxedDoubleIndexedPropertyEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
}
THREADED_TEST(IndexedInterceptorUnboxedDoubleWithIndexedAccessor) { … }
namespace {
void SloppyArgsIndexedPropertyEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
v8::Intercepted SloppyIndexedPropertyGetter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(IndexedInterceptorSloppyArgsWithIndexedAccessor) { … }
namespace {
v8::Intercepted IdentityIndexedPropertyGetter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(IndexedInterceptorWithGetOwnPropertyDescriptor) { … }
THREADED_TEST(IndexedInterceptorWithNoSetter) { … }
static bool AccessAlwaysBlocked(Local<v8::Context> accessing_context,
Local<v8::Object> accessed_object,
Local<v8::Value> data) { … }
THREADED_TEST(IndexedInterceptorWithAccessorCheck) { … }
THREADED_TEST(IndexedInterceptorWithDifferentIndices) { … }
THREADED_TEST(IndexedInterceptorWithNegativeIndices) { … }
THREADED_TEST(IndexedInterceptorWithNotSmiLookup) { … }
THREADED_TEST(IndexedInterceptorGoingMegamorphic) { … }
THREADED_TEST(IndexedInterceptorReceiverTurningSmi) { … }
THREADED_TEST(IndexedInterceptorOnProto) { … }
namespace {
void CheckIndexedInterceptorHasIC(v8::IndexedPropertyGetterCallbackV2 getter,
v8::IndexedPropertyQueryCallbackV2 query,
const char* source, int expected) { … }
int indexed_query_counter = …;
v8::Intercepted IndexedQueryCallback(
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted IndexHasICQueryAbsent(
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(IndexedInterceptorHasIC) { … }
THREADED_TEST(IndexedInterceptorHasICQueryAbsent) { … }
THREADED_TEST(IndexedInterceptorHasICQueryNone) { … }
THREADED_TEST(IndexedInterceptorHasICGetter) { … }
THREADED_TEST(IndexedInterceptorHasICQueryGetter) { … }
THREADED_TEST(IndexedInterceptorHasICQueryToggle) { … }
namespace {
v8::Intercepted NoBlockGetterX(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>&) { … }
v8::Intercepted NoBlockGetterI(uint32_t index,
const v8::PropertyCallbackInfo<v8::Value>&) { … }
v8::Intercepted PDeleter(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
v8::Intercepted IDeleter(uint32_t index,
const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
}
THREADED_TEST(Deleter) { … }
namespace {
v8::Intercepted GetK(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted IndexedGetK(uint32_t index,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { … }
static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { … }
THREADED_TEST(Enumerators) { … }
namespace {
v8::Global<Value> call_ic_function_global;
v8::Global<Value> call_ic_function2_global;
v8::Global<Value> call_ic_function3_global;
v8::Intercepted InterceptorCallICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorCallIC) { … }
THREADED_TEST(InterceptorCallICSeesOthers) { … }
namespace {
v8::Global<Value> call_ic_function4_global;
v8::Intercepted InterceptorCallICGetter4(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorCallICCacheableNotNeeded) { … }
THREADED_TEST(InterceptorCallICInvalidatedCacheable) { … }
THREADED_TEST(InterceptorCallICConstantFunctionUsed) { … }
namespace {
v8::Global<Value> call_ic_function5_global;
v8::Intercepted InterceptorCallICGetter5(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorCallICConstantFunctionNotNeeded) { … }
namespace {
v8::Global<Value> call_ic_function6_global;
v8::Intercepted InterceptorCallICGetter6(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorCallICConstantFunctionNotNeededWrapped) { … }
THREADED_TEST(InterceptorCallICInvalidatedConstantFunction) { … }
THREADED_TEST(InterceptorCallICInvalidatedConstantFunctionViaGlobal) { … }
THREADED_TEST(InterceptorCallICCachedFromGlobal) { … }
namespace {
v8::Global<Value> keyed_call_ic_function_global;
v8::Intercepted InterceptorKeyedCallICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorKeyedCallICKeyChange1) { … }
THREADED_TEST(InterceptorKeyedCallICKeyChange2) { … }
THREADED_TEST(InterceptorKeyedCallICKeyChangeOnGlobal) { … }
THREADED_TEST(InterceptorKeyedCallICFromGlobal) { … }
THREADED_TEST(InterceptorKeyedCallICMapChangeBefore) { … }
THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) { … }
namespace {
int interceptor_call_count = …;
v8::Intercepted InterceptorICRefErrorGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorICReferenceErrors) { … }
namespace {
int interceptor_ic_exception_get_count = …;
v8::Intercepted InterceptorICExceptionGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
THREADED_TEST(InterceptorICGetterExceptions) { … }
namespace {
int interceptor_ic_exception_set_count = …;
v8::Intercepted InterceptorICExceptionSetter(
Local<Name> key, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(InterceptorICSetterExceptions) { … }
THREADED_TEST(NullNamedInterceptor) { … }
THREADED_TEST(NullIndexedInterceptor) { … }
THREADED_TEST(NamedPropertyHandlerGetterAttributes) { … }
THREADED_TEST(Regress256330) { … }
THREADED_TEST(OptimizedInterceptorSetter) { … }
THREADED_TEST(OptimizedInterceptorGetter) { … }
THREADED_TEST(OptimizedInterceptorFieldRead) { … }
THREADED_TEST(OptimizedInterceptorFieldWrite) { … }
THREADED_TEST(Regress149912) { … }
THREADED_TEST(Regress625155) { … }
THREADED_TEST(Regress125988) { … }
namespace {
void IndexedPropertyEnumerator(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
void NamedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { … }
}
THREADED_TEST(GetOwnPropertyNamesWithInterceptor) { … }
namespace {
void IndexedPropertyEnumeratorException(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
}
THREADED_TEST(GetOwnPropertyNamesWithIndexedInterceptorExceptions_regress4026) { … }
namespace {
void NamedPropertyEnumeratorException(
const v8::PropertyCallbackInfo<v8::Array>& info) { … }
}
THREADED_TEST(GetOwnPropertyNamesWithNamedInterceptorExceptions_regress4026) { … }
namespace {
struct PreprocessExceptionTestConfig { … };
template <typename T>
PreprocessExceptionTestConfig* GetPETConfig(
const v8::PropertyCallbackInfo<T>& info) { … }
const char* ToString(v8::ExceptionContext kind) { … }
void PreprocessExceptionTestCallback(v8::ExceptionPropagationMessage info) { … }
void CheckMessage(v8::TryCatch& try_catch, const char* expected_message) { … }
v8::Intercepted PETNamedQuery(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted PETNamedGetter(Local<Name> name,
const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted PETNamedSetter(Local<Name> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted PETNamedDeleter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
v8::Intercepted PETNamedDefiner(Local<Name> name,
const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted PETNamedDescriptor(
Local<Name> property, const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted PETIndexedQuery(
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted PETIndexedGetter(uint32_t index,
const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted PETIndexedSetter(uint32_t index, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted PETIndexedDeleter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) { … }
v8::Intercepted PETIndexedDefiner(uint32_t index,
const v8::PropertyDescriptor& desc,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted PETIndexedDescriptor(
uint32_t index, const v8::PropertyCallbackInfo<Value>& info) { … }
}
void TestPreprocessExceptionFromInterceptors(
v8::Isolate* isolate, PreprocessExceptionTestConfig& config,
Local<Context> ctx, v8::Local<v8::Object> obj,
bool is_descriptor_callback_available) { … }
TEST(PreprocessExceptionFromInterceptorsWithoutDescriptorCallback) { … }
TEST(PreprocessExceptionFromInterceptorsWithDescriptorCallback) { … }
namespace {
template <typename T>
Local<Object> BuildWrappedObject(v8::Isolate* isolate, T* data) { … }
template <typename T>
T* GetWrappedObject(Local<Value> data) { … }
struct AccessCheckData { … };
struct ShouldInterceptData { … };
v8::Intercepted ShouldNamedInterceptor(
Local<Name> name, const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted ShouldIndexedInterceptor(
uint32_t, const v8::PropertyCallbackInfo<Value>& info) { … }
}
THREADED_TEST(NonMaskingInterceptorOwnProperty) { … }
THREADED_TEST(NonMaskingInterceptorPrototypeProperty) { … }
THREADED_TEST(NonMaskingInterceptorPrototypePropertyIC) { … }
namespace {
v8::Intercepted ConcatNamedPropertyGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted ConcatIndexedPropertyGetter(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
void EnumCallbackWithNames(const v8::PropertyCallbackInfo<v8::Array>& info) { … }
void EnumCallbackWithIndices(const v8::PropertyCallbackInfo<v8::Array>& info) { … }
v8::Intercepted RestrictiveNamedQuery(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
v8::Intercepted RestrictiveIndexedQuery(
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(EnumeratorsAndUnenumerableNamedProperties) { … }
namespace {
v8::Intercepted QueryInterceptorForFoo(
Local<Name> property, const v8::PropertyCallbackInfo<v8::Integer>& info) { … }
}
THREADED_TEST(EnumeratorsAndUnenumerableNamedPropertiesWithoutSet) { … }
THREADED_TEST(EnumeratorsAndUnenumerableIndexedPropertiesArgumentsElements) { … }
THREADED_TEST(EnumeratorsAndUnenumerableIndexedProperties) { … }
THREADED_TEST(EnumeratorsAndForIn) { … }
namespace {
v8::Intercepted DatabaseGetter(Local<Name> name,
const v8::PropertyCallbackInfo<Value>& info) { … }
v8::Intercepted DatabaseSetter(Local<Name> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(NonMaskingInterceptorGlobalEvalRegression) { … }
namespace {
v8::Intercepted CheckReceiver(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
}
TEST(Regress609134Interceptor) { … }
namespace {
v8::Intercepted Regress42204611_Getter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
v8::Intercepted Regress42204611_Setter(
Local<Name> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
v8::Intercepted Regress42204611_Definer(
Local<Name> name, const v8::PropertyDescriptor& descriptor,
const v8::PropertyCallbackInfo<void>& info) { … }
}
THREADED_TEST(Regress42204611) { … }