| OLD | NEW |
| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // LeaveInlined | 163 // LeaveInlined |
| 164 // Simulate (caller's environment) | 164 // Simulate (caller's environment) |
| 165 // Goto (target block) | 165 // Goto (target block) |
| 166 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 166 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
| 167 void MarkAsInlineReturnTarget(HBasicBlock* inlined_entry_block) { | 167 void MarkAsInlineReturnTarget(HBasicBlock* inlined_entry_block) { |
| 168 is_inline_return_target_ = true; | 168 is_inline_return_target_ = true; |
| 169 inlined_entry_block_ = inlined_entry_block; | 169 inlined_entry_block_ = inlined_entry_block; |
| 170 } | 170 } |
| 171 HBasicBlock* inlined_entry_block() { return inlined_entry_block_; } | 171 HBasicBlock* inlined_entry_block() { return inlined_entry_block_; } |
| 172 | 172 |
| 173 bool IsDeoptimizing() const { return is_deoptimizing_; } | 173 bool IsDeoptimizing() const { |
| 174 void MarkAsDeoptimizing() { is_deoptimizing_ = true; } | 174 return end() != NULL && end()->IsDeoptimize(); |
| 175 } |
| 176 |
| 177 void MarkUnreachable(); |
| 178 bool IsUnreachable() const { return !is_reachable_; } |
| 179 bool IsReachable() const { return is_reachable_; } |
| 175 | 180 |
| 176 bool IsLoopSuccessorDominator() const { | 181 bool IsLoopSuccessorDominator() const { |
| 177 return dominates_loop_successors_; | 182 return dominates_loop_successors_; |
| 178 } | 183 } |
| 179 void MarkAsLoopSuccessorDominator() { | 184 void MarkAsLoopSuccessorDominator() { |
| 180 dominates_loop_successors_ = true; | 185 dominates_loop_successors_ = true; |
| 181 } | 186 } |
| 182 | 187 |
| 183 inline Zone* zone() const; | 188 inline Zone* zone() const; |
| 184 | 189 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 208 // Outgoing parameter count at block exit, set during lithium translation. | 213 // Outgoing parameter count at block exit, set during lithium translation. |
| 209 int argument_count_; | 214 int argument_count_; |
| 210 // Instruction indices into the lithium code stream. | 215 // Instruction indices into the lithium code stream. |
| 211 int first_instruction_index_; | 216 int first_instruction_index_; |
| 212 int last_instruction_index_; | 217 int last_instruction_index_; |
| 213 ZoneList<int> deleted_phis_; | 218 ZoneList<int> deleted_phis_; |
| 214 HBasicBlock* parent_loop_header_; | 219 HBasicBlock* parent_loop_header_; |
| 215 // For blocks marked as inline return target: the block with HEnterInlined. | 220 // For blocks marked as inline return target: the block with HEnterInlined. |
| 216 HBasicBlock* inlined_entry_block_; | 221 HBasicBlock* inlined_entry_block_; |
| 217 bool is_inline_return_target_ : 1; | 222 bool is_inline_return_target_ : 1; |
| 218 bool is_deoptimizing_ : 1; | 223 bool is_reachable_ : 1; |
| 219 bool dominates_loop_successors_ : 1; | 224 bool dominates_loop_successors_ : 1; |
| 220 bool is_osr_entry_ : 1; | 225 bool is_osr_entry_ : 1; |
| 221 }; | 226 }; |
| 222 | 227 |
| 223 | 228 |
| 224 class HPredecessorIterator V8_FINAL BASE_EMBEDDED { | 229 class HPredecessorIterator V8_FINAL BASE_EMBEDDED { |
| 225 public: | 230 public: |
| 226 explicit HPredecessorIterator(HBasicBlock* block) | 231 explicit HPredecessorIterator(HBasicBlock* block) |
| 227 : predecessor_list_(block->predecessors()), current_(0) { } | 232 : predecessor_list_(block->predecessors()), current_(0) { } |
| 228 | 233 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 int maximum_environment_size() { return maximum_environment_size_; } | 404 int maximum_environment_size() { return maximum_environment_size_; } |
| 400 | 405 |
| 401 bool use_optimistic_licm() { | 406 bool use_optimistic_licm() { |
| 402 return use_optimistic_licm_; | 407 return use_optimistic_licm_; |
| 403 } | 408 } |
| 404 | 409 |
| 405 void set_use_optimistic_licm(bool value) { | 410 void set_use_optimistic_licm(bool value) { |
| 406 use_optimistic_licm_ = value; | 411 use_optimistic_licm_ = value; |
| 407 } | 412 } |
| 408 | 413 |
| 409 bool has_soft_deoptimize() { | |
| 410 return has_soft_deoptimize_; | |
| 411 } | |
| 412 | |
| 413 void set_has_soft_deoptimize(bool value) { | |
| 414 has_soft_deoptimize_ = value; | |
| 415 } | |
| 416 | |
| 417 void MarkRecursive() { | 414 void MarkRecursive() { |
| 418 is_recursive_ = true; | 415 is_recursive_ = true; |
| 419 } | 416 } |
| 420 | 417 |
| 421 bool is_recursive() const { | 418 bool is_recursive() const { |
| 422 return is_recursive_; | 419 return is_recursive_; |
| 423 } | 420 } |
| 424 | 421 |
| 425 void MarkDependsOnEmptyArrayProtoElements() { | 422 void MarkDependsOnEmptyArrayProtoElements() { |
| 426 // Add map dependency if not already added. | 423 // Add map dependency if not already added. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 SetOncePointer<HConstant> constant_invalid_context_; | 486 SetOncePointer<HConstant> constant_invalid_context_; |
| 490 SetOncePointer<HArgumentsObject> arguments_object_; | 487 SetOncePointer<HArgumentsObject> arguments_object_; |
| 491 | 488 |
| 492 HOsrBuilder* osr_; | 489 HOsrBuilder* osr_; |
| 493 | 490 |
| 494 CompilationInfo* info_; | 491 CompilationInfo* info_; |
| 495 Zone* zone_; | 492 Zone* zone_; |
| 496 | 493 |
| 497 bool is_recursive_; | 494 bool is_recursive_; |
| 498 bool use_optimistic_licm_; | 495 bool use_optimistic_licm_; |
| 499 bool has_soft_deoptimize_; | |
| 500 bool depends_on_empty_array_proto_elements_; | 496 bool depends_on_empty_array_proto_elements_; |
| 501 int type_change_checksum_; | 497 int type_change_checksum_; |
| 502 int maximum_environment_size_; | 498 int maximum_environment_size_; |
| 503 int no_side_effects_scope_count_; | 499 int no_side_effects_scope_count_; |
| 504 | 500 |
| 505 DISALLOW_COPY_AND_ASSIGN(HGraph); | 501 DISALLOW_COPY_AND_ASSIGN(HGraph); |
| 506 }; | 502 }; |
| 507 | 503 |
| 508 | 504 |
| 509 Zone* HBasicBlock::zone() const { return graph_->zone(); } | 505 Zone* HBasicBlock::zone() const { return graph_->zone(); } |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 HValue* right, | 1280 HValue* right, |
| 1285 HValue** operand, | 1281 HValue** operand, |
| 1286 HValue** shift_amount); | 1282 HValue** shift_amount); |
| 1287 | 1283 |
| 1288 HInstruction* BuildBinaryOperation(Token::Value op, | 1284 HInstruction* BuildBinaryOperation(Token::Value op, |
| 1289 HValue* left, | 1285 HValue* left, |
| 1290 HValue* right, | 1286 HValue* right, |
| 1291 Handle<Type> left_type, | 1287 Handle<Type> left_type, |
| 1292 Handle<Type> right_type, | 1288 Handle<Type> right_type, |
| 1293 Handle<Type> result_type, | 1289 Handle<Type> result_type, |
| 1294 Maybe<int> fixed_right_arg); | 1290 Maybe<int> fixed_right_arg, |
| 1291 bool binop_stub = false); |
| 1295 | 1292 |
| 1296 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1293 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
| 1297 | 1294 |
| 1298 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1295 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
| 1299 | 1296 |
| 1300 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); | 1297 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); |
| 1301 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1298 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
| 1302 | 1299 |
| 1303 void PushAndAdd(HInstruction* instr); | 1300 void PushAndAdd(HInstruction* instr); |
| 1304 | 1301 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 | 1647 |
| 1651 | 1648 |
| 1652 template<> | 1649 template<> |
| 1653 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( | 1650 inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>( |
| 1654 const char* reason, Deoptimizer::BailoutType type) { | 1651 const char* reason, Deoptimizer::BailoutType type) { |
| 1655 if (type == Deoptimizer::SOFT) { | 1652 if (type == Deoptimizer::SOFT) { |
| 1656 isolate()->counters()->soft_deopts_requested()->Increment(); | 1653 isolate()->counters()->soft_deopts_requested()->Increment(); |
| 1657 if (FLAG_always_opt) return NULL; | 1654 if (FLAG_always_opt) return NULL; |
| 1658 } | 1655 } |
| 1659 if (current_block()->IsDeoptimizing()) return NULL; | 1656 if (current_block()->IsDeoptimizing()) return NULL; |
| 1660 HDeoptimize* instr = New<HDeoptimize>(reason, type); | 1657 HBasicBlock* after_deopt_block = CreateBasicBlock( |
| 1661 AddInstruction(instr); | 1658 current_block()->last_environment()); |
| 1659 HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block); |
| 1662 if (type == Deoptimizer::SOFT) { | 1660 if (type == Deoptimizer::SOFT) { |
| 1663 isolate()->counters()->soft_deopts_inserted()->Increment(); | 1661 isolate()->counters()->soft_deopts_inserted()->Increment(); |
| 1664 graph()->set_has_soft_deoptimize(true); | |
| 1665 } | 1662 } |
| 1666 current_block()->MarkAsDeoptimizing(); | 1663 current_block()->Finish(instr); |
| 1664 set_current_block(after_deopt_block); |
| 1667 return instr; | 1665 return instr; |
| 1668 } | 1666 } |
| 1669 | 1667 |
| 1670 | 1668 |
| 1671 template<> | 1669 template<> |
| 1672 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( | 1670 inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>( |
| 1673 const char* reason, Deoptimizer::BailoutType type) { | 1671 const char* reason, Deoptimizer::BailoutType type) { |
| 1674 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); | 1672 return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type)); |
| 1675 } | 1673 } |
| 1676 | 1674 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1701 } | 1699 } |
| 1702 | 1700 |
| 1703 | 1701 |
| 1704 template<> | 1702 template<> |
| 1705 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { | 1703 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) { |
| 1706 return AddUncasted<HReturn>(static_cast<HValue*>(value)); | 1704 return AddUncasted<HReturn>(static_cast<HValue*>(value)); |
| 1707 } | 1705 } |
| 1708 | 1706 |
| 1709 | 1707 |
| 1710 template<> | 1708 template<> |
| 1709 inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>( |
| 1710 Handle<String> name, |
| 1711 const Runtime::Function* c_function, |
| 1712 int argument_count) { |
| 1713 HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count); |
| 1714 if (graph()->info()->IsStub()) { |
| 1715 // When compiling code stubs, we don't want to save all double registers |
| 1716 // upon entry to the stub, but instead have the call runtime instruction |
| 1717 // save the double registers only on-demand (in the fallback case). |
| 1718 instr->set_save_doubles(kSaveFPRegs); |
| 1719 } |
| 1720 AddInstruction(instr); |
| 1721 return instr; |
| 1722 } |
| 1723 |
| 1724 |
| 1725 template<> |
| 1711 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { | 1726 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { |
| 1712 return HContext::New(zone()); | 1727 return HContext::New(zone()); |
| 1713 } | 1728 } |
| 1714 | 1729 |
| 1715 | 1730 |
| 1716 class HOptimizedGraphBuilder V8_FINAL | 1731 class HOptimizedGraphBuilder V8_FINAL |
| 1717 : public HGraphBuilder, public AstVisitor { | 1732 : public HGraphBuilder, public AstVisitor { |
| 1718 public: | 1733 public: |
| 1719 // A class encapsulating (lazily-allocated) break and continue blocks for | 1734 // A class encapsulating (lazily-allocated) break and continue blocks for |
| 1720 // a breakable statement. Separated from BreakAndContinueScope so that it | 1735 // a breakable statement. Separated from BreakAndContinueScope so that it |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 HValue* value, | 2252 HValue* value, |
| 2238 Handle<Map> map); | 2253 Handle<Map> map); |
| 2239 HInstruction* BuildStoreKeyedGeneric(HValue* object, | 2254 HInstruction* BuildStoreKeyedGeneric(HValue* object, |
| 2240 HValue* key, | 2255 HValue* key, |
| 2241 HValue* value); | 2256 HValue* value); |
| 2242 | 2257 |
| 2243 HValue* BuildContextChainWalk(Variable* var); | 2258 HValue* BuildContextChainWalk(Variable* var); |
| 2244 | 2259 |
| 2245 HInstruction* BuildThisFunction(); | 2260 HInstruction* BuildThisFunction(); |
| 2246 | 2261 |
| 2247 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object, | 2262 HInstruction* BuildFastLiteral(Handle<JSObject> boilerplate_object); |
| 2248 Handle<Object> allocation_site, | |
| 2249 AllocationSiteMode mode); | |
| 2250 | 2263 |
| 2251 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object, | 2264 void BuildEmitObjectHeader(Handle<JSObject> boilerplate_object, |
| 2252 HInstruction* object); | 2265 HInstruction* object); |
| 2253 | 2266 |
| 2254 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object, | 2267 void BuildInitElementsInObjectHeader(Handle<JSObject> boilerplate_object, |
| 2255 HInstruction* object, | 2268 HInstruction* object, |
| 2256 HInstruction* object_elements); | 2269 HInstruction* object_elements); |
| 2257 | 2270 |
| 2258 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object, | 2271 void BuildEmitInObjectProperties(Handle<JSObject> boilerplate_object, |
| 2259 HInstruction* object); | 2272 HInstruction* object); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2461 } | 2474 } |
| 2462 | 2475 |
| 2463 private: | 2476 private: |
| 2464 HGraphBuilder* builder_; | 2477 HGraphBuilder* builder_; |
| 2465 }; | 2478 }; |
| 2466 | 2479 |
| 2467 | 2480 |
| 2468 } } // namespace v8::internal | 2481 } } // namespace v8::internal |
| 2469 | 2482 |
| 2470 #endif // V8_HYDROGEN_H_ | 2483 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |