v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
type-info.cc
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #include "v8.h"
29 
30 #include "ast.h"
31 #include "code-stubs.h"
32 #include "compiler.h"
33 #include "ic.h"
34 #include "macro-assembler.h"
35 #include "stub-cache.h"
36 #include "type-info.h"
37 
38 #include "ic-inl.h"
39 #include "objects-inl.h"
40 
41 namespace v8 {
42 namespace internal {
43 
44 
46  TypeInfo info;
47  if (value->IsSmi()) {
48  info = TypeInfo::Smi();
49  } else if (value->IsHeapNumber()) {
52  : TypeInfo::Double();
53  } else if (value->IsString()) {
54  info = TypeInfo::String();
55  } else {
56  info = TypeInfo::Unknown();
57  }
58  return info;
59 }
60 
61 
62 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
63  Handle<Context> global_context,
64  Isolate* isolate,
65  Zone* zone) {
66  global_context_ = global_context;
67  isolate_ = isolate;
68  zone_ = zone;
69  BuildDictionary(code);
70  ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue);
71 }
72 
73 
74 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) {
75  int entry = dictionary_->FindEntry(ast_id);
77  ? Handle<Object>(dictionary_->ValueAt(entry))
78  : Handle<Object>::cast(isolate_->factory()->undefined_value());
79 }
80 
81 
82 bool TypeFeedbackOracle::LoadIsUninitialized(Property* expr) {
83  Handle<Object> map_or_code = GetInfo(expr->id());
84  if (map_or_code->IsMap()) return false;
85  if (map_or_code->IsCode()) {
86  Handle<Code> code = Handle<Code>::cast(map_or_code);
87  return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
88  }
89  return false;
90 }
91 
92 
93 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
94  Handle<Object> map_or_code = GetInfo(expr->id());
95  if (map_or_code->IsMap()) return true;
96  if (map_or_code->IsCode()) {
97  Handle<Code> code = Handle<Code>::cast(map_or_code);
98  return code->is_keyed_load_stub() &&
99  code->ic_state() == MONOMORPHIC &&
100  Code::ExtractTypeFromFlags(code->flags()) == NORMAL &&
101  code->FindFirstMap() != NULL &&
102  !CanRetainOtherContext(code->FindFirstMap(), *global_context_);
103  }
104  return false;
105 }
106 
107 
108 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) {
109  Handle<Object> map_or_code = GetInfo(expr->id());
110  if (map_or_code->IsCode()) {
111  Handle<Code> code = Handle<Code>::cast(map_or_code);
112  Builtins* builtins = isolate_->builtins();
113  return code->is_keyed_load_stub() &&
114  *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
115  code->ic_state() == MEGAMORPHIC;
116  }
117  return false;
118 }
119 
120 
121 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) {
122  Handle<Object> map_or_code = GetInfo(expr->id());
123  if (map_or_code->IsMap()) return true;
124  if (map_or_code->IsCode()) {
125  Handle<Code> code = Handle<Code>::cast(map_or_code);
126  bool allow_growth =
127  Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
129  return code->is_keyed_store_stub() &&
130  !allow_growth &&
131  code->ic_state() == MONOMORPHIC &&
132  Code::ExtractTypeFromFlags(code->flags()) == NORMAL &&
133  code->FindFirstMap() != NULL &&
134  !CanRetainOtherContext(code->FindFirstMap(), *global_context_);
135  }
136  return false;
137 }
138 
139 
140 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) {
141  Handle<Object> map_or_code = GetInfo(expr->id());
142  if (map_or_code->IsCode()) {
143  Handle<Code> code = Handle<Code>::cast(map_or_code);
144  Builtins* builtins = isolate_->builtins();
145  bool allow_growth =
146  Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
148  return code->is_keyed_store_stub() &&
149  !allow_growth &&
150  *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) &&
151  *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic_Strict) &&
152  code->ic_state() == MEGAMORPHIC;
153  }
154  return false;
155 }
156 
157 
158 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
159  Handle<Object> value = GetInfo(expr->id());
160  return value->IsMap() || value->IsSmi() || value->IsJSFunction();
161 }
162 
163 
164 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) {
165  Handle<Object> value = GetInfo(expr->id());
166  return value->IsJSFunction();
167 }
168 
169 
170 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(
171  ObjectLiteral::Property* prop) {
172  Handle<Object> map_or_code = GetInfo(prop->key()->id());
173  return map_or_code->IsMap();
174 }
175 
176 
177 bool TypeFeedbackOracle::IsForInFastCase(ForInStatement* stmt) {
178  Handle<Object> value = GetInfo(stmt->PrepareId());
179  return value->IsSmi() &&
181 }
182 
183 
184 Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
185  ASSERT(LoadIsMonomorphicNormal(expr));
186  Handle<Object> map_or_code = GetInfo(expr->id());
187  if (map_or_code->IsCode()) {
188  Handle<Code> code = Handle<Code>::cast(map_or_code);
189  Map* first_map = code->FindFirstMap();
190  ASSERT(first_map != NULL);
191  return CanRetainOtherContext(first_map, *global_context_)
193  : Handle<Map>(first_map);
194  }
195  return Handle<Map>::cast(map_or_code);
196 }
197 
198 
199 Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) {
200  ASSERT(StoreIsMonomorphicNormal(expr));
201  Handle<Object> map_or_code = GetInfo(expr->id());
202  if (map_or_code->IsCode()) {
203  Handle<Code> code = Handle<Code>::cast(map_or_code);
204  Map* first_map = code->FindFirstMap();
205  ASSERT(first_map != NULL);
206  return CanRetainOtherContext(first_map, *global_context_)
208  : Handle<Map>(first_map);
209  }
210  return Handle<Map>::cast(map_or_code);
211 }
212 
213 
214 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr,
215  Handle<String> name,
216  SmallMapList* types) {
218  CollectReceiverTypes(expr->id(), name, flags, types);
219 }
220 
221 
222 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr,
223  Handle<String> name,
224  SmallMapList* types) {
226  CollectReceiverTypes(expr->id(), name, flags, types);
227 }
228 
229 
230 void TypeFeedbackOracle::CallReceiverTypes(Call* expr,
231  Handle<String> name,
232  CallKind call_kind,
233  SmallMapList* types) {
234  int arity = expr->arguments()->length();
235 
236  // Note: Currently we do not take string extra ic data into account
237  // here.
238  Code::ExtraICState extra_ic_state =
240 
242  NORMAL,
243  extra_ic_state,
244  OWN_MAP,
245  arity);
246  CollectReceiverTypes(expr->id(), name, flags, types);
247 }
248 
249 
250 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
251  Handle<Object> value = GetInfo(expr->id());
252  if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
253  CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
254  ASSERT(check != RECEIVER_MAP_CHECK);
255  return check;
256 }
257 
258 
259 Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck(
260  CheckType check) {
261  JSFunction* function = NULL;
262  switch (check) {
263  case RECEIVER_MAP_CHECK:
264  UNREACHABLE();
265  break;
266  case STRING_CHECK:
267  function = global_context_->string_function();
268  break;
269  case NUMBER_CHECK:
270  function = global_context_->number_function();
271  break;
272  case BOOLEAN_CHECK:
273  function = global_context_->boolean_function();
274  break;
275  }
276  ASSERT(function != NULL);
277  return Handle<JSObject>(JSObject::cast(function->instance_prototype()));
278 }
279 
280 
281 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) {
282  return Handle<JSFunction>::cast(GetInfo(expr->id()));
283 }
284 
285 
286 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) {
287  return Handle<JSFunction>::cast(GetInfo(expr->id()));
288 }
289 
290 
291 Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(
292  ObjectLiteral::Property* prop) {
293  ASSERT(ObjectLiteralStoreIsMonomorphic(prop));
294  return Handle<Map>::cast(GetInfo(prop->key()->id()));
295 }
296 
297 
298 bool TypeFeedbackOracle::LoadIsBuiltin(Property* expr, Builtins::Name id) {
299  return *GetInfo(expr->id()) ==
300  isolate_->builtins()->builtin(id);
301 }
302 
303 
304 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr) {
305  Handle<Object> object = GetInfo(expr->id());
306  TypeInfo unknown = TypeInfo::Unknown();
307  if (!object->IsCode()) return unknown;
308  Handle<Code> code = Handle<Code>::cast(object);
309  if (!code->is_compare_ic_stub()) return unknown;
310 
311  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
312  switch (state) {
314  // Uninitialized means never executed.
315  return TypeInfo::Uninitialized();
316  case CompareIC::SMIS:
317  return TypeInfo::Smi();
319  return TypeInfo::Number();
320  case CompareIC::SYMBOLS:
321  case CompareIC::STRINGS:
322  return TypeInfo::String();
323  case CompareIC::OBJECTS:
325  // TODO(kasperl): We really need a type for JS objects here.
326  return TypeInfo::NonPrimitive();
327  case CompareIC::GENERIC:
328  default:
329  return unknown;
330  }
331 }
332 
333 
334 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) {
335  Handle<Object> object = GetInfo(expr->id());
336  if (!object->IsCode()) return false;
337  Handle<Code> code = Handle<Code>::cast(object);
338  if (!code->is_compare_ic_stub()) return false;
339  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
340  return state == CompareIC::SYMBOLS;
341 }
342 
343 
344 Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
345  Handle<Object> object = GetInfo(expr->id());
346  if (!object->IsCode()) return Handle<Map>::null();
347  Handle<Code> code = Handle<Code>::cast(object);
348  if (!code->is_compare_ic_stub()) return Handle<Map>::null();
349  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
350  if (state != CompareIC::KNOWN_OBJECTS) {
351  return Handle<Map>::null();
352  }
353  Map* first_map = code->FindFirstMap();
354  ASSERT(first_map != NULL);
355  return CanRetainOtherContext(first_map, *global_context_)
357  : Handle<Map>(first_map);
358 }
359 
360 
361 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) {
362  Handle<Object> object = GetInfo(expr->id());
363  TypeInfo unknown = TypeInfo::Unknown();
364  if (!object->IsCode()) return unknown;
365  Handle<Code> code = Handle<Code>::cast(object);
366  ASSERT(code->is_unary_op_stub());
368  code->unary_op_type());
369  switch (type) {
370  case UnaryOpIC::SMI:
371  return TypeInfo::Smi();
373  return TypeInfo::Double();
374  default:
375  return unknown;
376  }
377 }
378 
379 
380 TypeInfo TypeFeedbackOracle::BinaryType(BinaryOperation* expr) {
381  Handle<Object> object = GetInfo(expr->id());
382  TypeInfo unknown = TypeInfo::Unknown();
383  if (!object->IsCode()) return unknown;
384  Handle<Code> code = Handle<Code>::cast(object);
385  if (code->is_binary_op_stub()) {
386  BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>(
387  code->binary_op_type());
388  BinaryOpIC::TypeInfo result_type = static_cast<BinaryOpIC::TypeInfo>(
389  code->binary_op_result_type());
390 
391  switch (type) {
393  // Uninitialized means never executed.
394  return TypeInfo::Uninitialized();
395  case BinaryOpIC::SMI:
396  switch (result_type) {
398  if (expr->op() == Token::DIV) {
399  return TypeInfo::Double();
400  }
401  return TypeInfo::Smi();
402  case BinaryOpIC::SMI:
403  return TypeInfo::Smi();
404  case BinaryOpIC::INT32:
405  return TypeInfo::Integer32();
407  return TypeInfo::Double();
408  default:
409  return unknown;
410  }
411  case BinaryOpIC::INT32:
412  if (expr->op() == Token::DIV ||
413  result_type == BinaryOpIC::HEAP_NUMBER) {
414  return TypeInfo::Double();
415  }
416  return TypeInfo::Integer32();
418  return TypeInfo::Double();
420  return TypeInfo::String();
421  case BinaryOpIC::STRING:
422  case BinaryOpIC::GENERIC:
423  return unknown;
424  default:
425  return unknown;
426  }
427  }
428  return unknown;
429 }
430 
431 
432 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) {
433  Handle<Object> object = GetInfo(clause->CompareId());
434  TypeInfo unknown = TypeInfo::Unknown();
435  if (!object->IsCode()) return unknown;
436  Handle<Code> code = Handle<Code>::cast(object);
437  if (!code->is_compare_ic_stub()) return unknown;
438 
439  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
440  switch (state) {
442  // Uninitialized means never executed.
443  // TODO(fschneider): Introduce a separate value for never-executed ICs.
444  return unknown;
445  case CompareIC::SMIS:
446  return TypeInfo::Smi();
447  case CompareIC::STRINGS:
448  return TypeInfo::String();
449  case CompareIC::SYMBOLS:
450  return TypeInfo::Symbol();
452  return TypeInfo::Number();
453  case CompareIC::OBJECTS:
455  // TODO(kasperl): We really need a type for JS objects here.
456  return TypeInfo::NonPrimitive();
457  case CompareIC::GENERIC:
458  default:
459  return unknown;
460  }
461 }
462 
463 
464 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) {
465  Handle<Object> object = GetInfo(expr->CountId());
466  TypeInfo unknown = TypeInfo::Unknown();
467  if (!object->IsCode()) return unknown;
468  Handle<Code> code = Handle<Code>::cast(object);
469  if (!code->is_binary_op_stub()) return unknown;
470 
471  BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>(
472  code->binary_op_type());
473  switch (type) {
475  case BinaryOpIC::SMI:
476  return TypeInfo::Smi();
477  case BinaryOpIC::INT32:
478  return TypeInfo::Integer32();
480  return TypeInfo::Double();
482  case BinaryOpIC::STRING:
483  case BinaryOpIC::GENERIC:
484  return unknown;
485  default:
486  return unknown;
487  }
488  UNREACHABLE();
489  return unknown;
490 }
491 
492 
493 void TypeFeedbackOracle::CollectReceiverTypes(unsigned ast_id,
494  Handle<String> name,
495  Code::Flags flags,
496  SmallMapList* types) {
497  Handle<Object> object = GetInfo(ast_id);
498  if (object->IsUndefined() || object->IsSmi()) return;
499 
500  if (*object ==
501  isolate_->builtins()->builtin(Builtins::kStoreIC_GlobalProxy)) {
502  // TODO(fschneider): We could collect the maps and signal that
503  // we need a generic store (or load) here.
504  ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC);
505  } else if (object->IsMap()) {
506  types->Add(Handle<Map>::cast(object), zone());
507  } else if (FLAG_collect_megamorphic_maps_from_stub_cache &&
508  Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) {
509  types->Reserve(4, zone());
510  ASSERT(object->IsCode());
511  isolate_->stub_cache()->CollectMatchingMaps(types,
512  *name,
513  flags,
514  global_context_);
515  }
516 }
517 
518 
519 // Check if a map originates from a given global context. We use this
520 // information to filter out maps from different context to avoid
521 // retaining objects from different tabs in Chrome via optimized code.
522 bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
523  Context* global_context) {
524  Object* constructor = NULL;
525  while (!map->prototype()->IsNull()) {
526  constructor = map->constructor();
527  if (!constructor->IsNull()) {
528  // If the constructor is not null or a JSFunction, we have to
529  // conservatively assume that it may retain a global context.
530  if (!constructor->IsJSFunction()) return true;
531  // Check if the constructor directly references a foreign context.
532  if (CanRetainOtherContext(JSFunction::cast(constructor),
533  global_context)) {
534  return true;
535  }
536  }
537  map = HeapObject::cast(map->prototype())->map();
538  }
539  constructor = map->constructor();
540  if (constructor->IsNull()) return false;
541  JSFunction* function = JSFunction::cast(constructor);
542  return CanRetainOtherContext(function, global_context);
543 }
544 
545 
546 bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function,
547  Context* global_context) {
548  return function->context()->global() != global_context->global()
549  && function->context()->global() != global_context->builtins();
550 }
551 
552 
553 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list,
554  Zone* zone) {
555  for (int i = 0; i < list->length(); ++i) {
556  if (list->at(i).is_identical_to(map)) return;
557  }
558  list->Add(map, zone);
559 }
560 
561 
562 void TypeFeedbackOracle::CollectKeyedReceiverTypes(unsigned ast_id,
563  SmallMapList* types) {
564  Handle<Object> object = GetInfo(ast_id);
565  if (!object->IsCode()) return;
566  Handle<Code> code = Handle<Code>::cast(object);
567  if (code->kind() == Code::KEYED_LOAD_IC ||
568  code->kind() == Code::KEYED_STORE_IC) {
569  AssertNoAllocation no_allocation;
570  int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
571  for (RelocIterator it(*code, mask); !it.done(); it.next()) {
572  RelocInfo* info = it.rinfo();
573  Object* object = info->target_object();
574  if (object->IsMap()) {
575  Map* map = Map::cast(object);
576  if (!CanRetainOtherContext(map, *global_context_)) {
577  AddMapIfMissing(Handle<Map>(map), types, zone());
578  }
579  }
580  }
581  }
582 }
583 
584 
585 byte TypeFeedbackOracle::ToBooleanTypes(unsigned ast_id) {
586  Handle<Object> object = GetInfo(ast_id);
587  return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0;
588 }
589 
590 
591 // Things are a bit tricky here: The iterator for the RelocInfos and the infos
592 // themselves are not GC-safe, so we first get all infos, then we create the
593 // dictionary (possibly triggering GC), and finally we relocate the collected
594 // infos before we process them.
595 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) {
596  AssertNoAllocation no_allocation;
597  ZoneList<RelocInfo> infos(16, zone());
598  HandleScope scope;
599  GetRelocInfos(code, &infos);
600  CreateDictionary(code, &infos);
601  ProcessRelocInfos(&infos);
602  ProcessTypeFeedbackCells(code);
603  // Allocate handle in the parent scope.
604  dictionary_ = scope.CloseAndEscape(dictionary_);
605 }
606 
607 
608 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code,
609  ZoneList<RelocInfo>* infos) {
610  int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
611  for (RelocIterator it(*code, mask); !it.done(); it.next()) {
612  infos->Add(*it.rinfo(), zone());
613  }
614 }
615 
616 
617 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code,
618  ZoneList<RelocInfo>* infos) {
619  DisableAssertNoAllocation allocation_allowed;
620  int cell_count = code->type_feedback_info()->IsTypeFeedbackInfo()
621  ? TypeFeedbackInfo::cast(code->type_feedback_info())->
622  type_feedback_cells()->CellCount()
623  : 0;
624  int length = infos->length() + cell_count;
625  byte* old_start = code->instruction_start();
626  dictionary_ = FACTORY->NewUnseededNumberDictionary(length);
627  byte* new_start = code->instruction_start();
628  RelocateRelocInfos(infos, old_start, new_start);
629 }
630 
631 
632 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos,
633  byte* old_start,
634  byte* new_start) {
635  for (int i = 0; i < infos->length(); i++) {
636  RelocInfo* info = &(*infos)[i];
637  info->set_pc(new_start + (info->pc() - old_start));
638  }
639 }
640 
641 
642 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
643  for (int i = 0; i < infos->length(); i++) {
644  RelocInfo reloc_entry = (*infos)[i];
645  Address target_address = reloc_entry.target_address();
646  unsigned ast_id = static_cast<unsigned>((*infos)[i].data());
647  Code* target = Code::GetCodeFromTargetAddress(target_address);
648  switch (target->kind()) {
649  case Code::LOAD_IC:
650  case Code::STORE_IC:
651  case Code::CALL_IC:
652  case Code::KEYED_CALL_IC:
653  if (target->ic_state() == MONOMORPHIC) {
654  if (target->kind() == Code::CALL_IC &&
655  target->check_type() != RECEIVER_MAP_CHECK) {
656  SetInfo(ast_id, Smi::FromInt(target->check_type()));
657  } else {
658  Object* map = target->FindFirstMap();
659  if (map == NULL) {
660  SetInfo(ast_id, static_cast<Object*>(target));
661  } else if (!CanRetainOtherContext(Map::cast(map),
662  *global_context_)) {
663  SetInfo(ast_id, map);
664  }
665  }
666  } else {
667  SetInfo(ast_id, target);
668  }
669  break;
670 
671  case Code::KEYED_LOAD_IC:
673  if (target->ic_state() == MONOMORPHIC ||
674  target->ic_state() == MEGAMORPHIC) {
675  SetInfo(ast_id, target);
676  }
677  break;
678 
679  case Code::UNARY_OP_IC:
680  case Code::BINARY_OP_IC:
681  case Code::COMPARE_IC:
682  case Code::TO_BOOLEAN_IC:
683  SetInfo(ast_id, target);
684  break;
685 
686  default:
687  break;
688  }
689  }
690 }
691 
692 
693 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) {
694  Object* raw_info = code->type_feedback_info();
695  if (!raw_info->IsTypeFeedbackInfo()) return;
696  Handle<TypeFeedbackCells> cache(
698  for (int i = 0; i < cache->CellCount(); i++) {
699  unsigned ast_id = cache->AstId(i)->value();
700  Object* value = cache->Cell(i)->value();
701  if (value->IsSmi() ||
702  (value->IsJSFunction() &&
703  !CanRetainOtherContext(JSFunction::cast(value),
704  *global_context_))) {
705  SetInfo(ast_id, value);
706  }
707  }
708 }
709 
710 
711 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) {
712  ASSERT(dictionary_->FindEntry(ast_id) == UnseededNumberDictionary::kNotFound);
713  MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target);
714  USE(maybe_result);
715 #ifdef DEBUG
716  Object* result = NULL;
717  // Dictionary has been allocated with sufficient size for all elements.
718  ASSERT(maybe_result->ToObject(&result));
719  ASSERT(*dictionary_ == result);
720 #endif
721 }
722 
723 } } // namespace v8::internal
byte * Address
Definition: globals.h:172
static bool IsInt32Double(double value)
Definition: type-info.h:106
static TypeInfo NonPrimitive()
Definition: type-info.h:75
static TypeFeedbackInfo * cast(Object *obj)
static uint32_t encode(boolvalue)
Definition: utils.h:261
static Smi * FromInt(int value)
Definition: objects-inl.h:973
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
Definition: flags.cc:1349
static HeapObject * cast(Object *obj)
static Handle< T > cast(Handle< S > that)
Definition: handles.h:81
static PropertyType ExtractTypeFromFlags(Flags flags)
Definition: objects-inl.h:3359
static TypeInfo Number()
Definition: type-info.h:63
static Map * cast(Object *obj)
static KeyedAccessGrowMode GetKeyedAccessGrowMode(ExtraICState extra_ic_state)
Definition: objects.h:4381
static TypeInfo Unknown()
Definition: type-info.h:59
Flag flags[]
Definition: flags.cc:1467
static TypeInfo Double()
Definition: type-info.h:71
#define ASSERT(condition)
Definition: checks.h:270
static Flags ComputeMonomorphicFlags(Kind kind, PropertyType type, ExtraICState extra_ic_state=kNoExtraICState, InlineCacheHolderFlag holder=OWN_MAP, int argc=-1)
Definition: objects-inl.h:3335
static TypeInfo TypeFromValue(Handle< Object > value)
Definition: type-info.cc:45
static TypeInfo Smi()
Definition: type-info.h:67
static Smi * cast(Object *object)
uint8_t byte
Definition: globals.h:171
#define UNREACHABLE()
Definition: checks.h:50
static TypeInfo String()
Definition: type-info.h:73
static TypeInfo Integer32()
Definition: type-info.h:65
static const int kForInFastCaseMarker
Definition: objects.h:4148
static TypeInfo Symbol()
Definition: type-info.h:69
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:3380
static HeapNumber * cast(Object *obj)
static Handle< T > null()
Definition: handles.h:86
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
Definition: flags.cc:274
void USE(T)
Definition: globals.h:303
static TypeInfo Uninitialized()
Definition: type-info.h:77
#define FACTORY
Definition: isolate.h:1409
void check(i::Vector< const char > string)
static JSObject * cast(Object *obj)
FlagType type() const
Definition: flags.cc:1358
const Address kHandleZapValue
Definition: v8globals.h:90
static JSFunction * cast(Object *obj)