46 StubCache::StubCache(Isolate* isolate, Zone* zone)
47 : isolate_(isolate), zone_(zone) {
48 ASSERT(isolate == Isolate::Current());
52 void StubCache::Initialize() {
65 ASSERT(!heap()->InNewSpace(name));
76 ASSERT(Code::ExtractTypeFromFlags(flags) == 0);
79 int primary_offset = PrimaryOffset(name, flags, map);
80 Entry* primary = entry(primary_, primary_offset);
85 if (old_code != isolate_->builtins()->builtin(Builtins::kIllegal)) {
86 Map* old_map = primary->
map;
88 int seed = PrimaryOffset(primary->
key, old_flags, old_map);
89 int secondary_offset = SecondaryOffset(primary->
key, old_flags, seed);
90 Entry* secondary = entry(secondary_, secondary_offset);
91 *secondary = *primary;
96 primary->
value = code;
98 isolate()->counters()->megamorphic_stub_cache_updates()->Increment();
105 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties());
113 if (receiver->IsGlobalObject()) cache_name = name;
115 while (last->GetPrototype() != heap()->null_value()) {
117 if (last->IsGlobalObject()) cache_name = name;
122 Code::ComputeMonomorphicFlags(Code::LOAD_IC,
NONEXISTENT);
123 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags));
129 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name));
130 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code));
131 JSObject::UpdateMapCodeCache(receiver, cache_name, code);
140 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
142 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
148 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
149 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
150 JSObject::UpdateMapCodeCache(receiver, name, code);
159 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
160 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
162 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
168 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
169 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
170 JSObject::UpdateMapCodeCache(receiver, name, code);
179 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
181 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
187 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
188 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
189 JSObject::UpdateMapCodeCache(receiver, name, code);
198 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
201 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
207 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
208 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
209 JSObject::UpdateMapCodeCache(receiver, name, code);
217 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
219 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
225 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
226 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
227 JSObject::UpdateMapCodeCache(receiver, name, code);
233 return isolate_->builtins()->LoadIC_Normal();
241 bool is_dont_delete) {
242 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
244 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
250 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
251 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
252 JSObject::UpdateMapCodeCache(receiver, name, code);
261 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
263 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
269 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
270 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
271 JSObject::UpdateMapCodeCache(receiver, name, code);
280 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
283 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
289 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
290 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
291 JSObject::UpdateMapCodeCache(receiver, name, code);
299 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
301 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
INTERCEPTOR);
302 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
307 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
308 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
309 JSObject::UpdateMapCodeCache(receiver, name, code);
319 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) ==
OWN_MAP);
321 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
CALLBACKS);
322 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
328 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
329 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
330 JSObject::UpdateMapCodeCache(receiver, name, code);
338 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
CALLBACKS);
339 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
344 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
345 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
346 JSObject::UpdateMapCodeCache(receiver, name, code);
354 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
CALLBACKS);
361 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
362 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
363 Map::UpdateCodeCache(map, name, code);
372 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
CALLBACKS);
373 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
378 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
379 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
380 JSObject::UpdateMapCodeCache(receiver, name, code);
392 Code::STORE_IC, type, strict_mode);
393 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
399 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
400 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
401 JSObject::UpdateMapCodeCache(receiver, name, code);
411 KeyedIC::GetGrowModeFromStubKind(stub_kind);
413 Code::ComputeExtraICState(grow_mode, strict_mode);
415 Code::ComputeMonomorphicFlags(
416 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC
417 : Code::KEYED_STORE_IC,
423 name = isolate()->factory()->KeyedLoadElementMonomorphic_symbol();
425 case KeyedIC::STORE_NO_TRANSITION:
426 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol();
428 case KeyedIC::STORE_AND_GROW_NO_TRANSITION:
429 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol();
435 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags));
440 case KeyedIC::LOAD: {
445 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: {
451 case KeyedIC::STORE_NO_TRANSITION: {
464 if (stub_kind == KeyedIC::LOAD) {
465 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0));
467 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, 0));
469 Map::UpdateCodeCache(receiver_map, name, code);
476 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
477 : isolate_->builtins()->Builtins::StoreIC_Normal();
486 Code::STORE_IC,
NORMAL, strict_mode);
487 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
492 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
493 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
494 JSObject::UpdateMapCodeCache(receiver, name, code);
503 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
506 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
511 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
512 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
513 JSObject::UpdateMapCodeCache(receiver, name, code);
524 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
529 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
530 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
531 JSObject::UpdateMapCodeCache(receiver, name, code);
541 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
546 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
547 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
548 JSObject::UpdateMapCodeCache(receiver, name, code);
559 Code::KEYED_STORE_IC, type, strict_mode);
560 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
567 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name));
568 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code));
569 JSObject::UpdateMapCodeCache(receiver, name, code);
574 #define CALL_LOGGER_TAG(kind, type) \
575 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type)
586 IC::GetCodeCacheForObject(*
object, *holder);
591 if (object->IsString()) {
593 }
else if (object->IsNumber()) {
595 }
else if (object->IsBoolean()) {
602 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags));
608 code->set_check_type(check);
612 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
613 JSObject::UpdateMapCodeCache(map_holder, name, code);
627 IC::GetCodeCacheForObject(*
object, *holder);
633 if (object->IsNumber() ||
object->IsBoolean() ||
object->IsString()) {
638 Code::ComputeMonomorphicFlags(kind,
FIELD, extra_state,
640 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags));
646 holder, index, name);
650 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
651 JSObject::UpdateMapCodeCache(map_holder, name, code);
664 IC::GetCodeCacheForObject(*
object, *holder);
670 if (object->IsNumber() ||
object->IsBoolean() ||
object->IsString()) {
675 Code::ComputeMonomorphicFlags(kind,
INTERCEPTOR, extra_state,
677 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags));
680 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder);
687 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
688 JSObject::UpdateMapCodeCache(map_holder, name, code);
702 IC::GetCodeCacheForObject(*receiver, *holder);
703 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
705 Code::ComputeMonomorphicFlags(kind,
NORMAL, extra_state,
707 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags));
710 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder);
716 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
717 JSObject::UpdateMapCodeCache(map_holder, name, code);
724 UnseededNumberDictionary::Set(isolate->
factory()->non_monomorphic_cache(),
731 Code* StubCache::FindCallInitialize(
int argc,
732 RelocInfo::Mode mode,
736 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
742 isolate()->
heap()->raw_unchecked_non_monomorphic_cache();
743 int entry = dictionary->
FindEntry(isolate(), flags);
748 return reinterpret_cast<Code*
>(code);
753 RelocInfo::Mode mode,
757 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
761 isolate_->factory()->non_monomorphic_cache();
762 int entry = cache->FindEntry(isolate_, flags);
763 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
765 StubCompiler compiler(isolate_);
766 Handle<Code> code = compiler.CompileCallInitialize(flags);
767 FillCache(isolate_, code);
772 Handle<Code> StubCache::ComputeCallInitialize(
int argc, RelocInfo::Mode mode) {
773 return ComputeCallInitialize(argc, mode, Code::CALL_IC);
778 return ComputeCallInitialize(argc, RelocInfo::CODE_TARGET,
779 Code::KEYED_CALL_IC);
790 isolate_->factory()->non_monomorphic_cache();
791 int entry = cache->FindEntry(isolate_, flags);
792 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
794 StubCompiler compiler(isolate_);
795 Handle<Code> code = compiler.CompileCallPreMonomorphic(flags);
796 FillCache(isolate_, code);
807 isolate_->factory()->non_monomorphic_cache();
808 int entry = cache->FindEntry(isolate_, flags);
809 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
811 StubCompiler compiler(isolate_);
813 FillCache(isolate_, code);
819 ASSERT(kind == Code::KEYED_CALL_IC);
821 Code::ComputeFlags(kind,
MEGAMORPHIC, Code::kNoExtraICState,
824 isolate_->factory()->non_monomorphic_cache();
825 int entry = cache->FindEntry(isolate_, flags);
826 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
828 StubCompiler compiler(isolate_);
829 Handle<Code> code = compiler.CompileCallArguments(flags);
830 FillCache(isolate_, code);
843 isolate_->factory()->non_monomorphic_cache();
844 int entry = cache->FindEntry(isolate_, flags);
845 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
847 StubCompiler compiler(isolate_);
848 Handle<Code> code = compiler.CompileCallMegamorphic(flags);
849 FillCache(isolate_, code);
863 isolate_->factory()->non_monomorphic_cache();
864 int entry = cache->FindEntry(isolate_, flags);
865 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
867 StubCompiler compiler(isolate_);
869 FillCache(isolate_, code);
874 #ifdef ENABLE_DEBUGGER_SUPPORT
880 Code::ComputeFlags(kind,
DEBUG_BREAK, Code::kNoExtraICState,
883 isolate_->factory()->non_monomorphic_cache();
884 int entry = cache->FindEntry(isolate_, flags);
885 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
887 StubCompiler compiler(isolate_);
888 Handle<Code> code = compiler.CompileCallDebugBreak(flags);
889 FillCache(isolate_, code);
894 Handle<Code> StubCache::ComputeCallDebugPrepareStepIn(
int argc,
902 isolate_->factory()->non_monomorphic_cache();
903 int entry = cache->FindEntry(isolate_, flags);
904 if (entry != -1)
return Handle<Code>(Code::cast(cache->ValueAt(entry)));
906 StubCompiler compiler(isolate_);
907 Handle<Code> code = compiler.CompileCallDebugPrepareStepIn(flags);
908 FillCache(isolate_, code);
914 void StubCache::Clear() {
915 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal);
916 for (
int i = 0; i < kPrimaryTableSize; i++) {
917 primary_[i].key = heap()->empty_string();
918 primary_[i].value = empty;
920 for (
int j = 0; j < kSecondaryTableSize; j++) {
921 secondary_[j].key = heap()->empty_string();
922 secondary_[j].value = empty;
931 for (
int i = 0; i < kPrimaryTableSize; i++) {
932 if (primary_[i].key == name) {
933 Map* map = primary_[i].value->FindFirstMap();
936 if (map ==
NULL)
continue;
938 int offset = PrimaryOffset(name, flags, map);
939 if (entry(primary_, offset) == &primary_[i] &&
940 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) {
946 for (
int i = 0; i < kSecondaryTableSize; i++) {
947 if (secondary_[i].key == name) {
948 Map* map = secondary_[i].value->FindFirstMap();
951 if (map ==
NULL)
continue;
954 int primary_offset = PrimaryOffset(name, flags, map);
955 Entry* primary_entry = entry(primary_, primary_offset);
956 if (primary_entry->
key == name) {
958 if (map == primary_map)
continue;
962 int offset = SecondaryOffset(name, flags, primary_offset);
963 if (entry(secondary_, offset) == &secondary_[i] &&
964 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) {
977 ASSERT(args[0]->IsJSObject());
978 ASSERT(args[1]->IsJSObject());
981 Address getter_address = v8::ToCData<Address>(callback->getter());
990 VMState state(isolate, EXTERNAL);
991 ExternalCallbackScope call_scope(isolate, getter_address);
995 if (result.
IsEmpty())
return HEAP->undefined_value();
1001 JSObject* recv = JSObject::cast(args[0]);
1003 Address setter_address = v8::ToCData<Address>(callback->setter());
1010 LOG(isolate, ApiNamedPropertyAccess(
"store", recv, *name));
1015 VMState state(isolate, EXTERNAL);
1016 ExternalCallbackScope call_scope(isolate, setter_address);
1024 static const int kAccessorInfoOffsetInInterceptorArgs = 2;
1037 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2);
1038 ASSERT(args[2]->IsJSObject());
1039 ASSERT(args[3]->IsJSObject());
1040 ASSERT(args[5]->IsSmi());
1041 ASSERT(args.length() == 6);
1043 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
1045 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address);
1051 kAccessorInfoOffsetInInterceptorArgs);
1056 VMState state(isolate, EXTERNAL);
1065 return isolate->
heap()->no_interceptor_result_sentinel();
1069 static MaybeObject* ThrowReferenceError(
String*
name) {
1073 IC ic(IC::NO_EXTRA_FRAME, Isolate::Current());
1074 ASSERT(ic.target()->is_load_stub() || ic.target()->is_keyed_load_stub());
1075 if (!ic.SlowIsContextual())
return HEAP->undefined_value();
1081 FACTORY->NewReferenceError(
"not_defined",
1083 return Isolate::Current()->Throw(*error);
1087 static MaybeObject* LoadWithInterceptor(Arguments* args,
1089 Handle<String> name_handle = args->at<String>(0);
1090 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1);
1091 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2);
1092 Handle<JSObject> receiver_handle = args->at<JSObject>(2);
1093 Handle<JSObject> holder_handle = args->at<JSObject>(3);
1094 ASSERT(args->length() == 6);
1096 Isolate* isolate = receiver_handle->GetIsolate();
1098 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
1100 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address);
1106 kAccessorInfoOffsetInInterceptorArgs);
1107 HandleScope scope(isolate);
1111 VMState state(isolate, EXTERNAL);
1121 MaybeObject* result = holder_handle->GetPropertyPostInterceptor(
1137 { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr);
1138 if (!maybe_result->ToObject(&result))
return maybe_result;
1142 if (attr !=
ABSENT)
return result;
1143 return ThrowReferenceError(String::cast(args[0]));
1149 MaybeObject* result = LoadWithInterceptor(&args, &attr);
1159 ASSERT(args.length() == 4);
1160 JSObject* recv = JSObject::cast(args[0]);
1161 String* name = String::cast(args[1]);
1165 ASSERT(recv->HasNamedInterceptor());
1167 MaybeObject* result = recv->SetPropertyWithInterceptor(
1168 name, value, attr, strict_mode);
1174 JSObject* receiver = JSObject::cast(args[0]);
1175 ASSERT(args.smi_at(1) >= 0);
1176 uint32_t index = args.smi_at(1);
1181 Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) {
1182 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1183 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1184 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1185 if (kind == Code::CALL_IC) {
1186 CallIC::GenerateInitialize(masm(), argc, extra_state);
1188 KeyedCallIC::GenerateInitialize(masm(), argc);
1190 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallInitialize");
1191 isolate()->counters()->call_initialize_stubs()->Increment();
1194 *code, code->arguments_count()));
1195 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code));
1200 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) {
1201 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1204 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1205 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1206 if (kind == Code::CALL_IC) {
1207 CallIC::GenerateInitialize(masm(), argc, extra_state);
1209 KeyedCallIC::GenerateInitialize(masm(), argc);
1211 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallPreMonomorphic");
1212 isolate()->counters()->call_premonomorphic_stubs()->Increment();
1215 *code, code->arguments_count()));
1216 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, *code));
1221 Handle<Code> StubCompiler::CompileCallNormal(Code::Flags flags) {
1222 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1223 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1224 if (kind == Code::CALL_IC) {
1226 ASSERT(!CallIC::Contextual::decode(
1227 Code::ExtractExtraICStateFromFlags(flags)));
1228 CallIC::GenerateNormal(masm(), argc);
1230 KeyedCallIC::GenerateNormal(masm(), argc);
1232 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallNormal");
1233 isolate()->counters()->call_normal_stubs()->Increment();
1236 *code, code->arguments_count()));
1237 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code));
1242 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) {
1243 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1244 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1245 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1246 if (kind == Code::CALL_IC) {
1247 CallIC::GenerateMegamorphic(masm(), argc, extra_state);
1249 KeyedCallIC::GenerateMegamorphic(masm(), argc);
1251 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallMegamorphic");
1252 isolate()->counters()->call_megamorphic_stubs()->Increment();
1255 *code, code->arguments_count()));
1256 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code));
1261 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) {
1262 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1263 KeyedCallIC::GenerateNonStrictArguments(masm(), argc);
1264 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallArguments");
1267 CALL_MEGAMORPHIC_TAG),
1268 *code, code->arguments_count()));
1269 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code));
1274 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) {
1275 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1276 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1277 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1278 if (kind == Code::CALL_IC) {
1279 CallIC::GenerateMiss(masm(), argc, extra_state);
1281 KeyedCallIC::GenerateMiss(masm(), argc);
1283 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallMiss");
1284 isolate()->counters()->call_megamorphic_stubs()->Increment();
1287 *code, code->arguments_count()));
1288 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, *code));
1293 #ifdef ENABLE_DEBUGGER_SUPPORT
1294 Handle<Code> StubCompiler::CompileCallDebugBreak(Code::Flags flags) {
1295 Debug::GenerateCallICDebugBreak(masm());
1296 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallDebugBreak");
1299 CALL_DEBUG_BREAK_TAG),
1300 *code, code->arguments_count()));
1305 Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) {
1308 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1309 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1310 if (kind == Code::CALL_IC) {
1312 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState);
1314 KeyedCallIC::GenerateMiss(masm(), argc);
1316 Handle<Code> code = GetCodeWithFlags(flags,
"CompileCallDebugPrepareStepIn");
1321 code->arguments_count()));
1324 #endif // ENABLE_DEBUGGER_SUPPORT
1326 #undef CALL_LOGGER_TAG
1329 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
1333 masm_.GetCode(&desc);
1334 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject());
1335 #ifdef ENABLE_DISASSEMBLER
1336 if (FLAG_print_code_stubs) code->Disassemble(name);
1342 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
1343 Handle<String> name) {
1344 return (FLAG_print_code_stubs && !name.is_null())
1345 ? GetCodeWithFlags(flags, *name->ToCString())
1346 : GetCodeWithFlags(flags, reinterpret_cast<char*>(
NULL));
1350 void StubCompiler::LookupPostInterceptor(Handle<JSObject> holder,
1351 Handle<String> name,
1352 LookupResult* lookup) {
1353 holder->LocalLookupRealNamedProperty(*name, lookup);
1354 if (lookup->IsProperty())
return;
1357 if (holder->GetPrototype()->IsNull())
return;
1359 holder->GetPrototype()->Lookup(*name, lookup);
1363 Handle<Code> LoadStubCompiler::GetCode(
PropertyType type, Handle<String> name) {
1364 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type);
1365 Handle<Code> code = GetCodeWithFlags(flags, name);
1366 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
1367 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
1372 Handle<Code> KeyedLoadStubCompiler::GetCode(
PropertyType type,
1373 Handle<String> name,
1375 Code::Flags flags = Code::ComputeFlags(
1376 Code::KEYED_LOAD_IC, state, Code::kNoExtraICState, type);
1377 Handle<Code> code = GetCodeWithFlags(flags, name);
1378 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
1379 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
1384 Handle<Code> StoreStubCompiler::GetCode(
PropertyType type,
1385 Handle<String> name) {
1387 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_);
1388 Handle<Code> code = GetCodeWithFlags(flags, name);
1389 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
1390 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
1395 Handle<Code> KeyedStoreStubCompiler::GetCode(
PropertyType type,
1396 Handle<String> name,
1398 Code::ExtraICState extra_state =
1399 Code::ComputeExtraICState(grow_mode_, strict_mode_);
1401 Code::ComputeFlags(Code::KEYED_STORE_IC, state, extra_state, type);
1402 Handle<Code> code = GetCodeWithFlags(flags, name);
1403 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name));
1404 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code));
1409 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement(
1411 KeyedStoreIC::GenerateSlow(masm);
1415 CallStubCompiler::CallStubCompiler(
Isolate* isolate,
1420 : StubCompiler(isolate),
1423 extra_state_(extra_state),
1424 cache_holder_(cache_holder) {
1429 if (function->shared()->HasBuiltinFunctionId()) {
1431 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
1433 #undef CALL_GENERATOR_CASE
1436 CallOptimization optimization(
function);
1437 return optimization.is_simple_api_call();
1449 if (function->shared()->HasBuiltinFunctionId()) {
1451 #define CALL_GENERATOR_CASE(name) \
1452 if (id == k##name) { \
1453 return CallStubCompiler::Compile##name##Call(object, \
1460 #undef CALL_GENERATOR_CASE
1462 CallOptimization optimization(
function);
1463 ASSERT(optimization.is_simple_api_call());
1464 return CompileFastApiCall(optimization,
1473 Handle<Code> CallStubCompiler::GetCode(
PropertyType type, Handle<String> name) {
1474 int argc = arguments_.immediate();
1480 return GetCodeWithFlags(flags, name);
1484 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction>
function) {
1485 Handle<String> function_name;
1486 if (function->shared()->name()->IsString()) {
1487 function_name = Handle<String>(
String::cast(function->shared()->name()));
1493 Handle<Code> ConstructStubCompiler::GetCode() {
1495 Handle<Code> code = GetCodeWithFlags(flags,
"ConstructStub");
1496 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, *code,
"ConstructStub"));
1497 GDBJIT(AddCode(GDBJITInterface::STUB,
"ConstructStub", *code));
1502 CallOptimization::CallOptimization(LookupResult* lookup) {
1503 if (lookup->IsFound() &&
1504 lookup->IsCacheable() &&
1507 Initialize(Handle<JSFunction>(lookup->GetConstantFunction()));
1509 Initialize(Handle<JSFunction>::null());
1513 CallOptimization::CallOptimization(Handle<JSFunction>
function) {
1514 Initialize(
function);
1518 int CallOptimization::GetPrototypeDepthOfExpectedType(
1519 Handle<JSObject>
object,
1520 Handle<JSObject> holder)
const {
1521 ASSERT(is_simple_api_call());
1522 if (expected_receiver_type_.is_null())
return 0;
1524 while (!
object.is_identical_to(holder)) {
1525 if (object->IsInstanceOf(*expected_receiver_type_))
return depth;
1526 object = Handle<JSObject>(
JSObject::cast(object->GetPrototype()));
1529 if (holder->IsInstanceOf(*expected_receiver_type_))
return depth;
1534 void CallOptimization::Initialize(Handle<JSFunction>
function) {
1536 is_simple_api_call_ =
false;
1540 if (
function.is_null() || !function->is_compiled())
return;
1542 constant_function_ =
function;
1543 AnalyzePossibleApiFunction(
function);
1547 void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction>
function) {
1548 if (!function->shared()->IsApiFunction())
return;
1549 Handle<FunctionTemplateInfo> info(function->shared()->get_api_func_data());
1552 if (info->call_code()->IsUndefined())
return;
1558 if (!info->signature()->IsUndefined()) {
1559 Handle<SignatureInfo> signature =
1561 if (!signature->args()->IsUndefined())
return;
1562 if (!signature->receiver()->IsUndefined()) {
1563 expected_receiver_type_ =
1564 Handle<FunctionTemplateInfo>(
1569 is_simple_api_call_ =
true;
MUST_USE_RESULT MaybeObject * GetElementWithInterceptor(Object *receiver, uint32_t index)
Handle< Code > CompileLoadFunctionPrototype(Handle< String > name)
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
static CallHandlerInfo * cast(Object *obj)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate)
Handle< Code > CompileLoadNonexistent(Handle< String > name, Handle< JSObject > object, Handle< JSObject > last)
static String * cast(Object *obj)
Handle< Code > CompileStoreElement(Handle< Map > receiver_map)
#define LOG(isolate, Call)
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Handle< Code > CompileStoreViaSetter(Handle< JSObject > receiver, Handle< JSFunction > setter, Handle< String > name)
#define RUNTIME_FUNCTION(Type, Name)
#define CALL_GENERATOR_CASE(name)
#define ASSERT(condition)
#define CUSTOM_CALL_IC_GENERATORS(V)
#define PROFILE(isolate, Call)
Handle< Code > CompileStoreCallback(Handle< JSObject > object, Handle< AccessorInfo > callback, Handle< String > name)
static Flags ComputeMonomorphicFlags(Kind kind, PropertyType type, ExtraICState extra_ic_state=kNoExtraICState, InlineCacheHolderFlag holder=OWN_MAP, int argc=-1)
Handle< Code > CompileLoadField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
Handle< Code > CompileStoreInterceptor(Handle< JSObject > object, Handle< String > name)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
Object * ValueAt(int entry)
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Handle< Value >(* NamedPropertyGetter)(Local< String > property, const AccessorInfo &info)
Handle< Code > CompileCallGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function, Handle< String > name)
Handle< Code > CompileLoadField(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, int index)
Handle< Code > CompileStoreGlobal(Handle< GlobalObject > object, Handle< JSGlobalPropertyCell > holder, Handle< String > name)
Handle< Code > CompileLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Handle< Code > CompileLoadConstant(Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value, Handle< String > name)
Handle< Code > CompileLoadConstant(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value)
Handle< Code > CompileCallField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Handle< Code > CompileLoadStringLength(Handle< String > name)
void(* AccessorSetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
static FunctionTemplateInfo * cast(Object *obj)
Handle< Code > CompileLoadGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< String > name, bool is_dont_delete)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
#define CALL_LOGGER_TAG(kind, type)
Handle< Code > CompileCallInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, PropertyType type=NORMAL, int argc=-1, InlineCacheHolderFlag holder=OWN_MAP)
static Handle< T > null()
#define ASSERT_EQ(v1, v2)
Handle< Code > CompileLoadArrayLength(Handle< String > name)
void public_set_non_monomorphic_cache(UnseededNumberDictionary *value)
Handle< Code > CompileCallConstant(Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function, Handle< String > name, CheckType check)
bool IsCompatibleReceiver(Object *receiver)
static bool HasCustomCallGenerator(Handle< JSFunction > function)
const int kInvalidProtoDepth
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
#define STATIC_ASSERT(test)
void Add(Handle< Map > handle, Zone *zone)
static SignatureInfo * cast(Object *obj)
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
void check(i::Vector< const char > string)
Handle< Value >(* AccessorGetter)(Local< String > property, const AccessorInfo &info)
Handle< Code > CompileLoadElement(Handle< Map > receiver_map)
static JSObject * cast(Object *obj)
static v8::internal::Handle< v8::internal::TemplateInfo > OpenHandle(const Template *that)