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

Side by Side Diff: src/hydrogen.h

Issue 23064017: Use V8_FINAL and V8_OVERRIDE in various places, fixing bugs revealed by them. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use V8_FINAL and V8_OVERRIDE instead. 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/ast.cc ('k') | src/hydrogen-instructions.h » ('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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class HEnvironment; 46 class HEnvironment;
47 class HGraph; 47 class HGraph;
48 class HLoopInformation; 48 class HLoopInformation;
49 class HOsrBuilder; 49 class HOsrBuilder;
50 class HTracer; 50 class HTracer;
51 class LAllocator; 51 class LAllocator;
52 class LChunk; 52 class LChunk;
53 class LiveRange; 53 class LiveRange;
54 54
55 55
56 class HBasicBlock FINAL : public ZoneObject { 56 class HBasicBlock V8_FINAL : public ZoneObject {
57 public: 57 public:
58 explicit HBasicBlock(HGraph* graph); 58 explicit HBasicBlock(HGraph* graph);
59 ~HBasicBlock() { } 59 ~HBasicBlock() { }
60 60
61 // Simple accessors. 61 // Simple accessors.
62 int block_id() const { return block_id_; } 62 int block_id() const { return block_id_; }
63 void set_block_id(int id) { block_id_ = id; } 63 void set_block_id(int id) { block_id_ = id; }
64 HGraph* graph() const { return graph_; } 64 HGraph* graph() const { return graph_; }
65 Isolate* isolate() const; 65 Isolate* isolate() const;
66 const ZoneList<HPhi*>* phis() const { return &phis_; } 66 const ZoneList<HPhi*>* phis() const { return &phis_; }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 HBasicBlock* parent_loop_header_; 213 HBasicBlock* parent_loop_header_;
214 // For blocks marked as inline return target: the block with HEnterInlined. 214 // For blocks marked as inline return target: the block with HEnterInlined.
215 HBasicBlock* inlined_entry_block_; 215 HBasicBlock* inlined_entry_block_;
216 bool is_inline_return_target_ : 1; 216 bool is_inline_return_target_ : 1;
217 bool is_deoptimizing_ : 1; 217 bool is_deoptimizing_ : 1;
218 bool dominates_loop_successors_ : 1; 218 bool dominates_loop_successors_ : 1;
219 bool is_osr_entry_ : 1; 219 bool is_osr_entry_ : 1;
220 }; 220 };
221 221
222 222
223 class HPredecessorIterator FINAL BASE_EMBEDDED { 223 class HPredecessorIterator V8_FINAL BASE_EMBEDDED {
224 public: 224 public:
225 explicit HPredecessorIterator(HBasicBlock* block) 225 explicit HPredecessorIterator(HBasicBlock* block)
226 : predecessor_list_(block->predecessors()), current_(0) { } 226 : predecessor_list_(block->predecessors()), current_(0) { }
227 227
228 bool Done() { return current_ >= predecessor_list_->length(); } 228 bool Done() { return current_ >= predecessor_list_->length(); }
229 HBasicBlock* Current() { return predecessor_list_->at(current_); } 229 HBasicBlock* Current() { return predecessor_list_->at(current_); }
230 void Advance() { current_++; } 230 void Advance() { current_++; }
231 231
232 private: 232 private:
233 const ZoneList<HBasicBlock*>* predecessor_list_; 233 const ZoneList<HBasicBlock*>* predecessor_list_;
234 int current_; 234 int current_;
235 }; 235 };
236 236
237 237
238 class HInstructionIterator FINAL BASE_EMBEDDED { 238 class HInstructionIterator V8_FINAL BASE_EMBEDDED {
239 public: 239 public:
240 explicit HInstructionIterator(HBasicBlock* block) 240 explicit HInstructionIterator(HBasicBlock* block)
241 : instr_(block->first()) { 241 : instr_(block->first()) {
242 next_ = Done() ? NULL : instr_->next(); 242 next_ = Done() ? NULL : instr_->next();
243 } 243 }
244 244
245 inline bool Done() const { return instr_ == NULL; } 245 inline bool Done() const { return instr_ == NULL; }
246 inline HInstruction* Current() { return instr_; } 246 inline HInstruction* Current() { return instr_; }
247 inline void Advance() { 247 inline void Advance() {
248 instr_ = next_; 248 instr_ = next_;
249 next_ = Done() ? NULL : instr_->next(); 249 next_ = Done() ? NULL : instr_->next();
250 } 250 }
251 251
252 private: 252 private:
253 HInstruction* instr_; 253 HInstruction* instr_;
254 HInstruction* next_; 254 HInstruction* next_;
255 }; 255 };
256 256
257 257
258 class HLoopInformation FINAL : public ZoneObject { 258 class HLoopInformation V8_FINAL : public ZoneObject {
259 public: 259 public:
260 HLoopInformation(HBasicBlock* loop_header, Zone* zone) 260 HLoopInformation(HBasicBlock* loop_header, Zone* zone)
261 : back_edges_(4, zone), 261 : back_edges_(4, zone),
262 loop_header_(loop_header), 262 loop_header_(loop_header),
263 blocks_(8, zone), 263 blocks_(8, zone),
264 stack_check_(NULL) { 264 stack_check_(NULL) {
265 blocks_.Add(loop_header, zone); 265 blocks_.Add(loop_header, zone);
266 } 266 }
267 ~HLoopInformation() {} 267 ~HLoopInformation() {}
268 268
(...skipping 27 matching lines...) Expand all
296 296
297 ZoneList<HBasicBlock*> back_edges_; 297 ZoneList<HBasicBlock*> back_edges_;
298 HBasicBlock* loop_header_; 298 HBasicBlock* loop_header_;
299 ZoneList<HBasicBlock*> blocks_; 299 ZoneList<HBasicBlock*> blocks_;
300 HStackCheck* stack_check_; 300 HStackCheck* stack_check_;
301 }; 301 };
302 302
303 303
304 class BoundsCheckTable; 304 class BoundsCheckTable;
305 class InductionVariableBlocksTable; 305 class InductionVariableBlocksTable;
306 class HGraph FINAL : public ZoneObject { 306 class HGraph V8_FINAL : public ZoneObject {
307 public: 307 public:
308 explicit HGraph(CompilationInfo* info); 308 explicit HGraph(CompilationInfo* info);
309 309
310 Isolate* isolate() const { return isolate_; } 310 Isolate* isolate() const { return isolate_; }
311 Zone* zone() const { return zone_; } 311 Zone* zone() const { return zone_; }
312 CompilationInfo* info() const { return info_; } 312 CompilationInfo* info() const { return info_; }
313 313
314 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 314 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
315 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 315 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
316 HBasicBlock* entry_block() const { return entry_block_; } 316 HBasicBlock* entry_block() const { return entry_block_; }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 enum FrameType { 516 enum FrameType {
517 JS_FUNCTION, 517 JS_FUNCTION,
518 JS_CONSTRUCT, 518 JS_CONSTRUCT,
519 JS_GETTER, 519 JS_GETTER,
520 JS_SETTER, 520 JS_SETTER,
521 ARGUMENTS_ADAPTOR, 521 ARGUMENTS_ADAPTOR,
522 STUB 522 STUB
523 }; 523 };
524 524
525 525
526 class HEnvironment FINAL : public ZoneObject { 526 class HEnvironment V8_FINAL : public ZoneObject {
527 public: 527 public:
528 HEnvironment(HEnvironment* outer, 528 HEnvironment(HEnvironment* outer,
529 Scope* scope, 529 Scope* scope,
530 Handle<JSFunction> closure, 530 Handle<JSFunction> closure,
531 Zone* zone); 531 Zone* zone);
532 532
533 HEnvironment(Zone* zone, int parameter_count); 533 HEnvironment(Zone* zone, int parameter_count);
534 534
535 HEnvironment* arguments_environment() { 535 HEnvironment* arguments_environment() {
536 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; 536 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 #endif 786 #endif
787 787
788 private: 788 private:
789 HOptimizedGraphBuilder* owner_; 789 HOptimizedGraphBuilder* owner_;
790 Expression::Context kind_; 790 Expression::Context kind_;
791 AstContext* outer_; 791 AstContext* outer_;
792 bool for_typeof_; 792 bool for_typeof_;
793 }; 793 };
794 794
795 795
796 class EffectContext FINAL : public AstContext { 796 class EffectContext V8_FINAL : public AstContext {
797 public: 797 public:
798 explicit EffectContext(HOptimizedGraphBuilder* owner) 798 explicit EffectContext(HOptimizedGraphBuilder* owner)
799 : AstContext(owner, Expression::kEffect) { 799 : AstContext(owner, Expression::kEffect) {
800 } 800 }
801 virtual ~EffectContext(); 801 virtual ~EffectContext();
802 802
803 virtual void ReturnValue(HValue* value) OVERRIDE; 803 virtual void ReturnValue(HValue* value) V8_OVERRIDE;
804 virtual void ReturnInstruction(HInstruction* instr, 804 virtual void ReturnInstruction(HInstruction* instr,
805 BailoutId ast_id) OVERRIDE; 805 BailoutId ast_id) V8_OVERRIDE;
806 virtual void ReturnControl(HControlInstruction* instr, 806 virtual void ReturnControl(HControlInstruction* instr,
807 BailoutId ast_id) OVERRIDE; 807 BailoutId ast_id) V8_OVERRIDE;
808 virtual void ReturnContinuation(HIfContinuation* continuation, 808 virtual void ReturnContinuation(HIfContinuation* continuation,
809 BailoutId ast_id) OVERRIDE; 809 BailoutId ast_id) V8_OVERRIDE;
810 }; 810 };
811 811
812 812
813 class ValueContext FINAL : public AstContext { 813 class ValueContext V8_FINAL : public AstContext {
814 public: 814 public:
815 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) 815 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag)
816 : AstContext(owner, Expression::kValue), flag_(flag) { 816 : AstContext(owner, Expression::kValue), flag_(flag) {
817 } 817 }
818 virtual ~ValueContext(); 818 virtual ~ValueContext();
819 819
820 virtual void ReturnValue(HValue* value) OVERRIDE; 820 virtual void ReturnValue(HValue* value) V8_OVERRIDE;
821 virtual void ReturnInstruction(HInstruction* instr, 821 virtual void ReturnInstruction(HInstruction* instr,
822 BailoutId ast_id) OVERRIDE; 822 BailoutId ast_id) V8_OVERRIDE;
823 virtual void ReturnControl(HControlInstruction* instr, 823 virtual void ReturnControl(HControlInstruction* instr,
824 BailoutId ast_id) OVERRIDE; 824 BailoutId ast_id) V8_OVERRIDE;
825 virtual void ReturnContinuation(HIfContinuation* continuation, 825 virtual void ReturnContinuation(HIfContinuation* continuation,
826 BailoutId ast_id) OVERRIDE; 826 BailoutId ast_id) V8_OVERRIDE;
827 827
828 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } 828 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; }
829 829
830 private: 830 private:
831 ArgumentsAllowedFlag flag_; 831 ArgumentsAllowedFlag flag_;
832 }; 832 };
833 833
834 834
835 class TestContext FINAL : public AstContext { 835 class TestContext V8_FINAL : public AstContext {
836 public: 836 public:
837 TestContext(HOptimizedGraphBuilder* owner, 837 TestContext(HOptimizedGraphBuilder* owner,
838 Expression* condition, 838 Expression* condition,
839 HBasicBlock* if_true, 839 HBasicBlock* if_true,
840 HBasicBlock* if_false) 840 HBasicBlock* if_false)
841 : AstContext(owner, Expression::kTest), 841 : AstContext(owner, Expression::kTest),
842 condition_(condition), 842 condition_(condition),
843 if_true_(if_true), 843 if_true_(if_true),
844 if_false_(if_false) { 844 if_false_(if_false) {
845 } 845 }
846 846
847 virtual void ReturnValue(HValue* value) OVERRIDE; 847 virtual void ReturnValue(HValue* value) V8_OVERRIDE;
848 virtual void ReturnInstruction(HInstruction* instr, 848 virtual void ReturnInstruction(HInstruction* instr,
849 BailoutId ast_id) OVERRIDE; 849 BailoutId ast_id) V8_OVERRIDE;
850 virtual void ReturnControl(HControlInstruction* instr, 850 virtual void ReturnControl(HControlInstruction* instr,
851 BailoutId ast_id) OVERRIDE; 851 BailoutId ast_id) V8_OVERRIDE;
852 virtual void ReturnContinuation(HIfContinuation* continuation, 852 virtual void ReturnContinuation(HIfContinuation* continuation,
853 BailoutId ast_id) OVERRIDE; 853 BailoutId ast_id) V8_OVERRIDE;
854 854
855 static TestContext* cast(AstContext* context) { 855 static TestContext* cast(AstContext* context) {
856 ASSERT(context->IsTest()); 856 ASSERT(context->IsTest());
857 return reinterpret_cast<TestContext*>(context); 857 return reinterpret_cast<TestContext*>(context);
858 } 858 }
859 859
860 Expression* condition() const { return condition_; } 860 Expression* condition() const { return condition_; }
861 HBasicBlock* if_true() const { return if_true_; } 861 HBasicBlock* if_true() const { return if_true_; }
862 HBasicBlock* if_false() const { return if_false_; } 862 HBasicBlock* if_false() const { return if_false_; }
863 863
864 private: 864 private:
865 // Build the shared core part of the translation unpacking a value into 865 // Build the shared core part of the translation unpacking a value into
866 // control flow. 866 // control flow.
867 void BuildBranch(HValue* value); 867 void BuildBranch(HValue* value);
868 868
869 Expression* condition_; 869 Expression* condition_;
870 HBasicBlock* if_true_; 870 HBasicBlock* if_true_;
871 HBasicBlock* if_false_; 871 HBasicBlock* if_false_;
872 }; 872 };
873 873
874 874
875 class FunctionState FINAL { 875 class FunctionState V8_FINAL {
876 public: 876 public:
877 FunctionState(HOptimizedGraphBuilder* owner, 877 FunctionState(HOptimizedGraphBuilder* owner,
878 CompilationInfo* info, 878 CompilationInfo* info,
879 InliningKind inlining_kind); 879 InliningKind inlining_kind);
880 ~FunctionState(); 880 ~FunctionState();
881 881
882 CompilationInfo* compilation_info() { return compilation_info_; } 882 CompilationInfo* compilation_info() { return compilation_info_; }
883 AstContext* call_context() { return call_context_; } 883 AstContext* call_context() { return call_context_; }
884 InliningKind inlining_kind() const { return inlining_kind_; } 884 InliningKind inlining_kind() const { return inlining_kind_; }
885 HBasicBlock* function_return() { return function_return_; } 885 HBasicBlock* function_return() { return function_return_; }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 // entry. 932 // entry.
933 HEnterInlined* entry_; 933 HEnterInlined* entry_;
934 934
935 HArgumentsObject* arguments_object_; 935 HArgumentsObject* arguments_object_;
936 HArgumentsElements* arguments_elements_; 936 HArgumentsElements* arguments_elements_;
937 937
938 FunctionState* outer_; 938 FunctionState* outer_;
939 }; 939 };
940 940
941 941
942 class HIfContinuation FINAL { 942 class HIfContinuation V8_FINAL {
943 public: 943 public:
944 HIfContinuation() { continuation_captured_ = false; } 944 HIfContinuation() { continuation_captured_ = false; }
945 ~HIfContinuation() { ASSERT(!continuation_captured_); } 945 ~HIfContinuation() { ASSERT(!continuation_captured_); }
946 946
947 void Capture(HBasicBlock* true_branch, 947 void Capture(HBasicBlock* true_branch,
948 HBasicBlock* false_branch, 948 HBasicBlock* false_branch,
949 int position) { 949 int position) {
950 ASSERT(!continuation_captured_); 950 ASSERT(!continuation_captured_);
951 true_branch_ = true_branch; 951 true_branch_ = true_branch;
952 false_branch_ = false_branch; 952 false_branch_ = false_branch;
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); 1271 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected);
1272 1272
1273 void PushAndAdd(HInstruction* instr); 1273 void PushAndAdd(HInstruction* instr);
1274 1274
1275 void FinishExitWithHardDeoptimization(const char* reason, 1275 void FinishExitWithHardDeoptimization(const char* reason,
1276 HBasicBlock* continuation); 1276 HBasicBlock* continuation);
1277 1277
1278 void AddIncrementCounter(StatsCounter* counter, 1278 void AddIncrementCounter(StatsCounter* counter,
1279 HValue* context); 1279 HValue* context);
1280 1280
1281 class IfBuilder FINAL { 1281 class IfBuilder V8_FINAL {
1282 public: 1282 public:
1283 explicit IfBuilder(HGraphBuilder* builder, 1283 explicit IfBuilder(HGraphBuilder* builder,
1284 int position = RelocInfo::kNoPosition); 1284 int position = RelocInfo::kNoPosition);
1285 IfBuilder(HGraphBuilder* builder, 1285 IfBuilder(HGraphBuilder* builder,
1286 HIfContinuation* continuation); 1286 HIfContinuation* continuation);
1287 1287
1288 ~IfBuilder() { 1288 ~IfBuilder() {
1289 if (!finished_) End(); 1289 if (!finished_) End();
1290 } 1290 }
1291 1291
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 bool did_or_ : 1; 1401 bool did_or_ : 1;
1402 bool captured_ : 1; 1402 bool captured_ : 1;
1403 bool needs_compare_ : 1; 1403 bool needs_compare_ : 1;
1404 HBasicBlock* first_true_block_; 1404 HBasicBlock* first_true_block_;
1405 HBasicBlock* last_true_block_; 1405 HBasicBlock* last_true_block_;
1406 HBasicBlock* first_false_block_; 1406 HBasicBlock* first_false_block_;
1407 HBasicBlock* split_edge_merge_block_; 1407 HBasicBlock* split_edge_merge_block_;
1408 HBasicBlock* merge_block_; 1408 HBasicBlock* merge_block_;
1409 }; 1409 };
1410 1410
1411 class LoopBuilder FINAL { 1411 class LoopBuilder V8_FINAL {
1412 public: 1412 public:
1413 enum Direction { 1413 enum Direction {
1414 kPreIncrement, 1414 kPreIncrement,
1415 kPostIncrement, 1415 kPostIncrement,
1416 kPreDecrement, 1416 kPreDecrement,
1417 kPostDecrement 1417 kPostDecrement
1418 }; 1418 };
1419 1419
1420 LoopBuilder(HGraphBuilder* builder, 1420 LoopBuilder(HGraphBuilder* builder,
1421 HValue* context, 1421 HValue* context,
(...skipping 20 matching lines...) Expand all
1442 HBasicBlock* exit_block_; 1442 HBasicBlock* exit_block_;
1443 Direction direction_; 1443 Direction direction_;
1444 bool finished_; 1444 bool finished_;
1445 }; 1445 };
1446 1446
1447 HValue* BuildNewElementsCapacity(HValue* old_capacity); 1447 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1448 1448
1449 void BuildNewSpaceArrayCheck(HValue* length, 1449 void BuildNewSpaceArrayCheck(HValue* length,
1450 ElementsKind kind); 1450 ElementsKind kind);
1451 1451
1452 class JSArrayBuilder FINAL { 1452 class JSArrayBuilder V8_FINAL {
1453 public: 1453 public:
1454 JSArrayBuilder(HGraphBuilder* builder, 1454 JSArrayBuilder(HGraphBuilder* builder,
1455 ElementsKind kind, 1455 ElementsKind kind,
1456 HValue* allocation_site_payload, 1456 HValue* allocation_site_payload,
1457 HValue* constructor_function, 1457 HValue* constructor_function,
1458 AllocationSiteOverrideMode override_mode); 1458 AllocationSiteOverrideMode override_mode);
1459 1459
1460 JSArrayBuilder(HGraphBuilder* builder, 1460 JSArrayBuilder(HGraphBuilder* builder,
1461 ElementsKind kind, 1461 ElementsKind kind,
1462 HValue* constructor_function); 1462 HValue* constructor_function);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 return AddUncasted<HReturn>(static_cast<HValue*>(value)); 1641 return AddUncasted<HReturn>(static_cast<HValue*>(value));
1642 } 1642 }
1643 1643
1644 1644
1645 template<> 1645 template<>
1646 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { 1646 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
1647 return HContext::New(zone()); 1647 return HContext::New(zone());
1648 } 1648 }
1649 1649
1650 1650
1651 class HOptimizedGraphBuilder FINAL : public HGraphBuilder, public AstVisitor { 1651 class HOptimizedGraphBuilder V8_FINAL
1652 : public HGraphBuilder, public AstVisitor {
1652 public: 1653 public:
1653 // A class encapsulating (lazily-allocated) break and continue blocks for 1654 // A class encapsulating (lazily-allocated) break and continue blocks for
1654 // a breakable statement. Separated from BreakAndContinueScope so that it 1655 // a breakable statement. Separated from BreakAndContinueScope so that it
1655 // can have a separate lifetime. 1656 // can have a separate lifetime.
1656 class BreakAndContinueInfo FINAL BASE_EMBEDDED { 1657 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED {
1657 public: 1658 public:
1658 explicit BreakAndContinueInfo(BreakableStatement* target, 1659 explicit BreakAndContinueInfo(BreakableStatement* target,
1659 int drop_extra = 0) 1660 int drop_extra = 0)
1660 : target_(target), 1661 : target_(target),
1661 break_block_(NULL), 1662 break_block_(NULL),
1662 continue_block_(NULL), 1663 continue_block_(NULL),
1663 drop_extra_(drop_extra) { 1664 drop_extra_(drop_extra) {
1664 } 1665 }
1665 1666
1666 BreakableStatement* target() { return target_; } 1667 BreakableStatement* target() { return target_; }
1667 HBasicBlock* break_block() { return break_block_; } 1668 HBasicBlock* break_block() { return break_block_; }
1668 void set_break_block(HBasicBlock* block) { break_block_ = block; } 1669 void set_break_block(HBasicBlock* block) { break_block_ = block; }
1669 HBasicBlock* continue_block() { return continue_block_; } 1670 HBasicBlock* continue_block() { return continue_block_; }
1670 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } 1671 void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
1671 int drop_extra() { return drop_extra_; } 1672 int drop_extra() { return drop_extra_; }
1672 1673
1673 private: 1674 private:
1674 BreakableStatement* target_; 1675 BreakableStatement* target_;
1675 HBasicBlock* break_block_; 1676 HBasicBlock* break_block_;
1676 HBasicBlock* continue_block_; 1677 HBasicBlock* continue_block_;
1677 int drop_extra_; 1678 int drop_extra_;
1678 }; 1679 };
1679 1680
1680 // A helper class to maintain a stack of current BreakAndContinueInfo 1681 // A helper class to maintain a stack of current BreakAndContinueInfo
1681 // structures mirroring BreakableStatement nesting. 1682 // structures mirroring BreakableStatement nesting.
1682 class BreakAndContinueScope FINAL BASE_EMBEDDED { 1683 class BreakAndContinueScope V8_FINAL BASE_EMBEDDED {
1683 public: 1684 public:
1684 BreakAndContinueScope(BreakAndContinueInfo* info, 1685 BreakAndContinueScope(BreakAndContinueInfo* info,
1685 HOptimizedGraphBuilder* owner) 1686 HOptimizedGraphBuilder* owner)
1686 : info_(info), owner_(owner), next_(owner->break_scope()) { 1687 : info_(info), owner_(owner), next_(owner->break_scope()) {
1687 owner->set_break_scope(this); 1688 owner->set_break_scope(this);
1688 } 1689 }
1689 1690
1690 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } 1691 ~BreakAndContinueScope() { owner_->set_break_scope(next_); }
1691 1692
1692 BreakAndContinueInfo* info() { return info_; } 1693 BreakAndContinueInfo* info() { return info_; }
1693 HOptimizedGraphBuilder* owner() { return owner_; } 1694 HOptimizedGraphBuilder* owner() { return owner_; }
1694 BreakAndContinueScope* next() { return next_; } 1695 BreakAndContinueScope* next() { return next_; }
1695 1696
1696 // Search the break stack for a break or continue target. 1697 // Search the break stack for a break or continue target.
1697 enum BreakType { BREAK, CONTINUE }; 1698 enum BreakType { BREAK, CONTINUE };
1698 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); 1699 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra);
1699 1700
1700 private: 1701 private:
1701 BreakAndContinueInfo* info_; 1702 BreakAndContinueInfo* info_;
1702 HOptimizedGraphBuilder* owner_; 1703 HOptimizedGraphBuilder* owner_;
1703 BreakAndContinueScope* next_; 1704 BreakAndContinueScope* next_;
1704 }; 1705 };
1705 1706
1706 explicit HOptimizedGraphBuilder(CompilationInfo* info); 1707 explicit HOptimizedGraphBuilder(CompilationInfo* info);
1707 1708
1708 virtual bool BuildGraph() OVERRIDE; 1709 virtual bool BuildGraph() V8_OVERRIDE;
1709 1710
1710 // Simple accessors. 1711 // Simple accessors.
1711 BreakAndContinueScope* break_scope() const { return break_scope_; } 1712 BreakAndContinueScope* break_scope() const { return break_scope_; }
1712 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 1713 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
1713 1714
1714 bool inline_bailout() { return inline_bailout_; } 1715 bool inline_bailout() { return inline_bailout_; }
1715 1716
1716 HValue* context() { return environment()->context(); } 1717 HValue* context() { return environment()->context(); }
1717 1718
1718 void Bailout(BailoutReason reason); 1719 void Bailout(BailoutReason reason);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 void VisitArgumentList(ZoneList<Expression*>* arguments); 1885 void VisitArgumentList(ZoneList<Expression*>* arguments);
1885 1886
1886 // Visit a list of expressions from left to right, each in a value context. 1887 // Visit a list of expressions from left to right, each in a value context.
1887 void VisitExpressions(ZoneList<Expression*>* exprs); 1888 void VisitExpressions(ZoneList<Expression*>* exprs);
1888 1889
1889 // Remove the arguments from the bailout environment and emit instructions 1890 // Remove the arguments from the bailout environment and emit instructions
1890 // to push them as outgoing parameters. 1891 // to push them as outgoing parameters.
1891 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); 1892 template <class Instruction> HInstruction* PreProcessCall(Instruction* call);
1892 1893
1893 void SetUpScope(Scope* scope); 1894 void SetUpScope(Scope* scope);
1894 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; 1895 virtual void VisitStatements(ZoneList<Statement*>* statements) V8_OVERRIDE;
1895 1896
1896 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; 1897 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) V8_OVERRIDE;
1897 AST_NODE_LIST(DECLARE_VISIT) 1898 AST_NODE_LIST(DECLARE_VISIT)
1898 #undef DECLARE_VISIT 1899 #undef DECLARE_VISIT
1899 1900
1900 // Helpers for flow graph construction. 1901 // Helpers for flow graph construction.
1901 enum GlobalPropertyAccess { 1902 enum GlobalPropertyAccess {
1902 kUseCell, 1903 kUseCell,
1903 kUseGeneric 1904 kUseGeneric
1904 }; 1905 };
1905 GlobalPropertyAccess LookupGlobalProperty(Variable* var, 1906 GlobalPropertyAccess LookupGlobalProperty(Variable* var,
1906 LookupResult* lookup, 1907 LookupResult* lookup,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 friend class KeyedLoadFastElementStub; 2166 friend class KeyedLoadFastElementStub;
2166 friend class HOsrBuilder; 2167 friend class HOsrBuilder;
2167 2168
2168 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); 2169 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);
2169 }; 2170 };
2170 2171
2171 2172
2172 Zone* AstContext::zone() const { return owner_->zone(); } 2173 Zone* AstContext::zone() const { return owner_->zone(); }
2173 2174
2174 2175
2175 class HStatistics FINAL: public Malloced { 2176 class HStatistics V8_FINAL: public Malloced {
2176 public: 2177 public:
2177 HStatistics() 2178 HStatistics()
2178 : timing_(5), 2179 : timing_(5),
2179 names_(5), 2180 names_(5),
2180 sizes_(5), 2181 sizes_(5),
2181 create_graph_(0), 2182 create_graph_(0),
2182 optimize_graph_(0), 2183 optimize_graph_(0),
2183 generate_code_(0), 2184 generate_code_(0),
2184 total_size_(0), 2185 total_size_(0),
2185 full_code_gen_(0), 2186 full_code_gen_(0),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 protected: 2225 protected:
2225 HGraph* graph() const { return graph_; } 2226 HGraph* graph() const { return graph_; }
2226 2227
2227 private: 2228 private:
2228 HGraph* graph_; 2229 HGraph* graph_;
2229 2230
2230 DISALLOW_COPY_AND_ASSIGN(HPhase); 2231 DISALLOW_COPY_AND_ASSIGN(HPhase);
2231 }; 2232 };
2232 2233
2233 2234
2234 class HTracer FINAL : public Malloced { 2235 class HTracer V8_FINAL : public Malloced {
2235 public: 2236 public:
2236 explicit HTracer(int isolate_id) 2237 explicit HTracer(int isolate_id)
2237 : trace_(&string_allocator_), indent_(0) { 2238 : trace_(&string_allocator_), indent_(0) {
2238 if (FLAG_trace_hydrogen_file == NULL) { 2239 if (FLAG_trace_hydrogen_file == NULL) {
2239 OS::SNPrintF(filename_, 2240 OS::SNPrintF(filename_,
2240 "hydrogen-%d-%d.cfg", 2241 "hydrogen-%d-%d.cfg",
2241 OS::GetCurrentProcessId(), 2242 OS::GetCurrentProcessId(),
2242 isolate_id); 2243 isolate_id);
2243 } else { 2244 } else {
2244 OS::StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length()); 2245 OS::StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
2245 } 2246 }
2246 WriteChars(filename_.start(), "", 0, false); 2247 WriteChars(filename_.start(), "", 0, false);
2247 } 2248 }
2248 2249
2249 void TraceCompilation(CompilationInfo* info); 2250 void TraceCompilation(CompilationInfo* info);
2250 void TraceHydrogen(const char* name, HGraph* graph); 2251 void TraceHydrogen(const char* name, HGraph* graph);
2251 void TraceLithium(const char* name, LChunk* chunk); 2252 void TraceLithium(const char* name, LChunk* chunk);
2252 void TraceLiveRanges(const char* name, LAllocator* allocator); 2253 void TraceLiveRanges(const char* name, LAllocator* allocator);
2253 2254
2254 private: 2255 private:
2255 class Tag FINAL BASE_EMBEDDED { 2256 class Tag V8_FINAL BASE_EMBEDDED {
2256 public: 2257 public:
2257 Tag(HTracer* tracer, const char* name) { 2258 Tag(HTracer* tracer, const char* name) {
2258 name_ = name; 2259 name_ = name;
2259 tracer_ = tracer; 2260 tracer_ = tracer;
2260 tracer->PrintIndent(); 2261 tracer->PrintIndent();
2261 tracer->trace_.Add("begin_%s\n", name); 2262 tracer->trace_.Add("begin_%s\n", name);
2262 tracer->indent_++; 2263 tracer->indent_++;
2263 } 2264 }
2264 2265
2265 ~Tag() { 2266 ~Tag() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 } 2311 }
2311 } 2312 }
2312 2313
2313 EmbeddedVector<char, 64> filename_; 2314 EmbeddedVector<char, 64> filename_;
2314 HeapStringAllocator string_allocator_; 2315 HeapStringAllocator string_allocator_;
2315 StringStream trace_; 2316 StringStream trace_;
2316 int indent_; 2317 int indent_;
2317 }; 2318 };
2318 2319
2319 2320
2320 class NoObservableSideEffectsScope FINAL { 2321 class NoObservableSideEffectsScope V8_FINAL {
2321 public: 2322 public:
2322 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) : 2323 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
2323 builder_(builder) { 2324 builder_(builder) {
2324 builder_->graph()->IncrementInNoSideEffectsScope(); 2325 builder_->graph()->IncrementInNoSideEffectsScope();
2325 } 2326 }
2326 ~NoObservableSideEffectsScope() { 2327 ~NoObservableSideEffectsScope() {
2327 builder_->graph()->DecrementInNoSideEffectsScope(); 2328 builder_->graph()->DecrementInNoSideEffectsScope();
2328 } 2329 }
2329 2330
2330 private: 2331 private:
2331 HGraphBuilder* builder_; 2332 HGraphBuilder* builder_;
2332 }; 2333 };
2333 2334
2334 2335
2335 } } // namespace v8::internal 2336 } } // namespace v8::internal
2336 2337
2337 #endif // V8_HYDROGEN_H_ 2338 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698