Index: runtime/vm/code_generator.cc |
=================================================================== |
--- runtime/vm/code_generator.cc (revision 1428) |
+++ runtime/vm/code_generator.cc (working copy) |
@@ -228,6 +228,7 @@ |
// Return value: newly allocated closure. |
DEFINE_RUNTIME_ENTRY(AllocateClosure, 2) { |
ASSERT(arguments.Count() == kAllocateClosureRuntimeEntry.argument_count()); |
+ Isolate* isolate = arguments.isolate(); |
const Function& function = Function::CheckedHandle(arguments.At(0)); |
ASSERT(function.IsClosureFunction() && !function.IsImplicitClosureFunction()); |
const TypeArguments& type_arguments = |
@@ -235,7 +236,7 @@ |
ASSERT(type_arguments.IsNull() || type_arguments.IsInstantiated()); |
// The current context was saved in the Isolate structure when entering the |
// runtime. |
- const Context& context = Context::Handle(Isolate::Current()->top_context()); |
+ const Context& context = Context::Handle(isolate->top_context()); |
ASSERT(!context.IsNull()); |
const Closure& closure = Closure::Handle(Closure::New(function, context)); |
closure.SetTypeArguments(type_arguments); |
@@ -249,7 +250,8 @@ |
DEFINE_RUNTIME_ENTRY(AllocateImplicitStaticClosure, 1) { |
ASSERT(arguments.Count() == |
kAllocateImplicitStaticClosureRuntimeEntry.argument_count()); |
- ObjectStore* object_store = Isolate::Current()->object_store(); |
+ Isolate* isolate = arguments.isolate(); |
+ ObjectStore* object_store = isolate->object_store(); |
ASSERT(object_store != NULL); |
const Function& function = Function::CheckedHandle(arguments.At(0)); |
ASSERT(function.IsImplicitStaticClosureFunction()); |
@@ -383,7 +385,8 @@ |
// Resolves and compiles the target function of an instance call, updates |
// function cache of the receiver's class and returns the compiled code or null. |
// Only the number of named arguments is checked, but not the actual names. |
-static RawCode* ResolveCompileInstanceCallTarget(const Instance& receiver) { |
+static RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate, |
+ const Instance& receiver) { |
DartFrameIterator iterator; |
DartFrame* caller_frame = iterator.NextFrame(); |
ASSERT(caller_frame != NULL); |
@@ -400,7 +403,7 @@ |
Class& receiver_class = Class::Handle(); |
if (receiver.IsNull()) { |
// TODO(srdjan): Clarify behavior of null objects. |
- receiver_class = Isolate::Current()->object_store()->object_class(); |
+ receiver_class = isolate->object_store()->object_class(); |
} else { |
receiver_class = receiver.clazz(); |
} |
@@ -455,8 +458,10 @@ |
DEFINE_RUNTIME_ENTRY(ResolveCompileInstanceFunction, 1) { |
ASSERT(arguments.Count() == |
kResolveCompileInstanceFunctionRuntimeEntry.argument_count()); |
+ Isolate* isolate = arguments.isolate(); |
const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
- const Code& code = Code::Handle(ResolveCompileInstanceCallTarget(receiver)); |
+ const Code& code = Code::Handle( |
+ ResolveCompileInstanceCallTarget(isolate, receiver)); |
arguments.SetReturn(Code::Handle(code.raw())); |
} |
@@ -469,9 +474,10 @@ |
DEFINE_RUNTIME_ENTRY(InlineCacheMissHandler, 1) { |
ASSERT(arguments.Count() == |
kInlineCacheMissHandlerRuntimeEntry.argument_count()); |
+ Isolate* isolate = arguments.isolate(); |
const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
const Code& target_code = |
- Code::Handle(ResolveCompileInstanceCallTarget(receiver)); |
+ Code::Handle(ResolveCompileInstanceCallTarget(isolate, receiver)); |
if (target_code.IsNull()) { |
// Let the megamorphic stub handle special cases: NoSuchMethod, |
// closure calls. |
@@ -516,12 +522,13 @@ |
} |
-static RawFunction* LookupDynamicFunction(const Class& in_cls, |
+static RawFunction* LookupDynamicFunction(Isolate* isolate, |
+ const Class& in_cls, |
const String& name) { |
Class& cls = Class::Handle(); |
// For lookups treat null as an instance of class Object. |
if (in_cls.IsNullClass()) { |
- cls = Isolate::Current()->object_store()->object_class(); |
+ cls = isolate->object_store()->object_class(); |
} else { |
cls = in_cls.raw(); |
} |
@@ -549,6 +556,7 @@ |
DEFINE_RUNTIME_ENTRY(ResolveImplicitClosureFunction, 2) { |
ASSERT(arguments.Count() == |
kResolveImplicitClosureFunctionRuntimeEntry.argument_count()); |
+ Isolate* isolate = arguments.isolate(); |
const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
const Array& ic_data_array = Array::CheckedHandle(arguments.At(1)); |
ICData ic_data(ic_data_array); |
@@ -567,8 +575,8 @@ |
String& func_name = String::Handle(); |
func_name = String::SubString(original_function_name, getter_prefix.Length()); |
func_name = String::NewSymbol(func_name); |
- const Function& function = |
- Function::Handle(LookupDynamicFunction(receiver_class, func_name)); |
+ const Function& function = Function::Handle( |
+ LookupDynamicFunction(isolate, receiver_class, func_name)); |
if (function.IsNull()) { |
// There is no function of the same name so can't be the case where |
// we are trying to create an implicit closure of an instance function. |
@@ -788,13 +796,14 @@ |
DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { |
ASSERT(arguments.Count() == |
kStackOverflowRuntimeEntry.argument_count()); |
- uword old_stack_limit = Isolate::Current()->stack_limit(); |
- Isolate::Current()->AdjustStackLimitForException(); |
+ Isolate* isolate = arguments.isolate(); |
Ivan Posva
2011/11/11 22:07:07
This is such a repeating pattern that we might con
siva
2011/11/12 03:01:05
Done.
|
+ uword old_stack_limit = isolate->stack_limit(); |
+ isolate->AdjustStackLimitForException(); |
// Recursive stack overflow check. |
- ASSERT(old_stack_limit != Isolate::Current()->stack_limit()); |
+ ASSERT(old_stack_limit != isolate->stack_limit()); |
GrowableArray<const Object*> args; |
Exceptions::ThrowByType(Exceptions::kStackOverflow, args); |
- Isolate::Current()->ResetStackLimitAfterException(); |
+ isolate->ResetStackLimitAfterException(); |
} |
@@ -866,10 +875,11 @@ |
// to patch the pc of the Dart frame and to disable/enable appropriate code. |
DEFINE_RUNTIME_ENTRY(Deoptimize, 0) { |
ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); |
+ Isolate* isolate = arguments.isolate(); |
DartFrameIterator iterator; |
DartFrame* caller_frame = iterator.NextFrame(); |
ASSERT(caller_frame != NULL); |
- CodeIndexTable* ci_table = Isolate::Current()->code_index_table(); |
+ CodeIndexTable* ci_table = isolate->code_index_table(); |
const Code& optimized_code = |
Code::Handle(ci_table->LookupCode(caller_frame->pc())); |
const Function& function = Function::Handle(optimized_code.function()); |