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

Unified Diff: runtime/vm/parser.cc

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: byte-order assert & context-var Created 6 years, 1 month 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
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 26bca7f651935962fb176e7cbaaf787c2474b5d4..66423e00cf6ba91798bee5c7377fa6d586909658 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -148,6 +148,14 @@ void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) {
}
+void ParsedFunction::SetRegExpCompileData(
+ RegExpCompileData* regexp_compile_data) {
+ ASSERT(regexp_compile_data_ == NULL);
+ ASSERT(regexp_compile_data != NULL);
+ regexp_compile_data_ = regexp_compile_data;
+}
+
+
void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) {
ASSERT(prefix.is_deferred_load());
ASSERT(!prefix.is_loaded());
@@ -161,6 +169,7 @@ void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) {
void ParsedFunction::AllocateVariables() {
+ ASSERT(!function().IsIrregexpFunction());
LocalScope* scope = node_sequence()->scope();
const intptr_t num_fixed_params = function().num_fixed_parameters();
const intptr_t num_opt_params = function().NumOptionalParameters();
@@ -209,6 +218,23 @@ struct CatchParamDesc {
};
+void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) {
+ ASSERT(function().IsIrregexpFunction());
+ ASSERT(function().NumOptionalParameters() == 0);
+ const intptr_t num_params = function().num_fixed_parameters();;
Ivan Posva 2014/11/05 07:56:30 As far as I understand this code, the number of fi
zerny-google 2014/11/05 11:52:00 Yes. Added the assert.
+ // Compute start indices to parameters and locals, and the number of
+ // parameters to copy.
+ // Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and
+ // local variable j will be at fp[kFirstLocalSlotFromFp - j].
+ first_parameter_index_ = kParamEndSlotFromFp + num_params;
+ first_stack_local_index_ = kFirstLocalSlotFromFp;
+ num_copied_params_ = 0;
+
+ // Frame indices are relative to the frame pointer and are decreasing.
+ num_stack_locals_ = num_stack_locals;
+}
+
+
struct Parser::Block : public ZoneAllocated {
Block(Block* outer_block, LocalScope* local_scope, SequenceNode* seq)
: parent(outer_block), scope(local_scope), statements(seq) {
@@ -829,6 +855,8 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
node_sequence =
parser.ParseInvokeFieldDispatcher(func, &default_parameter_values);
break;
+ case RawFunction::kIrregexpFunction:
+ UNREACHABLE(); // Irregexp functions have their own parser.
default:
UNREACHABLE();
}

Powered by Google App Engine
This is Rietveld 408576698