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

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

Issue 2750013002: [kernel] Debugging of switch statement (Closed)
Patch Set: Take #2: Update switch case to include list of positions Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #if !defined(DART_PRECOMPILED_RUNTIME) 4 #if !defined(DART_PRECOMPILED_RUNTIME)
5 5
6 #include "platform/globals.h" 6 #include "platform/globals.h"
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/kernel.h" 9 #include "vm/kernel.h"
10 #include "vm/kernel_to_il.h" 10 #include "vm/kernel_to_il.h"
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 SwitchCase* sc = stmt->cases_[i]; 1588 SwitchCase* sc = stmt->cases_[i];
1589 sc->ReadFrom(reader); 1589 sc->ReadFrom(reader);
1590 } 1590 }
1591 return stmt; 1591 return stmt;
1592 } 1592 }
1593 1593
1594 1594
1595 SwitchCase* SwitchCase::ReadFrom(Reader* reader) { 1595 SwitchCase* SwitchCase::ReadFrom(Reader* reader) {
1596 TRACE_READ_OFFSET(); 1596 TRACE_READ_OFFSET();
1597 expressions_.ReadFromStatic<Expression>(reader); 1597 expressions_.ReadFromStatic<Expression>(reader);
1598 // List of expression offsets of same length as expressions_: This serves as
Kevin Millikin (Google) 2017/03/20 12:29:47 I think it's obvious that it serves as the positio
jensj 2017/03/21 10:06:19 Comment removed.
1599 // positions of the expressions, especially useful if the expressions
1600 // doesn't have a position (e.g. int literal).
1601 int length = reader->ReadListLength();
1602 for (intptr_t i = 0; i < length; ++i) {
1603 expressions_[i]->set_position(reader->ReadPosition());
1604 }
1598 is_default_ = reader->ReadBool(); 1605 is_default_ = reader->ReadBool();
1599 body_ = Statement::ReadFrom(reader); 1606 body_ = Statement::ReadFrom(reader);
1600 return this; 1607 return this;
1601 } 1608 }
1602 1609
1603 1610
1604 ContinueSwitchStatement* ContinueSwitchStatement::ReadFrom(Reader* reader) { 1611 ContinueSwitchStatement* ContinueSwitchStatement::ReadFrom(Reader* reader) {
1605 TRACE_READ_OFFSET(); 1612 TRACE_READ_OFFSET();
1606 ContinueSwitchStatement* stmt = new ContinueSwitchStatement(); 1613 ContinueSwitchStatement* stmt = new ContinueSwitchStatement();
1607 stmt->target_ = reader->helper()->switch_cases().Lookup(reader->ReadUInt()); 1614 stmt->target_ = reader->helper()->switch_cases().Lookup(reader->ReadUInt());
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1939
1933 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 1940 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
1934 intptr_t buffer_length) { 1941 intptr_t buffer_length) {
1935 kernel::Reader reader(buffer, buffer_length); 1942 kernel::Reader reader(buffer, buffer_length);
1936 return kernel::Program::ReadFrom(&reader); 1943 return kernel::Program::ReadFrom(&reader);
1937 } 1944 }
1938 1945
1939 1946
1940 } // namespace dart 1947 } // namespace dart
1941 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1948 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698