| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 caller_frame->pc(), | 383 caller_frame->pc(), |
| 384 target_function.ToFullyQualifiedCString(), | 384 target_function.ToFullyQualifiedCString(), |
| 385 new_target); | 385 new_target); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 | 389 |
| 390 // Resolves and compiles the target function of an instance call, updates | 390 // Resolves and compiles the target function of an instance call, updates |
| 391 // function cache of the receiver's class and returns the compiled code or null. | 391 // function cache of the receiver's class and returns the compiled code or null. |
| 392 // Only the number of named arguments is checked, but not the actual names. | 392 // Only the number of named arguments is checked, but not the actual names. |
| 393 static RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate, | 393 RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate, |
| 394 const Instance& receiver) { | 394 const Instance& receiver) { |
| 395 DartFrameIterator iterator; | 395 DartFrameIterator iterator; |
| 396 DartFrame* caller_frame = iterator.NextFrame(); | 396 DartFrame* caller_frame = iterator.NextFrame(); |
| 397 ASSERT(caller_frame != NULL); | 397 ASSERT(caller_frame != NULL); |
| 398 int num_arguments = -1; | 398 int num_arguments = -1; |
| 399 int num_named_arguments = -1; | 399 int num_named_arguments = -1; |
| 400 uword target = 0; | 400 uword target = 0; |
| 401 String& function_name = String::Handle(); | 401 String& function_name = String::Handle(); |
| 402 CodePatcher::GetInstanceCallAt(caller_frame->pc(), | 402 CodePatcher::GetInstanceCallAt(caller_frame->pc(), |
| 403 &function_name, | 403 &function_name, |
| 404 &num_arguments, | 404 &num_arguments, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 const Function& function = Function::CheckedHandle(arguments.At(0)); | 482 const Function& function = Function::CheckedHandle(arguments.At(0)); |
| 483 if (!function.HasCode()) { | 483 if (!function.HasCode()) { |
| 484 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 484 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 485 if (!error.IsNull()) { | 485 if (!error.IsNull()) { |
| 486 Exceptions::PropagateError(error); | 486 Exceptions::PropagateError(error); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 } | 489 } |
| 490 | 490 |
| 491 | 491 |
| 492 // Gets called from debug stub when code reaches a breakpoint at a return |
| 493 // in Dart code. |
| 494 DEFINE_RUNTIME_ENTRY(BreakpointReturnHandler, 0) { |
| 495 ASSERT(arguments.Count() == |
| 496 kBreakpointReturnHandlerRuntimeEntry.argument_count()); |
| 497 ASSERT(isolate->debugger() != NULL); |
| 498 isolate->debugger()->BreakpointCallback(); |
| 499 } |
| 500 |
| 501 |
| 492 // Gets called from debug stub when code reaches a breakpoint. | 502 // Gets called from debug stub when code reaches a breakpoint. |
| 493 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { | 503 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { |
| 494 ASSERT(arguments.Count() == | 504 ASSERT(arguments.Count() == |
| 495 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); | 505 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); |
| 496 ASSERT(isolate->debugger() != NULL); | 506 ASSERT(isolate->debugger() != NULL); |
| 497 isolate->debugger()->BreakpointCallback(); | 507 isolate->debugger()->BreakpointCallback(); |
| 498 } | 508 } |
| 499 | 509 |
| 500 | 510 |
| 501 static RawFunction* InlineCacheMissHandler( | 511 static RawFunction* InlineCacheMissHandler( |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 } | 1135 } |
| 1126 } | 1136 } |
| 1127 } | 1137 } |
| 1128 // The cache is null terminated, therefore the loop above should never | 1138 // The cache is null terminated, therefore the loop above should never |
| 1129 // terminate by itself. | 1139 // terminate by itself. |
| 1130 UNREACHABLE(); | 1140 UNREACHABLE(); |
| 1131 return Code::null(); | 1141 return Code::null(); |
| 1132 } | 1142 } |
| 1133 | 1143 |
| 1134 } // namespace dart | 1144 } // namespace dart |
| OLD | NEW |