Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 "target '%s' %#" Px " -> %#" Px "\n", | 1334 "target '%s' %#" Px " -> %#" Px "\n", |
| 1335 frame->pc(), | 1335 frame->pc(), |
| 1336 target_function.ToFullyQualifiedCString(), | 1336 target_function.ToFullyQualifiedCString(), |
| 1337 target_code.EntryPoint(), | 1337 target_code.EntryPoint(), |
| 1338 current_target_code.EntryPoint()); | 1338 current_target_code.EntryPoint()); |
| 1339 } | 1339 } |
| 1340 arguments.SetReturn(current_target_code); | 1340 arguments.SetReturn(current_target_code); |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 | 1343 |
| 1344 // The caller tried to allocate an instance via an invalidated allocation | |
| 1345 // stub. | |
| 1346 DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) { | |
| 1347 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); | |
| 1348 StackFrame* frame = iterator.NextFrame(); | |
| 1349 while (frame != NULL && (frame->IsStubFrame() || frame->IsExitFrame())) { | |
|
koda
2014/09/10 15:33:21
This explicit null-check looks strange, since null
zra
2014/09/10 16:07:39
parens around (frame != NULL)
srdjan
2014/09/11 16:22:35
Done, also for FixCallersTarget above.
srdjan
2014/09/11 16:22:36
Removed that test
| |
| 1350 frame = iterator.NextFrame(); | |
| 1351 } | |
| 1352 ASSERT(frame != NULL); | |
| 1353 if (frame->IsEntryFrame()) { | |
| 1354 // There must be a valid Dart frame. | |
| 1355 UNREACHABLE(); | |
| 1356 } | |
| 1357 ASSERT(frame->IsDartFrame()); | |
| 1358 const Code& caller_code = Code::Handle(isolate, frame->LookupDartCode()); | |
| 1359 ASSERT(!caller_code.IsNull()); | |
| 1360 const uword target = | |
| 1361 CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code); | |
| 1362 const Code& stub = Code::Handle(isolate, Code::LookupCode(target)); | |
| 1363 Class& alloc_class = Class::ZoneHandle(isolate); | |
| 1364 alloc_class ^= stub.owner(); | |
| 1365 Code& alloc_stub = Code::Handle(isolate, alloc_class.allocation_stub()); | |
| 1366 if (alloc_stub.IsNull()) { | |
| 1367 alloc_stub = isolate->stub_code()->GetAllocationStubForClass(alloc_class); | |
| 1368 ASSERT(!CodePatcher::IsEntryPatched(alloc_stub)); | |
| 1369 } | |
| 1370 const Instructions& instrs = | |
| 1371 Instructions::Handle(isolate, caller_code.instructions()); | |
| 1372 { | |
| 1373 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | |
| 1374 CodePatcher::PatchStaticCallAt(frame->pc(), | |
| 1375 caller_code, | |
| 1376 alloc_stub.EntryPoint()); | |
| 1377 } | |
| 1378 if (FLAG_trace_patching) { | |
| 1379 OS::PrintErr("FixAllocationStubTarget: caller %#" Px " " | |
| 1380 " -> %#" Px "\n", | |
| 1381 frame->pc(), | |
| 1382 alloc_stub.EntryPoint()); | |
| 1383 } | |
| 1384 arguments.SetReturn(alloc_stub); | |
| 1385 } | |
| 1386 | |
| 1387 | |
| 1344 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { | 1388 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { |
| 1345 switch (deopt_reason) { | 1389 switch (deopt_reason) { |
| 1346 #define DEOPT_REASON_TO_TEXT(name) case ICData::kDeopt##name: return #name; | 1390 #define DEOPT_REASON_TO_TEXT(name) case ICData::kDeopt##name: return #name; |
| 1347 DEOPT_REASONS(DEOPT_REASON_TO_TEXT) | 1391 DEOPT_REASONS(DEOPT_REASON_TO_TEXT) |
| 1348 #undef DEOPT_REASON_TO_TEXT | 1392 #undef DEOPT_REASON_TO_TEXT |
| 1349 default: | 1393 default: |
| 1350 UNREACHABLE(); | 1394 UNREACHABLE(); |
| 1351 return ""; | 1395 return ""; |
| 1352 } | 1396 } |
| 1353 } | 1397 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1575 field.RecordStore(value); | 1619 field.RecordStore(value); |
| 1576 } | 1620 } |
| 1577 | 1621 |
| 1578 | 1622 |
| 1579 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { | 1623 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { |
| 1580 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1624 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1581 field.EvaluateInitializer(); | 1625 field.EvaluateInitializer(); |
| 1582 } | 1626 } |
| 1583 | 1627 |
| 1584 } // namespace dart | 1628 } // namespace dart |
| OLD | NEW |