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

Unified Diff: runtime/vm/code_generator.cc

Issue 11438017: Pass IC data and arguments descriptor to IC miss runtime functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « runtime/vm/code_generator.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 1c968f5e64051e50ca0c38c4b79fceb97ea67f2a..13ff8be07bdc653ff20684f8e3d2c0437c404789 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -791,20 +791,13 @@ DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
// 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.
-RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate,
- const Instance& receiver) {
- int num_arguments = -1;
- int num_named_arguments = -1;
- uword target = 0;
- String& function_name = String::Handle();
- DartFrameIterator iterator;
- StackFrame* caller_frame = iterator.NextFrame();
- ASSERT(caller_frame != NULL);
- CodePatcher::GetInstanceCallAt(caller_frame->pc(),
- &function_name,
- &num_arguments,
- &num_named_arguments,
- &target);
+RawCode* ResolveCompileInstanceCallTarget(
+ const Instance& receiver,
+ const ICData& ic_data,
+ const ArgumentsDescriptor& arguments_descriptor) {
+ intptr_t num_arguments = arguments_descriptor.Count();
+ int num_named_arguments = arguments_descriptor.NamedCount();
+ String& function_name = String::Handle(ic_data.target_name());
ASSERT(function_name.IsSymbol());
Function& function = Function::Handle();
@@ -837,16 +830,22 @@ static void CheckResultError(const Object& result) {
// Resolves an instance function and compiles it if necessary.
// Arg0: receiver object.
+// Arg1: IC data object.
+// Arg2: Arguments descriptor array.
// Returns: RawCode object or NULL (method not found or not compileable).
// This is called by the megamorphic stub when instance call does not need to be
// patched.
// Used by megamorphic lookup/no-such-method-handling.
-DEFINE_RUNTIME_ENTRY(ResolveCompileInstanceFunction, 1) {
+DEFINE_RUNTIME_ENTRY(ResolveCompileInstanceFunction, 3) {
ASSERT(arguments.ArgCount() ==
kResolveCompileInstanceFunctionRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
- const Code& code = Code::Handle(
- ResolveCompileInstanceCallTarget(isolate, receiver));
+ const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
+ ArgumentsDescriptor arg_descriptor(arguments.ArgAt(2));
+ const Code& code =
+ Code::Handle(ResolveCompileInstanceCallTarget(receiver,
+ ic_data,
+ arg_descriptor));
arguments.SetReturn(code);
}
@@ -897,10 +896,14 @@ DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) {
static RawFunction* InlineCacheMissHandler(
- Isolate* isolate, const GrowableArray<const Instance*>& args) {
+ const GrowableArray<const Instance*>& args,
+ const ICData& ic_data,
+ const ArgumentsDescriptor& arg_descriptor) {
const Instance& receiver = *args[0];
const Code& target_code =
- Code::Handle(ResolveCompileInstanceCallTarget(isolate, receiver));
+ Code::Handle(ResolveCompileInstanceCallTarget(receiver,
+ ic_data,
+ arg_descriptor));
if (target_code.IsNull()) {
// Let the megamorphic stub handle special cases: NoSuchMethod,
// closure calls.
@@ -916,8 +919,6 @@ static RawFunction* InlineCacheMissHandler(
DartFrameIterator iterator;
StackFrame* caller_frame = iterator.NextFrame();
ASSERT(caller_frame != NULL);
- ICData& ic_data = ICData::Handle(
- CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc()));
if (args.length() == 1) {
ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(),
target_function);
@@ -953,16 +954,20 @@ static RawFunction* InlineCacheMissHandler(
// Handles inline cache misses by updating the IC data array of the call
// site.
// Arg0: Receiver object.
+// Arg1: IC data object.
+// Arg2: Arguments descriptor array.
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
-DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 1) {
+DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 3) {
ASSERT(arguments.ArgCount() ==
kInlineCacheMissHandlerOneArgRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
+ const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
+ ArgumentsDescriptor arg_descriptor(arguments.ArgAt(2));
GrowableArray<const Instance*> args(1);
args.Add(&receiver);
const Function& result =
- Function::Handle(InlineCacheMissHandler(isolate, args));
+ Function::Handle(InlineCacheMissHandler(args, ic_data, arg_descriptor));
arguments.SetReturn(result);
}
@@ -971,18 +976,22 @@ DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 1) {
// site.
// Arg0: Receiver object.
// Arg1: Argument after receiver.
+// Arg2: IC data object.
+// Arg3: Arguments descriptor array.
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
-DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 2) {
+DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 4) {
ASSERT(arguments.ArgCount() ==
kInlineCacheMissHandlerTwoArgsRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& other = Instance::CheckedHandle(arguments.ArgAt(1));
+ const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2));
+ ArgumentsDescriptor arg_descriptor(arguments.ArgAt(3));
GrowableArray<const Instance*> args(2);
args.Add(&receiver);
args.Add(&other);
const Function& result =
- Function::Handle(InlineCacheMissHandler(isolate, args));
+ Function::Handle(InlineCacheMissHandler(args, ic_data, arg_descriptor));
arguments.SetReturn(result);
}
@@ -992,20 +1001,24 @@ DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 2) {
// Arg0: Receiver object.
// Arg1: Argument after receiver.
// Arg2: Second argument after receiver.
+// Arg3: IC data object.
+// Arg4: Arguments descriptor array.
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
-DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerThreeArgs, 3) {
+DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerThreeArgs, 5) {
ASSERT(arguments.ArgCount() ==
kInlineCacheMissHandlerThreeArgsRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1));
const Instance& arg2 = Instance::CheckedHandle(arguments.ArgAt(2));
+ const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(3));
+ ArgumentsDescriptor arg_descriptor(arguments.ArgAt(4));
GrowableArray<const Instance*> args(3);
args.Add(&receiver);
args.Add(&arg1);
args.Add(&arg2);
const Function& result =
- Function::Handle(InlineCacheMissHandler(isolate, args));
+ Function::Handle(InlineCacheMissHandler(args, ic_data, arg_descriptor));
arguments.SetReturn(result);
}
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/code_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698