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

Side by Side Diff: src/hydrogen.h

Issue 20680002: Rebase of partial ia32 implementation of optimized try/catch (started by Kevin Millikin, continued … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix detection of CATCH frames (fixes debuger exception reporting anf breaks another assertion...). 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/full-codegen.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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 bool ExpressionStackIsEmpty() const; 592 bool ExpressionStackIsEmpty() const;
593 593
594 HValue* ExpressionStackAt(int index_from_top) const { 594 HValue* ExpressionStackAt(int index_from_top) const {
595 int index = length() - index_from_top - 1; 595 int index = length() - index_from_top - 1;
596 ASSERT(HasExpressionAt(index)); 596 ASSERT(HasExpressionAt(index));
597 return values_[index]; 597 return values_[index];
598 } 598 }
599 599
600 void SetExpressionStackAt(int index_from_top, HValue* value); 600 void SetExpressionStackAt(int index_from_top, HValue* value);
601 601
602 int handler_count() { return handler_count_; }
603 void AddExceptionHandler() { ++handler_count_; }
604 void RemoveExceptionHandler() {
605 ASSERT(handler_count_ > 0);
606 --handler_count_;
607 }
608
602 HEnvironment* Copy() const; 609 HEnvironment* Copy() const;
603 HEnvironment* CopyWithoutHistory() const; 610 HEnvironment* CopyWithoutHistory() const;
604 HEnvironment* CopyAsLoopHeader(HBasicBlock* block) const; 611 HEnvironment* CopyAsLoopHeader(HBasicBlock* block) const;
605 612
606 // Create an "inlined version" of this environment, where the original 613 // Create an "inlined version" of this environment, where the original
607 // environment is the outer environment but the top expression stack 614 // environment is the outer environment but the top expression stack
608 // elements are moved to an inner environment as parameters. 615 // elements are moved to an inner environment as parameters.
609 HEnvironment* CopyForInlining(Handle<JSFunction> target, 616 HEnvironment* CopyForInlining(Handle<JSFunction> target,
610 int arguments, 617 int arguments,
611 FunctionLiteral* function, 618 FunctionLiteral* function,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 void Initialize(const HEnvironment* other); 692 void Initialize(const HEnvironment* other);
686 693
687 Handle<JSFunction> closure_; 694 Handle<JSFunction> closure_;
688 // Value array [parameters] [specials] [locals] [temporaries]. 695 // Value array [parameters] [specials] [locals] [temporaries].
689 ZoneList<HValue*> values_; 696 ZoneList<HValue*> values_;
690 GrowableBitVector assigned_variables_; 697 GrowableBitVector assigned_variables_;
691 FrameType frame_type_; 698 FrameType frame_type_;
692 int parameter_count_; 699 int parameter_count_;
693 int specials_count_; 700 int specials_count_;
694 int local_count_; 701 int local_count_;
702 int handler_count_;
695 HEnvironment* outer_; 703 HEnvironment* outer_;
696 HEnterInlined* entry_; 704 HEnterInlined* entry_;
697 int pop_count_; 705 int pop_count_;
698 int push_count_; 706 int push_count_;
699 BailoutId ast_id_; 707 BailoutId ast_id_;
700 Zone* zone_; 708 Zone* zone_;
701 }; 709 };
702 710
703 711
704 class HInferRepresentation BASE_EMBEDDED { 712 class HInferRepresentation BASE_EMBEDDED {
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 }; 1390 };
1383 1391
1384 1392
1385 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { 1393 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
1386 public: 1394 public:
1387 // A class encapsulating (lazily-allocated) break and continue blocks for 1395 // A class encapsulating (lazily-allocated) break and continue blocks for
1388 // a breakable statement. Separated from BreakAndContinueScope so that it 1396 // a breakable statement. Separated from BreakAndContinueScope so that it
1389 // can have a separate lifetime. 1397 // can have a separate lifetime.
1390 class BreakAndContinueInfo BASE_EMBEDDED { 1398 class BreakAndContinueInfo BASE_EMBEDDED {
1391 public: 1399 public:
1392 explicit BreakAndContinueInfo(BreakableStatement* target, 1400 BreakAndContinueInfo(Statement* statement, int drop_extra)
1393 int drop_extra = 0) 1401 : statement_(statement),
1394 : target_(target),
1395 break_block_(NULL), 1402 break_block_(NULL),
1396 continue_block_(NULL), 1403 continue_block_(NULL),
1397 drop_extra_(drop_extra) { 1404 drop_extra_(drop_extra) {
1398 } 1405 }
1399 1406
1400 BreakableStatement* target() { return target_; } 1407 Statement* statement() { return statement_; }
1408
1401 HBasicBlock* break_block() { return break_block_; } 1409 HBasicBlock* break_block() { return break_block_; }
1402 void set_break_block(HBasicBlock* block) { break_block_ = block; } 1410 void set_break_block(HBasicBlock* block) { break_block_ = block; }
1403 HBasicBlock* continue_block() { return continue_block_; } 1411 HBasicBlock* continue_block() { return continue_block_; }
1404 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } 1412 void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
1405 int drop_extra() { return drop_extra_; } 1413 int drop_extra() { return drop_extra_; }
1406 1414
1407 private: 1415 private:
1408 BreakableStatement* target_; 1416 Statement* statement_;
1409 HBasicBlock* break_block_; 1417 HBasicBlock* break_block_;
1410 HBasicBlock* continue_block_; 1418 HBasicBlock* continue_block_;
1411 int drop_extra_; 1419 int drop_extra_;
1412 }; 1420 };
1413 1421
1414 // A helper class to maintain a stack of current BreakAndContinueInfo 1422 // A helper class to maintain a stack of current BreakAndContinueInfo
1415 // structures mirroring BreakableStatement nesting. 1423 // structures mirroring BreakableStatement nesting.
1416 class BreakAndContinueScope BASE_EMBEDDED { 1424 class BreakAndContinueScope BASE_EMBEDDED {
1417 public: 1425 public:
1418 BreakAndContinueScope(BreakAndContinueInfo* info, 1426 BreakAndContinueScope(BreakAndContinueInfo* info,
1419 HOptimizedGraphBuilder* owner) 1427 HOptimizedGraphBuilder* owner)
1420 : info_(info), owner_(owner), next_(owner->break_scope()) { 1428 : info_(info), owner_(owner), next_(owner->break_scope()) {
1421 owner->set_break_scope(this); 1429 owner->set_break_scope(this);
1422 } 1430 }
1423 1431
1424 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } 1432 ~BreakAndContinueScope() { owner_->set_break_scope(next_); }
1425 1433
1426 BreakAndContinueInfo* info() { return info_; } 1434 BreakAndContinueInfo* info() { return info_; }
1427 HOptimizedGraphBuilder* owner() { return owner_; } 1435 HOptimizedGraphBuilder* owner() { return owner_; }
1428 BreakAndContinueScope* next() { return next_; } 1436 BreakAndContinueScope* next() { return next_; }
1429 1437
1430 // Search the break stack for a break or continue target.
1431 enum BreakType { BREAK, CONTINUE }; 1438 enum BreakType { BREAK, CONTINUE };
1432 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, int* drop_extra); 1439
1440 // Search the break stack for a break or continue target, emit any
1441 // instructions necessary to unwind the break stack and emit a jump to
1442 // the target block.
1443 void Unwind(BreakableStatement* target, BreakType type);
1444
1445 // Unwind the entire break stack for returning from the function.
1446 void UnwindReturn();
1433 1447
1434 private: 1448 private:
1435 BreakAndContinueInfo* info_; 1449 BreakAndContinueInfo* info_;
1436 HOptimizedGraphBuilder* owner_; 1450 HOptimizedGraphBuilder* owner_;
1437 BreakAndContinueScope* next_; 1451 BreakAndContinueScope* next_;
1438 }; 1452 };
1439 1453
1440 explicit HOptimizedGraphBuilder(CompilationInfo* info); 1454 explicit HOptimizedGraphBuilder(CompilationInfo* info);
1441 1455
1442 virtual bool BuildGraph(); 1456 virtual bool BuildGraph();
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 EmbeddedVector<char, 64> filename_; 2065 EmbeddedVector<char, 64> filename_;
2052 HeapStringAllocator string_allocator_; 2066 HeapStringAllocator string_allocator_;
2053 StringStream trace_; 2067 StringStream trace_;
2054 int indent_; 2068 int indent_;
2055 }; 2069 };
2056 2070
2057 2071
2058 } } // namespace v8::internal 2072 } } // namespace v8::internal
2059 2073
2060 #endif // V8_HYDROGEN_H_ 2074 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698