v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
code-stubs.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 "bootstrapper.h"
31 #include "code-stubs.h"
32 #include "cpu-profiler.h"
33 #include "stub-cache.h"
34 #include "factory.h"
35 #include "gdb-jit.h"
36 #include "macro-assembler.h"
37 
38 namespace v8 {
39 namespace internal {
40 
41 
43  : register_param_count_(-1),
44  stack_parameter_count_(no_reg),
45  hint_stack_parameter_count_(-1),
46  function_mode_(NOT_JS_FUNCTION_STUB_MODE),
47  register_params_(NULL),
48  deoptimization_handler_(NULL),
49  handler_arguments_mode_(DONT_PASS_ARGUMENTS),
50  miss_handler_(),
51  has_miss_handler_(false) { }
52 
53 
54 bool CodeStub::FindCodeInCache(Code** code_out, Isolate* isolate) {
55  UnseededNumberDictionary* stubs = isolate->heap()->code_stubs();
56  int index = stubs->FindEntry(GetKey());
58  *code_out = Code::cast(stubs->ValueAt(index));
59  return true;
60  }
61  return false;
62 }
63 
64 
65 SmartArrayPointer<const char> CodeStub::GetName() {
66  char buffer[100];
67  NoAllocationStringAllocator allocator(buffer,
68  static_cast<unsigned>(sizeof(buffer)));
69  StringStream stream(&allocator);
70  PrintName(&stream);
71  return stream.ToCString();
72 }
73 
74 
75 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) {
76  SmartArrayPointer<const char> name = GetName();
77  PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, name.get()));
78  GDBJIT(AddCode(GDBJITInterface::STUB, name.get(), code));
79  Counters* counters = isolate->counters();
80  counters->total_stubs_code_size()->Increment(code->instruction_size());
81 }
82 
83 
84 Code::Kind CodeStub::GetCodeKind() const {
85  return Code::STUB;
86 }
87 
88 
89 Handle<Code> CodeStub::GetCodeCopy(Isolate* isolate,
90  const Code::FindAndReplacePattern& pattern) {
91  Handle<Code> ic = GetCode(isolate);
92  ic = isolate->factory()->CopyCode(ic);
93  ic->FindAndReplace(pattern);
94  RecordCodeGeneration(*ic, isolate);
95  return ic;
96 }
97 
98 
100  Factory* factory = isolate->factory();
101 
102  // Generate the new code.
103  MacroAssembler masm(isolate, NULL, 256);
104 
105  {
106  // Update the static counter each time a new code stub is generated.
107  isolate->counters()->code_stubs()->Increment();
108 
109  // Generate the code for the stub.
110  masm.set_generating_stub(true);
111  NoCurrentFrameScope scope(&masm);
112  Generate(&masm);
113  }
114 
115  // Create the code object.
116  CodeDesc desc;
117  masm.GetCode(&desc);
118 
119  // Copy the generated code into a heap object.
121  GetCodeKind(),
122  GetICState(),
123  GetExtraICState(),
124  GetStubType());
125  Handle<Code> new_object = factory->NewCode(
126  desc, flags, masm.CodeObject(), NeedsImmovableCode());
127  return new_object;
128 }
129 
130 
131 void CodeStub::VerifyPlatformFeatures(Isolate* isolate) {
133 }
134 
135 
136 Handle<Code> CodeStub::GetCode(Isolate* isolate) {
137  Factory* factory = isolate->factory();
138  Heap* heap = isolate->heap();
139  Code* code;
140  if (UseSpecialCache()
141  ? FindCodeInSpecialCache(&code, isolate)
142  : FindCodeInCache(&code, isolate)) {
143  ASSERT(GetCodeKind() == code->kind());
144  return Handle<Code>(code);
145  }
146 
147 #ifdef DEBUG
148  VerifyPlatformFeatures(isolate);
149 #endif
150 
151  {
152  HandleScope scope(isolate);
153 
154  Handle<Code> new_object = GenerateCode(isolate);
155  new_object->set_major_key(MajorKey());
156  FinishCode(new_object);
157  RecordCodeGeneration(*new_object, isolate);
158 
159 #ifdef ENABLE_DISASSEMBLER
160  if (FLAG_print_code_stubs) {
161  CodeTracer::Scope trace_scope(isolate->GetCodeTracer());
162  new_object->Disassemble(GetName().get(), trace_scope.file());
163  PrintF(trace_scope.file(), "\n");
164  }
165 #endif
166 
167  if (UseSpecialCache()) {
168  AddToSpecialCache(new_object);
169  } else {
170  // Update the dictionary and the root in Heap.
171  Handle<UnseededNumberDictionary> dict =
172  factory->DictionaryAtNumberPut(
173  Handle<UnseededNumberDictionary>(heap->code_stubs()),
174  GetKey(),
175  new_object);
176  heap->public_set_code_stubs(*dict);
177  }
178  code = *new_object;
179  }
180 
181  Activate(code);
182  ASSERT(!NeedsImmovableCode() ||
183  heap->lo_space()->Contains(code) ||
184  heap->code_space()->FirstPage()->Contains(code->address()));
185  return Handle<Code>(code, isolate);
186 }
187 
188 
189 const char* CodeStub::MajorName(CodeStub::Major major_key,
190  bool allow_unknown_keys) {
191  switch (major_key) {
192 #define DEF_CASE(name) case name: return #name "Stub";
194 #undef DEF_CASE
195  case UninitializedMajorKey: return "<UninitializedMajorKey>Stub";
196  default:
197  if (!allow_unknown_keys) {
198  UNREACHABLE();
199  }
200  return NULL;
201  }
202 }
203 
204 
205 void CodeStub::PrintBaseName(StringStream* stream) {
206  stream->Add("%s", MajorName(MajorKey(), false));
207 }
208 
209 
210 void CodeStub::PrintName(StringStream* stream) {
211  PrintBaseName(stream);
212  PrintState(stream);
213 }
214 
215 
216 // static
218  // Generate the uninitialized versions of the stub.
219  for (int op = Token::BIT_OR; op <= Token::MOD; ++op) {
220  for (int mode = NO_OVERWRITE; mode <= OVERWRITE_RIGHT; ++mode) {
221  BinaryOpICStub stub(static_cast<Token::Value>(op),
222  static_cast<OverwriteMode>(mode));
223  stub.GetCode(isolate);
224  }
225  }
226 
227  // Generate special versions of the stub.
228  BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime);
229 }
230 
231 
233  state_.Print(stream);
234 }
235 
236 
237 // static
239  const BinaryOpIC::State& state) {
240  BinaryOpICStub stub(state);
241  stub.GetCode(isolate);
242 }
243 
244 
245 // static
246 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
247  // Generate special versions of the stub.
248  BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime);
249 }
250 
251 
252 void BinaryOpICWithAllocationSiteStub::PrintState(StringStream* stream) {
253  state_.Print(stream);
254 }
255 
256 
257 // static
258 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(
259  Isolate* isolate, const BinaryOpIC::State& state) {
260  if (state.CouldCreateAllocationMementos()) {
261  BinaryOpICWithAllocationSiteStub stub(state);
262  stub.GetCode(isolate);
263  }
264 }
265 
266 
267 void StringAddStub::PrintBaseName(StringStream* stream) {
268  stream->Add("StringAddStub");
270  stream->Add("_CheckBoth");
271  } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
272  stream->Add("_CheckLeft");
274  stream->Add("_CheckRight");
275  }
276  if (pretenure_flag() == TENURED) {
277  stream->Add("_Tenured");
278  }
279 }
280 
281 
283  CompareIC::State state = Max(left_, right_);
284  switch (state) {
287  case CompareIC::SMI:
288  case CompareIC::NUMBER:
290  case CompareIC::STRING:
292  case CompareIC::OBJECT:
294  return MONOMORPHIC;
295  case CompareIC::GENERIC:
297  }
298  UNREACHABLE();
300 }
301 
302 
303 void ICCompareStub::AddToSpecialCache(Handle<Code> new_object) {
304  ASSERT(*known_map_ != NULL);
305  Isolate* isolate = new_object->GetIsolate();
306  Factory* factory = isolate->factory();
307  return Map::UpdateCodeCache(known_map_,
308  strict() ?
309  factory->strict_compare_ic_string() :
310  factory->compare_ic_string(),
311  new_object);
312 }
313 
314 
315 bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) {
316  Factory* factory = isolate->factory();
318  GetCodeKind(),
319  UNINITIALIZED);
320  ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT);
321  Handle<Object> probe(
322  known_map_->FindInCodeCache(
323  strict() ?
324  *factory->strict_compare_ic_string() :
325  *factory->compare_ic_string(),
326  flags),
327  isolate);
328  if (probe->IsCode()) {
329  *code_out = Code::cast(*probe);
330 #ifdef DEBUG
331  Token::Value cached_op;
332  ICCompareStub::DecodeMinorKey((*code_out)->stub_info(), NULL, NULL, NULL,
333  &cached_op);
334  ASSERT(op_ == cached_op);
335 #endif
336  return true;
337  }
338  return false;
339 }
340 
341 
342 int ICCompareStub::MinorKey() {
343  return OpField::encode(op_ - Token::EQ) |
344  LeftStateField::encode(left_) |
345  RightStateField::encode(right_) |
346  HandlerStateField::encode(state_);
347 }
348 
349 
350 void ICCompareStub::DecodeMinorKey(int minor_key,
351  CompareIC::State* left_state,
352  CompareIC::State* right_state,
353  CompareIC::State* handler_state,
354  Token::Value* op) {
355  if (left_state) {
356  *left_state =
357  static_cast<CompareIC::State>(LeftStateField::decode(minor_key));
358  }
359  if (right_state) {
360  *right_state =
361  static_cast<CompareIC::State>(RightStateField::decode(minor_key));
362  }
363  if (handler_state) {
364  *handler_state =
365  static_cast<CompareIC::State>(HandlerStateField::decode(minor_key));
366  }
367  if (op) {
368  *op = static_cast<Token::Value>(OpField::decode(minor_key) + Token::EQ);
369  }
370 }
371 
372 
374  switch (state_) {
376  GenerateMiss(masm);
377  break;
378  case CompareIC::SMI:
379  GenerateSmis(masm);
380  break;
381  case CompareIC::NUMBER:
382  GenerateNumbers(masm);
383  break;
384  case CompareIC::STRING:
385  GenerateStrings(masm);
386  break;
388  GenerateInternalizedStrings(masm);
389  break;
391  GenerateUniqueNames(masm);
392  break;
393  case CompareIC::OBJECT:
394  GenerateObjects(masm);
395  break;
397  ASSERT(*known_map_ != NULL);
398  GenerateKnownObjects(masm);
399  break;
400  case CompareIC::GENERIC:
401  GenerateGeneric(masm);
402  break;
403  }
404 }
405 
406 
408  ASSERT(!state_.Contains(GENERIC));
409  State old_state(state_);
410  if (object->IsNull()) {
411  state_.Add(NULL_TYPE);
412  } else if (object->IsUndefined()) {
413  state_.Add(UNDEFINED);
414  } else if (object->IsUndetectableObject() ||
415  object->IsOddball() ||
416  !object->IsHeapObject()) {
417  state_.RemoveAll();
418  state_.Add(GENERIC);
419  } else if (IsMonomorphic()) {
420  state_.RemoveAll();
421  state_.Add(GENERIC);
422  } else {
423  state_.Add(MONOMORPHIC_MAP);
424  }
425  TraceTransition(old_state, state_);
426 }
427 
428 
429 template<class StateType>
430 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
431  // Note: Although a no-op transition is semantically OK, it is hinting at a
432  // bug somewhere in our state transition machinery.
433  ASSERT(from != to);
434  if (!FLAG_trace_ic) return;
435  char buffer[100];
436  NoAllocationStringAllocator allocator(buffer,
437  static_cast<unsigned>(sizeof(buffer)));
438  StringStream stream(&allocator);
439  stream.Add("[");
440  PrintBaseName(&stream);
441  stream.Add(": ");
442  from.Print(&stream);
443  stream.Add("=>");
444  to.Print(&stream);
445  stream.Add("]\n");
446  stream.OutputToStdOut();
447 }
448 
449 
451  CodeStub::PrintBaseName(stream);
452  stream->Add((nil_value_ == kNullValue) ? "(NullValue)":
453  "(UndefinedValue)");
454 }
455 
456 
458  state_.Print(stream);
459 }
460 
461 
462 void CompareNilICStub::State::Print(StringStream* stream) const {
463  stream->Add("(");
464  SimpleListPrinter printer(stream);
465  if (IsEmpty()) printer.Add("None");
466  if (Contains(UNDEFINED)) printer.Add("Undefined");
467  if (Contains(NULL_TYPE)) printer.Add("Null");
468  if (Contains(MONOMORPHIC_MAP)) printer.Add("MonomorphicMap");
469  if (Contains(GENERIC)) printer.Add("Generic");
470  stream->Add(")");
471 }
472 
473 
475  if (state_.Contains(CompareNilICStub::GENERIC)) {
476  return Type::Any(zone);
477  }
478 
479  Type* result = Type::None(zone);
480  if (state_.Contains(CompareNilICStub::UNDEFINED)) {
481  result = Type::Union(result, Type::Undefined(zone), zone);
482  }
483  if (state_.Contains(CompareNilICStub::NULL_TYPE)) {
484  result = Type::Union(result, Type::Null(zone), zone);
485  }
486  if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
487  Type* type =
488  map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
489  result = Type::Union(result, type, zone);
490  }
491 
492  return result;
493 }
494 
495 
497  Type* output_type = GetType(zone, map);
498  Type* nil_type =
499  nil_value_ == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
500  return Type::Union(output_type, nil_type, zone);
501 }
502 
503 
504 void InstanceofStub::PrintName(StringStream* stream) {
505  const char* args = "";
506  if (HasArgsInRegisters()) {
507  args = "_REGS";
508  }
509 
510  const char* inline_check = "";
511  if (HasCallSiteInlineCheck()) {
512  inline_check = "_INLINE";
513  }
514 
515  const char* return_true_false_object = "";
516  if (ReturnTrueFalseObject()) {
517  return_true_false_object = "_TRUEFALSE";
518  }
519 
520  stream->Add("InstanceofStub%s%s%s",
521  args,
522  inline_check,
523  return_true_false_object);
524 }
525 
526 
527 void JSEntryStub::FinishCode(Handle<Code> code) {
528  Handle<FixedArray> handler_table =
529  code->GetIsolate()->factory()->NewFixedArray(1, TENURED);
530  handler_table->set(0, Smi::FromInt(handler_offset_));
531  code->set_handler_table(*handler_table);
532 }
533 
534 
536  MacroAssembler* masm) {
538 }
539 
540 
543  stub.GetCode(isolate);
544 }
545 
546 
548  switch (elements_kind_) {
549  case FAST_ELEMENTS:
550  case FAST_HOLEY_ELEMENTS:
551  case FAST_SMI_ELEMENTS:
555 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
556  case EXTERNAL_##TYPE##_ELEMENTS: \
557  case TYPE##_ELEMENTS:
558 
560 #undef TYPED_ARRAY_CASE
561  UNREACHABLE();
562  break;
563  case DICTIONARY_ELEMENTS:
565  break;
567  UNREACHABLE();
568  break;
569  }
570 }
571 
572 
573 void ArgumentsAccessStub::PrintName(StringStream* stream) {
574  stream->Add("ArgumentsAccessStub_");
575  switch (type_) {
576  case READ_ELEMENT: stream->Add("ReadElement"); break;
577  case NEW_SLOPPY_FAST: stream->Add("NewSloppyFast"); break;
578  case NEW_SLOPPY_SLOW: stream->Add("NewSloppySlow"); break;
579  case NEW_STRICT: stream->Add("NewStrict"); break;
580  }
581 }
582 
583 
584 void CallFunctionStub::PrintName(StringStream* stream) {
585  stream->Add("CallFunctionStub_Args%d", argc_);
586  if (RecordCallTarget()) stream->Add("_Recording");
587 }
588 
589 
590 void CallConstructStub::PrintName(StringStream* stream) {
591  stream->Add("CallConstructStub");
592  if (RecordCallTarget()) stream->Add("_Recording");
593 }
594 
595 
596 void ArrayConstructorStub::PrintName(StringStream* stream) {
597  stream->Add("ArrayConstructorStub");
598  switch (argument_count_) {
599  case ANY: stream->Add("_Any"); break;
600  case NONE: stream->Add("_None"); break;
601  case ONE: stream->Add("_One"); break;
602  case MORE_THAN_ONE: stream->Add("_More_Than_One"); break;
603  }
604 }
605 
606 
608  StringStream* stream) {
609  stream->Add(name);
610  stream->Add("_");
613  stream->Add("_DISABLE_ALLOCATION_SITES");
614  }
615 }
616 
617 
619  Types old_types(types_);
620  bool to_boolean_value = types_.UpdateStatus(object);
621  TraceTransition(old_types, types_);
622  return to_boolean_value;
623 }
624 
625 
627  types_.Print(stream);
628 }
629 
630 
632  stream->Add("(");
633  SimpleListPrinter printer(stream);
634  if (IsEmpty()) printer.Add("None");
635  if (Contains(UNDEFINED)) printer.Add("Undefined");
636  if (Contains(BOOLEAN)) printer.Add("Bool");
637  if (Contains(NULL_TYPE)) printer.Add("Null");
638  if (Contains(SMI)) printer.Add("Smi");
639  if (Contains(SPEC_OBJECT)) printer.Add("SpecObject");
640  if (Contains(STRING)) printer.Add("String");
641  if (Contains(SYMBOL)) printer.Add("Symbol");
642  if (Contains(HEAP_NUMBER)) printer.Add("HeapNumber");
643  stream->Add(")");
644 }
645 
646 
648  if (object->IsUndefined()) {
649  Add(UNDEFINED);
650  return false;
651  } else if (object->IsBoolean()) {
652  Add(BOOLEAN);
653  return object->IsTrue();
654  } else if (object->IsNull()) {
655  Add(NULL_TYPE);
656  return false;
657  } else if (object->IsSmi()) {
658  Add(SMI);
659  return Smi::cast(*object)->value() != 0;
660  } else if (object->IsSpecObject()) {
661  Add(SPEC_OBJECT);
662  return !object->IsUndetectableObject();
663  } else if (object->IsString()) {
664  Add(STRING);
665  return !object->IsUndetectableObject() &&
666  String::cast(*object)->length() != 0;
667  } else if (object->IsSymbol()) {
668  Add(SYMBOL);
669  return true;
670  } else if (object->IsHeapNumber()) {
671  ASSERT(!object->IsUndetectableObject());
672  Add(HEAP_NUMBER);
673  double value = HeapNumber::cast(*object)->value();
674  return value != 0 && !std::isnan(value);
675  } else {
676  // We should never see an internal object at runtime here!
677  UNREACHABLE();
678  return true;
679  }
680 }
681 
682 
684  return Contains(ToBooleanStub::SPEC_OBJECT)
685  || Contains(ToBooleanStub::STRING)
686  || Contains(ToBooleanStub::SYMBOL)
687  || Contains(ToBooleanStub::HEAP_NUMBER);
688 }
689 
690 
692  return Contains(ToBooleanStub::SPEC_OBJECT)
693  || Contains(ToBooleanStub::STRING);
694 }
695 
696 
700  stub1.GetCode(isolate);
701  stub2.GetCode(isolate);
702 }
703 
704 
705 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
706  intptr_t stack_pointer,
707  Isolate* isolate) {
708  FunctionEntryHook entry_hook = isolate->function_entry_hook();
709  ASSERT(entry_hook != NULL);
710  entry_hook(function, stack_pointer);
711 }
712 
713 
714 static void InstallDescriptor(Isolate* isolate, HydrogenCodeStub* stub) {
715  int major_key = stub->MajorKey();
716  CodeStubInterfaceDescriptor* descriptor =
717  isolate->code_stub_interface_descriptor(major_key);
718  if (!descriptor->initialized()) {
719  stub->InitializeInterfaceDescriptor(isolate, descriptor);
720  }
721 }
722 
723 
726  InstallDescriptor(isolate, &stub1);
728  InstallDescriptor(isolate, &stub2);
730  InstallDescriptor(isolate, &stub3);
731 }
732 
733 
734 void NumberToStringStub::InstallDescriptors(Isolate* isolate) {
735  NumberToStringStub stub;
736  InstallDescriptor(isolate, &stub);
737 }
738 
739 
741  FastNewClosureStub stub(STRICT, false);
742  InstallDescriptor(isolate, &stub);
743 }
744 
745 
746 void FastNewContextStub::InstallDescriptors(Isolate* isolate) {
747  FastNewContextStub stub(FastNewContextStub::kMaximumSlots);
748  InstallDescriptor(isolate, &stub);
749 }
750 
751 
752 // static
756  InstallDescriptor(isolate, &stub);
757 }
758 
759 
760 // static
763  InstallDescriptor(isolate, &stub);
764 }
765 
766 
767 // static
768 void BinaryOpWithAllocationSiteStub::InstallDescriptors(Isolate* isolate) {
769  BinaryOpWithAllocationSiteStub stub(Token::ADD, NO_OVERWRITE);
770  InstallDescriptor(isolate, &stub);
771 }
772 
773 
774 // static
775 void StringAddStub::InstallDescriptors(Isolate* isolate) {
776  StringAddStub stub(STRING_ADD_CHECK_NONE, NOT_TENURED);
777  InstallDescriptor(isolate, &stub);
778 }
779 
780 
781 // static
782 void RegExpConstructResultStub::InstallDescriptors(Isolate* isolate) {
783  RegExpConstructResultStub stub;
784  InstallDescriptor(isolate, &stub);
785 }
786 
787 
789  : argument_count_(ANY) {
791 }
792 
793 
795  int argument_count) {
796  if (argument_count == 0) {
797  argument_count_ = NONE;
798  } else if (argument_count == 1) {
799  argument_count_ = ONE;
800  } else if (argument_count >= 2) {
801  argument_count_ = MORE_THAN_ONE;
802  } else {
803  UNREACHABLE();
804  }
806 }
807 
808 
811  InstallDescriptor(isolate, &stub1);
813  InstallDescriptor(isolate, &stub2);
815  InstallDescriptor(isolate, &stub3);
816 }
817 
819  Isolate* isolate) {
821 }
822 
823 
824 } } // namespace v8::internal
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Definition: flags.cc:269
#define PROFILE(IsolateGetter, Call)
Definition: cpu-profiler.h:194
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:217
void PrintF(const char *format,...)
Definition: v8utils.cc:40
static void DecodeMinorKey(int minor_key, CompareIC::State *left_state, CompareIC::State *right_state, CompareIC::State *handler_state, Token::Value *op)
Definition: code-stubs.cc:350
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Definition: flags.cc:350
#define DEF_CASE(name)
static String * cast(Object *obj)
Type * GetType(Zone *zone, Handle< Map > map=Handle< Map >())
Definition: code-stubs.cc:474
static void InstallDescriptors(Isolate *isolate)
Definition: code-stubs.cc:809
static Smi * FromInt(int value)
Definition: objects-inl.h:1209
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:541
T Max(T a, T b)
Definition: utils.h:227
ArrayConstructorStub(Isolate *isolate, int argument_count)
Definition: code-stubs.cc:794
ElementsKind elements_kind() const
Definition: code-stubs.h:2104
uint32_t Flags
Definition: objects.h:5184
void BasePrintName(const char *name, StringStream *stream)
Definition: code-stubs.cc:607
virtual void PrintState(StringStream *stream)
Definition: code-stubs.cc:457
#define ASSERT(condition)
Definition: checks.h:329
Factory * factory()
Definition: isolate.h:995
static Code * cast(Object *obj)
static Smi * cast(Object *object)
int isnan(double x)
void Add(Vector< const char > format, Vector< FmtElm > elms)
Object * ValueAt(int entry)
Definition: objects.h:3930
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
Definition: v8.h:4509
V8_INLINE bool IsNull() const
Definition: v8.h:6247
#define UNREACHABLE()
Definition: checks.h:52
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization 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 VFP3 instructions if available enable use of NEON instructions if 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 d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_string(expose_natives_as
void UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:407
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization 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 VFP3 instructions if available enable use of NEON instructions if 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 d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing 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 statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
Definition: flags.cc:665
bool IsSymbol() const
Definition: api.cc:2369
FunctionEntryHook function_entry_hook()
Definition: isolate.h:1099
void Add(const char *str)
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
void GetCode(CodeDesc *desc)
bool IsBoolean() const
Definition: api.cc:2421
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
AllocationSiteOverrideMode override_mode() const
Definition: code-stubs.h:2108
virtual void PrintState(StringStream *stream)
Definition: code-stubs.cc:626
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
Definition: objects.cc:7149
Definition: v8.h:123
static void GenerateStubsAheadOfTime(Isolate *isolate)
static void InstallDescriptors(Isolate *isolate)
Definition: code-stubs.cc:761
V8_INLINE bool IsUndefined() const
Definition: v8.h:6229
virtual Handle< Code > GenerateCode(Isolate *isolate)
Definition: code-stubs.cc:99
V8_INLINE Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6541
static void GenerateLoadDictionaryElement(MacroAssembler *masm)
virtual void Generate(MacroAssembler *masm)=0
bool UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:618
V8_INLINE bool IsString() const
Definition: v8.h:6265
#define GDBJIT(action)
Definition: gdb-jit.h:137
Definition: v8.h:2107
Type * GetInputType(Zone *zone, Handle< Map > map)
Definition: code-stubs.cc:496
InlineCacheState State
Definition: ic.h:80
virtual void PrintBaseName(StringStream *stream)
Definition: code-stubs.cc:450
static HeapNumber * cast(Object *obj)
HydrogenCodeStub(InitializationState state=INITIALIZED)
Definition: code-stubs.h:389
const char * ElementsKindToString(ElementsKind kind)
bool is_null() const
Definition: handles.h:81
bool Contains(Typeelement) const
Definition: utils.h:1055
ElementsKind GetInitialFastElementsKind()
static void InstallDescriptors(Isolate *isolate)
Definition: code-stubs.cc:724
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, InlineCacheHolderFlag holder=OWN_MAP)
Definition: objects-inl.h:4601
static bool VerifyCrossCompiling()
Definition: assembler-arm.h:86
Handle< Code > NewCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false, bool crankshafted=false, int prologue_offset=Code::kPrologueOffsetNotSet)
Definition: factory.cc:1291
#define TYPED_ARRAYS(V)
Definition: objects.h:4663
static void GenerateStubsAheadOfTime(Isolate *isolate)
bool UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:647
static void InstallDescriptors(Isolate *isolate)
Definition: code-stubs.cc:740
Counters * counters()
Definition: isolate.h:859
void Print(const v8::FunctionCallbackInfo< v8::Value > &args)
static void InstallDescriptors(Isolate *isolate)
Definition: code-stubs.cc:753
void Generate(MacroAssembler *masm)
Definition: code-stubs.cc:547
void TraceTransition(StateType from, StateType to)
Definition: code-stubs.cc:430
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:697
const Register no_reg
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
virtual InlineCacheState GetICState()
Definition: code-stubs.cc:282
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:277
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
Definition: types.h:232
virtual void Generate(MacroAssembler *masm)
Definition: code-stubs.cc:373
#define CODE_STUB_LIST(V)
Definition: code-stubs.h:139
void Print(StringStream *stream) const
Definition: code-stubs.cc:631
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization 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 VFP3 instructions if available enable use of NEON instructions if 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 d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing 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 statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505
V8_INLINE Handle< Primitive > Null(Isolate *isolate)
Definition: v8.h:6550
virtual void PrintState(StringStream *stream) V8_FINAL V8_OVERRIDE
Definition: code-stubs.cc:232
static void GenerateStoreDictionaryElement(MacroAssembler *masm)
Definition: stub-cache.cc:1380