34 using namespace v8::internal;
39 static const unsigned kArraySize = 200;
43 for (
unsigned i = 0; i < kArraySize; i++) {
44 if (handles_[i].IsEmpty())
continue;
57 static const unsigned kArraySize = 1024/
sizeof(uint64_t);
61 for (
unsigned i = 0; i < kArraySize; i++) {
67 T As() {
return reinterpret_cast<T>(data_); }
70 uint64_t data_[kArraySize];
93 const char* class_name,
95 const char* descriptor_name =
NULL,
102 if (descriptor_name !=
NULL && !descriptor.IsEmpty()) {
103 bool added_accessor =
104 obj_template->SetDeclaredAccessor(v8_str(descriptor_name), descriptor);
105 CHECK(added_accessor);
107 obj_template->SetInternalFieldCount((internal_field+1)*2 + 7);
115 void* internal_object,
120 CreateConstructor(context,
"Accessible", internal_field,
"x", descriptor);
122 CompileRun(
"var accessible = new Accessible();");
124 context->Global()->Get(v8_str(
"accessible")));
128 CHECK(added_accessor);
130 CHECK(added_accessor);
133 value = CompileRun(
"accessible.x;");
135 value = CompileRun(
"accessible['x'];");
138 value = CompileRun(
"accessible.y;");
140 value = CompileRun(
"accessible['y'];");
142 value = CompileRun(
"accessible[13];");
144 value = CompileRun(
"accessible['13'];");
167 static void TestPrimitiveValue(
173 int internal_field = 6;
176 ->NewRawShift(helper->
isolate_, static_cast<uint16_t>(index*
sizeof(
T)))
177 ->NewPrimitiveValue(helper->
isolate_, data_type, 0);
180 helper->
array_->As<
T*>()[index] = value;
181 VerifyRead(descriptor, internal_field, helper->
array_.
get(), expected);
194 static void TestBitmaskCompare(
T bitmask,
199 int internal_field = 4;
202 ->NewRawShift(helper->
isolate_, static_cast<uint16_t>(index*
sizeof(
T)));
208 static_cast<uint8_t>(bitmask),
209 static_cast<uint8_t>(compare_value));
214 static_cast<uint16_t>(bitmask),
215 static_cast<uint16_t>(compare_value));
220 static_cast<uint32_t>(bitmask),
221 static_cast<uint32_t>(compare_value));
230 array->
As<
T*>()[index] = compare_value;
232 helper->
array_->As<
T*>()[index] = compare_value & bitmask;
239 TestBitmaskCompare<uint8_t>(0xf3, 0xa8, &helper);
240 TestBitmaskCompare<uint16_t>(0xfefe, 0x7d42, &helper);
241 TestBitmaskCompare<uint32_t>(0xfefeab18, 0x1234fdec, &helper);
249 int internal_field = 3;
253 ->NewRawShift(helper.
isolate_, static_cast<uint16_t>(index*
sizeof(ptr)))
254 ->NewPointerCompare(helper.
isolate_, ptr);
257 array->
As<uintptr_t*>()[index] = reinterpret_cast<uintptr_t>(ptr);
265 int first_index = 13;
266 int internal_field = 7;
267 int second_index = 11;
268 int pointed_to_index = 75;
273 ->NewRawDereference(helper.
isolate_)
275 static_cast<uint16_t>(second_index*
sizeof(
int16_t)))
278 array->
As<uintptr_t**>()[first_index] =
279 &array->
As<uintptr_t*>()[pointed_to_index];
280 VerifyRead(descriptor, internal_field, array,
282 second_index += pointed_to_index*
sizeof(uintptr_t)/
sizeof(
uint16_t);
283 array->
As<
uint16_t*>()[second_index] = expected;
284 VerifyRead(descriptor, internal_field, array,
293 int internal_field = 0;
297 ->NewHandleDereference(helper.
isolate_);
301 VerifyRead(descriptor, internal_field, array, expected);
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
#define CHECK_EQ(expected, value)
static Local< RawOperationDescriptor > NewInternalFieldDereference(Isolate *isolate, int internal_field)
bool SetDeclaredAccessor(Local< String > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
Local< ObjectTemplate > InstanceTemplate()
v8::Persistent< v8::Value > handles_[kArraySize]
static Local< Integer > New(Isolate *isolate, int32_t value)
Local< DeclaredAccessorDescriptor > NewBitmaskCompare32(Isolate *isolate, uint32_t bitmask, uint32_t compare_value)
v8::Isolate * GetIsolate()
void SetAlignedPointerInInternalField(int index, void *value)
V8_INLINE Handle< Boolean > True(Isolate *isolate)
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >(), int length=0)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Local< DeclaredAccessorDescriptor > NewBitmaskCompare8(Isolate *isolate, uint8_t bitmask, uint8_t compare_value)
static Local< Number > New(Isolate *isolate, double value)
static V8_INLINE Local< T > Cast(Local< S > that)
#define T(name, string, precedence)
SmartPointer< AlignedArray > array_
V8_INLINE Handle< Boolean > False(Isolate *isolate)
v8::ObjectOperationDescriptor OOD
SmartPointer< HandleArray > handle_array_
Local< Function > GetFunction()
DeclaredAccessorDescriptorDataType
Local< DeclaredAccessorDescriptor > NewBitmaskCompare16(Isolate *isolate, uint16_t bitmask, uint16_t compare_value)
v8::Local< v8::Context > local()
static v8::Isolate * isolate()