v8  3.14.5(node0.10.28)
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 
63  Handle<Context> native_context,
64  Isolate* isolate,
65  Zone* zone) {
66  native_context_ = native_context;
67  isolate_ = isolate;
68  zone_ = zone;
69  BuildDictionary(code);
70  ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue);
71 }
72 
73 
74 static uint32_t IdToKey(TypeFeedbackId ast_id) {
75  return static_cast<uint32_t>(ast_id.ToInt());
76 }
77 
78 
79 Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) {
80  int entry = dictionary_->FindEntry(IdToKey(ast_id));
82  ? Handle<Object>(dictionary_->ValueAt(entry))
83  : Handle<Object>::cast(isolate_->factory()->undefined_value());
84 }
85 
86 
88  Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
89  if (map_or_code->IsMap()) return false;
90  if (map_or_code->IsCode()) {
91  Handle<Code> code = Handle<Code>::cast(map_or_code);
92  return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
93  }
94  return false;
95 }
96 
97 
99  Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
100  if (map_or_code->IsMap()) return true;
101  if (map_or_code->IsCode()) {
102  Handle<Code> code = Handle<Code>::cast(map_or_code);
103  bool preliminary_checks = code->is_keyed_load_stub() &&
104  code->ic_state() == MONOMORPHIC &&
105  Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
106  if (!preliminary_checks) return false;
107  Map* map = code->FindFirstMap();
108  return map != NULL && !CanRetainOtherContext(map, *native_context_);
109  }
110  return false;
111 }
112 
113 
115  Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
116  if (map_or_code->IsCode()) {
117  Handle<Code> code = Handle<Code>::cast(map_or_code);
118  Builtins* builtins = isolate_->builtins();
119  return code->is_keyed_load_stub() &&
120  *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
121  code->ic_state() == MEGAMORPHIC;
122  }
123  return false;
124 }
125 
126 
128  Handle<Object> map_or_code = GetInfo(ast_id);
129  if (map_or_code->IsMap()) return true;
130  if (map_or_code->IsCode()) {
131  Handle<Code> code = Handle<Code>::cast(map_or_code);
132  bool allow_growth =
133  Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
135  bool preliminary_checks =
136  code->is_keyed_store_stub() &&
137  !allow_growth &&
138  code->ic_state() == MONOMORPHIC &&
139  Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
140  if (!preliminary_checks) return false;
141  Map* map = code->FindFirstMap();
142  return map != NULL && !CanRetainOtherContext(map, *native_context_);
143  }
144  return false;
145 }
146 
147 
149  Handle<Object> map_or_code = GetInfo(ast_id);
150  if (map_or_code->IsCode()) {
151  Handle<Code> code = Handle<Code>::cast(map_or_code);
152  Builtins* builtins = isolate_->builtins();
153  bool allow_growth =
154  Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
156  return code->is_keyed_store_stub() &&
157  !allow_growth &&
158  *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) &&
159  *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic_Strict) &&
160  code->ic_state() == MEGAMORPHIC;
161  }
162  return false;
163 }
164 
165 
167  Handle<Object> value = GetInfo(expr->CallFeedbackId());
168  return value->IsMap() || value->IsSmi() || value->IsJSFunction();
169 }
170 
171 
173  Handle<Object> value = GetInfo(expr->CallNewFeedbackId());
174  return value->IsJSFunction();
175 }
176 
177 
179  ObjectLiteral::Property* prop) {
180  Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId());
181  return map_or_code->IsMap();
182 }
183 
184 
186  Handle<Object> value = GetInfo(stmt->ForInFeedbackId());
187  return value->IsSmi() &&
189 }
190 
191 
194  Handle<Object> map_or_code = GetInfo(expr->PropertyFeedbackId());
195  if (map_or_code->IsCode()) {
196  Handle<Code> code = Handle<Code>::cast(map_or_code);
197  Map* first_map = code->FindFirstMap();
198  ASSERT(first_map != NULL);
199  return CanRetainOtherContext(first_map, *native_context_)
201  : Handle<Map>(first_map);
202  }
203  return Handle<Map>::cast(map_or_code);
204 }
205 
206 
208  TypeFeedbackId ast_id) {
210  Handle<Object> map_or_code = GetInfo(ast_id);
211  if (map_or_code->IsCode()) {
212  Handle<Code> code = Handle<Code>::cast(map_or_code);
213  Map* first_map = code->FindFirstMap();
214  ASSERT(first_map != NULL);
215  return CanRetainOtherContext(first_map, *native_context_)
217  : Handle<Map>(first_map);
218  }
219  return Handle<Map>::cast(map_or_code);
220 }
221 
222 
224  Handle<String> name,
225  SmallMapList* types) {
228  CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types);
229 }
230 
231 
233  Handle<String> name,
234  SmallMapList* types) {
237  CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types);
238 }
239 
240 
242  Handle<String> name,
243  CallKind call_kind,
244  SmallMapList* types) {
245  int arity = expr->arguments()->length();
246 
247  // Note: Currently we do not take string extra ic data into account
248  // here.
249  Code::ExtraICState extra_ic_state =
251 
253  Code::NORMAL,
254  extra_ic_state,
255  OWN_MAP,
256  arity);
257  CollectReceiverTypes(expr->CallFeedbackId(), name, flags, types);
258 }
259 
260 
262  Handle<Object> value = GetInfo(expr->CallFeedbackId());
263  if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
264  CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
265  ASSERT(check != RECEIVER_MAP_CHECK);
266  return check;
267 }
268 
269 
271  CheckType check) {
272  JSFunction* function = NULL;
273  switch (check) {
274  case RECEIVER_MAP_CHECK:
275  UNREACHABLE();
276  break;
277  case STRING_CHECK:
278  function = native_context_->string_function();
279  break;
280  case NUMBER_CHECK:
281  function = native_context_->number_function();
282  break;
283  case BOOLEAN_CHECK:
284  function = native_context_->boolean_function();
285  break;
286  }
287  ASSERT(function != NULL);
288  return Handle<JSObject>(JSObject::cast(function->instance_prototype()));
289 }
290 
291 
293  return Handle<JSFunction>::cast(GetInfo(expr->CallFeedbackId()));
294 }
295 
296 
298  return Handle<JSFunction>::cast(GetInfo(expr->CallNewFeedbackId()));
299 }
300 
301 
303  ObjectLiteral::Property* prop) {
305  return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId()));
306 }
307 
308 
310  return *GetInfo(expr->PropertyFeedbackId()) ==
311  isolate_->builtins()->builtin(id);
312 }
313 
314 
316  Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId());
317  TypeInfo unknown = TypeInfo::Unknown();
318  if (!object->IsCode()) return unknown;
320  if (!code->is_compare_ic_stub()) return unknown;
321 
322  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
323  switch (state) {
325  // Uninitialized means never executed.
326  return TypeInfo::Uninitialized();
327  case CompareIC::SMIS:
328  return TypeInfo::Smi();
330  return TypeInfo::Number();
331  case CompareIC::SYMBOLS:
332  case CompareIC::STRINGS:
333  return TypeInfo::String();
334  case CompareIC::OBJECTS:
336  // TODO(kasperl): We really need a type for JS objects here.
337  return TypeInfo::NonPrimitive();
338  case CompareIC::GENERIC:
339  default:
340  return unknown;
341  }
342 }
343 
344 
346  Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId());
347  if (!object->IsCode()) return false;
349  if (!code->is_compare_ic_stub()) return false;
350  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
351  return state == CompareIC::SYMBOLS;
352 }
353 
354 
356  Handle<Object> object = GetInfo(expr->CompareOperationFeedbackId());
357  if (!object->IsCode()) return Handle<Map>::null();
359  if (!code->is_compare_ic_stub()) return Handle<Map>::null();
360  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
361  if (state != CompareIC::KNOWN_OBJECTS) {
362  return Handle<Map>::null();
363  }
364  Map* first_map = code->FindFirstMap();
365  ASSERT(first_map != NULL);
366  return CanRetainOtherContext(first_map, *native_context_)
368  : Handle<Map>(first_map);
369 }
370 
371 
373  Handle<Object> object = GetInfo(expr->UnaryOperationFeedbackId());
374  TypeInfo unknown = TypeInfo::Unknown();
375  if (!object->IsCode()) return unknown;
377  ASSERT(code->is_unary_op_stub());
378  UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>(
379  code->unary_op_type());
380  switch (type) {
381  case UnaryOpIC::SMI:
382  return TypeInfo::Smi();
384  return TypeInfo::Double();
385  default:
386  return unknown;
387  }
388 }
389 
390 
392  Handle<Object> object = GetInfo(expr->BinaryOperationFeedbackId());
393  TypeInfo unknown = TypeInfo::Unknown();
394  if (!object->IsCode()) return unknown;
396  if (code->is_binary_op_stub()) {
397  BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>(
398  code->binary_op_type());
399  BinaryOpIC::TypeInfo result_type = static_cast<BinaryOpIC::TypeInfo>(
400  code->binary_op_result_type());
401 
402  switch (type) {
404  // Uninitialized means never executed.
405  return TypeInfo::Uninitialized();
406  case BinaryOpIC::SMI:
407  switch (result_type) {
409  if (expr->op() == Token::DIV) {
410  return TypeInfo::Double();
411  }
412  return TypeInfo::Smi();
413  case BinaryOpIC::SMI:
414  return TypeInfo::Smi();
415  case BinaryOpIC::INT32:
416  return TypeInfo::Integer32();
418  return TypeInfo::Double();
419  default:
420  return unknown;
421  }
422  case BinaryOpIC::INT32:
423  if (expr->op() == Token::DIV ||
424  result_type == BinaryOpIC::HEAP_NUMBER) {
425  return TypeInfo::Double();
426  }
427  return TypeInfo::Integer32();
429  return TypeInfo::Double();
431  return TypeInfo::String();
432  case BinaryOpIC::STRING:
433  case BinaryOpIC::GENERIC:
434  return unknown;
435  default:
436  return unknown;
437  }
438  }
439  return unknown;
440 }
441 
442 
444  Handle<Object> object = GetInfo(clause->CompareId());
445  TypeInfo unknown = TypeInfo::Unknown();
446  if (!object->IsCode()) return unknown;
448  if (!code->is_compare_ic_stub()) return unknown;
449 
450  CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
451  switch (state) {
453  // Uninitialized means never executed.
454  // TODO(fschneider): Introduce a separate value for never-executed ICs.
455  return unknown;
456  case CompareIC::SMIS:
457  return TypeInfo::Smi();
458  case CompareIC::STRINGS:
459  return TypeInfo::String();
460  case CompareIC::SYMBOLS:
461  return TypeInfo::Symbol();
463  return TypeInfo::Number();
464  case CompareIC::OBJECTS:
466  // TODO(kasperl): We really need a type for JS objects here.
467  return TypeInfo::NonPrimitive();
468  case CompareIC::GENERIC:
469  default:
470  return unknown;
471  }
472 }
473 
474 
476  Handle<Object> object = GetInfo(expr->CountBinOpFeedbackId());
477  TypeInfo unknown = TypeInfo::Unknown();
478  if (!object->IsCode()) return unknown;
480  if (!code->is_binary_op_stub()) return unknown;
481 
482  BinaryOpIC::TypeInfo type = static_cast<BinaryOpIC::TypeInfo>(
483  code->binary_op_type());
484  switch (type) {
486  case BinaryOpIC::SMI:
487  return TypeInfo::Smi();
488  case BinaryOpIC::INT32:
489  return TypeInfo::Integer32();
491  return TypeInfo::Double();
493  case BinaryOpIC::STRING:
494  case BinaryOpIC::GENERIC:
495  return unknown;
496  default:
497  return unknown;
498  }
499  UNREACHABLE();
500  return unknown;
501 }
502 
503 
504 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id,
505  Handle<String> name,
507  SmallMapList* types) {
508  Handle<Object> object = GetInfo(ast_id);
509  if (object->IsUndefined() || object->IsSmi()) return;
510 
511  if (*object ==
512  isolate_->builtins()->builtin(Builtins::kStoreIC_GlobalProxy)) {
513  // TODO(fschneider): We could collect the maps and signal that
514  // we need a generic store (or load) here.
515  ASSERT(Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC);
516  } else if (object->IsMap()) {
517  types->Add(Handle<Map>::cast(object), zone());
518  } else if (FLAG_collect_megamorphic_maps_from_stub_cache &&
519  Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) {
520  types->Reserve(4, zone());
521  ASSERT(object->IsCode());
522  isolate_->stub_cache()->CollectMatchingMaps(types,
523  *name,
524  flags,
525  native_context_,
526  zone());
527  }
528 }
529 
530 
531 // Check if a map originates from a given native context. We use this
532 // information to filter out maps from different context to avoid
533 // retaining objects from different tabs in Chrome via optimized code.
535  Context* native_context) {
536  Object* constructor = NULL;
537  while (!map->prototype()->IsNull()) {
538  constructor = map->constructor();
539  if (!constructor->IsNull()) {
540  // If the constructor is not null or a JSFunction, we have to
541  // conservatively assume that it may retain a native context.
542  if (!constructor->IsJSFunction()) return true;
543  // Check if the constructor directly references a foreign context.
544  if (CanRetainOtherContext(JSFunction::cast(constructor),
545  native_context)) {
546  return true;
547  }
548  }
549  map = HeapObject::cast(map->prototype())->map();
550  }
551  constructor = map->constructor();
552  if (constructor->IsNull()) return false;
553  JSFunction* function = JSFunction::cast(constructor);
554  return CanRetainOtherContext(function, native_context);
555 }
556 
557 
559  Context* native_context) {
560  return function->context()->global_object() != native_context->global_object()
561  && function->context()->global_object() != native_context->builtins();
562 }
563 
564 
565 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list,
566  Zone* zone) {
567  for (int i = 0; i < list->length(); ++i) {
568  if (list->at(i).is_identical_to(map)) return;
569  }
570  list->Add(map, zone);
571 }
572 
573 
575  SmallMapList* types) {
576  Handle<Object> object = GetInfo(ast_id);
577  if (!object->IsCode()) return;
579  if (code->kind() == Code::KEYED_LOAD_IC ||
580  code->kind() == Code::KEYED_STORE_IC) {
581  AssertNoAllocation no_allocation;
582  int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
583  for (RelocIterator it(*code, mask); !it.done(); it.next()) {
584  RelocInfo* info = it.rinfo();
585  Object* object = info->target_object();
586  if (object->IsMap()) {
587  Map* map = Map::cast(object);
588  if (!CanRetainOtherContext(map, *native_context_)) {
589  AddMapIfMissing(Handle<Map>(map), types, zone());
590  }
591  }
592  }
593  }
594 }
595 
596 
598  Handle<Object> object = GetInfo(ast_id);
599  return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0;
600 }
601 
602 
603 // Things are a bit tricky here: The iterator for the RelocInfos and the infos
604 // themselves are not GC-safe, so we first get all infos, then we create the
605 // dictionary (possibly triggering GC), and finally we relocate the collected
606 // infos before we process them.
607 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) {
608  AssertNoAllocation no_allocation;
609  ZoneList<RelocInfo> infos(16, zone());
610  HandleScope scope;
611  GetRelocInfos(code, &infos);
612  CreateDictionary(code, &infos);
613  ProcessRelocInfos(&infos);
614  ProcessTypeFeedbackCells(code);
615  // Allocate handle in the parent scope.
616  dictionary_ = scope.CloseAndEscape(dictionary_);
617 }
618 
619 
620 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code,
621  ZoneList<RelocInfo>* infos) {
622  int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
623  for (RelocIterator it(*code, mask); !it.done(); it.next()) {
624  infos->Add(*it.rinfo(), zone());
625  }
626 }
627 
628 
629 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code,
630  ZoneList<RelocInfo>* infos) {
631  DisableAssertNoAllocation allocation_allowed;
632  int cell_count = code->type_feedback_info()->IsTypeFeedbackInfo()
633  ? TypeFeedbackInfo::cast(code->type_feedback_info())->
634  type_feedback_cells()->CellCount()
635  : 0;
636  int length = infos->length() + cell_count;
637  byte* old_start = code->instruction_start();
638  dictionary_ = FACTORY->NewUnseededNumberDictionary(length);
639  byte* new_start = code->instruction_start();
640  RelocateRelocInfos(infos, old_start, new_start);
641 }
642 
643 
644 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos,
645  byte* old_start,
646  byte* new_start) {
647  for (int i = 0; i < infos->length(); i++) {
648  RelocInfo* info = &(*infos)[i];
649  info->set_pc(new_start + (info->pc() - old_start));
650  }
651 }
652 
653 
654 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
655  for (int i = 0; i < infos->length(); i++) {
656  RelocInfo reloc_entry = (*infos)[i];
657  Address target_address = reloc_entry.target_address();
658  TypeFeedbackId ast_id =
659  TypeFeedbackId(static_cast<unsigned>((*infos)[i].data()));
660  Code* target = Code::GetCodeFromTargetAddress(target_address);
661  switch (target->kind()) {
662  case Code::LOAD_IC:
663  case Code::STORE_IC:
664  case Code::CALL_IC:
665  case Code::KEYED_CALL_IC:
666  if (target->ic_state() == MONOMORPHIC) {
667  if (target->kind() == Code::CALL_IC &&
668  target->check_type() != RECEIVER_MAP_CHECK) {
669  SetInfo(ast_id, Smi::FromInt(target->check_type()));
670  } else {
671  Object* map = target->FindFirstMap();
672  if (map == NULL) {
673  SetInfo(ast_id, static_cast<Object*>(target));
674  } else if (!CanRetainOtherContext(Map::cast(map),
675  *native_context_)) {
676  SetInfo(ast_id, map);
677  }
678  }
679  } else {
680  SetInfo(ast_id, target);
681  }
682  break;
683 
684  case Code::KEYED_LOAD_IC:
685  case Code::KEYED_STORE_IC:
686  if (target->ic_state() == MONOMORPHIC ||
687  target->ic_state() == MEGAMORPHIC) {
688  SetInfo(ast_id, target);
689  }
690  break;
691 
692  case Code::UNARY_OP_IC:
693  case Code::BINARY_OP_IC:
694  case Code::COMPARE_IC:
695  case Code::TO_BOOLEAN_IC:
696  SetInfo(ast_id, target);
697  break;
698 
699  default:
700  break;
701  }
702  }
703 }
704 
705 
706 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) {
707  Object* raw_info = code->type_feedback_info();
708  if (!raw_info->IsTypeFeedbackInfo()) return;
709  Handle<TypeFeedbackCells> cache(
710  TypeFeedbackInfo::cast(raw_info)->type_feedback_cells());
711  for (int i = 0; i < cache->CellCount(); i++) {
712  TypeFeedbackId ast_id = cache->AstId(i);
713  Object* value = cache->Cell(i)->value();
714  if (value->IsSmi() ||
715  (value->IsJSFunction() &&
717  *native_context_))) {
718  SetInfo(ast_id, value);
719  }
720  }
721 }
722 
723 
724 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) {
725  ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) ==
727  MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target);
728  USE(maybe_result);
729 #ifdef DEBUG
730  Object* result = NULL;
731  // Dictionary has been allocated with sufficient size for all elements.
732  ASSERT(maybe_result->ToObject(&result));
733  ASSERT(*dictionary_ == result);
734 #endif
735 }
736 
737 } } // namespace v8::internal
byte * Address
Definition: globals.h:157
Handle< JSFunction > GetCallNewTarget(CallNew *expr)
Definition: type-info.cc:297
Code * builtin(Name name)
Definition: builtins.h:320
Handle< Map > at(int i) const
Definition: ast.h:278
Handle< Map > GetCompareMap(CompareOperation *expr)
Definition: type-info.cc:355
static bool IsInt32Double(double value)
Definition: type-info.h:106
TypeFeedbackId CallNewFeedbackId() const
Definition: ast.h:1572
void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, SmallMapList *types)
Definition: type-info.cc:574
static TypeInfo NonPrimitive()
Definition: type-info.h:75
TypeFeedbackId CallFeedbackId() const
Definition: ast.h:1510
static TypeFeedbackInfo * cast(Object *obj)
TypeFeedbackId UnaryOperationFeedbackId() const
Definition: ast.h:1648
bool IsForInFastCase(ForInStatement *expr)
Definition: type-info.cc:185
static uint32_t encode(boolvalue)
Definition: utils.h:262
static Smi * FromInt(int value)
Definition: objects-inl.h:981
ZoneList< Expression * > * arguments() const
Definition: ast.h:1506
static HeapObject * cast(Object *obj)
static Handle< T > cast(Handle< S > that)
Definition: handles.h:81
static bool CanRetainOtherContext(Map *map, Context *native_context)
Definition: type-info.cc:534
static TypeInfo Number()
Definition: type-info.h:63
static Map * cast(Object *obj)
static KeyedAccessGrowMode GetKeyedAccessGrowMode(ExtraICState extra_ic_state)
Definition: objects.h:4418
JSBuiltinsObject * builtins()
Definition: contexts.cc:47
static StubType ExtractTypeFromFlags(Flags flags)
Definition: objects-inl.h:3538
static TypeInfo Unknown()
Definition: type-info.h:59
Builtins * builtins()
Definition: isolate.h:924
TypeFeedbackId CountBinOpFeedbackId() const
Definition: ast.h:1740
static TypeInfo Double()
Definition: type-info.h:71
Handle< Map > LoadMonomorphicReceiverType(Property *expr)
Definition: type-info.cc:192
TypeFeedbackId PropertyFeedbackId()
Definition: ast.h:1466
#define ASSERT(condition)
Definition: checks.h:270
bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id)
Definition: type-info.cc:127
TypeInfo IncrementType(CountOperation *expr)
Definition: type-info.cc:475
void Reserve(int capacity, Zone *zone)
Definition: ast.h:267
Factory * factory()
Definition: isolate.h:992
void CollectMatchingMaps(SmallMapList *types, String *name, Code::Flags flags, Handle< Context > native_context, Zone *zone)
Definition: stub-cache.cc:938
static TypeInfo TypeFromValue(Handle< Object > value)
Definition: type-info.cc:45
static TypeInfo Smi()
Definition: type-info.h:67
static Smi * cast(Object *object)
void CallReceiverTypes(Call *expr, Handle< String > name, CallKind call_kind, SmallMapList *types)
Definition: type-info.cc:241
void LoadReceiverTypes(Property *expr, Handle< String > name, SmallMapList *types)
Definition: type-info.cc:223
TypeFeedbackId CompareId()
Definition: ast.h:948
uint8_t byte
Definition: globals.h:156
GlobalObject * global_object()
Definition: contexts.h:328
TypeInfo SwitchType(CaseClause *clause)
Definition: type-info.cc:443
#define UNREACHABLE()
Definition: checks.h:50
static TypeInfo String()
Definition: type-info.h:73
static TypeInfo Integer32()
Definition: type-info.h:65
CheckType GetCallCheckType(Call *expr)
Definition: type-info.cc:261
int length() const
Definition: ast.h:272
static const int kForInFastCaseMarker
Definition: objects.h:4166
static TypeInfo Symbol()
Definition: type-info.h:69
bool StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id)
Definition: type-info.cc:148
Handle< JSObject > GetPrototypeForPrimitiveCheck(CheckType check)
Definition: type-info.cc:270
TypeFeedbackId LiteralFeedbackId() const
Definition: ast.h:1195
Handle< Map > StoreMonomorphicReceiverType(TypeFeedbackId ast_id)
Definition: type-info.cc:207
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:3559
bool LoadIsUninitialized(Property *expr)
Definition: type-info.cc:87
TypeFeedbackId CompareOperationFeedbackId() const
Definition: ast.h:1779
TypeInfo CompareType(CompareOperation *expr)
Definition: type-info.cc:315
StubCache * stub_cache()
Definition: isolate.h:837
TypeInfo BinaryType(BinaryOperation *expr)
Definition: type-info.cc:391
static HeapNumber * cast(Object *obj)
byte ToBooleanTypes(TypeFeedbackId ast_id)
Definition: type-info.cc:597
Handle< Map > GetObjectLiteralStoreMap(ObjectLiteral::Property *prop)
Definition: type-info.cc:302
bool LoadIsBuiltin(Property *expr, Builtins::Name id)
Definition: type-info.cc:309
static Handle< T > null()
Definition: handles.h:86
TypeFeedbackOracle(Handle< Code > code, Handle< Context > native_context, Isolate *isolate, Zone *zone)
Definition: type-info.cc:62
void USE(T)
Definition: globals.h:289
TypeFeedbackId ForInFeedbackId() const
Definition: ast.h:829
static TypeInfo Uninitialized()
Definition: type-info.h:77
#define FACTORY
Definition: isolate.h:1434
void StoreReceiverTypes(Assignment *expr, Handle< String > name, SmallMapList *types)
Definition: type-info.cc:232
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra 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 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
Definition: flags.cc:301
bool CallIsMonomorphic(Call *expr)
Definition: type-info.cc:166
bool IsSymbolCompare(CompareOperation *expr)
Definition: type-info.cc:345
Handle< JSFunction > GetCallTarget(Call *expr)
Definition: type-info.cc:292
bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property *prop)
Definition: type-info.cc:178
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
Token::Value op() const
Definition: ast.h:1682
void Add(Handle< Map > handle, Zone *zone)
Definition: ast.h:274
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra 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 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage including flags
Definition: flags.cc:495
bool LoadIsMonomorphicNormal(Property *expr)
Definition: type-info.cc:98
TypeFeedbackId BinaryOperationFeedbackId() const
Definition: ast.h:1689
bool LoadIsMegamorphicWithTypeInfo(Property *expr)
Definition: type-info.cc:114
void check(i::Vector< const char > string)
TypeInfo UnaryType(UnaryOperation *expr)
Definition: type-info.cc:372
static JSObject * cast(Object *obj)
bool CallNewIsMonomorphic(CallNew *expr)
Definition: type-info.cc:172
TypeFeedbackId AssignmentFeedbackId()
Definition: ast.h:1876
const Address kHandleZapValue
Definition: v8globals.h:81
static Flags ComputeMonomorphicFlags(Kind kind, StubType type, ExtraICState extra_ic_state=kNoExtraICState, InlineCacheHolderFlag holder=OWN_MAP, int argc=-1)
Definition: objects-inl.h:3514
Handle< T > CloseAndEscape(Handle< T > handle_value)
Definition: handles-inl.h:113
static JSFunction * cast(Object *obj)