| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 ASSERT(arguments.Count() == | 472 ASSERT(arguments.Count() == |
| 472 kResolveCompileInstanceFunctionRuntimeEntry.argument_count()); | 473 kResolveCompileInstanceFunctionRuntimeEntry.argument_count()); |
| 473 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); | 474 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
| 474 const Code& code = Code::Handle( | 475 const Code& code = Code::Handle( |
| 475 ResolveCompileInstanceCallTarget(isolate, receiver)); | 476 ResolveCompileInstanceCallTarget(isolate, receiver)); |
| 476 arguments.SetReturn(Code::Handle(code.raw())); | 477 arguments.SetReturn(Code::Handle(code.raw())); |
| 477 } | 478 } |
| 478 | 479 |
| 479 | 480 |
| 480 // Gets called from debug stub when code reaches a breakpoint. | 481 // Gets called from debug stub when code reaches a breakpoint. |
| 481 DEFINE_RUNTIME_ENTRY(BreakpointHandler, 0) { | 482 // Arg0: function object of the static function that was about to be called. |
| 482 ASSERT(arguments.Count() == kBreakpointHandlerRuntimeEntry.argument_count()); | 483 DEFINE_RUNTIME_ENTRY(BreakpointStaticHandler, 1) { |
| 483 DartFrameIterator iterator; | 484 ASSERT(arguments.Count() == |
| 484 DartFrame* frame = iterator.NextFrame(); | 485 kBreakpointStaticHandlerRuntimeEntry.argument_count()); |
| 485 Function& func = Function::Handle(); | 486 ASSERT(isolate->debugger() != NULL); |
| 486 ASSERT(frame != NULL); | 487 isolate->debugger()->BreakpointCallback(); |
| 487 OS::Print(">>> Breakpoint at 0x%08x\n", frame->pc()); | 488 // Make sure the static function that is about to be called is |
| 488 while (frame != NULL) { | 489 // compiled. The stub will jump to the entry point without any |
| 489 ASSERT(frame->IsValid()); | 490 // further tests. |
| 490 ASSERT(frame->IsDartFrame()); | 491 const Function& function = Function::CheckedHandle(arguments.At(0)); |
| 491 func = frame->LookupDartFunction(); | 492 if (!function.HasCode()) { |
| 492 OS::Print(" func %s\n", String::Handle(func.name()).ToCString()); | 493 Compiler::CompileFunction(function); |
| 493 frame = iterator.NextFrame(); | |
| 494 } | 494 } |
| 495 } | 495 } |
| 496 | 496 |
| 497 | 497 |
| 498 // Gets called from debug stub when code reaches a breakpoint. |
| 499 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { |
| 500 ASSERT(arguments.Count() == |
| 501 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); |
| 502 ASSERT(isolate->debugger() != NULL); |
| 503 isolate->debugger()->BreakpointCallback(); |
| 504 } |
| 505 |
| 506 |
| 498 // Handles inline cache misses by updating the IC data array of the call | 507 // Handles inline cache misses by updating the IC data array of the call |
| 499 // site. | 508 // site. |
| 500 // Arg0: Receiver object. | 509 // Arg0: Receiver object. |
| 501 // Returns: target function with compiled code or 0. | 510 // Returns: target function with compiled code or 0. |
| 502 // Modifies the instance call to hold the updated IC data array. | 511 // Modifies the instance call to hold the updated IC data array. |
| 503 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandler, 1) { | 512 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandler, 1) { |
| 504 ASSERT(arguments.Count() == | 513 ASSERT(arguments.Count() == |
| 505 kInlineCacheMissHandlerRuntimeEntry.argument_count()); | 514 kInlineCacheMissHandlerRuntimeEntry.argument_count()); |
| 506 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); | 515 const Instance& receiver = Instance::CheckedHandle(arguments.At(0)); |
| 507 const Code& target_code = | 516 const Code& target_code = |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 } | 1047 } |
| 1039 } | 1048 } |
| 1040 } | 1049 } |
| 1041 // The cache is null terminated, therefore the loop above should never | 1050 // The cache is null terminated, therefore the loop above should never |
| 1042 // terminate by itself. | 1051 // terminate by itself. |
| 1043 UNREACHABLE(); | 1052 UNREACHABLE(); |
| 1044 return Code::null(); | 1053 return Code::null(); |
| 1045 } | 1054 } |
| 1046 | 1055 |
| 1047 } // namespace dart | 1056 } // namespace dart |
| OLD | NEW |