OLD | NEW |
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 #ifndef VM_FLOW_GRAPH_BUILDER_H_ | 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ |
6 #define VM_FLOW_GRAPH_BUILDER_H_ | 6 #define VM_FLOW_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Wraps a value in a push-argument instruction and adds the result to the | 296 // Wraps a value in a push-argument instruction and adds the result to the |
297 // graph. | 297 // graph. |
298 PushArgumentInstr* PushArgument(Value* value); | 298 PushArgumentInstr* PushArgument(Value* value); |
299 | 299 |
300 // This implementation shares state among visitors by using the builder. | 300 // This implementation shares state among visitors by using the builder. |
301 // The implementation is incorrect if a visitor that hits a return is not | 301 // The implementation is incorrect if a visitor that hits a return is not |
302 // actually added to the graph. | 302 // actually added to the graph. |
303 void AddReturnExit(intptr_t token_pos, Value* value); | 303 void AddReturnExit(intptr_t token_pos, Value* value); |
304 | 304 |
305 protected: | 305 protected: |
306 Definition* BuildStoreTemp(const LocalVariable& local, Value* value); | 306 Definition* BuildStoreTemp(const LocalVariable& local, |
307 Definition* BuildStoreExprTemp(Value* value); | 307 Value* value, |
308 Definition* BuildLoadExprTemp(); | 308 intptr_t token_pos); |
| 309 Definition* BuildStoreExprTemp(Value* value, intptr_t token_pos); |
| 310 Definition* BuildLoadExprTemp(intptr_t token_pos); |
309 | 311 |
310 Definition* BuildStoreLocal(const LocalVariable& local, | 312 Definition* BuildStoreLocal(const LocalVariable& local, |
311 Value* value, | 313 Value* value, |
312 intptr_t token_pos = Scanner::kNoSourcePos); | 314 intptr_t token_pos); |
313 Definition* BuildLoadLocal(const LocalVariable& local, | 315 Definition* BuildLoadLocal(const LocalVariable& local, |
314 intptr_t token_pos = Scanner::kNoSourcePos); | 316 intptr_t token_pos); |
315 LoadLocalInstr* BuildLoadThisVar(LocalScope* scope); | 317 LoadLocalInstr* BuildLoadThisVar(LocalScope* scope, intptr_t token_pos); |
316 LoadFieldInstr* BuildNativeGetter( | 318 LoadFieldInstr* BuildNativeGetter( |
317 NativeBodyNode* node, | 319 NativeBodyNode* node, |
318 MethodRecognizer::Kind kind, | 320 MethodRecognizer::Kind kind, |
319 intptr_t offset, | 321 intptr_t offset, |
320 const Type& type, | 322 const Type& type, |
321 intptr_t class_id); | 323 intptr_t class_id); |
322 // Assumes setter parameter is named 'value'. Returns null constant. | 324 // Assumes setter parameter is named 'value'. Returns null constant. |
323 ConstantInstr* DoNativeSetterStoreValue( | 325 ConstantInstr* DoNativeSetterStoreValue( |
324 NativeBodyNode* node, | 326 NativeBodyNode* node, |
325 intptr_t offset, | 327 intptr_t offset, |
326 StoreBarrierType emit_store_barrier); | 328 StoreBarrierType emit_store_barrier); |
327 | 329 |
328 // Helpers for translating parts of the AST. | 330 // Helpers for translating parts of the AST. |
329 void BuildPushArguments(const ArgumentListNode& node, | 331 void BuildPushArguments(const ArgumentListNode& node, |
330 ZoneGrowableArray<PushArgumentInstr*>* values); | 332 ZoneGrowableArray<PushArgumentInstr*>* values); |
331 | 333 |
332 // Creates an instantiated type argument vector used in preparation of an | 334 // Creates an instantiated type argument vector used in preparation of an |
333 // allocation call. | 335 // allocation call. |
334 // May be called only if allocating an object of a parameterized class. | 336 // May be called only if allocating an object of a parameterized class. |
335 Value* BuildInstantiatedTypeArguments( | 337 Value* BuildInstantiatedTypeArguments( |
336 intptr_t token_pos, | 338 intptr_t token_pos, |
337 const TypeArguments& type_arguments); | 339 const TypeArguments& type_arguments); |
338 | 340 |
339 void BuildTypecheckPushArguments( | 341 void BuildTypecheckPushArguments( |
340 intptr_t token_pos, | 342 intptr_t token_pos, |
341 PushArgumentInstr** push_instantiator_type_arguments); | 343 PushArgumentInstr** push_instantiator_type_arguments); |
342 void BuildTypecheckArguments(intptr_t token_pos, | 344 void BuildTypecheckArguments(intptr_t token_pos, |
343 Value** instantiator_type_arguments); | 345 Value** instantiator_type_arguments); |
344 Value* BuildInstantiator(const Class& instantiator_class); | 346 Value* BuildInstantiator(intptr_t token_pos, const Class& instantiator_class); |
345 Value* BuildInstantiatorTypeArguments(intptr_t token_pos, | 347 Value* BuildInstantiatorTypeArguments(intptr_t token_pos, |
346 const Class& instantiator_class, | 348 const Class& instantiator_class, |
347 Value* instantiator); | 349 Value* instantiator); |
348 | 350 |
349 // Perform a type check on the given value. | 351 // Perform a type check on the given value. |
350 AssertAssignableInstr* BuildAssertAssignable(intptr_t token_pos, | 352 AssertAssignableInstr* BuildAssertAssignable(intptr_t token_pos, |
351 Value* value, | 353 Value* value, |
352 const AbstractType& dst_type, | 354 const AbstractType& dst_type, |
353 const String& dst_name); | 355 const String& dst_name); |
354 | 356 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 ArgumentListNode* function_arguments, | 423 ArgumentListNode* function_arguments, |
422 int invocation_type); | 424 int invocation_type); |
423 | 425 |
424 void BuildStaticSetter(StaticSetterNode* node, bool result_is_needed); | 426 void BuildStaticSetter(StaticSetterNode* node, bool result_is_needed); |
425 Definition* BuildStoreStaticField(StoreStaticFieldNode* node, | 427 Definition* BuildStoreStaticField(StoreStaticFieldNode* node, |
426 bool result_is_needed, | 428 bool result_is_needed, |
427 intptr_t token_pos); | 429 intptr_t token_pos); |
428 | 430 |
429 void BuildClosureCall(ClosureCallNode* node, bool result_needed); | 431 void BuildClosureCall(ClosureCallNode* node, bool result_needed); |
430 | 432 |
431 Value* BuildNullValue(); | 433 Value* BuildNullValue(intptr_t token_pos); |
432 | 434 |
433 // Returns true if the run-time type check can be eliminated. | 435 // Returns true if the run-time type check can be eliminated. |
434 bool CanSkipTypeCheck(intptr_t token_pos, | 436 bool CanSkipTypeCheck(intptr_t token_pos, |
435 Value* value, | 437 Value* value, |
436 const AbstractType& dst_type, | 438 const AbstractType& dst_type, |
437 const String& dst_name); | 439 const String& dst_name); |
438 | 440 |
439 // Helpers for allocating and deallocating temporary locals on top of the | 441 // Helpers for allocating and deallocating temporary locals on top of the |
440 // expression stack. | 442 // expression stack. |
441 LocalVariable* EnterTempLocalScope(Value* value); | 443 LocalVariable* EnterTempLocalScope(Value* value, intptr_t token_pos); |
442 Definition* ExitTempLocalScope(LocalVariable* var); | 444 Definition* ExitTempLocalScope(LocalVariable* var, intptr_t token_pos); |
443 | 445 |
444 void BuildLetTempExpressions(LetNode* node); | 446 void BuildLetTempExpressions(LetNode* node); |
445 | 447 |
446 void BuildInstanceGetterConditional(InstanceGetterNode* node); | 448 void BuildInstanceGetterConditional(InstanceGetterNode* node); |
447 void BuildInstanceCallConditional(InstanceCallNode* node); | 449 void BuildInstanceCallConditional(InstanceCallNode* node); |
448 | 450 |
449 Thread* thread() const { return owner()->thread(); } | 451 Thread* thread() const { return owner()->thread(); } |
450 Isolate* isolate() const { return owner()->isolate(); } | 452 Isolate* isolate() const { return owner()->isolate(); } |
451 Zone* zone() const { return owner()->zone(); } | 453 Zone* zone() const { return owner()->zone(); } |
452 | 454 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // Output parameters. | 583 // Output parameters. |
582 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 584 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
583 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 585 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
584 | 586 |
585 intptr_t condition_token_pos_; | 587 intptr_t condition_token_pos_; |
586 }; | 588 }; |
587 | 589 |
588 } // namespace dart | 590 } // namespace dart |
589 | 591 |
590 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 592 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |