Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/hydrogen.h

Issue 22857004: Merged r16128, r16135, r16136 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void Finish(HControlInstruction* last); 135 void Finish(HControlInstruction* last);
136 void FinishExit(HControlInstruction* instruction); 136 void FinishExit(HControlInstruction* instruction);
137 void Goto(HBasicBlock* block, 137 void Goto(HBasicBlock* block,
138 FunctionState* state = NULL, 138 FunctionState* state = NULL,
139 bool add_simulate = true); 139 bool add_simulate = true);
140 void GotoNoSimulate(HBasicBlock* block) { 140 void GotoNoSimulate(HBasicBlock* block) {
141 Goto(block, NULL, false); 141 Goto(block, NULL, false);
142 } 142 }
143 143
144 int PredecessorIndexOf(HBasicBlock* predecessor) const; 144 int PredecessorIndexOf(HBasicBlock* predecessor) const;
145 HSimulate* AddSimulate(BailoutId ast_id, 145 HPhi* AddNewPhi(int merged_index);
146 RemovableSimulate removable = FIXED_SIMULATE) { 146 HSimulate* AddNewSimulate(BailoutId ast_id,
147 RemovableSimulate removable = FIXED_SIMULATE) {
147 HSimulate* instr = CreateSimulate(ast_id, removable); 148 HSimulate* instr = CreateSimulate(ast_id, removable);
148 AddInstruction(instr); 149 AddInstruction(instr);
149 return instr; 150 return instr;
150 } 151 }
151 void AssignCommonDominator(HBasicBlock* other); 152 void AssignCommonDominator(HBasicBlock* other);
152 void AssignLoopSuccessorDominators(); 153 void AssignLoopSuccessorDominators();
153 154
154 // Add the inlined function exit sequence, adding an HLeaveInlined 155 // Add the inlined function exit sequence, adding an HLeaveInlined
155 // instruction and updating the bailout environment. 156 // instruction and updating the bailout environment.
156 void AddLeaveInlined(HValue* return_value, FunctionState* state); 157 void AddLeaveInlined(HValue* return_value, FunctionState* state);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 447 }
447 448
448 void RecordUint32Instruction(HInstruction* instr) { 449 void RecordUint32Instruction(HInstruction* instr) {
449 ASSERT(uint32_instructions_ == NULL || !uint32_instructions_->is_empty()); 450 ASSERT(uint32_instructions_ == NULL || !uint32_instructions_->is_empty());
450 if (uint32_instructions_ == NULL) { 451 if (uint32_instructions_ == NULL) {
451 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); 452 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone());
452 } 453 }
453 uint32_instructions_->Add(instr, zone()); 454 uint32_instructions_->Add(instr, zone());
454 } 455 }
455 456
457 void IncrementInNoSideEffectsScope() { no_side_effects_scope_count_++; }
458 void DecrementInNoSideEffectsScope() { no_side_effects_scope_count_--; }
459 bool IsInsideNoSideEffectsScope() { return no_side_effects_scope_count_ > 0; }
460
456 private: 461 private:
457 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, 462 HConstant* GetConstant(SetOncePointer<HConstant>* pointer,
458 int32_t integer_value); 463 int32_t integer_value);
459 464
460 template<class Phase> 465 template<class Phase>
461 void Run() { 466 void Run() {
462 Phase phase(this); 467 Phase phase(this);
463 phase.Run(); 468 phase.Run();
464 } 469 }
465 470
(...skipping 25 matching lines...) Expand all
491 496
492 CompilationInfo* info_; 497 CompilationInfo* info_;
493 Zone* zone_; 498 Zone* zone_;
494 499
495 bool is_recursive_; 500 bool is_recursive_;
496 bool use_optimistic_licm_; 501 bool use_optimistic_licm_;
497 bool has_soft_deoptimize_; 502 bool has_soft_deoptimize_;
498 bool depends_on_empty_array_proto_elements_; 503 bool depends_on_empty_array_proto_elements_;
499 int type_change_checksum_; 504 int type_change_checksum_;
500 int maximum_environment_size_; 505 int maximum_environment_size_;
506 int no_side_effects_scope_count_;
501 507
502 DISALLOW_COPY_AND_ASSIGN(HGraph); 508 DISALLOW_COPY_AND_ASSIGN(HGraph);
503 }; 509 };
504 510
505 511
506 Zone* HBasicBlock::zone() const { return graph_->zone(); } 512 Zone* HBasicBlock::zone() const { return graph_->zone(); }
507 513
508 514
509 // Type of stack frame an environment might refer to. 515 // Type of stack frame an environment might refer to.
510 enum FrameType { 516 enum FrameType {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 HBasicBlock* false_branch_; 969 HBasicBlock* false_branch_;
964 int position_; 970 int position_;
965 }; 971 };
966 972
967 973
968 class HGraphBuilder { 974 class HGraphBuilder {
969 public: 975 public:
970 explicit HGraphBuilder(CompilationInfo* info) 976 explicit HGraphBuilder(CompilationInfo* info)
971 : info_(info), 977 : info_(info),
972 graph_(NULL), 978 graph_(NULL),
973 current_block_(NULL), 979 current_block_(NULL) {}
974 no_side_effects_scope_count_(0) {}
975 virtual ~HGraphBuilder() {} 980 virtual ~HGraphBuilder() {}
976 981
977 HBasicBlock* current_block() const { return current_block_; } 982 HBasicBlock* current_block() const { return current_block_; }
978 void set_current_block(HBasicBlock* block) { current_block_ = block; } 983 void set_current_block(HBasicBlock* block) { current_block_ = block; }
979 HEnvironment* environment() const { 984 HEnvironment* environment() const {
980 return current_block()->last_environment(); 985 return current_block()->last_environment();
981 } 986 }
982 Zone* zone() const { return info_->zone(); } 987 Zone* zone() const { return info_->zone(); }
983 HGraph* graph() const { return graph_; } 988 HGraph* graph() const { return graph_; }
984 Isolate* isolate() const { return graph_->isolate(); } 989 Isolate* isolate() const { return graph_->isolate(); }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)); 1184 return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1180 } 1185 }
1181 1186
1182 template<class I, class P1, class P2, class P3, class P4, 1187 template<class I, class P1, class P2, class P3, class P4,
1183 class P5, class P6, class P7, class P8> 1188 class P5, class P6, class P7, class P8>
1184 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) { 1189 I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
1185 return I::cast( 1190 return I::cast(
1186 AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8))); 1191 AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)));
1187 } 1192 }
1188 1193
1189 void AddSimulate(BailoutId id, 1194 void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE);
1190 RemovableSimulate removable = FIXED_SIMULATE);
1191
1192 void IncrementInNoSideEffectsScope() {
1193 no_side_effects_scope_count_++;
1194 }
1195
1196 void DecrementInNoSideEffectsScope() {
1197 no_side_effects_scope_count_--;
1198 }
1199 1195
1200 protected: 1196 protected:
1201 virtual bool BuildGraph() = 0; 1197 virtual bool BuildGraph() = 0;
1202 1198
1203 HBasicBlock* CreateBasicBlock(HEnvironment* env); 1199 HBasicBlock* CreateBasicBlock(HEnvironment* env);
1204 HBasicBlock* CreateLoopHeaderBlock(); 1200 HBasicBlock* CreateLoopHeaderBlock();
1205 1201
1206 HValue* BuildCheckHeapObject(HValue* object); 1202 HValue* BuildCheckHeapObject(HValue* object);
1207 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); 1203 HValue* BuildCheckMap(HValue* obj, Handle<Map> map);
1208 HValue* BuildWrapReceiver(HValue* object, HValue* function); 1204 HValue* BuildWrapReceiver(HValue* object, HValue* function);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 HValue* context_; 1430 HValue* context_;
1435 HInstruction* increment_; 1431 HInstruction* increment_;
1436 HPhi* phi_; 1432 HPhi* phi_;
1437 HBasicBlock* header_block_; 1433 HBasicBlock* header_block_;
1438 HBasicBlock* body_block_; 1434 HBasicBlock* body_block_;
1439 HBasicBlock* exit_block_; 1435 HBasicBlock* exit_block_;
1440 Direction direction_; 1436 Direction direction_;
1441 bool finished_; 1437 bool finished_;
1442 }; 1438 };
1443 1439
1444 class NoObservableSideEffectsScope {
1445 public:
1446 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
1447 builder_(builder) {
1448 builder_->IncrementInNoSideEffectsScope();
1449 }
1450 ~NoObservableSideEffectsScope() {
1451 builder_->DecrementInNoSideEffectsScope();
1452 }
1453
1454 private:
1455 HGraphBuilder* builder_;
1456 };
1457
1458 HValue* BuildNewElementsCapacity(HValue* old_capacity); 1440 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1459 1441
1460 void BuildNewSpaceArrayCheck(HValue* length, 1442 void BuildNewSpaceArrayCheck(HValue* length,
1461 ElementsKind kind); 1443 ElementsKind kind);
1462 1444
1463 class JSArrayBuilder { 1445 class JSArrayBuilder {
1464 public: 1446 public:
1465 JSArrayBuilder(HGraphBuilder* builder, 1447 JSArrayBuilder(HGraphBuilder* builder,
1466 ElementsKind kind, 1448 ElementsKind kind,
1467 HValue* allocation_site_payload, 1449 HValue* allocation_site_payload,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 1550
1569 private: 1551 private:
1570 HGraphBuilder(); 1552 HGraphBuilder();
1571 1553
1572 void PadEnvironmentForContinuation(HBasicBlock* from, 1554 void PadEnvironmentForContinuation(HBasicBlock* from,
1573 HBasicBlock* continuation); 1555 HBasicBlock* continuation);
1574 1556
1575 CompilationInfo* info_; 1557 CompilationInfo* info_;
1576 HGraph* graph_; 1558 HGraph* graph_;
1577 HBasicBlock* current_block_; 1559 HBasicBlock* current_block_;
1578 int no_side_effects_scope_count_;
1579 }; 1560 };
1580 1561
1581 1562
1582 template<> 1563 template<>
1583 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( 1564 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
1584 Deoptimizer::BailoutType type) { 1565 Deoptimizer::BailoutType type) {
1585 if (type == Deoptimizer::SOFT) { 1566 if (type == Deoptimizer::SOFT) {
1586 isolate()->counters()->soft_deopts_requested()->Increment(); 1567 isolate()->counters()->soft_deopts_requested()->Increment();
1587 if (FLAG_always_opt) return NULL; 1568 if (FLAG_always_opt) return NULL;
1588 } 1569 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 } 2304 }
2324 } 2305 }
2325 2306
2326 EmbeddedVector<char, 64> filename_; 2307 EmbeddedVector<char, 64> filename_;
2327 HeapStringAllocator string_allocator_; 2308 HeapStringAllocator string_allocator_;
2328 StringStream trace_; 2309 StringStream trace_;
2329 int indent_; 2310 int indent_;
2330 }; 2311 };
2331 2312
2332 2313
2314 class NoObservableSideEffectsScope {
2315 public:
2316 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
2317 builder_(builder) {
2318 builder_->graph()->IncrementInNoSideEffectsScope();
2319 }
2320 ~NoObservableSideEffectsScope() {
2321 builder_->graph()->DecrementInNoSideEffectsScope();
2322 }
2323
2324 private:
2325 HGraphBuilder* builder_;
2326 };
2327
2328
2333 } } // namespace v8::internal 2329 } } // namespace v8::internal
2334 2330
2335 #endif // V8_HYDROGEN_H_ 2331 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698