30 Factory* factory = isolate->
factory();
32 info->set_property_attributes(attributes);
33 info->set_all_can_read(
false);
34 info->set_all_can_write(
false);
35 info->set_name(*
name);
38 info->set_getter(*get);
39 info->set_setter(*set);
47 Factory* factory = isolate->
factory();
49 info->set_name(accessor->name());
50 info->set_flag(accessor->flag());
51 info->set_expected_receiver_type(accessor->expected_receiver_type());
52 info->set_getter(accessor->getter());
53 info->set_setter(accessor->setter());
54 info->set_data(accessor->data());
63 !iter.
IsAtEnd(); iter.Advance()) {
64 if (Is<C>(iter.GetCurrent()))
return C::cast(iter.GetCurrent());
75 *object_offset = offset;
90 if (type->Is(T::String())) {
95 if (!type->IsClass())
return false;
98 switch (
map->instance_type()) {
128 bool Accessors::IsJSObjectFieldAccessor<Type>(
Type* type,
144 if (*holder == *receiver)
return false;
145 if (receiver->IsJSObject()) {
150 if (!object->map()->is_extensible())
return true;
152 value,
NONE).Check();
163 void Accessors::ArgumentsIteratorGetter(
173 void Accessors::ArgumentsIteratorSetter(
177 HandleScope scope(isolate);
185 DCHECK(it.HolderIsReceiverOrHiddenPrototype());
190 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo(
192 Handle<Name>
name(isolate->native_context()->iterator_symbol(), isolate);
194 &ArgumentsIteratorSetter, attributes);
206 if (value->IsNumber() || !value->IsJSValue())
return value;
208 DCHECK(wrapper->GetIsolate()->native_context()->number_function()->
210 if (wrapper->map() == isolate->number_function()->initial_map()) {
211 return handle(wrapper->value(), isolate);
218 void Accessors::ArrayLengthGetter(
225 Object* result = holder->length();
230 void Accessors::ArrayLengthSetter(
245 MaybeHandle<Object>
maybe;
246 Handle<Object> uint32_v;
247 maybe = Execution::ToUint32(isolate, value);
248 if (!
maybe.ToHandle(&uint32_v)) {
252 Handle<Object> number_v;
254 if (!
maybe.ToHandle(&number_v)) {
259 if (uint32_v->Number() == number_v->Number()) {
265 Handle<Object> exception;
266 maybe = isolate->
factory()->NewRangeError(
"invalid_array_length",
267 HandleVector<Object>(
NULL, 0));
268 if (!
maybe.ToHandle(&exception)) {
277 Handle<AccessorInfo> Accessors::ArrayLengthInfo(
280 isolate->factory()->length_string(),
292 void Accessors::StringLengthGetter(
297 HandleScope scope(isolate);
305 if (!value->IsString()) {
315 void Accessors::StringLengthSetter(
323 Handle<AccessorInfo> Accessors::StringLengthInfo(
326 isolate->factory()->length_string(),
338 void Accessors::ScriptColumnOffsetGetter(
343 HandleScope scope(isolate);
345 Object* res = Script::cast(JSValue::cast(
object)->value())->column_offset();
350 void Accessors::ScriptColumnOffsetSetter(
358 Handle<AccessorInfo> Accessors::ScriptColumnOffsetInfo(
360 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
364 &ScriptColumnOffsetGetter,
365 &ScriptColumnOffsetSetter,
375 void Accessors::ScriptIdGetter(
380 HandleScope scope(isolate);
382 Object*
id = Script::cast(JSValue::cast(
object)->value())->id();
387 void Accessors::ScriptIdSetter(
395 Handle<AccessorInfo> Accessors::ScriptIdInfo(
412 void Accessors::ScriptNameGetter(
417 HandleScope scope(isolate);
419 Object* source = Script::cast(JSValue::cast(
object)->value())->name();
424 void Accessors::ScriptNameSetter(
432 Handle<AccessorInfo> Accessors::ScriptNameInfo(
435 isolate->factory()->name_string(),
447 void Accessors::ScriptSourceGetter(
452 HandleScope scope(isolate);
454 Object* source = Script::cast(JSValue::cast(
object)->value())->source();
459 void Accessors::ScriptSourceSetter(
467 Handle<AccessorInfo> Accessors::ScriptSourceInfo(
470 isolate->factory()->source_string(),
482 void Accessors::ScriptLineOffsetGetter(
487 HandleScope scope(isolate);
489 Object* res = Script::cast(JSValue::cast(
object)->value())->line_offset();
494 void Accessors::ScriptLineOffsetSetter(
502 Handle<AccessorInfo> Accessors::ScriptLineOffsetInfo(
504 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
508 &ScriptLineOffsetGetter,
509 &ScriptLineOffsetSetter,
519 void Accessors::ScriptTypeGetter(
524 HandleScope scope(isolate);
526 Object* res = Script::cast(JSValue::cast(
object)->value())->type();
531 void Accessors::ScriptTypeSetter(
539 Handle<AccessorInfo> Accessors::ScriptTypeInfo(
556 void Accessors::ScriptCompilationTypeGetter(
561 HandleScope scope(isolate);
564 Script::cast(JSValue::cast(
object)->value())->compilation_type());
569 void Accessors::ScriptCompilationTypeSetter(
577 Handle<AccessorInfo> Accessors::ScriptCompilationTypeInfo(
579 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
583 &ScriptCompilationTypeGetter,
584 &ScriptCompilationTypeSetter,
594 void Accessors::ScriptLineEndsGetter(
598 HandleScope scope(isolate);
600 Handle<Script> script(
603 DCHECK(script->line_ends()->IsFixedArray());
604 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
606 DCHECK(*line_ends == isolate->
heap()->empty_fixed_array() ||
607 line_ends->map() == isolate->
heap()->fixed_cow_array_map());
608 Handle<JSArray> js_array =
609 isolate->
factory()->NewJSArrayWithElements(line_ends);
614 void Accessors::ScriptLineEndsSetter(
622 Handle<AccessorInfo> Accessors::ScriptLineEndsInfo(
624 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
628 &ScriptLineEndsGetter,
629 &ScriptLineEndsSetter,
639 void Accessors::ScriptSourceUrlGetter(
644 HandleScope scope(isolate);
646 Object* url = Script::cast(JSValue::cast(
object)->value())->source_url();
651 void Accessors::ScriptSourceUrlSetter(
659 Handle<AccessorInfo> Accessors::ScriptSourceUrlInfo(
662 isolate->factory()->source_url_string(),
663 &ScriptSourceUrlGetter,
664 &ScriptSourceUrlSetter,
674 void Accessors::ScriptSourceMappingUrlGetter(
679 HandleScope scope(isolate);
682 Script::cast(JSValue::cast(
object)->value())->source_mapping_url();
687 void Accessors::ScriptSourceMappingUrlSetter(
695 Handle<AccessorInfo> Accessors::ScriptSourceMappingUrlInfo(
698 isolate->factory()->source_mapping_url_string(),
699 &ScriptSourceMappingUrlGetter,
700 &ScriptSourceMappingUrlSetter,
710 void Accessors::ScriptContextDataGetter(
715 HandleScope scope(isolate);
717 Object* res = Script::cast(JSValue::cast(
object)->value())->context_data();
722 void Accessors::ScriptContextDataSetter(
730 Handle<AccessorInfo> Accessors::ScriptContextDataInfo(
732 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
736 &ScriptContextDataGetter,
737 &ScriptContextDataSetter,
747 void Accessors::ScriptEvalFromScriptGetter(
751 HandleScope scope(isolate);
753 Handle<Script> script(
755 Handle<Object> result = isolate->
factory()->undefined_value();
756 if (!script->eval_from_shared()->IsUndefined()) {
757 Handle<SharedFunctionInfo> eval_from_shared(
758 SharedFunctionInfo::cast(script->eval_from_shared()));
759 if (eval_from_shared->script()->IsScript()) {
760 Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()));
769 void Accessors::ScriptEvalFromScriptSetter(
777 Handle<AccessorInfo> Accessors::ScriptEvalFromScriptInfo(
779 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
783 &ScriptEvalFromScriptGetter,
784 &ScriptEvalFromScriptSetter,
794 void Accessors::ScriptEvalFromScriptPositionGetter(
798 HandleScope scope(isolate);
800 Handle<Script> script(
802 Handle<Object> result = isolate->
factory()->undefined_value();
804 Handle<Code> code(SharedFunctionInfo::cast(
805 script->eval_from_shared())->code());
806 result = Handle<Object>(
807 Smi::FromInt(code->SourcePosition(code->instruction_start() +
808 script->eval_from_instructions_offset()->value())),
815 void Accessors::ScriptEvalFromScriptPositionSetter(
823 Handle<AccessorInfo> Accessors::ScriptEvalFromScriptPositionInfo(
825 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
829 &ScriptEvalFromScriptPositionGetter,
830 &ScriptEvalFromScriptPositionSetter,
840 void Accessors::ScriptEvalFromFunctionNameGetter(
844 HandleScope scope(isolate);
846 Handle<Script> script(
848 Handle<Object> result;
849 Handle<SharedFunctionInfo> shared(
850 SharedFunctionInfo::cast(script->eval_from_shared()));
852 if (!shared->name()->IsUndefined()) {
853 result = Handle<Object>(shared->name(), isolate);
855 result = Handle<Object>(shared->inferred_name(), isolate);
861 void Accessors::ScriptEvalFromFunctionNameSetter(
869 Handle<AccessorInfo> Accessors::ScriptEvalFromFunctionNameInfo(
871 Handle<String>
name(isolate->factory()->InternalizeOneByteString(
875 &ScriptEvalFromFunctionNameGetter,
876 &ScriptEvalFromFunctionNameSetter,
887 if (!function->has_prototype()) {
899 bool is_observed =
function->map()->is_observed();
901 if (function->has_prototype())
902 old_value =
handle(function->prototype(), isolate);
904 old_value = isolate->
factory()->NewFunctionPrototype(
function);
908 DCHECK(function->prototype() == *value);
910 if (is_observed && !old_value->SameValue(*value)) {
912 function,
"update", isolate->
factory()->prototype_string(), old_value);
926 DCHECK(function->should_have_prototype());
927 Isolate* isolate =
function->GetIsolate();
932 void Accessors::FunctionPrototypeGetter(
944 void Accessors::FunctionPrototypeSetter(
954 Handle<JSFunction>
object =
960 Handle<AccessorInfo> Accessors::FunctionPrototypeInfo(
963 isolate->factory()->prototype_string(),
964 &FunctionPrototypeGetter,
965 &FunctionPrototypeSetter,
975 void Accessors::FunctionLengthGetter(
979 HandleScope scope(isolate);
980 Handle<JSFunction>
function =
984 if (function->shared()->is_compiled()) {
985 length =
function->shared()->length();
990 length =
function->shared()->length();
1001 void Accessors::FunctionLengthSetter(
1010 Handle<AccessorInfo> Accessors::FunctionLengthInfo(
1013 isolate->factory()->length_string(),
1014 &FunctionLengthGetter,
1015 &FunctionLengthSetter,
1025 void Accessors::FunctionNameGetter(
1029 HandleScope scope(isolate);
1030 Handle<JSFunction>
function =
1032 Handle<Object> result(function->shared()->name(), isolate);
1037 void Accessors::FunctionNameSetter(
1046 Handle<AccessorInfo> Accessors::FunctionNameInfo(
1049 isolate->factory()->name_string(),
1050 &FunctionNameGetter,
1051 &FunctionNameSetter,
1064 int inlined_frame_index) {
1065 Isolate* isolate = inlined_function->GetIsolate();
1066 Factory* factory = isolate->
factory();
1067 SlotRefValueBuilder slot_refs(
1069 inlined_frame_index,
1070 inlined_function->shared()->formal_parameter_count());
1072 int args_count = slot_refs.args_length();
1074 factory->NewArgumentsObject(inlined_function, args_count);
1076 slot_refs.Prepare(isolate);
1077 for (
int i = 0;
i < args_count; ++
i) {
1079 array->set(
i, *value);
1081 slot_refs.Finish(isolate);
1082 arguments->set_elements(*array);
1094 for (
int i = functions.length() - 1;
i >= 0;
i--) {
1095 if (functions[
i] == *
function)
return i;
1103 if (function->shared()->native())
return isolate->
factory()->null_value();
1106 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
1109 if (function_index < 0)
continue;
1111 if (function_index > 0) {
1119 if (!frame->is_optimized()) {
1122 int index = scope_info->StackSlotIndex(
1123 isolate->
heap()->arguments_string());
1126 if (!arguments->IsArgumentsMarker())
return arguments;
1133 it.AdvanceToArgumentsFrame();
1144 DCHECK(array->length() == length);
1146 arguments->set_elements(*array);
1153 return isolate->
factory()->null_value();
1162 void Accessors::FunctionArgumentsGetter(
1174 void Accessors::FunctionArgumentsSetter(
1183 Handle<AccessorInfo> Accessors::FunctionArgumentsInfo(
1186 isolate->factory()->arguments_string(),
1187 &FunctionArgumentsGetter,
1188 &FunctionArgumentsSetter,
1207 : isolate_(isolate),
1208 frame_iterator_(isolate),
1215 if (functions_.length() == 0)
return NULL;
1216 JSFunction* next_function = functions_[index_];
1223 return next_function;
1233 next_function = next();
1234 if (next_function ==
function)
return true;
1235 }
while (next_function !=
NULL);
1241 functions_.Rewind(0);
1242 if (frame_iterator_.done())
return;
1245 DCHECK(functions_.length() > 0);
1246 frame_iterator_.Advance();
1247 index_ = functions_.length() - 1;
1260 if (function->shared()->native()) {
1264 if (!it.
Find(*
function)) {
1273 }
while (caller->shared()->is_toplevel());
1278 while (potential_caller !=
NULL && potential_caller->
IsBuiltin()) {
1279 caller = potential_caller;
1280 potential_caller = it.
next();
1282 if (!caller->shared()->native() && potential_caller !=
NULL) {
1283 caller = potential_caller;
1288 if (caller->shared()->bound()) {
1294 if (caller->shared()->strict_mode() ==
STRICT) {
1305 void Accessors::FunctionCallerGetter(
1313 MaybeHandle<JSFunction> maybe_caller;
1314 maybe_caller =
FindCaller(isolate,
function);
1316 if (maybe_caller.ToHandle(&caller)) {
1319 result = isolate->
factory()->null_value();
1325 void Accessors::FunctionCallerSetter(
1334 Handle<AccessorInfo> Accessors::FunctionCallerInfo(
1337 isolate->factory()->caller_string(),
1338 &FunctionCallerGetter,
1339 &FunctionCallerSetter,
1354 int slot = info.
Data()->Int32Value();
1357 if (value->IsTheHole()) {
1363 if (!
maybe.ToHandle(&exception)) {
1382 int slot = info.
Data()->Int32Value();
1385 if (old_value->IsTheHole()) {
1390 if (!
maybe.ToHandle(&exception)) {
1407 Factory* factory = isolate->
factory();
1409 info->set_property_attributes(attributes);
1410 info->set_all_can_read(
true);
1411 info->set_all_can_write(
true);
1412 info->set_name(*
name);
1416 info->set_getter(*getter);
1417 if (!(attributes &
ReadOnly)) info->set_setter(*setter);
A stack-allocated class that governs a number of local handles.
An object reference managed by the v8 garbage collector.
A light-weight stack-allocated object handle.
A JavaScript object (ECMA-262, 4.3.3)
The information passed to a property callback about the context of the property access.
Local< Value > Data() const
Local< Object > Holder() const
ReturnValue< T > GetReturnValue() const
Local< Object > This() const
Isolate * GetIsolate() const
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static Handle< Object > FlattenNumber(Isolate *isolate, Handle< Object > value)
static Handle< ExecutableAccessorInfo > CloneAccessor(Isolate *isolate, Handle< ExecutableAccessorInfo > accessor)
static Handle< Object > FunctionSetPrototype(Handle< JSFunction > object, Handle< Object > value)
static Handle< AccessorInfo > MakeModuleExport(Handle< String > name, int index, PropertyAttributes attributes)
static Handle< AccessorInfo > MakeAccessor(Isolate *isolate, Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, PropertyAttributes attributes)
static Handle< Object > FunctionGetPrototype(Handle< JSFunction > object)
static Handle< Object > FunctionGetArguments(Handle< JSFunction > object)
static bool IsJSObjectFieldAccessor(typename T::TypeHandle type, Handle< Name > name, int *object_offset)
static bool EnsureCompiled(Handle< JSFunction > function, ClearExceptionFlag flag)
static Context * cast(Object *context)
bool HasSameSecurityTokenAs(Context *that)
void set(int index, Object *value)
List< JSFunction * > functions_
bool Find(JSFunction *function)
FrameFunctionIterator(Isolate *isolate, const DisallowHeapAllocation &promise)
JavaScriptFrameIterator frame_iterator_
static Handle< T > cast(Handle< S > that)
Isolate * GetIsolate() const
Handle< Context > native_context()
void ScheduleThrow(Object *exception)
bool OptionalRescheduleException(bool is_bottom_call)
bool has_pending_exception()
static const int kByteOffsetOffset
static const int kByteLengthOffset
static const int kByteLengthOffset
static MUST_USE_RESULT MaybeHandle< Object > SetElementsLength(Handle< JSArray > array, Handle< Object > length)
static const int kLengthOffset
static void SetPrototype(Handle< JSFunction > function, Handle< Object > value)
static void EnqueueChangeRecord(Handle< JSObject > object, const char *type, Handle< Name > name, Handle< Object > old_value)
static MUST_USE_RESULT MaybeHandle< Object > SetOwnPropertyIgnoreAttributes(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, ExecutableAccessorInfoHandling handling=DEFAULT_HANDLING)
static const int kLengthOffset
virtual void GetFunctions(List< JSFunction * > *functions)
Object * GetParameter(int index) const
int ComputeParametersCount() const
static Handle< Object > SetDataProperty(LookupIterator *it, Handle< Object > value)
A class to uniformly access the prototype of any Object and walk its prototype chain.
bool IsAtEnd(WhereToEnd where_to_end=END_AT_NULL) const
static void InitLineEnds(Handle< Script > script)
static Handle< JSObject > GetWrapper(Handle< Script > script)
static Smi * FromInt(int value)
Object * GetExpression(int index) const
static const int kLengthOffset
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define CHECK_EQ(expected, value)
#define DCHECK(condition)
MaybeHandle< JSFunction > FindCaller(Isolate *isolate, Handle< JSFunction > function)
static bool AllowAccessToFunction(Context *current_context, JSFunction *function)
Handle< Object > GetFunctionArguments(Isolate *isolate, Handle< JSFunction > function)
static Handle< Object > ArgumentsForInlinedFunction(JavaScriptFrame *frame, Handle< JSFunction > inlined_function, int inlined_frame_index)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
static void ModuleGetExport(v8::Local< v8::String > property, const v8::PropertyCallbackInfo< v8::Value > &info)
static Handle< Object > GetFunctionPrototype(Isolate *isolate, Handle< JSFunction > function)
int ToNumber(Register reg)
kSerializedDataOffset Object
Handle< T > handle(T *t, Isolate *isolate)
static bool CheckForName(Handle< Name > name, Handle< String > property_name, int offset, int *object_offset)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
static void ModuleSetExport(v8::Local< v8::String > property, v8::Local< v8::Value > value, const v8::PropertyCallbackInfo< v8::Value > &info)
static int FindFunctionInFrame(JavaScriptFrame *frame, Handle< JSFunction > function)
static C * FindInstanceOf(Isolate *isolate, Object *obj)
bool SetPropertyOnInstanceIfInherited(Isolate *isolate, const v8::PropertyCallbackInfo< void > &info, v8::Local< v8::Name > name, Handle< Object > value)
static Handle< Object > SetFunctionPrototype(Isolate *isolate, Handle< JSFunction > function, Handle< Object > value)
Debugger support for the V8 JavaScript engine.
v8::internal::Handle< v8::internal::Object > FromCData(v8::internal::Isolate *isolate, T obj)
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
#define STATIC_CHAR_VECTOR(x)