Make sure that ParsedFunction holds onto zone handles.

Review URL: https://codereview.chromium.org//11364166

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14718 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
srdjan@google.com
2012-11-09 00:58:21 +00:00
parent 73f6d857a5
commit 2fdbeb2153
5 changed files with 13 additions and 9 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ CODEGEN_TEST_GENERATE(StackmapCodegen, test) {
Class& cls = Class::ZoneHandle();
const Script& script = Script::Handle();
cls = Class::New(function_name, script, Scanner::kDummyTokenIndex);
const Function& function = Function::Handle(
const Function& function = Function::ZoneHandle(
Function::New(function_name, RawFunction::kRegularFunction,
true, false, false, false, cls, 0));
function.set_result_type(Type::Handle(Type::DynamicType()));
@@ -45,7 +45,7 @@ CODEGEN_TEST_GENERATE(StackmapCodegen, test) {
test->node_sequence()->Add(new ReturnNode(kPos, l));
parsed_function->SetNodeSequence(test->node_sequence());
parsed_function->set_instantiator(NULL);
parsed_function->set_default_parameter_values(Array::Handle());
parsed_function->set_default_parameter_values(Array::ZoneHandle());
parsed_function->AllocateVariables();
bool retval;
Isolate* isolate = Isolate::Current();
+4 -3
View File
@@ -435,7 +435,8 @@ static RawError* CompileFunctionHelper(const Function& function,
TIMERSCOPE(time_compilation);
Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
per_compile_timer.Start();
ParsedFunction* parsed_function = new ParsedFunction(function);
ParsedFunction* parsed_function = new ParsedFunction(
Function::ZoneHandle(function.raw()));
if (FLAG_trace_compiler) {
OS::Print("Compiling %sfunction: '%s' @ token %"Pd"\n",
(optimized ? "optimized " : ""),
@@ -561,7 +562,7 @@ RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
// The function needs to be associated with a named Class: the interface
// Function fits the bill.
const char* kEvalConst = "eval_const";
const Function& func = Function::Handle(Function::New(
const Function& func = Function::ZoneHandle(Function::New(
String::Handle(Symbols::New(kEvalConst)),
RawFunction::kConstImplicitGetter,
true, // static function.
@@ -582,7 +583,7 @@ RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
// here.
ParsedFunction* parsed_function = new ParsedFunction(func);
parsed_function->SetNodeSequence(fragment);
parsed_function->set_default_parameter_values(Array::Handle());
parsed_function->set_default_parameter_values(Array::ZoneHandle());
parsed_function->set_expression_temp_var(
ParsedFunction::CreateExpressionTempVar(0));
fragment->scope()->AddVariable(parsed_function->expression_temp_var());
+1 -1
View File
@@ -772,7 +772,7 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
const Script& script = Script::Handle(isolate, func.script());
Parser parser(script, func, func.token_pos());
SequenceNode* node_sequence = NULL;
Array& default_parameter_values = Array::Handle(isolate, Array::null());
Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null());
switch (func.kind()) {
case RawFunction::kRegularFunction:
case RawFunction::kClosureFunction:
+5 -2
View File
@@ -36,13 +36,15 @@ class ParsedFunction : public ZoneAllocated {
: function_(function),
node_sequence_(NULL),
instantiator_(NULL),
default_parameter_values_(Array::Handle()),
default_parameter_values_(Array::ZoneHandle()),
saved_context_var_(NULL),
expression_temp_var_(NULL),
first_parameter_index_(0),
first_stack_local_index_(0),
num_copied_params_(0),
num_stack_locals_(0) { }
num_stack_locals_(0) {
ASSERT(function.IsZoneHandle());
}
const Function& function() const { return function_; }
@@ -59,6 +61,7 @@ class ParsedFunction : public ZoneAllocated {
return default_parameter_values_;
}
void set_default_parameter_values(const Array& default_parameter_values) {
ASSERT(default_parameter_values.IsZoneHandle());
default_parameter_values_ = default_parameter_values.raw();
}
+1 -1
View File
@@ -20,7 +20,7 @@ void DumpFunction(const Library& lib, const char* cname, const char* fname) {
EXPECT(!cls.IsNull());
String& funcname = String::Handle(String::New(fname));
Function& function = Function::Handle(cls.LookupStaticFunction(funcname));
Function& function = Function::ZoneHandle(cls.LookupStaticFunction(funcname));
EXPECT(!function.IsNull());
bool retval;