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

Unified Diff: pkg/fletchc/lib/bytecodes.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/fletchc/lib/back_trace.dart ('k') | pkg/fletchc/lib/debug_state.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/fletchc/lib/bytecodes.dart
diff --git a/pkg/fletchc/lib/bytecodes.dart b/pkg/fletchc/lib/bytecodes.dart
deleted file mode 100644
index 45c8244c76a9157fcba22ec85fd9f83948987eb3..0000000000000000000000000000000000000000
--- a/pkg/fletchc/lib/bytecodes.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-library fletch.bytecodes;
-
-import 'dart:typed_data' show
- ByteData,
- Endianness,
- Uint8List;
-
-part 'generated_bytecodes.dart';
-
-const int VAR_DIFF = 0x3FFFFFFF;
-
-abstract class Bytecode {
- static bool identicalBytecodes(List<Bytecode> expected,
- List<Bytecode> actual) {
- if (expected.length != actual.length) return false;
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] != actual[i]) return false;
- }
- return true;
- }
-
- const Bytecode();
-
- Opcode get opcode;
-
- String get name;
-
- String get format;
-
- int get size;
-
- /// The effect on stack size.
- int get stackPointerDifference;
-
- String get formatString;
-
- void addTo(Sink<List<int>> sink);
-
- bool operator==(Bytecode other) => other.opcode == opcode;
-
- int get hashCode => opcode.index;
-
- static void prettyPrint(StringBuffer sb, List<Bytecode> bytecodes) {
- int offset = 0;
- for (Bytecode bytecode in bytecodes) {
- offset += bytecode.size;
- }
- int padding = "$offset".length;
- offset = 0;
- for (Bytecode bytecode in bytecodes) {
- String paddedOffset = ("0" * padding) + "$offset";
- paddedOffset = paddedOffset.substring(paddedOffset.length - padding);
- sb.writeln(" $paddedOffset: $bytecode");
- offset += bytecode.size;
- }
- }
-}
-
-class BytecodeBuffer {
- int position = 0;
-
- Uint8List list = new Uint8List(8);
-
- ByteData get view => new ByteData.view(list.buffer);
-
- void growBytes(int size) {
- while (position + size >= list.length) {
- list = new Uint8List(list.length * 2)
- ..setRange(0, list.length, list);
- }
- }
-
- void addUint8(int value) {
- growBytes(1);
- view.setUint8(position++, value);
- }
-
- void addUint32(int value) {
- growBytes(4);
- view.setUint32(position, value, Endianness.LITTLE_ENDIAN);
- position += 4;
- }
-
- void addUint64(int value) {
- growBytes(8);
- view.setUint64(position, value, Endianness.LITTLE_ENDIAN);
- position += 8;
- }
-
- void sendOn(Sink<List<int>> sink) {
- sink.add(new Uint8List.view(list.buffer, list.offsetInBytes, position));
- }
-}
« no previous file with comments | « pkg/fletchc/lib/back_trace.dart ('k') | pkg/fletchc/lib/debug_state.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698