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

Unified Diff: src/full-codegen.h

Issue 9752002: This patch is an effort to simplify cascading jumps to return label in such case: Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.h
===================================================================
--- src/full-codegen.h (revision 11089)
+++ src/full-codegen.h (working copy)
@@ -91,7 +91,8 @@
type_feedback_cells_(info->HasDeoptimizationSupport()
? info->function()->ast_node_count() : 0),
ic_total_count_(0),
- has_self_optimization_header_(false) { }
+ has_self_optimization_header_(false),
+ immediate_return_enabled_(false) { }
static bool MakeCode(CompilationInfo* info);
@@ -562,6 +563,8 @@
FunctionLiteral* function() { return info_->function(); }
Scope* scope() { return scope_; }
+ bool immediate_return_enabled() { return immediate_return_enabled_; }
+
static Register result_register();
static Register context_register();
@@ -666,6 +669,9 @@
// it. Only used for asserts.
virtual bool IsTest() const { return false; }
+ // Returns true if we are branching on the value that can be returned.
+ virtual bool IsReturnable() const { return false; }
+
protected:
FullCodeGenerator* codegen() const { return codegen_; }
MacroAssembler* masm() const { return masm_; }
@@ -695,6 +701,9 @@
Label** if_false,
Label** fall_through) const;
virtual bool IsAccumulatorValue() const { return true; }
+ virtual bool IsReturnable() const {
+ return codegen()->immediate_return_enabled();
+ }
};
class StackValueContext : public ExpressionContext {
@@ -784,6 +793,36 @@
virtual bool IsEffect() const { return true; }
};
+ class ImmediateReturnEnabled {
+ public:
+ explicit ImmediateReturnEnabled(FullCodeGenerator* codegen)
+ : codegen_(codegen), old_(codegen->immediate_return_enabled_) {
+ codegen_->immediate_return_enabled_ = true;
+ }
+ virtual ~ImmediateReturnEnabled() {
+ codegen_->immediate_return_enabled_ = old_;
+ }
+
+ private:
+ FullCodeGenerator* codegen_;
+ bool old_;
+ };
+
+ class ImmediateReturnDisabled {
+ public:
+ explicit ImmediateReturnDisabled(FullCodeGenerator* codegen)
+ : codegen_(codegen), old_(codegen->immediate_return_enabled_) {
+ codegen_->immediate_return_enabled_ = false;
+ }
+ virtual ~ImmediateReturnDisabled() {
+ codegen_->immediate_return_enabled_ = old_;
+ }
+
+ private:
+ FullCodeGenerator* codegen_;
+ bool old_;
+ };
+
MacroAssembler* masm_;
CompilationInfo* info_;
Scope* scope_;
@@ -799,6 +838,7 @@
bool has_self_optimization_header_;
Handle<FixedArray> handler_table_;
Handle<JSGlobalPropertyCell> profiling_counter_;
+ bool immediate_return_enabled_;
friend class NestedStatement;
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698