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

Side by Side Diff: runtime/vm/code_generator.cc

Issue 9420038: Heartbeat implementation of dart:mirrors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bootstrap_nocorelib.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/debugger.h"
13 #include "vm/exceptions.h" 13 #include "vm/exceptions.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/message.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
22 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches"); 23 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches");
23 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); 24 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization");
24 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling"); 25 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling");
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 1121
1121 1122
1122 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) { 1123 DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) {
1123 ASSERT(arguments.Count() == 1124 ASSERT(arguments.Count() ==
1124 kClosureArgumentMismatchRuntimeEntry.argument_count()); 1125 kClosureArgumentMismatchRuntimeEntry.argument_count());
1125 GrowableArray<const Object*> args; 1126 GrowableArray<const Object*> args;
1126 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); 1127 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args);
1127 } 1128 }
1128 1129
1129 1130
1131 static RawInstance* DeserializeMessage(void* data) {
1132 // Create a snapshot object using the buffer.
1133 const Snapshot* snapshot = Snapshot::SetupFromBuffer(data);
1134 ASSERT(snapshot->IsMessageSnapshot());
1135
1136 // Read object back from the snapshot.
1137 SnapshotReader reader(snapshot, Isolate::Current());
1138 Instance& instance = Instance::Handle();
1139 instance ^= reader.ReadObject();
1140 return instance.raw();
1141 }
1142
1143
1144
1130 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { 1145 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) {
1131 ASSERT(arguments.Count() == 1146 ASSERT(arguments.Count() ==
1132 kStackOverflowRuntimeEntry.argument_count()); 1147 kStackOverflowRuntimeEntry.argument_count());
1133 uword stack_pos = reinterpret_cast<uword>(&arguments); 1148 uword stack_pos = reinterpret_cast<uword>(&arguments);
1134 1149
1135 // If an interrupt happens at the same time as a stack overflow, we 1150 // If an interrupt happens at the same time as a stack overflow, we
1136 // process the stack overflow first. 1151 // process the stack overflow first.
1137 if (stack_pos < isolate->saved_stack_limit()) { 1152 if (stack_pos < isolate->saved_stack_limit()) {
1138 // Use the preallocated stack overflow exception to avoid calling 1153 // Use the preallocated stack overflow exception to avoid calling
1139 // into dart code. 1154 // into dart code.
1140 const Instance& exception = 1155 const Instance& exception =
1141 Instance::Handle(isolate->object_store()->stack_overflow()); 1156 Instance::Handle(isolate->object_store()->stack_overflow());
1142 Exceptions::Throw(exception); 1157 Exceptions::Throw(exception);
1143 UNREACHABLE(); 1158 UNREACHABLE();
1144 } 1159 }
1145 1160
1146 uword interrupt_bits = isolate->GetAndClearInterrupts(); 1161 uword interrupt_bits = isolate->GetAndClearInterrupts();
1147 if (interrupt_bits & Isolate::kMessageInterrupt) { 1162 if (interrupt_bits & Isolate::kMessageInterrupt) {
1148 // UNIMPLEMENTED(); 1163 while (true) {
1164 // TODO(turnidge): This code is duplicated elsewhere. Consolidate.
1165 Message* message =
1166 isolate->message_handler()->queue()->DequeueNoWaitWithPriority(
1167 Message::kOOBPriority);
1168 if (message == NULL) {
1169 // No more OOB messages to handle.
1170 break;
1171 }
1172 const Instance& msg =
1173 Instance::Handle(DeserializeMessage(message->data()));
1174 // For now the only OOB messages are Mirrors messages.
1175 const Object& result = Object::Handle(
1176 DartLibraryCalls::HandleMirrorsMessage(
1177 message->dest_port(), message->reply_port(), msg));
1178 delete message;
1179 if (result.IsError()) {
1180 // TODO(turnidge): Propagating the error is probably wrong here.
1181 Exceptions::PropagateError(result);
1182 }
1183 ASSERT(result.IsNull());
1184 }
1149 } 1185 }
1150 if (interrupt_bits & Isolate::kApiInterrupt) { 1186 if (interrupt_bits & Isolate::kApiInterrupt) {
1151 Dart_IsolateInterruptCallback callback = isolate->InterruptCallback(); 1187 Dart_IsolateInterruptCallback callback = isolate->InterruptCallback();
1152 if (callback) { 1188 if (callback) {
1153 if ((*callback)()) { 1189 if ((*callback)()) {
1154 return; 1190 return;
1155 } else { 1191 } else {
1156 // TODO(turnidge): Unwind the stack. 1192 // TODO(turnidge): Unwind the stack.
1157 UNIMPLEMENTED(); 1193 UNIMPLEMENTED();
1158 } 1194 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 } 1428 }
1393 } 1429 }
1394 } 1430 }
1395 // The cache is null terminated, therefore the loop above should never 1431 // The cache is null terminated, therefore the loop above should never
1396 // terminate by itself. 1432 // terminate by itself.
1397 UNREACHABLE(); 1433 UNREACHABLE();
1398 return Code::null(); 1434 return Code::null();
1399 } 1435 }
1400 1436
1401 } // namespace dart 1437 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_nocorelib.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698