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

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

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 set_saved_entry_context_var(context_var); 216 set_saved_entry_context_var(context_var);
217 } 217 }
218 } 218 }
219 219
220 // Frame indices are relative to the frame pointer and are decreasing. 220 // Frame indices are relative to the frame pointer and are decreasing.
221 ASSERT(next_free_frame_index <= first_stack_local_index_); 221 ASSERT(next_free_frame_index <= first_stack_local_index_);
222 num_stack_locals_ = first_stack_local_index_ - next_free_frame_index; 222 num_stack_locals_ = first_stack_local_index_ - next_free_frame_index;
223 } 223 }
224 224
225 225
226 void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) {
227 const intptr_t num_fixed_params = function().num_fixed_parameters();
228 const intptr_t num_opt_params = function().NumOptionalParameters();
229 const intptr_t num_params = num_fixed_params + num_opt_params;
230 // Compute start indices to parameters and locals, and the number of
231 // parameters to copy.
232 ASSERT(num_opt_params == 0);
233 // Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and
234 // local variable j will be at fp[kFirstLocalSlotFromFp - j].
235 first_parameter_index_ = kParamEndSlotFromFp + num_params;
236 first_stack_local_index_ = kFirstLocalSlotFromFp;
237 num_copied_params_ = 0;
238
239 // Frame indices are relative to the frame pointer and are decreasing.
240 num_stack_locals_ = num_stack_locals;
241 }
242
243
226 struct Parser::Block : public ZoneAllocated { 244 struct Parser::Block : public ZoneAllocated {
227 Block(Block* outer_block, LocalScope* local_scope, SequenceNode* seq) 245 Block(Block* outer_block, LocalScope* local_scope, SequenceNode* seq)
228 : parent(outer_block), scope(local_scope), statements(seq) { 246 : parent(outer_block), scope(local_scope), statements(seq) {
229 ASSERT(scope != NULL); 247 ASSERT(scope != NULL);
230 ASSERT(statements != NULL); 248 ASSERT(statements != NULL);
231 } 249 }
232 Block* parent; // Enclosing block, or NULL if outermost. 250 Block* parent; // Enclosing block, or NULL if outermost.
233 LocalScope* scope; 251 LocalScope* scope;
234 SequenceNode* statements; 252 SequenceNode* statements;
235 }; 253 };
(...skipping 11259 matching lines...) Expand 10 before | Expand all | Expand 10 after
11495 void Parser::SkipQualIdent() { 11513 void Parser::SkipQualIdent() {
11496 ASSERT(IsIdentifier()); 11514 ASSERT(IsIdentifier());
11497 ConsumeToken(); 11515 ConsumeToken();
11498 if (CurrentToken() == Token::kPERIOD) { 11516 if (CurrentToken() == Token::kPERIOD) {
11499 ConsumeToken(); // Consume the kPERIOD token. 11517 ConsumeToken(); // Consume the kPERIOD token.
11500 ExpectIdentifier("identifier expected after '.'"); 11518 ExpectIdentifier("identifier expected after '.'");
11501 } 11519 }
11502 } 11520 }
11503 11521
11504 } // namespace dart 11522 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698