Author: [email protected]
Date: Mon Mar 9 07:48:34 2009
New Revision: 1456
Modified:
branches/bleeding_edge/src/ast.h
branches/bleeding_edge/src/codegen.cc
Log:
Assert in debug mode that we do not try to compile a function literal
more than once.
Review URL: http://codereview.chromium.org/39339
Modified: branches/bleeding_edge/src/ast.h
==============================================================================
--- branches/bleeding_edge/src/ast.h (original)
+++ branches/bleeding_edge/src/ast.h Mon Mar 9 07:48:34 2009
@@ -1197,6 +1197,9 @@
is_expression_(is_expression),
loop_nesting_(0),
function_token_position_(RelocInfo::kNoPosition) {
+#ifdef DEBUG
+ already_compiled_ = false;
+#endif
}
virtual void Accept(AstVisitor* v);
@@ -1223,6 +1226,13 @@
bool loop_nesting() const { return loop_nesting_; }
void set_loop_nesting(int nesting) { loop_nesting_ = nesting; }
+#ifdef DEBUG
+ void mark_as_compiled() {
+ ASSERT(!already_compiled_);
+ already_compiled_ = true;
+ }
+#endif
+
private:
Handle<String> name_;
Scope* scope_;
@@ -1236,6 +1246,9 @@
bool is_expression_;
int loop_nesting_;
int function_token_position_;
+#ifdef DEBUG
+ bool already_compiled_;
+#endif
};
Modified: branches/bleeding_edge/src/codegen.cc
==============================================================================
--- branches/bleeding_edge/src/codegen.cc (original)
+++ branches/bleeding_edge/src/codegen.cc Mon Mar 9 07:48:34 2009
@@ -237,6 +237,12 @@
Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) {
+#ifdef DEBUG
+ // We should not try to compile the same function literal more than
+ // once.
+ node->mark_as_compiled();
+#endif
+
// Determine if the function can be lazily compiled. This is
// necessary to allow some of our builtin JS files to be lazily
// compiled. These builtins cannot be handled lazily by the parser,
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---