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
hydrogen.h
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 #ifndef V8_HYDROGEN_H_
29 #define V8_HYDROGEN_H_
30 
31 #include "v8.h"
32 
33 #include "allocation.h"
34 #include "ast.h"
35 #include "compiler.h"
36 #include "hydrogen-instructions.h"
37 #include "type-info.h"
38 #include "zone.h"
39 
40 namespace v8 {
41 namespace internal {
42 
43 // Forward declarations.
44 class BitVector;
45 class FunctionState;
46 class HEnvironment;
47 class HGraph;
48 class HLoopInformation;
49 class HTracer;
50 class LAllocator;
51 class LChunk;
52 class LiveRange;
53 
54 
55 class HBasicBlock: public ZoneObject {
56  public:
57  explicit HBasicBlock(HGraph* graph);
58  virtual ~HBasicBlock() { }
59 
60  // Simple accessors.
61  int block_id() const { return block_id_; }
62  void set_block_id(int id) { block_id_ = id; }
63  HGraph* graph() const { return graph_; }
64  const ZoneList<HPhi*>* phis() const { return &phis_; }
65  HInstruction* first() const { return first_; }
66  HInstruction* last() const { return last_; }
67  void set_last(HInstruction* instr) { last_ = instr; }
69  HControlInstruction* end() const { return end_; }
70  HLoopInformation* loop_information() const { return loop_information_; }
71  const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; }
72  bool HasPredecessor() const { return predecessors_.length() > 0; }
74  return &dominated_blocks_;
75  }
76  const ZoneList<int>* deleted_phis() const {
77  return &deleted_phis_;
78  }
79  void RecordDeletedPhi(int merge_index) {
80  deleted_phis_.Add(merge_index, zone());
81  }
82  HBasicBlock* dominator() const { return dominator_; }
83  HEnvironment* last_environment() const { return last_environment_; }
84  int argument_count() const { return argument_count_; }
85  void set_argument_count(int count) { argument_count_ = count; }
86  int first_instruction_index() const { return first_instruction_index_; }
87  void set_first_instruction_index(int index) {
88  first_instruction_index_ = index;
89  }
90  int last_instruction_index() const { return last_instruction_index_; }
91  void set_last_instruction_index(int index) {
92  last_instruction_index_ = index;
93  }
94 
95  void AttachLoopInformation();
96  void DetachLoopInformation();
97  bool IsLoopHeader() const { return loop_information() != NULL; }
98  bool IsStartBlock() const { return block_id() == 0; }
100 
101  bool IsFinished() const { return end_ != NULL; }
102  void AddPhi(HPhi* phi);
103  void RemovePhi(HPhi* phi);
104  void AddInstruction(HInstruction* instr);
105  bool Dominates(HBasicBlock* other) const;
106  int LoopNestingDepth() const;
107 
109  void ClearEnvironment() { last_environment_ = NULL; }
110  bool HasEnvironment() const { return last_environment_ != NULL; }
111  void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; }
112  HBasicBlock* parent_loop_header() const { return parent_loop_header_; }
113 
115  ASSERT(parent_loop_header_ == NULL);
116  parent_loop_header_ = block;
117  }
118 
119  bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; }
120 
121  void SetJoinId(int ast_id);
122 
124  void FinishExit(HControlInstruction* instruction);
125  void Goto(HBasicBlock* block, FunctionState* state = NULL);
126 
127  int PredecessorIndexOf(HBasicBlock* predecessor) const;
128  void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); }
129  void AssignCommonDominator(HBasicBlock* other);
131 
133  FinishExit(CreateDeoptimize(has_uses));
134  }
135 
136  // Add the inlined function exit sequence, adding an HLeaveInlined
137  // instruction and updating the bailout environment.
138  void AddLeaveInlined(HValue* return_value,
139  HBasicBlock* target,
140  FunctionState* state = NULL);
141 
142  // If a target block is tagged as an inline function return, all
143  // predecessors should contain the inlined exit sequence:
144  //
145  // LeaveInlined
146  // Simulate (caller's environment)
147  // Goto (target block)
148  bool IsInlineReturnTarget() const { return is_inline_return_target_; }
149  void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; }
150 
151  bool IsDeoptimizing() const { return is_deoptimizing_; }
152  void MarkAsDeoptimizing() { is_deoptimizing_ = true; }
153 
155  return dominates_loop_successors_;
156  }
158  dominates_loop_successors_ = true;
159  }
160 
161  inline Zone* zone() const;
162 
163 #ifdef DEBUG
164  void Verify();
165 #endif
166 
167  private:
168  void RegisterPredecessor(HBasicBlock* pred);
169  void AddDominatedBlock(HBasicBlock* block);
170 
171  HSimulate* CreateSimulate(int ast_id);
172  HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses);
173 
174  int block_id_;
175  HGraph* graph_;
176  ZoneList<HPhi*> phis_;
177  HInstruction* first_;
178  HInstruction* last_;
179  HControlInstruction* end_;
180  HLoopInformation* loop_information_;
181  ZoneList<HBasicBlock*> predecessors_;
182  HBasicBlock* dominator_;
183  ZoneList<HBasicBlock*> dominated_blocks_;
184  HEnvironment* last_environment_;
185  // Outgoing parameter count at block exit, set during lithium translation.
186  int argument_count_;
187  // Instruction indices into the lithium code stream.
188  int first_instruction_index_;
189  int last_instruction_index_;
190  ZoneList<int> deleted_phis_;
191  HBasicBlock* parent_loop_header_;
192  bool is_inline_return_target_;
193  bool is_deoptimizing_;
194  bool dominates_loop_successors_;
195 };
196 
197 
198 class HPredecessorIterator BASE_EMBEDDED {
199  public:
201  : predecessor_list_(block->predecessors()), current_(0) { }
202 
203  bool Done() { return current_ >= predecessor_list_->length(); }
204  HBasicBlock* Current() { return predecessor_list_->at(current_); }
205  void Advance() { current_++; }
206 
207  private:
208  const ZoneList<HBasicBlock*>* predecessor_list_;
209  int current_;
210 };
211 
212 
214  public:
216  : back_edges_(4, zone),
217  loop_header_(loop_header),
218  blocks_(8, zone),
219  stack_check_(NULL) {
220  blocks_.Add(loop_header, zone);
221  }
222  virtual ~HLoopInformation() {}
223 
224  const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; }
225  const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
226  HBasicBlock* loop_header() const { return loop_header_; }
227  HBasicBlock* GetLastBackEdge() const;
228  void RegisterBackEdge(HBasicBlock* block);
229 
230  HStackCheck* stack_check() const { return stack_check_; }
232  stack_check_ = stack_check;
233  }
234 
235  private:
236  void AddBlock(HBasicBlock* block);
237 
238  ZoneList<HBasicBlock*> back_edges_;
239  HBasicBlock* loop_header_;
240  ZoneList<HBasicBlock*> blocks_;
241  HStackCheck* stack_check_;
242 };
243 
244 class BoundsCheckTable;
245 class HGraph: public ZoneObject {
246  public:
247  HGraph(CompilationInfo* info, Zone* zone);
248 
249  Isolate* isolate() { return isolate_; }
250  Zone* zone() const { return zone_; }
251 
252  const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
253  const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
254  HBasicBlock* entry_block() const { return entry_block_; }
255  HEnvironment* start_environment() const { return start_environment_; }
256 
258  void InsertTypeConversions();
261  void ComputeMinusZeroChecks();
262  bool ProcessArgumentsObject();
263  void EliminateRedundantPhis();
265  void Canonicalize();
266  void OrderBlocks();
267  void AssignDominators();
268  void ReplaceCheckedValues();
272 
273  // Returns false if there are phi-uses of the arguments-object
274  // which are not supported by the optimizing compiler.
275  bool CheckArgumentsPhiUses();
276 
277  // Returns false if there are phi-uses of an uninitialized const
278  // which are not supported by the optimizing compiler.
279  bool CheckConstPhiUses();
280 
281  void CollectPhis();
282 
283  Handle<Code> Compile(CompilationInfo* info, Zone* zone);
284 
286  undefined_constant_.set(constant);
287  }
288  HConstant* GetConstantUndefined() const { return undefined_constant_.get(); }
294 
297  return arguments_object_.get();
298  }
299 
301  arguments_object_.set(object);
302  }
303 
304  int GetMaximumValueID() const { return values_.length(); }
305  int GetNextBlockID() { return next_block_id_++; }
306  int GetNextValueID(HValue* value) {
307  values_.Add(value, zone());
308  return values_.length() - 1;
309  }
310  HValue* LookupValue(int id) const {
311  if (id >= 0 && id < values_.length()) return values_[id];
312  return NULL;
313  }
314 
315 #ifdef DEBUG
316  void Verify(bool do_full_verify) const;
317 #endif
318 
320  return osr_loop_entry_.is_set();
321  }
322 
324  return osr_loop_entry_.get();
325  }
326 
328  osr_loop_entry_.set(entry);
329  }
330 
332  return osr_values_.get();
333  }
334 
336  osr_values_.set(values);
337  }
338 
339  void MarkRecursive() {
340  is_recursive_ = true;
341  }
342 
343  bool is_recursive() const {
344  return is_recursive_;
345  }
346 
347  private:
348  void Postorder(HBasicBlock* block,
349  BitVector* visited,
350  ZoneList<HBasicBlock*>* order,
351  HBasicBlock* loop_header);
352  void PostorderLoopBlocks(HLoopInformation* loop,
353  BitVector* visited,
354  ZoneList<HBasicBlock*>* order,
355  HBasicBlock* loop_header);
356  HConstant* GetConstant(SetOncePointer<HConstant>* pointer,
357  Object* value);
358 
359  void MarkAsDeoptimizingRecursively(HBasicBlock* block);
360  void InsertTypeConversions(HInstruction* instr);
361  void PropagateMinusZeroChecks(HValue* value, BitVector* visited);
362  void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi);
363  void InsertRepresentationChangeForUse(HValue* value,
364  HValue* use_value,
365  int use_index,
366  Representation to);
367  void InsertRepresentationChangesForValue(HValue* value);
368  void InferTypes(ZoneList<HValue*>* worklist);
369  void InitializeInferredTypes(int from_inclusive, int to_inclusive);
370  void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
372 
373  Isolate* isolate_;
374  int next_block_id_;
375  HBasicBlock* entry_block_;
376  HEnvironment* start_environment_;
377  ZoneList<HBasicBlock*> blocks_;
378  ZoneList<HValue*> values_;
379  ZoneList<HPhi*>* phi_list_;
380  SetOncePointer<HConstant> undefined_constant_;
381  SetOncePointer<HConstant> constant_1_;
382  SetOncePointer<HConstant> constant_minus1_;
383  SetOncePointer<HConstant> constant_true_;
384  SetOncePointer<HConstant> constant_false_;
385  SetOncePointer<HConstant> constant_hole_;
386  SetOncePointer<HArgumentsObject> arguments_object_;
387 
388  SetOncePointer<HBasicBlock> osr_loop_entry_;
390 
391  Zone* zone_;
392 
393  bool is_recursive_;
394 
395  DISALLOW_COPY_AND_ASSIGN(HGraph);
396 };
397 
398 
399 Zone* HBasicBlock::zone() const { return graph_->zone(); }
400 
401 
402 // Type of stack frame an environment might refer to.
404 
405 
406 class HEnvironment: public ZoneObject {
407  public:
409  Scope* scope,
411  Zone* zone);
412 
413  HEnvironment* DiscardInlined(bool drop_extra) {
414  HEnvironment* outer = outer_;
415  while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_;
416  if (drop_extra) outer->Drop(1);
417  return outer;
418  }
419 
421  return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this;
422  }
423 
424  // Simple accessors.
425  Handle<JSFunction> closure() const { return closure_; }
426  const ZoneList<HValue*>* values() const { return &values_; }
428  return &assigned_variables_;
429  }
430  FrameType frame_type() const { return frame_type_; }
431  int parameter_count() const { return parameter_count_; }
432  int specials_count() const { return specials_count_; }
433  int local_count() const { return local_count_; }
434  HEnvironment* outer() const { return outer_; }
435  int pop_count() const { return pop_count_; }
436  int push_count() const { return push_count_; }
437 
438  int ast_id() const { return ast_id_; }
439  void set_ast_id(int id) { ast_id_ = id; }
440 
441  int length() const { return values_.length(); }
442  bool is_special_index(int i) const {
443  return i >= parameter_count() && i < parameter_count() + specials_count();
444  }
445 
447  return parameter_count() + specials_count() + local_count();
448  }
449 
450  void Bind(Variable* variable, HValue* value) {
451  Bind(IndexFor(variable), value);
452  }
453 
454  void Bind(int index, HValue* value);
455 
456  void BindContext(HValue* value) {
457  Bind(parameter_count(), value);
458  }
459 
460  HValue* Lookup(Variable* variable) const {
461  return Lookup(IndexFor(variable));
462  }
463 
464  HValue* Lookup(int index) const {
465  HValue* result = values_[index];
466  ASSERT(result != NULL);
467  return result;
468  }
469 
471  // Return first special.
472  return Lookup(parameter_count());
473  }
474 
475  void Push(HValue* value) {
476  ASSERT(value != NULL);
477  ++push_count_;
478  values_.Add(value, zone());
479  }
480 
481  HValue* Pop() {
483  if (push_count_ > 0) {
484  --push_count_;
485  } else {
486  ++pop_count_;
487  }
488  return values_.RemoveLast();
489  }
490 
491  void Drop(int count);
492 
493  HValue* Top() const { return ExpressionStackAt(0); }
494 
495  bool ExpressionStackIsEmpty() const;
496 
497  HValue* ExpressionStackAt(int index_from_top) const {
498  int index = length() - index_from_top - 1;
499  ASSERT(HasExpressionAt(index));
500  return values_[index];
501  }
502 
503  void SetExpressionStackAt(int index_from_top, HValue* value);
504 
505  HEnvironment* Copy() const;
508 
509  // Create an "inlined version" of this environment, where the original
510  // environment is the outer environment but the top expression stack
511  // elements are moved to an inner environment as parameters.
513  int arguments,
514  FunctionLiteral* function,
515  HConstant* undefined,
516  CallKind call_kind,
517  bool is_construct) const;
518 
519  void AddIncomingEdge(HBasicBlock* block, HEnvironment* other);
520 
521  void ClearHistory() {
522  pop_count_ = 0;
523  push_count_ = 0;
524  assigned_variables_.Rewind(0);
525  }
526 
527  void SetValueAt(int index, HValue* value) {
528  ASSERT(index < length());
529  values_[index] = value;
530  }
531 
532  void PrintTo(StringStream* stream);
533  void PrintToStd();
534 
535  Zone* zone() const { return zone_; }
536 
537  private:
538  HEnvironment(const HEnvironment* other, Zone* zone);
539 
540  HEnvironment(HEnvironment* outer,
541  Handle<JSFunction> closure,
543  int arguments,
544  Zone* zone);
545 
546  // Create an artificial stub environment (e.g. for argument adaptor or
547  // constructor stub).
548  HEnvironment* CreateStubEnvironment(HEnvironment* outer,
549  Handle<JSFunction> target,
551  int arguments) const;
552 
553  // True if index is included in the expression stack part of the environment.
554  bool HasExpressionAt(int index) const;
555 
556  void Initialize(int parameter_count, int local_count, int stack_height);
557  void Initialize(const HEnvironment* other);
558 
559  // Map a variable to an environment index. Parameter indices are shifted
560  // by 1 (receiver is parameter index -1 but environment index 0).
561  // Stack-allocated local indices are shifted by the number of parameters.
562  int IndexFor(Variable* variable) const {
563  ASSERT(variable->IsStackAllocated());
564  int shift = variable->IsParameter()
565  ? 1
566  : parameter_count_ + specials_count_;
567  return variable->index() + shift;
568  }
569 
570  Handle<JSFunction> closure_;
571  // Value array [parameters] [specials] [locals] [temporaries].
572  ZoneList<HValue*> values_;
573  ZoneList<int> assigned_variables_;
574  FrameType frame_type_;
575  int parameter_count_;
576  int specials_count_;
577  int local_count_;
578  HEnvironment* outer_;
579  int pop_count_;
580  int push_count_;
581  int ast_id_;
582  Zone* zone_;
583 };
584 
585 
586 class HGraphBuilder;
587 
591 };
592 
593 // This class is not BASE_EMBEDDED because our inlining implementation uses
594 // new and delete.
595 class AstContext {
596  public:
597  bool IsEffect() const { return kind_ == Expression::kEffect; }
598  bool IsValue() const { return kind_ == Expression::kValue; }
599  bool IsTest() const { return kind_ == Expression::kTest; }
600 
601  // 'Fill' this context with a hydrogen value. The value is assumed to
602  // have already been inserted in the instruction stream (or not need to
603  // be, e.g., HPhi). Call this function in tail position in the Visit
604  // functions for expressions.
605  virtual void ReturnValue(HValue* value) = 0;
606 
607  // Add a hydrogen instruction to the instruction stream (recording an
608  // environment simulation if necessary) and then fill this context with
609  // the instruction as value.
610  virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0;
611 
612  // Finishes the current basic block and materialize a boolean for
613  // value context, nothing for effect, generate a branch for test context.
614  // Call this function in tail position in the Visit functions for
615  // expressions.
616  virtual void ReturnControl(HControlInstruction* instr, int ast_id) = 0;
617 
618  void set_for_typeof(bool for_typeof) { for_typeof_ = for_typeof; }
619  bool is_for_typeof() { return for_typeof_; }
620 
621  protected:
623  virtual ~AstContext();
624 
625  HGraphBuilder* owner() const { return owner_; }
626 
627  inline Zone* zone() const;
628 
629  // We want to be able to assert, in a context-specific way, that the stack
630  // height makes sense when the context is filled.
631 #ifdef DEBUG
632  int original_length_;
633 #endif
634 
635  private:
636  HGraphBuilder* owner_;
637  Expression::Context kind_;
638  AstContext* outer_;
639  bool for_typeof_;
640 };
641 
642 
643 class EffectContext: public AstContext {
644  public:
646  : AstContext(owner, Expression::kEffect) {
647  }
648  virtual ~EffectContext();
649 
650  virtual void ReturnValue(HValue* value);
651  virtual void ReturnInstruction(HInstruction* instr, int ast_id);
652  virtual void ReturnControl(HControlInstruction* instr, int ast_id);
653 };
654 
655 
656 class ValueContext: public AstContext {
657  public:
659  : AstContext(owner, Expression::kValue), flag_(flag) {
660  }
661  virtual ~ValueContext();
662 
663  virtual void ReturnValue(HValue* value);
664  virtual void ReturnInstruction(HInstruction* instr, int ast_id);
665  virtual void ReturnControl(HControlInstruction* instr, int ast_id);
666 
667  bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; }
668 
669  private:
670  ArgumentsAllowedFlag flag_;
671 };
672 
673 
674 class TestContext: public AstContext {
675  public:
680  : AstContext(owner, Expression::kTest),
681  condition_(condition),
682  if_true_(if_true),
683  if_false_(if_false) {
684  }
685 
686  virtual void ReturnValue(HValue* value);
687  virtual void ReturnInstruction(HInstruction* instr, int ast_id);
688  virtual void ReturnControl(HControlInstruction* instr, int ast_id);
689 
690  static TestContext* cast(AstContext* context) {
691  ASSERT(context->IsTest());
692  return reinterpret_cast<TestContext*>(context);
693  }
694 
695  Expression* condition() const { return condition_; }
696  HBasicBlock* if_true() const { return if_true_; }
697  HBasicBlock* if_false() const { return if_false_; }
698 
699  private:
700  // Build the shared core part of the translation unpacking a value into
701  // control flow.
702  void BuildBranch(HValue* value);
703 
704  Expression* condition_;
705  HBasicBlock* if_true_;
706  HBasicBlock* if_false_;
707 };
708 
709 
714 };
715 
716 
718  public:
720  CompilationInfo* info,
721  TypeFeedbackOracle* oracle,
722  ReturnHandlingFlag return_handling);
723  ~FunctionState();
724 
725  CompilationInfo* compilation_info() { return compilation_info_; }
726  TypeFeedbackOracle* oracle() { return oracle_; }
727  AstContext* call_context() { return call_context_; }
728  bool drop_extra() { return return_handling_ == DROP_EXTRA_ON_RETURN; }
729  bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; }
730  HBasicBlock* function_return() { return function_return_; }
731  TestContext* test_context() { return test_context_; }
733  delete test_context_;
734  test_context_ = NULL;
735  }
736 
737  FunctionState* outer() { return outer_; }
738 
739  HEnterInlined* entry() { return entry_; }
740  void set_entry(HEnterInlined* entry) { entry_ = entry; }
741 
742  HArgumentsElements* arguments_elements() { return arguments_elements_; }
744  arguments_elements_ = arguments_elements;
745  }
746 
747  bool arguments_pushed() { return arguments_elements() != NULL; }
748 
749  private:
750  HGraphBuilder* owner_;
751 
752  CompilationInfo* compilation_info_;
753  TypeFeedbackOracle* oracle_;
754 
755  // During function inlining, expression context of the call being
756  // inlined. NULL when not inlining.
757  AstContext* call_context_;
758 
759  // Indicate whether we have to perform special handling on return from
760  // inlined functions.
761  // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment.
762  // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value.
763  ReturnHandlingFlag return_handling_;
764 
765  // When inlining in an effect or value context, this is the return block.
766  // It is NULL otherwise. When inlining in a test context, there are a
767  // pair of return blocks in the context. When not inlining, there is no
768  // local return point.
769  HBasicBlock* function_return_;
770 
771  // When inlining a call in a test context, a context containing a pair of
772  // return blocks. NULL in all other cases.
773  TestContext* test_context_;
774 
775  // When inlining HEnterInlined instruction corresponding to the function
776  // entry.
777  HEnterInlined* entry_;
778 
779  HArgumentsElements* arguments_elements_;
780 
781  FunctionState* outer_;
782 };
783 
784 
785 class HGraphBuilder: public AstVisitor {
786  public:
789 
790  // A class encapsulating (lazily-allocated) break and continue blocks for
791  // a breakable statement. Separated from BreakAndContinueScope so that it
792  // can have a separate lifetime.
793  class BreakAndContinueInfo BASE_EMBEDDED {
794  public:
796  int drop_extra = 0)
797  : target_(target),
798  break_block_(NULL),
799  continue_block_(NULL),
800  drop_extra_(drop_extra) {
801  }
802 
803  BreakableStatement* target() { return target_; }
804  HBasicBlock* break_block() { return break_block_; }
805  void set_break_block(HBasicBlock* block) { break_block_ = block; }
806  HBasicBlock* continue_block() { return continue_block_; }
807  void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
808  int drop_extra() { return drop_extra_; }
809 
810  private:
811  BreakableStatement* target_;
812  HBasicBlock* break_block_;
813  HBasicBlock* continue_block_;
814  int drop_extra_;
815  };
816 
817  // A helper class to maintain a stack of current BreakAndContinueInfo
818  // structures mirroring BreakableStatement nesting.
819  class BreakAndContinueScope BASE_EMBEDDED {
820  public:
821  BreakAndContinueScope(BreakAndContinueInfo* info, HGraphBuilder* owner)
822  : info_(info), owner_(owner), next_(owner->break_scope()) {
823  owner->set_break_scope(this);
824  }
825 
826  ~BreakAndContinueScope() { owner_->set_break_scope(next_); }
827 
828  BreakAndContinueInfo* info() { return info_; }
829  HGraphBuilder* owner() { return owner_; }
830  BreakAndContinueScope* next() { return next_; }
831 
832  // Search the break stack for a break or continue target.
833  HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra);
834 
835  private:
836  BreakAndContinueInfo* info_;
837  HGraphBuilder* owner_;
838  BreakAndContinueScope* next_;
839  };
840 
841  HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle, Zone* zone);
842 
843  HGraph* CreateGraph();
844 
845  // Simple accessors.
846  HGraph* graph() const { return graph_; }
847  BreakAndContinueScope* break_scope() const { return break_scope_; }
848  void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
849 
850  HBasicBlock* current_block() const { return current_block_; }
851  void set_current_block(HBasicBlock* block) { current_block_ = block; }
853  return current_block()->last_environment();
854  }
855 
856  bool inline_bailout() { return inline_bailout_; }
857 
858  // Adding instructions.
860  void AddSimulate(int ast_id);
861 
862  // Bailout environment manipulation.
863  void Push(HValue* value) { environment()->Push(value); }
864  HValue* Pop() { return environment()->Pop(); }
865 
866  void Bailout(const char* reason);
867 
869  HBasicBlock* second,
870  int join_id);
871 
872  TypeFeedbackOracle* oracle() const { return function_state()->oracle(); }
873 
874  FunctionState* function_state() const { return function_state_; }
875 
876  void VisitDeclarations(ZoneList<Declaration*>* declarations);
877 
878  private:
879  // Type of a member function that generates inline code for a native function.
880  typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call);
881 
882  // Forward declarations for inner scope classes.
883  class SubgraphScope;
884 
885  static const InlineFunctionGenerator kInlineFunctionGenerators[];
886 
887  static const int kMaxCallPolymorphism = 4;
888  static const int kMaxLoadPolymorphism = 4;
889  static const int kMaxStorePolymorphism = 4;
890 
891  // Even in the 'unlimited' case we have to have some limit in order not to
892  // overflow the stack.
893  static const int kUnlimitedMaxInlinedSourceSize = 100000;
894  static const int kUnlimitedMaxInlinedNodes = 10000;
895  static const int kUnlimitedMaxInlinedNodesCumulative = 10000;
896 
897  // Simple accessors.
898  void set_function_state(FunctionState* state) { function_state_ = state; }
899 
900  AstContext* ast_context() const { return ast_context_; }
901  void set_ast_context(AstContext* context) { ast_context_ = context; }
902 
903  // Accessors forwarded to the function state.
904  CompilationInfo* info() const {
905  return function_state()->compilation_info();
906  }
907  AstContext* call_context() const {
908  return function_state()->call_context();
909  }
910  HBasicBlock* function_return() const {
911  return function_state()->function_return();
912  }
913  TestContext* inlined_test_context() const {
914  return function_state()->test_context();
915  }
916  void ClearInlinedTestContext() {
918  }
919  StrictModeFlag function_strict_mode_flag() {
920  return function_state()->compilation_info()->is_classic_mode()
922  }
923 
924  // Generators for inline runtime functions.
925 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \
926  void Generate##Name(CallRuntime* call);
927 
930 #undef INLINE_FUNCTION_GENERATOR_DECLARATION
931 
932  void VisitDelete(UnaryOperation* expr);
933  void VisitVoid(UnaryOperation* expr);
934  void VisitTypeof(UnaryOperation* expr);
935  void VisitAdd(UnaryOperation* expr);
936  void VisitSub(UnaryOperation* expr);
937  void VisitBitNot(UnaryOperation* expr);
938  void VisitNot(UnaryOperation* expr);
939 
940  void VisitComma(BinaryOperation* expr);
941  void VisitLogicalExpression(BinaryOperation* expr);
942  void VisitArithmeticExpression(BinaryOperation* expr);
943 
944  bool PreProcessOsrEntry(IterationStatement* statement);
945  // True iff. we are compiling for OSR and the statement is the entry.
946  bool HasOsrEntryAt(IterationStatement* statement);
947  void VisitLoopBody(IterationStatement* stmt,
948  HBasicBlock* loop_entry,
949  BreakAndContinueInfo* break_info);
950 
951  // Create a back edge in the flow graph. body_exit is the predecessor
952  // block and loop_entry is the successor block. loop_successor is the
953  // block where control flow exits the loop normally (e.g., via failure of
954  // the condition) and break_block is the block where control flow breaks
955  // from the loop. All blocks except loop_entry can be NULL. The return
956  // value is the new successor block which is the join of loop_successor
957  // and break_block, or NULL.
958  HBasicBlock* CreateLoop(IterationStatement* statement,
959  HBasicBlock* loop_entry,
960  HBasicBlock* body_exit,
961  HBasicBlock* loop_successor,
962  HBasicBlock* break_block);
963 
964  HBasicBlock* JoinContinue(IterationStatement* statement,
965  HBasicBlock* exit_block,
966  HBasicBlock* continue_block);
967 
968  HValue* Top() const { return environment()->Top(); }
969  void Drop(int n) { environment()->Drop(n); }
970  void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); }
971 
972  // The value of the arguments object is allowed in some but not most value
973  // contexts. (It's allowed in all effect contexts and disallowed in all
974  // test contexts.)
975  void VisitForValue(Expression* expr,
977  void VisitForTypeOf(Expression* expr);
978  void VisitForEffect(Expression* expr);
979  void VisitForControl(Expression* expr,
980  HBasicBlock* true_block,
981  HBasicBlock* false_block);
982 
983  // Visit an argument subexpression and emit a push to the outgoing
984  // arguments. Returns the hydrogen value that was pushed.
985  HValue* VisitArgument(Expression* expr);
986 
987  void VisitArgumentList(ZoneList<Expression*>* arguments);
988 
989  // Visit a list of expressions from left to right, each in a value context.
990  void VisitExpressions(ZoneList<Expression*>* exprs);
991 
992  void AddPhi(HPhi* phi);
993 
994  void PushAndAdd(HInstruction* instr);
995 
996  // Remove the arguments from the bailout environment and emit instructions
997  // to push them as outgoing parameters.
998  template <class Instruction> HInstruction* PreProcessCall(Instruction* call);
999 
1000  void TraceRepresentation(Token::Value op,
1001  TypeInfo info,
1002  HValue* value,
1003  Representation rep);
1004  static Representation ToRepresentation(TypeInfo info);
1005 
1006  void SetUpScope(Scope* scope);
1007  virtual void VisitStatements(ZoneList<Statement*>* statements);
1008 
1009 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
1011 #undef DECLARE_VISIT
1012 
1013  HBasicBlock* CreateBasicBlock(HEnvironment* env);
1014  HBasicBlock* CreateLoopHeaderBlock();
1015 
1016  // Helpers for flow graph construction.
1017  enum GlobalPropertyAccess {
1018  kUseCell,
1019  kUseGeneric
1020  };
1021  GlobalPropertyAccess LookupGlobalProperty(Variable* var,
1022  LookupResult* lookup,
1023  bool is_store);
1024 
1025  void EnsureArgumentsArePushedForAccess();
1026  bool TryArgumentsAccess(Property* expr);
1027 
1028  // Try to optimize fun.apply(receiver, arguments) pattern.
1029  bool TryCallApply(Call* expr);
1030 
1031  int InliningAstSize(Handle<JSFunction> target);
1032  bool TryInline(CallKind call_kind,
1033  Handle<JSFunction> target,
1034  ZoneList<Expression*>* arguments,
1035  HValue* receiver,
1036  int ast_id,
1037  int return_id,
1038  ReturnHandlingFlag return_handling);
1039 
1040  bool TryInlineCall(Call* expr, bool drop_extra = false);
1041  bool TryInlineConstruct(CallNew* expr, HValue* receiver);
1042  bool TryInlineBuiltinMethodCall(Call* expr,
1043  HValue* receiver,
1044  Handle<Map> receiver_map,
1045  CheckType check_type);
1046  bool TryInlineBuiltinFunctionCall(Call* expr, bool drop_extra);
1047 
1048  // If --trace-inlining, print a line of the inlining trace. Inlining
1049  // succeeded if the reason string is NULL and failed if there is a
1050  // non-NULL reason string.
1051  void TraceInline(Handle<JSFunction> target,
1052  Handle<JSFunction> caller,
1053  const char* failure_reason);
1054 
1055  void HandleGlobalVariableAssignment(Variable* var,
1056  HValue* value,
1057  int position,
1058  int ast_id);
1059 
1060  void HandlePropertyAssignment(Assignment* expr);
1061  void HandleCompoundAssignment(Assignment* expr);
1062  void HandlePolymorphicLoadNamedField(Property* expr,
1063  HValue* object,
1064  SmallMapList* types,
1065  Handle<String> name);
1066  void HandlePolymorphicStoreNamedField(Assignment* expr,
1067  HValue* object,
1068  HValue* value,
1069  SmallMapList* types,
1070  Handle<String> name);
1071  void HandlePolymorphicCallNamed(Call* expr,
1072  HValue* receiver,
1073  SmallMapList* types,
1074  Handle<String> name);
1075  void HandleLiteralCompareTypeof(CompareOperation* expr,
1076  HTypeof* typeof_expr,
1077  Handle<String> check);
1078  void HandleLiteralCompareNil(CompareOperation* expr,
1079  HValue* value,
1080  NilValue nil);
1081 
1082  HStringCharCodeAt* BuildStringCharCodeAt(HValue* context,
1083  HValue* string,
1084  HValue* index);
1085  HInstruction* BuildBinaryOperation(BinaryOperation* expr,
1086  HValue* left,
1087  HValue* right);
1088  HInstruction* BuildIncrement(bool returns_original_input,
1089  CountOperation* expr);
1090  HLoadNamedField* BuildLoadNamedField(HValue* object,
1091  Property* expr,
1092  Handle<Map> type,
1093  LookupResult* result,
1094  bool smi_and_map_check);
1095  HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr);
1096  HInstruction* BuildLoadKeyedGeneric(HValue* object,
1097  HValue* key);
1098  HInstruction* BuildExternalArrayElementAccess(
1099  HValue* external_elements,
1100  HValue* checked_key,
1101  HValue* val,
1102  ElementsKind elements_kind,
1103  bool is_store);
1104  HInstruction* BuildFastElementAccess(HValue* elements,
1105  HValue* checked_key,
1106  HValue* val,
1107  ElementsKind elements_kind,
1108  bool is_store);
1109 
1110  HInstruction* BuildMonomorphicElementAccess(HValue* object,
1111  HValue* key,
1112  HValue* val,
1113  HValue* dependency,
1114  Handle<Map> map,
1115  bool is_store);
1116  HValue* HandlePolymorphicElementAccess(HValue* object,
1117  HValue* key,
1118  HValue* val,
1119  Expression* prop,
1120  int ast_id,
1121  int position,
1122  bool is_store,
1123  bool* has_side_effects);
1124 
1125  HValue* HandleKeyedElementAccess(HValue* obj,
1126  HValue* key,
1127  HValue* val,
1128  Expression* expr,
1129  int ast_id,
1130  int position,
1131  bool is_store,
1132  bool* has_side_effects);
1133 
1134  HInstruction* BuildLoadNamed(HValue* object,
1135  Property* prop,
1136  Handle<Map> map,
1137  Handle<String> name);
1138  HInstruction* BuildStoreNamed(HValue* object,
1139  HValue* value,
1140  Expression* expr);
1141  HInstruction* BuildStoreNamed(HValue* object,
1142  HValue* value,
1143  ObjectLiteral::Property* prop);
1144  HInstruction* BuildStoreNamedField(HValue* object,
1145  Handle<String> name,
1146  HValue* value,
1147  Handle<Map> type,
1148  LookupResult* lookup,
1149  bool smi_and_map_check);
1150  HInstruction* BuildStoreNamedGeneric(HValue* object,
1151  Handle<String> name,
1152  HValue* value);
1153  HInstruction* BuildStoreKeyedGeneric(HValue* object,
1154  HValue* key,
1155  HValue* value);
1156 
1157  HValue* BuildContextChainWalk(Variable* var);
1158 
1159  void AddCheckConstantFunction(Call* expr,
1160  HValue* receiver,
1161  Handle<Map> receiver_map,
1162  bool smi_and_map_check);
1163 
1164  Zone* zone() const { return zone_; }
1165 
1166  // The translation state of the currently-being-translated function.
1167  FunctionState* function_state_;
1168 
1169  // The base of the function state stack.
1170  FunctionState initial_function_state_;
1171 
1172  // Expression context of the currently visited subexpression. NULL when
1173  // visiting statements.
1174  AstContext* ast_context_;
1175 
1176  // A stack of breakable statements entered.
1177  BreakAndContinueScope* break_scope_;
1178 
1179  HGraph* graph_;
1180  HBasicBlock* current_block_;
1181 
1182  int inlined_count_;
1183  ZoneList<Handle<Object> > globals_;
1184 
1185  Zone* zone_;
1186 
1187  bool inline_bailout_;
1188 
1189  friend class FunctionState; // Pushes and pops the state stack.
1190  friend class AstContext; // Pushes and pops the AST context stack.
1191 
1193 };
1194 
1195 
1196 Zone* AstContext::zone() const { return owner_->zone(); }
1197 
1198 
1199 class HValueMap: public ZoneObject {
1200  public:
1201  explicit HValueMap(Zone* zone)
1202  : array_size_(0),
1203  lists_size_(0),
1204  count_(0),
1205  present_flags_(0),
1206  array_(NULL),
1207  lists_(NULL),
1208  free_list_head_(kNil) {
1209  ResizeLists(kInitialSize, zone);
1210  Resize(kInitialSize, zone);
1211  }
1212 
1213  void Kill(GVNFlagSet flags);
1214 
1215  void Add(HValue* value, Zone* zone) {
1216  present_flags_.Add(value->gvn_flags());
1217  Insert(value, zone);
1218  }
1219 
1220  HValue* Lookup(HValue* value) const;
1221 
1222  HValueMap* Copy(Zone* zone) const {
1223  return new(zone) HValueMap(zone, this);
1224  }
1225 
1226  bool IsEmpty() const { return count_ == 0; }
1227 
1228  private:
1229  // A linked list of HValue* values. Stored in arrays.
1230  struct HValueMapListElement {
1231  HValue* value;
1232  int next; // Index in the array of the next list element.
1233  };
1234  static const int kNil = -1; // The end of a linked list
1235 
1236  // Must be a power of 2.
1237  static const int kInitialSize = 16;
1238 
1239  HValueMap(Zone* zone, const HValueMap* other);
1240 
1241  void Resize(int new_size, Zone* zone);
1242  void ResizeLists(int new_size, Zone* zone);
1243  void Insert(HValue* value, Zone* zone);
1244  uint32_t Bound(uint32_t value) const { return value & (array_size_ - 1); }
1245 
1246  int array_size_;
1247  int lists_size_;
1248  int count_; // The number of values stored in the HValueMap.
1249  GVNFlagSet present_flags_; // All flags that are in any value in the
1250  // HValueMap.
1251  HValueMapListElement* array_; // Primary store - contains the first value
1252  // with a given hash. Colliding elements are stored in linked lists.
1253  HValueMapListElement* lists_; // The linked lists containing hash collisions.
1254  int free_list_head_; // Unused elements in lists_ are on the free list.
1255 };
1256 
1257 
1258 class HSideEffectMap BASE_EMBEDDED {
1259  public:
1260  HSideEffectMap();
1261  explicit HSideEffectMap(HSideEffectMap* other);
1262  HSideEffectMap& operator= (const HSideEffectMap& other);
1263 
1264  void Kill(GVNFlagSet flags);
1265 
1266  void Store(GVNFlagSet flags, HInstruction* instr);
1267 
1268  bool IsEmpty() const { return count_ == 0; }
1269 
1270  inline HInstruction* operator[](int i) const {
1271  ASSERT(0 <= i);
1273  return data_[i];
1274  }
1275  inline HInstruction* at(int i) const { return operator[](i); }
1276 
1277  private:
1278  int count_;
1280 };
1281 
1282 
1283 class HStatistics: public Malloced {
1284  public:
1285  void Initialize(CompilationInfo* info);
1286  void Print();
1287  void SaveTiming(const char* name, int64_t ticks, unsigned size);
1288  static HStatistics* Instance() {
1289  static SetOncePointer<HStatistics> instance;
1290  if (!instance.is_set()) {
1291  instance.set(new HStatistics());
1292  }
1293  return instance.get();
1294  }
1295 
1296  private:
1297  HStatistics()
1298  : timing_(5),
1299  names_(5),
1300  sizes_(5),
1301  total_(0),
1302  total_size_(0),
1303  full_code_gen_(0),
1304  source_size_(0) { }
1305 
1306  List<int64_t> timing_;
1307  List<const char*> names_;
1308  List<unsigned> sizes_;
1309  int64_t total_;
1310  unsigned total_size_;
1311  int64_t full_code_gen_;
1312  double source_size_;
1313 };
1314 
1315 
1316 class HPhase BASE_EMBEDDED {
1317  public:
1318  static const char* const kFullCodeGen;
1319  static const char* const kTotal;
1320 
1321  explicit HPhase(const char* name) { Begin(name, NULL, NULL, NULL); }
1322  HPhase(const char* name, HGraph* graph) {
1323  Begin(name, graph, NULL, NULL);
1324  }
1325  HPhase(const char* name, LChunk* chunk) {
1326  Begin(name, NULL, chunk, NULL);
1327  }
1328  HPhase(const char* name, LAllocator* allocator) {
1329  Begin(name, NULL, NULL, allocator);
1330  }
1331 
1333  End();
1334  }
1335 
1336  private:
1337  void Begin(const char* name,
1338  HGraph* graph,
1339  LChunk* chunk,
1340  LAllocator* allocator);
1341  void End() const;
1342 
1343  int64_t start_;
1344  const char* name_;
1345  HGraph* graph_;
1346  LChunk* chunk_;
1347  LAllocator* allocator_;
1348  unsigned start_allocation_size_;
1349 };
1350 
1351 
1352 class HTracer: public Malloced {
1353  public:
1354  void TraceCompilation(FunctionLiteral* function);
1355  void TraceHydrogen(const char* name, HGraph* graph);
1356  void TraceLithium(const char* name, LChunk* chunk);
1357  void TraceLiveRanges(const char* name, LAllocator* allocator);
1358 
1359  static HTracer* Instance() {
1360  static SetOncePointer<HTracer> instance;
1361  if (!instance.is_set()) {
1362  instance.set(new HTracer("hydrogen.cfg"));
1363  }
1364  return instance.get();
1365  }
1366 
1367  private:
1368  class Tag BASE_EMBEDDED {
1369  public:
1370  Tag(HTracer* tracer, const char* name) {
1371  name_ = name;
1372  tracer_ = tracer;
1373  tracer->PrintIndent();
1374  tracer->trace_.Add("begin_%s\n", name);
1375  tracer->indent_++;
1376  }
1377 
1378  ~Tag() {
1379  tracer_->indent_--;
1380  tracer_->PrintIndent();
1381  tracer_->trace_.Add("end_%s\n", name_);
1382  ASSERT(tracer_->indent_ >= 0);
1383  tracer_->FlushToFile();
1384  }
1385 
1386  private:
1387  HTracer* tracer_;
1388  const char* name_;
1389  };
1390 
1391  explicit HTracer(const char* filename)
1392  : filename_(filename), trace_(&string_allocator_), indent_(0) {
1393  WriteChars(filename, "", 0, false);
1394  }
1395 
1396  void TraceLiveRange(LiveRange* range, const char* type, Zone* zone);
1397  void Trace(const char* name, HGraph* graph, LChunk* chunk);
1398  void FlushToFile();
1399 
1400  void PrintEmptyProperty(const char* name) {
1401  PrintIndent();
1402  trace_.Add("%s\n", name);
1403  }
1404 
1405  void PrintStringProperty(const char* name, const char* value) {
1406  PrintIndent();
1407  trace_.Add("%s \"%s\"\n", name, value);
1408  }
1409 
1410  void PrintLongProperty(const char* name, int64_t value) {
1411  PrintIndent();
1412  trace_.Add("%s %d000\n", name, static_cast<int>(value / 1000));
1413  }
1414 
1415  void PrintBlockProperty(const char* name, int block_id) {
1416  PrintIndent();
1417  trace_.Add("%s \"B%d\"\n", name, block_id);
1418  }
1419 
1420  void PrintIntProperty(const char* name, int value) {
1421  PrintIndent();
1422  trace_.Add("%s %d\n", name, value);
1423  }
1424 
1425  void PrintIndent() {
1426  for (int i = 0; i < indent_; i++) {
1427  trace_.Add(" ");
1428  }
1429  }
1430 
1431  const char* filename_;
1432  HeapStringAllocator string_allocator_;
1433  StringStream trace_;
1434  int indent_;
1435 };
1436 
1437 
1438 } } // namespace v8::internal
1439 
1440 #endif // V8_HYDROGEN_H_
HValue * LookupValue(int id) const
Definition: hydrogen.h:310
Isolate * isolate()
Definition: hydrogen.h:249
void SetInitialEnvironment(HEnvironment *env)
Definition: hydrogen.cc:200
#define INLINE_FUNCTION_LIST(F)
Definition: runtime.h:493
bool IsTest() const
Definition: hydrogen.h:599
void set_break_scope(BreakAndContinueScope *head)
Definition: hydrogen.h:848
ArgumentsAllowedFlag
Definition: hydrogen.h:588
FunctionState(HGraphBuilder *owner, CompilationInfo *info, TypeFeedbackOracle *oracle, ReturnHandlingFlag return_handling)
Definition: hydrogen.cc:2521
HPhase(const char *name, HGraph *graph)
Definition: hydrogen.h:1322
bool IsFinished() const
Definition: hydrogen.h:101
bool IsDeoptimizing() const
Definition: hydrogen.h:151
HBasicBlock * if_true() const
Definition: hydrogen.h:696
GVNFlagSet gvn_flags() const
HStackCheck * stack_check() const
Definition: hydrogen.h:230
const ZoneList< int > * deleted_phis() const
Definition: hydrogen.h:76
void set_entry(HEnterInlined *entry)
Definition: hydrogen.h:740
HValueMap * Copy(Zone *zone) const
Definition: hydrogen.h:1222
void set_for_typeof(bool for_typeof)
Definition: hydrogen.h:618
virtual void ReturnControl(HControlInstruction *instr, int ast_id)
Definition: hydrogen.cc:2628
HBasicBlock * loop_header() const
Definition: hydrogen.h:226
EffectContext(HGraphBuilder *owner)
Definition: hydrogen.h:645
int push_count() const
Definition: hydrogen.h:436
void set_block_id(int id)
Definition: hydrogen.h:62
#define DECLARE_VISIT(type)
Definition: hydrogen.h:1009
bool IsEffect() const
Definition: hydrogen.h:597
HBasicBlock * Current()
Definition: hydrogen.h:204
void AddLeaveInlined(HValue *return_value, HBasicBlock *target, FunctionState *state=NULL)
Definition: hydrogen.cc:183
HValue * LookupContext() const
Definition: hydrogen.h:470
HPhase(const char *name, LAllocator *allocator)
Definition: hydrogen.h:1328
int current_
bool Dominates(HBasicBlock *other) const
Definition: hydrogen.cc:223
void Kill(GVNFlagSet flags)
Definition: hydrogen.cc:1204
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
const ZoneList< int > * assigned_variables() const
Definition: hydrogen.h:427
HConstant * GetConstant1()
Definition: hydrogen.cc:582
Expression * condition() const
Definition: hydrogen.h:695
void SetArgumentsObject(HArgumentsObject *object)
Definition: hydrogen.h:300
void Push(HValue *value)
Definition: hydrogen.h:863
void set_break_block(HBasicBlock *block)
Definition: hydrogen.h:805
void Finish(HControlInstruction *last)
Definition: hydrogen.cc:158
HInstruction * first() const
Definition: hydrogen.h:65
HEnvironment * CopyForInlining(Handle< JSFunction > target, int arguments, FunctionLiteral *function, HConstant *undefined, CallKind call_kind, bool is_construct) const
Definition: hydrogen.cc:8783
HValueMap(Zone *zone)
Definition: hydrogen.h:1201
Flag flags[]
Definition: flags.cc:1467
HGraph * graph() const
Definition: hydrogen.h:63
HEnvironment * arguments_environment()
Definition: hydrogen.h:420
HValue * Lookup(Variable *variable) const
Definition: hydrogen.h:460
void MarkAsLoopSuccessorDominator()
Definition: hydrogen.h:157
void Bind(Variable *variable, HValue *value)
Definition: hydrogen.h:450
virtual void ReturnValue(HValue *value)
Definition: hydrogen.cc:2616
HGraphBuilder * owner() const
Definition: hydrogen.h:625
void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses)
Definition: hydrogen.h:132
HBasicBlock * dominator() const
Definition: hydrogen.h:82
void SetExpressionStackAt(int index_from_top, HValue *value)
Definition: hydrogen.cc:8721
bool IsStackAllocated() const
Definition: variables.h:118
FrameType frame_type() const
Definition: hydrogen.h:430
bool CheckArgumentsPhiUses()
Definition: hydrogen.cc:928
Zone * zone() const
Definition: hydrogen.h:535
int PredecessorIndexOf(HBasicBlock *predecessor) const
Definition: hydrogen.cc:382
#define ASSERT(condition)
Definition: checks.h:270
bool is_recursive() const
Definition: hydrogen.h:343
void SaveTiming(const char *name, int64_t ticks, unsigned size)
Definition: hydrogen.cc:9121
void InsertRepresentationChanges()
Definition: hydrogen.cc:2417
HBasicBlock * current_block() const
Definition: hydrogen.h:850
HConstant * GetConstantTrue()
Definition: hydrogen.cc:592
virtual void ReturnInstruction(HInstruction *instr, int ast_id)
Definition: hydrogen.cc:2671
FunctionState * outer()
Definition: hydrogen.h:737
void AddSimulate(int ast_id)
Definition: hydrogen.h:128
HLoopInformation(HBasicBlock *loop_header, Zone *zone)
Definition: hydrogen.h:215
const ZoneList< HBasicBlock * > * predecessors() const
Definition: hydrogen.h:71
BreakAndContinueInfo(BreakableStatement *target, int drop_extra=0)
Definition: hydrogen.h:795
HEnvironment * Copy() const
Definition: hydrogen.cc:8743
HPredecessorIterator(HBasicBlock *block)
Definition: hydrogen.h:200
void RegisterBackEdge(HBasicBlock *block)
Definition: hydrogen.cc:407
HControlInstruction * end() const
Definition: hydrogen.h:69
static const char *const kFullCodeGen
Definition: hydrogen.h:1318
bool HasPredecessor() const
Definition: hydrogen.h:72
HValue * Top() const
Definition: hydrogen.h:493
HEnvironment * CopyAsLoopHeader(HBasicBlock *block) const
Definition: hydrogen.cc:8755
virtual void ReturnValue(HValue *value)
Definition: hydrogen.cc:2601
FunctionState * function_state() const
Definition: hydrogen.h:874
bool has_osr_loop_entry()
Definition: hydrogen.h:319
int GetMaximumValueID() const
Definition: hydrogen.h:304
int parameter_count() const
Definition: hydrogen.h:431
ZoneList< HUnknownOSRValue * > * osr_values()
Definition: hydrogen.h:331
virtual void ReturnInstruction(HInstruction *instr, int ast_id)
Definition: hydrogen.cc:2640
void set(T *value)
Definition: utils.h:471
virtual void ReturnControl(HControlInstruction *instr, int ast_id)
Definition: hydrogen.cc:2651
static HStatistics * Instance()
Definition: hydrogen.h:1288
TypeFeedbackOracle * oracle() const
Definition: hydrogen.h:872
void AssignCommonDominator(HBasicBlock *other)
Definition: hydrogen.cc:299
HEnvironment * environment() const
Definition: hydrogen.h:852
HEnvironment * last_environment() const
Definition: hydrogen.h:83
void DehoistSimpleArrayIndexComputations()
Definition: hydrogen.cc:3293
const ZoneList< HValue * > * values() const
Definition: hydrogen.h:426
int last_instruction_index() const
Definition: hydrogen.h:90
void TraceLithium(const char *name, LChunk *chunk)
Definition: hydrogen.cc:8876
AstContext(HGraphBuilder *owner, Expression::Context kind)
Definition: hydrogen.cc:2567
void Add(Vector< const char > format, Vector< FmtElm > elms)
HConstant * GetConstantFalse()
Definition: hydrogen.cc:597
void Initialize(CompilationInfo *info)
Definition: hydrogen.cc:9082
BreakAndContinueScope(BreakAndContinueInfo *info, HGraphBuilder *owner)
Definition: hydrogen.h:821
void RemovePhi(HPhi *phi)
Definition: hydrogen.cc:96
void VisitDeclarations(ZoneList< Declaration * > *declarations)
Definition: hydrogen.cc:7976
HEnvironment * outer() const
Definition: hydrogen.h:434
bool ExpressionStackIsEmpty() const
Definition: hydrogen.cc:8715
void set_stack_check(HStackCheck *stack_check)
Definition: hydrogen.h:231
void set_osr_loop_entry(HBasicBlock *entry)
Definition: hydrogen.h:327
Zone * zone() const
Definition: hydrogen.h:250
void set_arguments_elements(HArgumentsElements *arguments_elements)
Definition: hydrogen.h:743
HBasicBlock * GetLastBackEdge() const
Definition: hydrogen.cc:413
const ZoneList< HBasicBlock * > * dominated_blocks() const
Definition: hydrogen.h:73
EnumSet< GVNFlag > GVNFlagSet
int first_expression_index() const
Definition: hydrogen.h:446
HConstant * GetConstantUndefined() const
Definition: hydrogen.h:288
void AddIncomingEdge(HBasicBlock *block, HEnvironment *other)
Definition: hydrogen.cc:8671
HBasicBlock(HGraph *graph)
Definition: hydrogen.cc:55
void set_ast_id(int id)
Definition: hydrogen.h:439
HInstruction * operator[](int i) const
Definition: hydrogen.h:1270
NilValue
Definition: v8.h:141
virtual void ReturnControl(HControlInstruction *instr, int ast_id)=0
HInstruction * GetLastInstruction()
void PostProcessLoopHeader(IterationStatement *stmt)
Definition: hydrogen.cc:244
bool HasEnvironment() const
Definition: hydrogen.h:110
void set_current_block(HBasicBlock *block)
Definition: hydrogen.h:851
TypeFeedbackOracle * oracle()
Definition: hydrogen.h:726
void UpdateEnvironment(HEnvironment *env)
Definition: hydrogen.h:111
BreakAndContinueScope * break_scope() const
Definition: hydrogen.h:847
HInstruction * at(int i) const
Definition: hydrogen.h:1275
bool HasParentLoopHeader() const
Definition: hydrogen.h:119
HArgumentsElements * arguments_elements()
Definition: hydrogen.h:742
void EliminateUnreachablePhis()
Definition: hydrogen.cc:884
void set_undefined_constant(HConstant *constant)
Definition: hydrogen.h:285
static HTracer * Instance()
Definition: hydrogen.h:1359
HValue * ExpressionStackAt(int index_from_top) const
Definition: hydrogen.h:497
HEnvironment(HEnvironment *outer, Scope *scope, Handle< JSFunction > closure, Zone *zone)
Definition: hydrogen.cc:8589
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:321
static TestContext * cast(AstContext *context)
Definition: hydrogen.h:690
int pop_count() const
Definition: hydrogen.h:435
HGraphBuilder(CompilationInfo *info, TypeFeedbackOracle *oracle, Zone *zone)
Definition: hydrogen.cc:607
int index() const
Definition: variables.h:154
#define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize)
Definition: hydrogen.h:925
void PropagateDeoptimizingMark()
Definition: hydrogen.cc:837
HValue * Lookup(int index) const
Definition: hydrogen.h:464
int local_count() const
Definition: hydrogen.h:433
HBasicBlock * osr_loop_entry()
Definition: hydrogen.h:323
HConstant * GetConstantMinus1()
Definition: hydrogen.cc:587
Definition: v8.h:104
const ZoneList< HBasicBlock * > * back_edges() const
Definition: hydrogen.h:224
HInstruction * last() const
Definition: hydrogen.h:66
#define BASE_EMBEDDED
Definition: allocation.h:68
void MarkDeoptimizeOnUndefined()
Definition: hydrogen.cc:2473
void ComputeMinusZeroChecks()
Definition: hydrogen.cc:2495
ValueContext(HGraphBuilder *owner, ArgumentsAllowedFlag flag)
Definition: hydrogen.h:658
void RecordDeletedPhi(int merge_index)
Definition: hydrogen.h:79
BreakAndContinueScope * next()
Definition: hydrogen.h:830
AstContext * call_context()
Definition: hydrogen.h:727
#define AST_NODE_LIST(V)
Definition: ast.h:115
void Drop(int count)
Definition: hydrogen.cc:8736
void set_last(HInstruction *instr)
Definition: hydrogen.h:67
HBasicBlock * CreateBasicBlock()
Definition: hydrogen.cc:735
bool IsInlineReturnTarget() const
Definition: hydrogen.h:148
void BindContext(HValue *value)
Definition: hydrogen.h:456
int specials_count() const
Definition: hydrogen.h:432
void SetValueAt(int index, HValue *value)
Definition: hydrogen.h:527
int WriteChars(const char *filename, const char *str, int size, bool verbose)
Definition: v8utils.cc:222
HArgumentsObject * GetArgumentsObject() const
Definition: hydrogen.h:296
const ZoneList< HBasicBlock * > * blocks() const
Definition: hydrogen.h:252
static const char *const kTotal
Definition: hydrogen.h:1319
int first_instruction_index() const
Definition: hydrogen.h:86
void set_last_instruction_index(int index)
Definition: hydrogen.h:91
Handle< Code > Compile(CompilationInfo *info, Zone *zone)
Definition: hydrogen.cc:694
int LoopNestingDepth() const
Definition: hydrogen.cc:233
const ZoneList< HPhi * > * phi_list() const
Definition: hydrogen.h:253
void set_argument_count(int count)
Definition: hydrogen.h:85
HBasicBlock * parent_loop_header() const
Definition: hydrogen.h:112
bool IsLoopSuccessorDominator() const
Definition: hydrogen.h:154
void InitializeInferredTypes()
Definition: hydrogen.cc:2280
HEnvironment * DiscardInlined(bool drop_extra)
Definition: hydrogen.h:413
HEnterInlined * entry()
Definition: hydrogen.h:739
bool IsParameter() const
Definition: variables.h:116
void FinishExit(HControlInstruction *instruction)
Definition: hydrogen.cc:671
bool is_special_index(int i) const
Definition: hydrogen.h:442
HPhase(const char *name)
Definition: hydrogen.h:1321
bool IsEmpty() const
Definition: hydrogen.h:1226
void Add(HValue *value, Zone *zone)
Definition: hydrogen.h:1215
HBasicBlock * CreateJoin(HBasicBlock *first, HBasicBlock *second, int join_id)
Definition: hydrogen.cc:626
void Goto(HBasicBlock *block, FunctionState *state=NULL)
Definition: hydrogen.cc:168
void EliminateRedundantPhis()
Definition: hydrogen.cc:850
HLoopInformation * loop_information() const
Definition: hydrogen.h:70
bool IsStartBlock() const
Definition: hydrogen.h:98
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset flag
Definition: objects-inl.h:3682
TestContext(HGraphBuilder *owner, Expression *condition, HBasicBlock *if_true, HBasicBlock *if_false)
Definition: hydrogen.h:676
bool IsLoopHeader() const
Definition: hydrogen.h:97
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
virtual void ReturnValue(HValue *value)
Definition: hydrogen.cc:2606
void PrintTo(StringStream *stream)
Definition: hydrogen.cc:8838
void set_continue_block(HBasicBlock *block)
Definition: hydrogen.h:807
void set_parent_loop_header(HBasicBlock *block)
Definition: hydrogen.h:114
HConstant * GetConstantHole()
Definition: hydrogen.cc:602
void AddPhi(HPhi *phi)
Definition: hydrogen.cc:89
CompilationInfo * compilation_info()
Definition: hydrogen.h:725
Zone * zone() const
Definition: hydrogen.h:1196
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:38
HGraph(CompilationInfo *info, Zone *zone)
Definition: hydrogen.cc:677
bool CheckConstPhiUses()
Definition: hydrogen.cc:941
HBasicBlock * if_false() const
Definition: hydrogen.h:697
int GetNextValueID(HValue *value)
Definition: hydrogen.h:306
void EliminateRedundantBoundsChecks()
Definition: hydrogen.cc:3238
void TraceHydrogen(const char *name, HGraph *graph)
Definition: hydrogen.cc:8881
void Bailout(const char *reason)
Definition: hydrogen.cc:2736
const char * name_
Definition: flags.cc:1352
const ZoneList< HPhi * > * phis() const
Definition: hydrogen.h:64
void TraceCompilation(FunctionLiteral *function)
Definition: hydrogen.cc:8867
void AssignLoopSuccessorDominators()
Definition: hydrogen.cc:326
TestContext * test_context()
Definition: hydrogen.h:731
int block_id() const
Definition: hydrogen.h:61
bool IsValue() const
Definition: hydrogen.h:598
void Push(HValue *value)
Definition: hydrogen.h:475
virtual void ReturnInstruction(HInstruction *instr, int ast_id)=0
virtual void ReturnControl(HControlInstruction *instr, int ast_id)
Definition: hydrogen.cc:2686
Handle< JSFunction > closure() const
Definition: hydrogen.h:425
int argument_count() const
Definition: hydrogen.h:84
#define INLINE_RUNTIME_FUNCTION_LIST(F)
Definition: runtime.h:531
void SetJoinId(int ast_id)
Definition: hydrogen.cc:207
Zone * zone() const
Definition: hydrogen.h:399
void set_first_instruction_index(int index)
Definition: hydrogen.h:87
void Add(E element)
Definition: utils.h:963
void check(i::Vector< const char > string)
virtual void ReturnValue(HValue *value)=0
virtual void ReturnInstruction(HInstruction *instr, int ast_id)
Definition: hydrogen.cc:2621
void TraceLiveRanges(const char *name, LAllocator *allocator)
Definition: hydrogen.cc:8998
HEnvironment * start_environment() const
Definition: hydrogen.h:255
void set_osr_values(ZoneList< HUnknownOSRValue * > *values)
Definition: hydrogen.h:335
HBasicBlock * entry_block() const
Definition: hydrogen.h:254
HValue * Lookup(HValue *value) const
Definition: hydrogen.cc:1252
FlagType type() const
Definition: flags.cc:1358
void AddInstruction(HInstruction *instr)
Definition: hydrogen.cc:106
HGraph * graph() const
Definition: hydrogen.h:846
HInstruction * AddInstruction(HInstruction *instr)
Definition: hydrogen.cc:3333
HBasicBlock * function_return()
Definition: hydrogen.h:730
const ZoneList< HBasicBlock * > * blocks() const
Definition: hydrogen.h:225
HPhase(const char *name, LChunk *chunk)
Definition: hydrogen.h:1325
friend class FunctionState
Definition: hydrogen.h:1189
HEnvironment * CopyWithoutHistory() const
Definition: hydrogen.cc:8748
void AddSimulate(int ast_id)
Definition: hydrogen.cc:3340
bool is_set() const
Definition: utils.h:464