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

Unified Diff: runtime/vm/regexp_assembler_bytecode_inl.h

Issue 1201383002: Port irregexp bytecode compiler and interpreter from V8 r24065. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | « runtime/vm/regexp_assembler_bytecode.cc ('k') | runtime/vm/regexp_assembler_ir.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/regexp_assembler_bytecode_inl.h
diff --git a/runtime/vm/regexp_assembler_bytecode_inl.h b/runtime/vm/regexp_assembler_bytecode_inl.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b370db0c76f185330b9c3c56c80392a0f3831f8
--- /dev/null
+++ b/runtime/vm/regexp_assembler_bytecode_inl.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2015, the Dart 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 file.
+
+// A light-weight assembler for the Irregexp byte code.
+
+#include "vm/regexp_bytecodes.h"
+
+#ifndef VM_REGEXP_ASSEMBLER_BYTECODE_INL_H_
+#define VM_REGEXP_ASSEMBLER_BYTECODE_INL_H_
+
+namespace dart {
+
+void BytecodeRegExpMacroAssembler::Emit(uint32_t byte,
+ uint32_t twenty_four_bits) {
+ uint32_t word = ((twenty_four_bits << BYTECODE_SHIFT) | byte);
+ ASSERT(pc_ <= buffer_->length());
+ if (pc_ + 3 >= buffer_->length()) {
+ Expand();
+ }
+ *reinterpret_cast<uint32_t*>(buffer_->data() + pc_) = word;
+ pc_ += 4;
+}
+
+
+void BytecodeRegExpMacroAssembler::Emit16(uint32_t word) {
+ ASSERT(pc_ <= buffer_->length());
+ if (pc_ + 1 >= buffer_->length()) {
+ Expand();
+ }
+ *reinterpret_cast<uint16_t*>(buffer_->data() + pc_) = word;
+ pc_ += 2;
+}
+
+
+void BytecodeRegExpMacroAssembler::Emit8(uint32_t word) {
+ ASSERT(pc_ <= buffer_->length());
+ if (pc_ == buffer_->length()) {
+ Expand();
+ }
+ *reinterpret_cast<unsigned char*>(buffer_->data() + pc_) = word;
+ pc_ += 1;
+}
+
+
+void BytecodeRegExpMacroAssembler::Emit32(uint32_t word) {
+ ASSERT(pc_ <= buffer_->length());
+ if (pc_ + 3 >= buffer_->length()) {
+ Expand();
+ }
+ *reinterpret_cast<uint32_t*>(buffer_->data() + pc_) = word;
+ pc_ += 4;
+}
+
+} // namespace dart
+
+#endif // VM_REGEXP_ASSEMBLER_BYTECODE_INL_H_
« no previous file with comments | « runtime/vm/regexp_assembler_bytecode.cc ('k') | runtime/vm/regexp_assembler_ir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698