28 #ifndef V8_HYDROGEN_H_
29 #define V8_HYDROGEN_H_
49 class HLoopInformation;
57 class HBasicBlock
V8_FINAL :
public ZoneObject {
59 explicit HBasicBlock(HGraph* graph);
65 HGraph*
graph()
const {
return graph_; }
74 return IsLoopHeader() ? loop_information()
75 : (parent_loop_header() !=
NULL
76 ? parent_loop_header()->loop_information() :
NULL);
81 return &dominated_blocks_;
84 return &deleted_phis_;
87 deleted_phis_.Add(merge_index, zone());
89 HBasicBlock*
dominator()
const {
return dominator_; }
95 first_instruction_index_ = index;
99 last_instruction_index_ = index;
104 void AttachLoopInformation();
105 void DetachLoopInformation();
111 void AddPhi(HPhi* phi);
112 void RemovePhi(HPhi* phi);
114 bool Dominates(HBasicBlock* other)
const;
115 bool EqualToOrDominates(HBasicBlock* other)
const;
116 int LoopNestingDepth()
const;
118 void SetInitialEnvironment(HEnvironment* env);
121 ASSERT(end()->SuccessorCount() == 0);
122 last_environment_ =
NULL;
125 void UpdateEnvironment(HEnvironment* env);
130 parent_loop_header_ = block;
137 int PredecessorIndexOf(HBasicBlock* predecessor)
const;
138 HPhi* AddNewPhi(
int merged_index);
142 HSimulate* instr = CreateSimulate(ast_id, removable);
143 AddInstruction(instr, position);
146 void AssignCommonDominator(HBasicBlock* other);
147 void AssignLoopSuccessorDominators();
157 is_inline_return_target_ =
true;
158 inlined_entry_block_ = inlined_entry_block;
163 return end() !=
NULL && end()->IsDeoptimize();
166 void MarkUnreachable();
171 return dominates_loop_successors_;
174 dominates_loop_successors_ =
true;
177 void MarkSuccEdgeUnreachable(
int succ);
179 inline Zone* zone()
const;
191 void Goto(HBasicBlock* block,
193 FunctionState* state =
NULL,
194 bool add_simulate =
true);
196 Goto(block, position,
NULL,
false);
201 void AddLeaveInlined(
HValue* return_value,
202 FunctionState* state,
206 void RegisterPredecessor(HBasicBlock* pred);
207 void AddDominatedBlock(HBasicBlock* block);
215 HLoopInformation* loop_information_;
217 HBasicBlock* dominator_;
219 HEnvironment* last_environment_;
223 int first_instruction_index_;
224 int last_instruction_index_;
226 HBasicBlock* parent_loop_header_;
228 HBasicBlock* inlined_entry_block_;
229 bool is_inline_return_target_ : 1;
230 bool is_reachable_ : 1;
231 bool dominates_loop_successors_ : 1;
232 bool is_osr_entry_ : 1;
239 : predecessor_list_(block->predecessors()),
current_(0) { }
254 : instr_(block->first()) {
255 next_ = Done() ?
NULL : instr_->next();
258 inline bool Done()
const {
return instr_ ==
NULL; }
262 next_ = Done() ?
NULL : instr_->next();
271 class HLoopInformation
V8_FINAL :
public ZoneObject {
274 : back_edges_(4, zone),
275 loop_header_(loop_header),
278 blocks_.Add(loop_header, zone);
285 HBasicBlock* GetLastBackEdge()
const;
286 void RegisterBackEdge(HBasicBlock* block);
290 stack_check_ = stack_check;
294 while (other !=
NULL) {
298 other = other->parent_loop();
303 HBasicBlock* parent_header = loop_header()->parent_loop_header();
304 return parent_header !=
NULL ? parent_header->loop_information() :
NULL;
308 void AddBlock(HBasicBlock* block);
311 HBasicBlock* loop_header_;
313 HStackCheck* stack_check_;
317 class BoundsCheckTable;
318 class InductionVariableBlocksTable;
319 class HGraph
V8_FINAL :
public ZoneObject {
321 explicit HGraph(CompilationInfo*
info);
332 void FinalizeUniqueness();
333 bool ProcessArgumentsObject();
335 void AssignDominators();
336 void RestoreActualValues();
340 bool CheckArgumentsPhiUses();
344 bool CheckConstPhiUses();
348 HConstant* GetConstantUndefined();
349 HConstant* GetConstant0();
350 HConstant* GetConstant1();
351 HConstant* GetConstantMinus1();
352 HConstant* GetConstantTrue();
353 HConstant* GetConstantFalse();
354 HConstant* GetConstantHole();
355 HConstant* GetConstantNull();
356 HConstant* GetInvalidContext();
358 bool IsConstantUndefined(HConstant* constant);
359 bool IsConstant0(HConstant* constant);
360 bool IsConstant1(HConstant* constant);
361 bool IsConstantMinus1(HConstant* constant);
362 bool IsConstantTrue(HConstant* constant);
363 bool IsConstantFalse(HConstant* constant);
364 bool IsConstantHole(HConstant* constant);
365 bool IsConstantNull(HConstant* constant);
366 bool IsStandardConstant(HConstant* constant);
368 HBasicBlock* CreateBasicBlock();
370 return arguments_object_.get();
374 arguments_object_.set(
object);
380 ASSERT(!disallow_adding_new_values_);
381 values_.Add(value, zone());
382 return values_.length() - 1;
385 if (
id >= 0 &&
id < values_.length())
return values_[
id];
389 disallow_adding_new_values_ =
true;
395 void Verify(
bool do_full_verify)
const;
411 type_change_checksum_ += delta;
412 return type_change_checksum_;
416 if (environment_size > maximum_environment_size_) {
417 maximum_environment_size_ = environment_size;
423 return use_optimistic_licm_;
427 use_optimistic_licm_ = value;
431 is_recursive_ =
true;
435 return is_recursive_;
440 if (depends_on_empty_array_proto_elements_)
return;
441 isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo(
443 isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo(
445 depends_on_empty_array_proto_elements_ =
true;
449 return depends_on_empty_array_proto_elements_;
453 ASSERT(uint32_instructions_ ==
NULL || !uint32_instructions_->is_empty());
454 return uint32_instructions_ !=
NULL;
458 ASSERT(uint32_instructions_ ==
NULL || !uint32_instructions_->is_empty());
459 return uint32_instructions_;
463 ASSERT(uint32_instructions_ ==
NULL || !uint32_instructions_->is_empty());
464 if (uint32_instructions_ ==
NULL) {
467 uint32_instructions_->
Add(instr, zone());
485 HConstant* ReinsertConstantIfNecessary(HConstant* constant);
489 template<
class Phase>
495 void EliminateRedundantBoundsChecksUsingInductionVariables();
499 HBasicBlock* entry_block_;
500 HEnvironment* start_environment_;
501 ZoneList<HBasicBlock*> blocks_;
502 ZoneList<HValue*> values_;
503 ZoneList<HPhi*>* phi_list_;
504 ZoneList<HInstruction*>* uint32_instructions_;
505 SetOncePointer<HConstant> constant_undefined_;
506 SetOncePointer<HConstant> constant_0_;
507 SetOncePointer<HConstant> constant_1_;
508 SetOncePointer<HConstant> constant_minus1_;
509 SetOncePointer<HConstant> constant_true_;
510 SetOncePointer<HConstant> constant_false_;
511 SetOncePointer<HConstant> constant_the_hole_;
512 SetOncePointer<HConstant> constant_null_;
513 SetOncePointer<HConstant> constant_invalid_context_;
514 SetOncePointer<HArgumentsObject> arguments_object_;
518 CompilationInfo* info_;
522 bool use_optimistic_licm_;
523 bool depends_on_empty_array_proto_elements_;
524 int type_change_checksum_;
525 int maximum_environment_size_;
526 int no_side_effects_scope_count_;
527 bool disallow_adding_new_values_;
529 class InlinedFunctionInfo {
532 : shared_(shared), start_position_(shared->start_position()) {
535 Handle<SharedFunctionInfo> shared()
const {
return shared_; }
536 int start_position()
const {
return start_position_; }
539 Handle<SharedFunctionInfo> shared_;
544 ZoneList<InlinedFunctionInfo> inlined_functions_;
550 Zone* HBasicBlock::zone()
const {
return graph_->zone(); }
564 class HEnvironment
V8_FINAL :
public ZoneObject {
566 HEnvironment(HEnvironment* outer,
571 HEnvironment(Zone* zone,
int parameter_count);
581 return &assigned_variables_;
587 HEnvironment*
outer()
const {
return outer_; }
594 HEnterInlined*
entry()
const {
return entry_; }
595 void set_entry(HEnterInlined* entry) { entry_ = entry; }
597 int length()
const {
return values_.length(); }
600 return parameter_count() + specials_count() + local_count();
604 return parameter_count() + specials_count();
608 Bind(IndexFor(variable), value);
611 void Bind(
int index,
HValue* value);
614 Bind(parameter_count(), value);
618 return Lookup(IndexFor(variable));
622 HValue* result = values_[index];
629 return Lookup(parameter_count());
635 values_.Add(value, zone());
639 ASSERT(!ExpressionStackIsEmpty());
640 if (push_count_ > 0) {
645 return values_.RemoveLast();
648 void Drop(
int count);
652 bool ExpressionStackIsEmpty()
const;
655 int index = length() - index_from_top - 1;
656 ASSERT(HasExpressionAt(index));
657 return values_[index];
660 void SetExpressionStackAt(
int index_from_top,
HValue* value);
662 HEnvironment* Copy()
const;
663 HEnvironment* CopyWithoutHistory()
const;
664 HEnvironment* CopyAsLoopHeader(HBasicBlock* block)
const;
671 FunctionLiteral*
function,
672 HConstant* undefined,
676 HEnvironment* outer = outer_;
677 while (outer->frame_type() !=
JS_FUNCTION) outer = outer->outer_;
678 if (drop_extra) outer->Drop(1);
682 void AddIncomingEdge(HBasicBlock* block, HEnvironment* other);
687 assigned_variables_.Clear();
692 values_[index] = value;
702 : parameter_count_ + specials_count_;
707 return i >= first_local_index() && i < first_expression_index();
711 return i >= 0 && i < parameter_count();
715 return i >= parameter_count() && i < parameter_count() + specials_count();
724 HEnvironment(
const HEnvironment* other,
Zone* zone);
726 HEnvironment(HEnvironment* outer,
734 HEnvironment* CreateStubEnvironment(HEnvironment* outer,
737 int arguments)
const;
740 bool HasExpressionAt(
int index)
const;
742 void Initialize(
int parameter_count,
int local_count,
int stack_height);
743 void Initialize(
const HEnvironment* other);
748 GrowableBitVector assigned_variables_;
750 int parameter_count_;
753 HEnvironment* outer_;
754 HEnterInlined* entry_;
762 class HOptimizedGraphBuilder;
770 class HIfContinuation;
818 int original_length_;
829 class EffectContext
V8_FINAL :
public AstContext {
834 virtual ~EffectContext();
841 virtual void ReturnContinuation(HIfContinuation* continuation,
846 class ValueContext
V8_FINAL :
public AstContext {
851 virtual ~ValueContext();
858 virtual void ReturnContinuation(HIfContinuation* continuation,
868 class TestContext
V8_FINAL :
public AstContext {
872 HBasicBlock* if_true,
873 HBasicBlock* if_false)
875 condition_(condition),
877 if_false_(if_false) {
885 virtual void ReturnContinuation(HIfContinuation* continuation,
890 return reinterpret_cast<TestContext*
>(context);
894 HBasicBlock*
if_true()
const {
return if_true_; }
895 HBasicBlock*
if_false()
const {
return if_false_; }
900 void BuildBranch(
HValue* value);
903 HBasicBlock* if_true_;
904 HBasicBlock* if_false_;
910 FunctionState(HOptimizedGraphBuilder* owner,
911 CompilationInfo*
info,
922 delete test_context_;
923 test_context_ =
NULL;
926 FunctionState*
outer() {
return outer_; }
928 HEnterInlined*
entry() {
return entry_; }
929 void set_entry(HEnterInlined* entry) { entry_ = entry; }
933 arguments_object_ = arguments_object;
938 arguments_elements_ = arguments_elements;
961 HBasicBlock* function_return_;
965 TestContext* test_context_;
969 HEnterInlined* entry_;
971 HArgumentsObject* arguments_object_;
972 HArgumentsElements* arguments_elements_;
977 FunctionState* outer_;
984 : continuation_captured_(
false),
986 false_branch_(
NULL) {}
988 HBasicBlock* false_branch)
989 : continuation_captured_(
true), true_branch_(true_branch),
990 false_branch_(false_branch) {}
994 HBasicBlock* false_branch) {
995 ASSERT(!continuation_captured_);
996 true_branch_ = true_branch;
997 false_branch_ = false_branch;
998 continuation_captured_ =
true;
1002 HBasicBlock** false_branch) {
1003 ASSERT(continuation_captured_);
1004 *true_branch = true_branch_;
1005 *false_branch = false_branch_;
1006 continuation_captured_ =
false;
1012 return IsTrueReachable() || IsFalseReachable();
1019 bool continuation_captured_;
1020 HBasicBlock* true_branch_;
1021 HBasicBlock* false_branch_;
1028 : current_site_(
NULL), feedback_site_(feedback_site),
1031 : current_site_(current_site), pretenure_flag_(
NOT_TENURED) {}
1033 : current_site_(
NULL), pretenure_flag_(pretenure_flag) {}
1041 return current_site() !=
NULL;
1045 if (!feedback_site().is_null())
return feedback_site()->GetPretenureMode();
1046 return pretenure_flag_;
1061 current_block_(
NULL),
1063 start_position_(0) {}
1072 HGraph*
graph()
const {
return graph_; }
1090 HBasicBlock* target,
1091 FunctionState* state =
NULL,
1092 bool add_simulate =
true) {
1096 FunctionState* state =
NULL,
1097 bool add_simulate =
true) {
1108 FunctionState* state) {
1125 I*
Add() {
return AddInstructionTyped(New<I>());}
1127 template<
class I,
class P1>
1132 template<
class I,
class P1>
1135 template<
class I,
class P1>
1140 ASSERT(!result->IsReturn() && !result->IsSimulate() &&
1141 !result->IsDeoptimize());
1145 template<
class I,
class P1>
1147 I* result = AddInstructionTyped(New<I>(p1));
1150 ASSERT(!result->IsReturn() && !result->IsSimulate() &&
1151 !result->IsDeoptimize());
1155 template<
class I,
class P1,
class P2>
1160 template<
class I,
class P1,
class P2>
1165 template<
class I,
class P1,
class P2>
1170 ASSERT(!result->IsSimulate());
1174 template<
class I,
class P1,
class P2>
1176 I* result = AddInstructionTyped(New<I>(p1, p2));
1179 ASSERT(!result->IsSimulate());
1183 template<
class I,
class P1,
class P2,
class P3>
1188 template<
class I,
class P1,
class P2,
class P3>
1193 template<
class I,
class P1,
class P2,
class P3>
1198 template<
class I,
class P1,
class P2,
class P3>
1200 return AddInstructionTyped(New<I>(p1, p2, p3));
1203 template<
class I,
class P1,
class P2,
class P3,
class P4>
1208 template<
class I,
class P1,
class P2,
class P3,
class P4>
1213 template<
class I,
class P1,
class P2,
class P3,
class P4>
1218 template<
class I,
class P1,
class P2,
class P3,
class P4>
1220 return AddInstructionTyped(New<I>(p1, p2, p3, p4));
1223 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5>
1225 return I::New(
zone(),
context(), p1, p2, p3, p4, p5);
1228 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5>
1230 return I::New(
zone(),
context(), p1, p2, p3, p4, p5);
1233 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5>
1238 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5>
1240 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5));
1243 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5,
class P6>
1245 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6);
1248 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5,
class P6>
1250 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6);
1253 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5,
class P6>
1258 template<
class I,
class P1,
class P2,
class P3,
class P4,
class P5,
class P6>
1260 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6));
1263 template<
class I,
class P1,
class P2,
class P3,
class P4,
1264 class P5,
class P6,
class P7>
1266 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6, p7);
1269 template<
class I,
class P1,
class P2,
class P3,
class P4,
1270 class P5,
class P6,
class P7>
1272 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6, p7);
1275 template<
class I,
class P1,
class P2,
class P3,
1276 class P4,
class P5,
class P6,
class P7>
1278 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7));
1281 template<
class I,
class P1,
class P2,
class P3,
1282 class P4,
class P5,
class P6,
class P7>
1284 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7));
1287 template<
class I,
class P1,
class P2,
class P3,
class P4,
1288 class P5,
class P6,
class P7,
class P8>
1291 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6, p7, p8);
1294 template<
class I,
class P1,
class P2,
class P3,
class P4,
1295 class P5,
class P6,
class P7,
class P8>
1297 return I::New(
zone(),
context(), p1, p2, p3, p4, p5, p6, p7, p8);
1300 template<
class I,
class P1,
class P2,
class P3,
class P4,
1301 class P5,
class P6,
class P7,
class P8>
1304 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1307 template<
class I,
class P1,
class P2,
class P3,
class P4,
1308 class P5,
class P6,
class P7,
class P8>
1310 return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1359 HAllocationMode allocation_mode);
1366 HAllocationMode allocation_mode);
1382 HAllocationMode allocation_mode);
1386 HAllocationMode allocation_mode);
1410 HStoreNamedField* store_map = Add<HStoreNamedField>(
1411 object, HObjectAccess::ForMap(),
map);
1412 store_map->SkipWriteBarrier();
1419 store_map->SkipWriteBarrier();
1436 HAllocationMode allocation_mode);
1453 HIfContinuation* continuation);
1456 if (!finished_) End();
1459 template<
class Condition>
1462 AddCompare(compare);
1466 template<
class Condition,
class P2>
1469 AddCompare(compare);
1473 template<
class Condition,
class P2,
class P3>
1476 AddCompare(compare);
1480 template<
class Condition>
1487 template<
class Condition,
class P2>
1494 template<
class Condition,
class P2,
class P3>
1501 template<
class Condition>
1504 return If<Condition>(p);
1507 template<
class Condition,
class P2>
1510 return If<Condition>(
p1,
p2);
1513 template<
class Condition,
class P2,
class P3>
1516 return If<Condition>(
p1,
p2,
p3);
1519 template<
class Condition>
1522 return If<Condition>(p);
1525 template<
class Condition,
class P2>
1528 return If<Condition>(
p1,
p2);
1531 template<
class Condition,
class P2,
class P3>
1534 return If<Condition>(
p1,
p2,
p3);
1542 void CaptureContinuation(HIfContinuation* continuation);
1582 void JoinContinuation(HIfContinuation* continuation);
1588 void Deopt(
const char* reason);
1598 void Return(
HValue* value);
1605 void AddMergeAtJoinBlock(
bool deopt);
1608 void Finish(HBasicBlock** then_continuation,
1609 HBasicBlock** else_continuation);
1613 MergeAtJoinBlock(HBasicBlock* block,
1615 MergeAtJoinBlock* next)
1619 HBasicBlock* block_;
1621 MergeAtJoinBlock* next_;
1624 HGraphBuilder* builder_;
1628 bool did_else_if_ : 1;
1632 bool needs_compare_ : 1;
1633 bool pending_merge_block_ : 1;
1634 HBasicBlock* first_true_block_;
1635 HBasicBlock* first_false_block_;
1636 HBasicBlock* split_edge_merge_block_;
1637 MergeAtJoinBlock* merge_at_join_blocks_;
1638 int normal_merge_at_join_block_count_;
1639 int deopt_merge_at_join_block_count_;
1653 Direction direction);
1656 Direction direction,
1657 HValue* increment_amount);
1673 Zone*
zone() {
return builder_->zone(); }
1677 HValue* increment_amount_;
1680 HBasicBlock* header_block_;
1681 HBasicBlock* body_block_;
1682 HBasicBlock* exit_block_;
1683 HBasicBlock* exit_trampoline_block_;
1684 Direction direction_;
1695 JSArrayBuilder(HGraphBuilder* builder,
1697 HValue* allocation_site_payload,
1698 HValue* constructor_function,
1701 JSArrayBuilder(HGraphBuilder* builder,
1703 HValue* constructor_function =
NULL);
1712 HValue* AllocateEmptyArray();
1714 FillMode fill_mode = FILL_WITH_HOLE);
1719 Zone*
zone()
const {
return builder_->zone(); }
1720 int elements_size()
const {
1723 HGraphBuilder* builder() {
return builder_; }
1724 HGraph*
graph() {
return builder_->graph(); }
1725 int initial_capacity() {
1730 HValue* EmitInternalMapCode();
1731 HValue* EstablishEmptyArrayAllocationSize();
1732 HValue* EstablishAllocationSize(HValue* length_node);
1733 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity,
1734 HValue* length_field,
1735 FillMode fill_mode = FILL_WITH_HOLE);
1737 HGraphBuilder* builder_;
1740 HValue* allocation_site_payload_;
1741 HValue* constructor_function_;
1742 HInnerAllocatedObject* elements_location_;
1746 HValue* length_argument);
1766 HValue* allocation_site_payload,
1767 HValue* length_field);
1774 HValue* new_capacity);
1783 HValue* to_elements,
1789 HValue* allocation_site,
1799 HIfContinuation* continuation);
1802 HValue* previous_object_size,
1806 CompilationInfo*
info);
1808 Handle<JSObject> holder);
1816 ASSERT(position != RelocInfo::kNoPosition);
1821 if (FLAG_hydrogen_track_positions) {
1822 start_position_ = start_position;
1838 position_ = position;
1841 template <
typename ViewClass>
1850 HValue* BuildUncheckedDictionaryElementLoadHelper(
1858 I* AddInstructionTyped(
I* instr) {
1862 CompilationInfo* info_;
1864 HBasicBlock* current_block_;
1865 HSourcePosition position_;
1866 int start_position_;
1871 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
1874 isolate()->counters()->soft_deopts_requested()->Increment();
1875 if (FLAG_always_opt)
return NULL;
1877 if (current_block()->IsDeoptimizing())
return NULL;
1878 HBasicBlock* after_deopt_block = CreateBasicBlock(
1879 current_block()->last_environment());
1880 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block);
1882 isolate()->counters()->soft_deopts_inserted()->Increment();
1884 FinishCurrentBlock(instr);
1885 set_current_block(after_deopt_block);
1893 return Add<HDeoptimize>(reason, type);
1898 inline HSimulate* HGraphBuilder::Add<HSimulate>(
1901 HSimulate* instr = current_block()->CreateSimulate(
id, removable);
1902 AddInstruction(instr);
1908 inline HSimulate* HGraphBuilder::Add<HSimulate>(
1921 inline HReturn* HGraphBuilder::Add<HReturn>(
HValue* value) {
1922 int num_parameters = graph()->info()->num_parameters();
1923 HValue* params = AddUncasted<HConstant>(num_parameters);
1924 HReturn* return_instruction = New<HReturn>(value, params);
1925 FinishExitCurrentBlock(return_instruction);
1926 return return_instruction;
1931 inline HReturn* HGraphBuilder::Add<HReturn>(HConstant* value) {
1932 return Add<HReturn>(
static_cast<HValue*
>(value));
1937 return Add<HReturn>(value);
1942 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) {
1943 return Add<HReturn>(value);
1948 inline HCallRuntime* HGraphBuilder::Add<HCallRuntime>(
1951 int argument_count) {
1952 HCallRuntime* instr = New<HCallRuntime>(
name, c_function, argument_count);
1953 if (graph()->info()->IsStub()) {
1959 AddInstruction(instr);
1968 int argument_count) {
1969 return Add<HCallRuntime>(
name, c_function, argument_count);
1974 inline HContext* HGraphBuilder::New<HContext>() {
1975 return HContext::New(zone());
1981 return New<HContext>();
1995 continue_block_(
NULL),
1996 drop_extra_(drop_extra) {
2008 HBasicBlock* break_block_;
2009 HBasicBlock* continue_block_;
2019 : info_(info), owner_(owner), next_(owner->
break_scope()) {
2025 BreakAndContinueInfo*
info() {
return info_; }
2027 BreakAndContinueScope*
next() {
return next_; }
2034 BreakAndContinueInfo* info_;
2036 BreakAndContinueScope* next_;
2056 HBasicBlock* second,
2067 void operator delete(
void* pointer) { }
2074 (CallRuntime* call);
2077 class SubgraphScope;
2123 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \
2124 void Generate##Name(CallRuntime* call);
2128 #undef INLINE_FUNCTION_GENERATOR_DECLARATION
2133 void VisitNot(UnaryOperation* expr);
2141 HBasicBlock* loop_entry,
2142 BreakAndContinueInfo* break_info);
2151 HBasicBlock*
CreateLoop(IterationStatement* statement,
2152 HBasicBlock* loop_entry,
2153 HBasicBlock* body_exit,
2154 HBasicBlock* loop_successor,
2155 HBasicBlock* break_block);
2163 HBasicBlock*
JoinContinue(IterationStatement* statement,
2164 HBasicBlock* exit_block,
2165 HBasicBlock* continue_block);
2173 HEnvironment* env) {
2174 if (!FLAG_analyze_environment_liveness)
return false;
2179 !value->IsArgumentsObject() &&
2180 env->is_local_index(index);
2184 int index = env->IndexFor(var);
2185 env->Bind(index, value);
2187 HEnvironmentMarker* bind =
2188 Add<HEnvironmentMarker>(HEnvironmentMarker::BIND, index);
2191 bind->set_closure(env->closure());
2198 int index = env->IndexFor(var);
2199 HValue* value = env->Lookup(index);
2201 HEnvironmentMarker* lookup =
2202 Add<HEnvironmentMarker>(HEnvironmentMarker::LOOKUP, index);
2205 lookup->set_closure(env->closure());
2219 HBasicBlock* true_block,
2220 HBasicBlock* false_block);
2233 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) V8_OVERRIDE;
2235 #undef DECLARE_VISIT
2241 enum GlobalPropertyAccess {
2245 GlobalPropertyAccess LookupGlobalProperty(Variable* var,
2246 LookupResult* lookup,
2249 void EnsureArgumentsArePushedForAccess();
2250 bool TryArgumentsAccess(Property* expr);
2253 bool TryCallApply(Call* expr);
2255 HValue* ImplicitReceiverFor(HValue*
function,
2260 int arguments_count,
2261 HValue* implicit_return_value,
2263 BailoutId return_id,
2265 HSourcePosition position);
2267 bool TryInlineCall(Call* expr);
2268 bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value);
2272 BailoutId return_id);
2276 BailoutId assignment_id,
2277 HValue* implicit_return_value);
2280 int arguments_count);
2281 bool TryInlineBuiltinMethodCall(Call* expr,
2284 bool TryInlineBuiltinFunctionCall(Call* expr);
2291 bool TryInlineApiMethodCall(Call* expr,
2293 SmallMapList* receiver_types);
2294 bool TryInlineApiFunctionCall(Call* expr, HValue* receiver);
2295 bool TryInlineApiGetter(Handle<JSFunction>
function,
2296 Handle<Map> receiver_map,
2298 bool TryInlineApiSetter(Handle<JSFunction>
function,
2299 Handle<Map> receiver_map,
2301 bool TryInlineApiCall(Handle<JSFunction>
function,
2303 SmallMapList* receiver_maps,
2306 ApiCallType call_type);
2311 void TraceInline(Handle<JSFunction> target,
2312 Handle<JSFunction> caller,
2313 const char* failure_reason);
2315 void HandleGlobalVariableAssignment(Variable* var,
2319 void HandlePropertyAssignment(Assignment* expr);
2320 void HandleCompoundAssignment(Assignment* expr);
2323 BailoutId return_id,
2326 SmallMapList* types,
2327 Handle<String>
name);
2329 HValue* BuildAllocateExternalElements(
2331 bool is_zero_byte_offset,
2332 HValue* buffer, HValue* byte_offset, HValue* length);
2333 HValue* BuildAllocateFixedTypedArray(
2336 HValue* byte_length, HValue* length);
2338 bool IsCallNewArrayInlineable(CallNew* expr);
2339 void BuildInlinedCallNewArray(CallNew* expr);
2341 class PropertyAccessInfo {
2346 Handle<String>
name)
2347 : lookup_(builder->
isolate()),
2349 access_type_(access_type),
2352 access_(HObjectAccess::ForMap()) { }
2357 bool CanAccessMonomorphic();
2365 bool CanAccessAsMonomorphic(SmallMapList* types);
2368 if (type_->Is(Type::Number())) {
2370 context = context->native_context();
2371 return handle(context->number_function()->initial_map());
2372 }
else if (type_->Is(Type::Boolean())) {
2374 context = context->native_context();
2375 return handle(context->boolean_function()->initial_map());
2376 }
else if (type_->Is(Type::String())) {
2378 context = context->native_context();
2379 return handle(context->string_function()->initial_map());
2381 return type_->AsClass();
2384 Type* type()
const {
return type_; }
2385 Handle<String>
name()
const {
return name_; }
2387 bool IsJSObjectFieldAccessor() {
2389 return Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset);
2392 bool GetJSObjectFieldAccess(HObjectAccess* access) {
2394 if (Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset)) {
2395 if (type_->Is(Type::String())) {
2397 *access = HObjectAccess::ForStringLength();
2398 }
else if (type_->Is(Type::Array())) {
2400 *access = HObjectAccess::ForArrayLength(
map()->elements_kind());
2402 *access = HObjectAccess::ForMapAndOffset(
map(), offset);
2409 bool has_holder() {
return !holder_.is_null(); }
2410 bool IsLoad()
const {
return access_type_ ==
LOAD; }
2412 LookupResult* lookup() {
return &lookup_; }
2413 Handle<JSObject> holder() {
return holder_; }
2414 Handle<JSFunction> accessor() {
return accessor_; }
2415 Handle<Object> constant() {
return constant_; }
2416 Handle<Map> transition() {
return handle(lookup_.GetTransitionTarget()); }
2417 HObjectAccess access() {
return access_; }
2420 Type*
ToType(Handle<Map>
map) {
return builder_->ToType(map); }
2421 Isolate*
isolate() {
return lookup_.isolate(); }
2422 CompilationInfo*
current_info() {
return builder_->current_info(); }
2424 bool LoadResult(Handle<Map> map);
2425 bool LookupDescriptor();
2426 bool LookupInPrototypes();
2427 bool IsCompatible(PropertyAccessInfo* other);
2429 void GeneralizeRepresentation(Representation r) {
2430 access_ = access_.WithRepresentation(
2431 access_.representation().generalize(r));
2434 LookupResult lookup_;
2438 Handle<String> name_;
2439 Handle<JSObject> holder_;
2440 Handle<JSFunction> accessor_;
2441 Handle<JSObject> api_holder_;
2442 Handle<Object> constant_;
2443 HObjectAccess access_;
2446 HInstruction* BuildMonomorphicAccess(PropertyAccessInfo*
info,
2448 HValue* checked_object,
2451 BailoutId return_id,
2452 bool can_inline_accessor =
true);
2456 BailoutId reutrn_id,
2459 Handle<String>
name,
2461 bool is_uninitialized =
false);
2463 void HandlePolymorphicCallNamed(Call* expr,
2465 SmallMapList* types,
2466 Handle<String>
name);
2467 void HandleLiteralCompareTypeof(CompareOperation* expr,
2468 Expression* sub_expr,
2469 Handle<String>
check);
2470 void HandleLiteralCompareNil(CompareOperation* expr,
2471 Expression* sub_expr,
2474 enum PushBeforeSimulateBehavior {
2475 PUSH_BEFORE_SIMULATE,
2476 NO_PUSH_BEFORE_SIMULATE
2479 HControlInstruction* BuildCompareInstruction(
2485 Type* combined_type,
2486 HSourcePosition left_position,
2487 HSourcePosition right_position,
2488 PushBeforeSimulateBehavior push_sim_result,
2489 BailoutId bailout_id);
2491 HInstruction* BuildStringCharCodeAt(HValue*
string,
2494 HValue* BuildBinaryOperation(
2495 BinaryOperation* expr,
2498 PushBeforeSimulateBehavior push_sim_result);
2499 HInstruction* BuildIncrement(
bool returns_original_input,
2500 CountOperation* expr);
2506 HInstruction* TryBuildConsolidatedElementLoad(HValue*
object,
2509 SmallMapList* maps);
2513 HInstruction* BuildMonomorphicElementAccess(HValue*
object,
2521 HValue* HandlePolymorphicElementAccess(HValue*
object,
2527 bool* has_side_effects);
2529 HValue* HandleKeyedElementAccess(HValue*
obj,
2534 bool* has_side_effects);
2538 Handle<String>
name,
2540 bool is_uninitialized =
false);
2542 HCheckMaps* AddCheckMap(HValue*
object, Handle<Map> map);
2544 void BuildLoad(Property* property,
2546 void PushLoad(Property* property,
2550 void BuildStoreForEffect(Expression* expression,
2553 BailoutId return_id,
2558 void BuildStore(Expression* expression,
2561 BailoutId return_id,
2562 bool is_uninitialized =
false);
2564 HInstruction* BuildLoadNamedField(PropertyAccessInfo*
info,
2565 HValue* checked_object);
2566 HInstruction* BuildStoreNamedField(PropertyAccessInfo*
info,
2567 HValue* checked_object,
2570 HValue* BuildContextChainWalk(Variable* var);
2572 HInstruction* BuildThisFunction();
2574 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object,
2575 AllocationSiteUsageContext* site_context);
2577 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object,
2578 HInstruction*
object);
2580 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object,
2581 HInstruction*
object,
2582 HInstruction* object_elements);
2584 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object,
2585 HInstruction*
object,
2586 AllocationSiteUsageContext* site_context,
2589 void BuildEmitElements(Handle<JSObject> boilerplate_object,
2590 Handle<FixedArrayBase> elements,
2591 HValue* object_elements,
2592 AllocationSiteUsageContext* site_context);
2594 void BuildEmitFixedDoubleArray(Handle<FixedArrayBase> elements,
2596 HValue* object_elements);
2598 void BuildEmitFixedArray(Handle<FixedArrayBase> elements,
2600 HValue* object_elements,
2601 AllocationSiteUsageContext* site_context);
2603 void AddCheckPrototypeMaps(Handle<JSObject> holder,
2604 Handle<Map> receiver_map);
2606 HInstruction* NewPlainFunctionCall(HValue* fun,
2608 bool pass_argument_count);
2610 HInstruction* NewArgumentAdaptorCall(HValue* fun, HValue* context,
2612 HValue* expected_param_count);
2614 HInstruction* BuildCallConstantFunction(Handle<JSFunction> target,
2615 int argument_count);
2628 BreakAndContinueScope* break_scope_;
2631 ZoneList<Handle<Object> > globals_;
2633 bool inline_bailout_;
2660 void SaveTiming(
const char*
name, TimeDelta time,
unsigned size);
2663 full_code_gen_ += full_code_gen;
2667 TimeDelta optimize_graph,
2668 TimeDelta generate_code) {
2669 create_graph_ += create_graph;
2670 optimize_graph_ += optimize_graph;
2671 generate_code_ += generate_code;
2678 TimeDelta create_graph_;
2679 TimeDelta optimize_graph_;
2680 TimeDelta generate_code_;
2681 unsigned total_size_;
2682 TimeDelta full_code_gen_;
2683 double source_size_;
2690 : CompilationPhase(name, graph->
info()),
2695 HGraph*
graph()
const {
return graph_; }
2700 DISALLOW_COPY_AND_ASSIGN(
HPhase);
2704 class HTracer
V8_FINAL :
public Malloced {
2707 : trace_(&string_allocator_), indent_(0) {
2708 if (FLAG_trace_hydrogen_file ==
NULL) {
2710 "hydrogen-%d-%d.cfg",
2714 OS::StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
2720 void TraceHydrogen(
const char*
name, HGraph* graph);
2721 void TraceLithium(
const char*
name,
LChunk* chunk);
2722 void TraceLiveRanges(
const char*
name, LAllocator* allocator);
2727 Tag(HTracer* tracer,
const char*
name) {
2730 tracer->PrintIndent();
2731 tracer->trace_.Add(
"begin_%s\n", name);
2737 tracer_->PrintIndent();
2738 tracer_->trace_.Add(
"end_%s\n", name_);
2739 ASSERT(tracer_->indent_ >= 0);
2740 tracer_->FlushToFile();
2748 void TraceLiveRange(LiveRange* range,
const char* type, Zone* zone);
2749 void Trace(
const char* name, HGraph* graph, LChunk* chunk);
2752 void PrintEmptyProperty(
const char* name) {
2754 trace_.Add(
"%s\n", name);
2757 void PrintStringProperty(
const char* name,
const char* value) {
2759 trace_.Add(
"%s \"%s\"\n", name, value);
2762 void PrintLongProperty(
const char* name, int64_t value) {
2764 trace_.Add(
"%s %d000\n", name, static_cast<int>(value / 1000));
2767 void PrintBlockProperty(
const char* name,
int block_id) {
2769 trace_.Add(
"%s \"B%d\"\n", name, block_id);
2772 void PrintIntProperty(
const char* name,
int value) {
2774 trace_.Add(
"%s %d\n", name, value);
2777 void PrintIndent() {
2778 for (
int i = 0; i < indent_; i++) {
2783 EmbeddedVector<char, 64> filename_;
2784 HeapStringAllocator string_allocator_;
2785 StringStream trace_;
2790 class NoObservableSideEffectsScope
V8_FINAL {
2794 builder_->graph()->IncrementInNoSideEffectsScope();
2797 builder_->graph()->DecrementInNoSideEffectsScope();
2807 #endif // V8_HYDROGEN_H_
const ZoneList< HPhi * > * phi_list() const
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
int update_type_change_checksum(int delta)
bool IsNestedInThisLoop(HLoopInformation *other)
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
#define INLINE_FUNCTION_LIST(F)
AstContext(HOptimizedGraphBuilder *owner, Expression::Context kind)
I * New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
HValue * TruncateToNumber(HValue *value, Type **expected)
const ZoneList< HBasicBlock * > * blocks() const
void GotoNoSimulate(HBasicBlock *from, HBasicBlock *target)
static const int kUnlimitedMaxInlinedNodesCumulative
void BindContext(HValue *value)
Isolate * isolate() const
Condition * AndIf(HValue *p1, P2 p2, P3 p3)
void BuildTransitionElementsKind(HValue *object, HValue *map, ElementsKind from_kind, ElementsKind to_kind, bool is_jsarray)
virtual bool BuildGraph()=0
void DisallowAddingNewValues()
void set_arguments_object(HArgumentsObject *arguments_object)
HBasicBlock * function_return()
void BuildCreateAllocationMemento(HValue *previous_object, HValue *previous_object_size, HValue *payload)
void VisitTypeof(UnaryOperation *expr)
HInstruction * BuildGetArrayFunction()
void set_parent_loop_header(HBasicBlock *block)
const ZoneList< HPhi * > * phis() const
Condition * OrIf(HValue *p)
void set_argument_count(int count)
void set_ast_context(AstContext *context)
Condition * IfNot(HValue *p)
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 true
void Continue(HBasicBlock **true_branch, HBasicBlock **false_branch)
void VisitVoid(UnaryOperation *expr)
HValue * BuildCloneShallowArray(HValue *boilerplate, HValue *allocation_site, AllocationSiteMode mode, ElementsKind kind, int length)
void GotoNoSimulate(HBasicBlock *target)
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4)
void set_for_typeof(bool for_typeof)
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
void PushArgumentsFromEnvironment(int count)
void set_osr(HOsrBuilder *osr)
bool is_local_index(int i) const
CompilationInfo * info() const
int IndexFor(Variable *variable) const
PretenureFlag GetPretenureMode() const V8_WARN_UNUSED_RESULT
HInstruction * AddUncasted(P1 p1, P2 p2)
void RecordUint32Instruction(HInstruction *instr)
#define DECLARE_VISIT(type)
HBasicBlock * if_false() const
I * New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
BreakAndContinueScope * next()
int GetNextValueID(HValue *value)
void VisitForValue(Expression *expr, ArgumentsAllowedFlag flag=ARGUMENTS_NOT_ALLOWED)
I * Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()
void AddIncrementCounter(StatsCounter *counter)
void ThenDeopt(const char *reason)
void set_ast_id(BailoutId id)
bool IsInlineReturnTarget() const
HBasicBlock * CreateLoop(IterationStatement *statement, HBasicBlock *loop_entry, HBasicBlock *body_exit, HBasicBlock *loop_successor, HBasicBlock *break_block)
void BuildCopySeqStringChars(HValue *src, HValue *src_offset, String::Encoding src_encoding, HValue *dst, HValue *dst_offset, String::Encoding dst_encoding, HValue *length)
HInstruction * AddLoadStringInstanceType(HValue *string)
void AddLeaveInlined(HBasicBlock *block, HValue *return_value, FunctionState *state)
void VisitDelete(UnaryOperation *expr)
HOsrBuilder * osr() const
bool HasEnvironment() const
HValue * LookupValue(int id) const
HLoopInformation * loop_information() const
Condition * OrIf(HValue *p1, P2 p2, P3 p3)
HInstruction * first() const
HEnvironment * start_environment() const
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
void set_source_position(HSourcePosition position)
virtual void ReturnInstruction(HInstruction *instr, BailoutId ast_id)=0
HBasicBlock * function_return() const
HStoreNamedField * AddStoreMapNoWriteBarrier(HValue *object, HValue *map)
TestContext(HOptimizedGraphBuilder *owner, Expression *condition, HBasicBlock *if_true, HBasicBlock *if_false)
HBasicBlock * if_true() const
HStoreNamedField * AddStoreMapConstantNoWriteBarrier(HValue *object, Handle< Map > map)
HValue * BuildBinaryOperation(Token::Value op, HValue *left, HValue *right, Type *left_type, Type *right_type, Type *result_type, Maybe< int > fixed_right_arg, HAllocationMode allocation_mode)
TypeImpl< ZoneTypeConfig > Type
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
HArgumentsObject * arguments_object()
HValue * BuildUncheckedStringAdd(HValue *left, HValue *right, HAllocationMode allocation_mode)
void AddSimulate(BailoutId id, RemovableSimulate removable=FIXED_SIMULATE)
const ZoneList< HBasicBlock * > * predecessors() const
void set_position(int position)
virtual void ReturnControl(HControlInstruction *instr, BailoutId ast_id)=0
bool IsStackAllocated() const
HOptimizedGraphBuilder * owner() const
HSourcePosition source_position()
AllocationSiteOverrideMode
Condition * IfNot(HValue *p1, P2 p2)
HLoopInformation(HBasicBlock *loop_header, Zone *zone)
void IncrementInNoSideEffectsScope()
HValue * BuildGrowElementsCapacity(HValue *object, HValue *elements, ElementsKind kind, ElementsKind new_kind, HValue *length, HValue *new_capacity)
friend class FunctionState
#define ASSERT(condition)
BreakAndContinueInfo(BreakableStatement *target, int drop_extra=0)
void DecrementInNoSideEffectsScope()
HBasicBlock * current_block() const
HArgumentsElements * arguments_elements()
FunctionState * function_state() const
HPredecessorIterator(HBasicBlock *block)
void VisitLoopBody(IterationStatement *stmt, HBasicBlock *loop_entry, BreakAndContinueInfo *break_info)
bool is_special_index(int i) const
static const int kUnlimitedMaxInlinedNodes
I * Add(P1 p1, P2 p2, P3 p3)
HSourcePosition ScriptPositionToSourcePosition(int position)
Condition * AndIf(HValue *p1, P2 p2)
HValue * GetElementsLocation()
void VisitDeclarations(ZoneList< Declaration * > *declarations)
I * New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
HBasicBlock * continue_block()
int maximum_environment_size()
I * Add(P1 p1, P2 p2, P3 p3, P4 p4)
static const int kMaxStorePolymorphism
HValue * BuildCreateConsString(HValue *length, HValue *left, HValue *right, HAllocationMode allocation_mode)
HEnterInlined * entry() const
HEnvironment * environment() const
FrameType frame_type() const
HPhase(const char *name, HGraph *graph)
bool HasPredecessor() const
HInstruction * PreProcessCall(Instruction *call)
static const int kUnlimitedMaxInlinedSourceSize
HAllocate * BuildAllocate(HValue *object_size, HType type, InstanceType instance_type, HAllocationMode allocation_mode)
static TestContext * cast(AstContext *context)
kInstanceClassNameOffset flag
HAllocationMode(PretenureFlag pretenure_flag)
const GrowableBitVector * assigned_variables() const
CompilationInfo * current_info() const
int first_local_index() const
bool IsDeoptimizing() const
HValue * Lookup(Variable *variable) const
void RecordDeletedPhi(int merge_index)
void ClearInlinedTestContext()
void Bailout(BailoutReason reason)
void set_continue_block(HBasicBlock *block)
const ZoneList< HValue * > * values() const
void Bind(Variable *var, HValue *value)
virtual HValue * context()=0
I * New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
void ElseDeopt(const char *reason)
void EnterInlinedSource(int start_position, int id)
AstContext * call_context()
void(HOptimizedGraphBuilder::* InlineFunctionGenerator)(CallRuntime *call)
HControlInstruction * end() const
I * New(P1 p1, P2 p2, P3 p3)
int first_expression_index() const
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
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 size
void FinishExitWithHardDeoptimization(const char *reason)
~NoObservableSideEffectsScope()
BreakableStatement * target()
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
CompilationInfo * compilation_info()
const ZoneList< HBasicBlock * > * dominated_blocks() const
AstContext * call_context() const
void VisitForEffect(Expression *expr)
const ZoneList< HBasicBlock * > * back_edges() const
int specials_count() const
HValue * BuildElementIndexHash(HValue *index)
Handle< AllocationSite > feedback_site() const
static const int kMaxFastLiteralDepth
void check(i::Vector< const uint8_t > string)
void set_current_block(HBasicBlock *block)
bool depends_on_empty_array_proto_elements()
void set_entry(HEnterInlined *entry)
HEnvironment * DiscardInlined(bool drop_extra)
void MarkDependsOnEmptyArrayProtoElements()
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 shift
void IncrementSubtotals(TimeDelta create_graph, TimeDelta optimize_graph, TimeDelta generate_code)
BreakAndContinueScope * break_scope() const
static const InlineFunctionGenerator kInlineFunctionGenerators[]
void IncrementFullCodeGen(TimeDelta full_code_gen)
HBasicBlock * BuildLoopEntry()
HValue * LookupAndMakeLive(Variable *var)
Condition * If(HValue *p)
void BuildArrayBufferViewInitialization(HValue *obj, HValue *buffer, HValue *byte_offset, HValue *byte_length)
HLoopInformation * current_loop() const
static const int kMaxLoadPolymorphism
HInstruction * BuildCheckPrototypeMaps(Handle< JSObject > prototype, Handle< JSObject > holder)
HBasicBlock * break_block()
Condition * If(HValue *p1, P2 p2)
void Bind(Variable *variable, HValue *value)
bool IsStartBlock() const
void set_arguments_elements(HArgumentsElements *arguments_elements)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
HInstruction * AddLoadStringLength(HValue *string)
virtual void ReturnContinuation(HIfContinuation *continuation, BailoutId ast_id)=0
StrictMode function_strict_mode()
static int GetCurrentProcessId()
#define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize)
bool HasParentLoopHeader() const
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
HValue * Lookup(int index) const
Condition * OrIf(HValue *p1, P2 p2)
HGraphBuilder(CompilationInfo *info)
void VisitLogicalExpression(BinaryOperation *expr)
HValue * BuildAllocateArrayFromLength(JSArrayBuilder *array_builder, HValue *length_argument)
HValue * BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, HValue *capacity)
Handle< JSFunction > closure() const
HOptimizedGraphBuilder(CompilationInfo *info)
HInstruction * BuildGetNativeContext()
HBasicBlock * true_branch() const
const ZoneList< int > * deleted_phis() const
BreakAndContinueScope(BreakAndContinueInfo *info, HOptimizedGraphBuilder *owner)
HInstructionIterator(HBasicBlock *block)
HInstruction * AddUncasted()
void VisitForTypeOf(Expression *expr)
void Capture(HBasicBlock *true_branch, HBasicBlock *false_branch)
void BuildCompareNil(HValue *value, Type *type, HIfContinuation *continuation)
void VisitNot(UnaryOperation *expr)
void SetUpScope(Scope *scope)
void MarkAsLoopSuccessorDominator()
void set_stack_check(HStackCheck *stack_check)
void update_maximum_environment_size(int environment_size)
void set_first_instruction_index(int index)
HBasicBlock * CreateJoin(HBasicBlock *first, HBasicBlock *second, BailoutId join_id)
static int SNPrintF(Vector< char > str, const char *format,...)
HInstruction * AddElementAccess(HValue *elements, HValue *checked_key, HValue *val, HValue *dependency, ElementsKind elements_kind, PropertyAccessType access_type, LoadKeyedHoleMode load_mode=NEVER_RETURN_HOLE)
HBasicBlock * dominator() const
int WriteChars(const char *filename, const char *str, int size, bool verbose)
HValue * BuildNewElementsCapacity(HValue *old_capacity)
HEnvironment * last_environment() const
void VisitForControl(Expression *expr, HBasicBlock *true_block, HBasicBlock *false_block)
void Goto(HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
HValue * BuildAddStringLengths(HValue *left_length, HValue *right_length)
I * Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
Expression * condition() const
bool has_uint32_instructions()
HValue * BuildWrapReceiver(HValue *object, HValue *function)
I * Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
int last_instruction_index() const
BreakAndContinueInfo * info()
void BuildNewSpaceArrayCheck(HValue *length, ElementsKind kind)
Isolate * isolate() const
void set_use_optimistic_licm(bool value)
HValue * BuildObjectSizeAlignment(HValue *unaligned_size, int header_size)
void SetSourcePosition(int position)
bool is_parameter_index(int i) const
HValue * EnforceNumberType(HValue *number, Type *expected)
HValue * BuildRegExpConstructResult(HValue *length, HValue *index, HValue *input)
void AddLeaveInlined(HValue *return_value, FunctionState *state)
HValue * BuildAllocateElements(ElementsKind kind, HValue *capacity)
Handle< T > handle(T *t, Isolate *isolate)
HInstruction * NewUncasted()
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 info
bool IsInsideNoSideEffectsScope()
HBasicBlock * parent_loop_header() const
Condition * IfNot(HValue *p1, P2 p2, P3 p3)
HArgumentsObject * GetArgumentsObject() const
int argument_count() const
bool is_arguments() const
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
static const int kMaxFastLiteralProperties
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3)
HValue * BuildCheckString(HValue *string)
bool IsEligibleForEnvironmentLivenessAnalysis(Variable *var, int index, HValue *value, HEnvironment *env)
HBasicBlock * CreateLoopHeaderBlock()
Type * ToType(Handle< Map > map)
CompilationInfo * top_info()
HValue * BuildCopyElementsOnWrite(HValue *object, HValue *elements, ElementsKind kind, HValue *length)
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
int parameter_count() const
bool is_recursive() const
void VisitExpressions(ZoneList< Expression * > *exprs)
HInstruction * NewUncasted(P1 p1)
bool CreateAllocationMementos() const V8_WARN_UNUSED_RESULT
HValue * BuildNumberToString(HValue *object, Type *type)
bool IsLoopSuccessorDominator() const
HBasicBlock * CreateBasicBlock(HEnvironment *env)
HValue * ExpressionStackAt(int index_from_top) const
#define V8_WARN_UNUSED_RESULT
void SetArgumentsObject(HArgumentsObject *object)
void BuildInitializeElementsHeader(HValue *elements, ElementsKind kind, HValue *capacity)
NoObservableSideEffectsScope(HGraphBuilder *builder)
void set_inlining_id(int inlining_id)
virtual void VisitStatements(ZoneList< Statement * > *statements) V8_OVERRIDE
HInstruction * last() const
void VisitComma(BinaryOperation *expr)
HBasicBlock * inlined_entry_block()
Condition * AndIf(HValue *p)
HEnvironment * arguments_environment()
static void StrNCpy(Vector< char > dest, const char *src, size_t n)
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
void Print(const v8::FunctionCallbackInfo< v8::Value > &args)
HStoreNamedField * AddStoreMapConstant(HValue *object, Handle< Map > map)
HAllocationMode(Handle< AllocationSite > feedback_site)
int GetMaximumValueID() const
HInstruction * NewUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
bool PreProcessOsrEntry(IterationStatement *statement)
HLoopInformation * parent_loop()
void set_block_id(int id)
bool IsLoopHeader() const
static const int kPreallocatedArrayElements
void GotoNoSimulate(HBasicBlock *block, HSourcePosition position)
HInstruction * AddUncasted(P1 p1)
static const int kMaxCallPolymorphism
HInstruction * BuildUncheckedMonomorphicElementAccess(HValue *checked_object, HValue *key, HValue *val, bool is_js_array, ElementsKind elements_kind, PropertyAccessType access_type, LoadKeyedHoleMode load_mode, KeyedAccessStoreMode store_mode)
ZoneList< HInstruction * > * uint32_instructions()
EffectContext(HOptimizedGraphBuilder *owner)
void set_last_instruction_index(int index)
HValue * BuildCheckForCapacityGrow(HValue *object, HValue *elements, ElementsKind kind, HValue *length, HValue *key, bool is_js_array, PropertyAccessType access_type)
HOptimizedGraphBuilder * owner()
HLoadNamedField * AddLoadElements(HValue *object)
HBasicBlock * entry_block() const
HValue * BuildCheckMap(HValue *obj, Handle< Map > map)
HSimulate * AddNewSimulate(BailoutId ast_id, HSourcePosition position, RemovableSimulate removable=FIXED_SIMULATE)
int first_instruction_index() const
Condition * If(HValue *p1, P2 p2, P3 p3)
Handle< JSFunction > closure() const
AstContext * ast_context() const
void set_function_state(FunctionState *state)
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3)
HValue * BuildUncheckedDictionaryElementLoad(HValue *receiver, HValue *key)
bool TrueAndFalseReachable()
HInstruction * BuildConstantMapCheck(Handle< JSObject > constant, CompilationInfo *info)
void FinishCurrentBlock(HControlInstruction *last)
virtual bool BuildGraph() V8_OVERRIDE
bool MatchRotateRight(HValue *left, HValue *right, HValue **operand, HValue **shift_amount)
bool IsUnreachable() const
void ClearInlinedTestContext()
void BuildCopyElements(HValue *from_elements, ElementsKind from_elements_kind, HValue *to_elements, ElementsKind to_elements_kind, HValue *length, HValue *capacity)
HValue * current_site() const
void BuildFillElementsWithHole(HValue *elements, ElementsKind elements_kind, HValue *from, HValue *to)
void BindIfLive(Variable *var, HValue *value)
HLoadNamedField * AddLoadFixedArrayLength(HValue *object)
HInnerAllocatedObject * BuildJSArrayHeader(HValue *array, HValue *array_map, AllocationSiteMode mode, ElementsKind elements_kind, HValue *allocation_site_payload, HValue *length_field)
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
void MarkAsInlineReturnTarget(HBasicBlock *inlined_entry_block)
HInstruction * NewUncasted(P1 p1, P2 p2)
HIfContinuation(HBasicBlock *true_branch, HBasicBlock *false_branch)
HValue * BuildCheckHeapObject(HValue *object)
virtual void ReturnValue(HValue *value)=0
HValue * BuildStringAdd(HValue *left, HValue *right, HAllocationMode allocation_mode)
HBasicBlock * false_branch() const
ValueContext(HOptimizedGraphBuilder *owner, ArgumentsAllowedFlag flag)
HInstruction * AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4)
TestContext * test_context()
I * Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
bool use_optimistic_licm()
I * New(P1 p1, P2 p2, P3 p3, P4 p4)
HStackCheck * stack_check() const
HBasicBlock * loop_header() const
HEnvironment * outer() const
void set_break_block(HBasicBlock *block)
HValue * AddLoadJSBuiltin(Builtins::JavaScript builtin)
void set_break_scope(BreakAndContinueScope *head)
void SetValueAt(int index, HValue *value)
HAllocationMode(HValue *current_site)
HInstruction * AddInstruction(HInstruction *instr)
void set_last(HInstruction *instr)
bool IsFastDoubleElementsKind(ElementsKind kind)
HBasicBlock * JoinContinue(IterationStatement *statement, HBasicBlock *exit_block, HBasicBlock *continue_block)
void Goto(HBasicBlock *from, HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
void VisitArithmeticExpression(BinaryOperation *expr)
void FinishExitCurrentBlock(HControlInstruction *instruction)
InliningKind inlining_kind() const
TestContext * inlined_test_context() const
#define INLINE_OPTIMIZED_FUNCTION_LIST(F)