| 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" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/debugger.h" |
| 12 #include "vm/exceptions.h" | 13 #include "vm/exceptions.h" |
| 13 #include "vm/ic_data.h" | 14 #include "vm/ic_data.h" |
| 14 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 15 #include "vm/resolver.h" | 16 #include "vm/resolver.h" |
| 16 #include "vm/runtime_entry.h" | 17 #include "vm/runtime_entry.h" |
| 17 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 18 #include "vm/verifier.h" | 19 #include "vm/verifier.h" |
| 19 | 20 |
| 20 namespace dart { | 21 namespace dart { |
| 21 | 22 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 ASSERT(arguments.Count() == | 465 ASSERT(arguments.Count() == |
| 465 kResolveCompileInstanceFunctionRuntimeEntry.argument_count()); | 466 kResolveCompileInstanceFunctionRuntimeEntry.argument_count()); |
| 466 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); | 467 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
| 467 const Code& code = Code::Handle( | 468 const Code& code = Code::Handle( |
| 468 ResolveCompileInstanceCallTarget(isolate, receiver)); | 469 ResolveCompileInstanceCallTarget(isolate, receiver)); |
| 469 arguments.SetReturn(Code::Handle(code.raw())); | 470 arguments.SetReturn(Code::Handle(code.raw())); |
| 470 } | 471 } |
| 471 | 472 |
| 472 | 473 |
| 473 // Gets called from debug stub when code reaches a breakpoint. | 474 // Gets called from debug stub when code reaches a breakpoint. |
| 474 DEFINE_RUNTIME_ENTRY(BreakpointHandler, 0) { | 475 // Arg0: function object of the static function that was about to be called. |
| 475 ASSERT(arguments.Count() == kBreakpointHandlerRuntimeEntry.argument_count()); | 476 DEFINE_RUNTIME_ENTRY(BreakpointStaticHandler, 1) { |
| 476 DartFrameIterator iterator; | 477 ASSERT(arguments.Count() == |
| 477 DartFrame* frame = iterator.NextFrame(); | 478 kBreakpointStaticHandlerRuntimeEntry.argument_count()); |
| 478 Function& func = Function::Handle(); | 479 ASSERT(isolate->debugger() != NULL); |
| 479 ASSERT(frame != NULL); | 480 isolate->debugger()->BreakpointCallback(); |
| 480 OS::Print(">>> Breakpoint at 0x%08x\n", frame->pc()); | 481 // Make sure the static function that is about to be called is |
| 481 while (frame != NULL) { | 482 // compiled. The stub will jump to the entry point without any |
| 482 ASSERT(frame->IsValid()); | 483 // further tests. |
| 483 ASSERT(frame->IsDartFrame()); | 484 const Function& function = Function::CheckedHandle(arguments.At(0)); |
| 484 func = frame->LookupDartFunction(); | 485 if (!function.HasCode()) { |
| 485 OS::Print(" func %s\n", String::Handle(func.name()).ToCString()); | 486 Compiler::CompileFunction(function); |
| 486 frame = iterator.NextFrame(); | |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 | 490 |
| 491 // Gets called from debug stub when code reaches a breakpoint. |
| 492 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { |
| 493 ASSERT(arguments.Count() == |
| 494 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); |
| 495 ASSERT(isolate->debugger() != NULL); |
| 496 isolate->debugger()->BreakpointCallback(); |
| 497 } |
| 498 |
| 499 |
| 491 // Handles inline cache misses by updating the IC data array of the call | 500 // Handles inline cache misses by updating the IC data array of the call |
| 492 // site. | 501 // site. |
| 493 // Arg0: Receiver object. | 502 // Arg0: Receiver object. |
| 494 // Returns: target function with compiled code or 0. | 503 // Returns: target function with compiled code or 0. |
| 495 // Modifies the instance call to hold the updated IC data array. | 504 // Modifies the instance call to hold the updated IC data array. |
| 496 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandler, 1) { | 505 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandler, 1) { |
| 497 ASSERT(arguments.Count() == | 506 ASSERT(arguments.Count() == |
| 498 kInlineCacheMissHandlerRuntimeEntry.argument_count()); | 507 kInlineCacheMissHandlerRuntimeEntry.argument_count()); |
| 499 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); | 508 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
| 500 const Code& target_code = | 509 const Code& target_code = |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 } | 1040 } |
| 1032 } | 1041 } |
| 1033 } | 1042 } |
| 1034 // The cache is null terminated, therefore the loop above should never | 1043 // The cache is null terminated, therefore the loop above should never |
| 1035 // terminate by itself. | 1044 // terminate by itself. |
| 1036 UNREACHABLE(); | 1045 UNREACHABLE(); |
| 1037 return Code::null(); | 1046 return Code::null(); |
| 1038 } | 1047 } |
| 1039 | 1048 |
| 1040 } // namespace dart | 1049 } // namespace dart |
| OLD | NEW |