| 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_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 M(CreateArray, CreateArrayComp) \ | 49 M(CreateArray, CreateArrayComp) \ |
| 50 M(CreateClosure, CreateClosureComp) \ | 50 M(CreateClosure, CreateClosureComp) \ |
| 51 M(AllocateObject, AllocateObjectComp) \ | 51 M(AllocateObject, AllocateObjectComp) \ |
| 52 M(NativeLoadField, NativeLoadFieldComp) \ | 52 M(NativeLoadField, NativeLoadFieldComp) \ |
| 53 M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \ | 53 M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \ |
| 54 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ | 54 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ |
| 55 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ | 55 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ |
| 56 M(AllocateContext, AllocateContextComp) \ | 56 M(AllocateContext, AllocateContextComp) \ |
| 57 M(ChainContext, ChainContextComp) \ | 57 M(ChainContext, ChainContextComp) \ |
| 58 M(CloneContext, CloneContextComp) \ | 58 M(CloneContext, CloneContextComp) \ |
| 59 M(CatchEntry, CatchEntryComp) \ |
| 59 | 60 |
| 60 | 61 |
| 61 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; | 62 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; |
| 62 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) | 63 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) |
| 63 #undef FORWARD_DECLARATION | 64 #undef FORWARD_DECLARATION |
| 64 | 65 |
| 65 class Computation : public ZoneAllocated { | 66 class Computation : public ZoneAllocated { |
| 66 public: | 67 public: |
| 67 Computation() { } | 68 Computation() { } |
| 68 | 69 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 private: | 179 private: |
| 179 Value* value_; | 180 Value* value_; |
| 180 | 181 |
| 181 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); | 182 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 | 185 |
| 185 class ClosureCallComp : public Computation { | 186 class ClosureCallComp : public Computation { |
| 186 public: | 187 public: |
| 187 ClosureCallComp(ClosureCallNode* node, | 188 ClosureCallComp(ClosureCallNode* node, |
| 189 intptr_t try_index, |
| 188 Value* context, | 190 Value* context, |
| 189 ZoneGrowableArray<Value*>* arguments) | 191 ZoneGrowableArray<Value*>* arguments) |
| 190 : ast_node_(*node), | 192 : ast_node_(*node), |
| 193 try_index_(try_index), |
| 191 context_(context), | 194 context_(context), |
| 192 arguments_(arguments) { | 195 arguments_(arguments) { |
| 193 ASSERT(context->IsTemp()); | 196 ASSERT(context->IsTemp()); |
| 194 } | 197 } |
| 195 | 198 |
| 196 DECLARE_COMPUTATION(ClosureCall) | 199 DECLARE_COMPUTATION(ClosureCall) |
| 197 | 200 |
| 198 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 201 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
| 199 intptr_t token_index() const { return ast_node_.token_index(); } | 202 intptr_t token_index() const { return ast_node_.token_index(); } |
| 203 intptr_t try_index() const { return try_index_; } |
| 200 | 204 |
| 201 Value* context() const { return context_; } | 205 Value* context() const { return context_; } |
| 202 intptr_t ArgumentCount() const { return arguments_->length(); } | 206 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 203 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 207 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 204 | 208 |
| 205 private: | 209 private: |
| 206 const ClosureCallNode& ast_node_; | 210 const ClosureCallNode& ast_node_; |
| 211 const intptr_t try_index_; |
| 207 Value* context_; | 212 Value* context_; |
| 208 ZoneGrowableArray<Value*>* arguments_; | 213 ZoneGrowableArray<Value*>* arguments_; |
| 209 | 214 |
| 210 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); | 215 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); |
| 211 }; | 216 }; |
| 212 | 217 |
| 213 | 218 |
| 214 class InstanceCallComp : public Computation { | 219 class InstanceCallComp : public Computation { |
| 215 public: | 220 public: |
| 216 InstanceCallComp(intptr_t node_id, | 221 InstanceCallComp(intptr_t node_id, |
| 217 intptr_t token_index, | 222 intptr_t token_index, |
| 223 intptr_t try_index, |
| 218 const String& function_name, | 224 const String& function_name, |
| 219 ZoneGrowableArray<Value*>* arguments, | 225 ZoneGrowableArray<Value*>* arguments, |
| 220 const Array& argument_names, | 226 const Array& argument_names, |
| 221 intptr_t checked_argument_count) | 227 intptr_t checked_argument_count) |
| 222 : node_id_(node_id), | 228 : node_id_(node_id), |
| 223 token_index_(token_index), | 229 token_index_(token_index), |
| 230 try_index_(try_index), |
| 224 function_name_(function_name), | 231 function_name_(function_name), |
| 225 arguments_(arguments), | 232 arguments_(arguments), |
| 226 argument_names_(argument_names), | 233 argument_names_(argument_names), |
| 227 checked_argument_count_(checked_argument_count) { | 234 checked_argument_count_(checked_argument_count) { |
| 228 ASSERT(function_name.IsZoneHandle()); | 235 ASSERT(function_name.IsZoneHandle()); |
| 229 ASSERT(!arguments->is_empty()); | 236 ASSERT(!arguments->is_empty()); |
| 230 ASSERT(argument_names.IsZoneHandle()); | 237 ASSERT(argument_names.IsZoneHandle()); |
| 231 } | 238 } |
| 232 | 239 |
| 233 DECLARE_COMPUTATION(InstanceCall) | 240 DECLARE_COMPUTATION(InstanceCall) |
| 234 | 241 |
| 235 intptr_t node_id() const { return node_id_; } | 242 intptr_t node_id() const { return node_id_; } |
| 236 intptr_t token_index() const { return token_index_; } | 243 intptr_t token_index() const { return token_index_; } |
| 244 intptr_t try_index() const { return try_index_; } |
| 237 const String& function_name() const { return function_name_; } | 245 const String& function_name() const { return function_name_; } |
| 238 intptr_t ArgumentCount() const { return arguments_->length(); } | 246 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 239 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 247 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 240 const Array& argument_names() const { return argument_names_; } | 248 const Array& argument_names() const { return argument_names_; } |
| 241 intptr_t checked_argument_count() const { return checked_argument_count_; } | 249 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 242 | 250 |
| 243 private: | 251 private: |
| 244 const intptr_t node_id_; | 252 const intptr_t node_id_; |
| 245 const intptr_t token_index_; | 253 const intptr_t token_index_; |
| 254 const intptr_t try_index_; |
| 246 const String& function_name_; | 255 const String& function_name_; |
| 247 ZoneGrowableArray<Value*>* const arguments_; | 256 ZoneGrowableArray<Value*>* const arguments_; |
| 248 const Array& argument_names_; | 257 const Array& argument_names_; |
| 249 const intptr_t checked_argument_count_; | 258 const intptr_t checked_argument_count_; |
| 250 | 259 |
| 251 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 260 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 252 }; | 261 }; |
| 253 | 262 |
| 254 | 263 |
| 255 class StrictCompareComp : public Computation { | 264 class StrictCompareComp : public Computation { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 270 Value* left_; | 279 Value* left_; |
| 271 Value* right_; | 280 Value* right_; |
| 272 | 281 |
| 273 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); | 282 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); |
| 274 }; | 283 }; |
| 275 | 284 |
| 276 | 285 |
| 277 class StaticCallComp : public Computation { | 286 class StaticCallComp : public Computation { |
| 278 public: | 287 public: |
| 279 StaticCallComp(intptr_t token_index, | 288 StaticCallComp(intptr_t token_index, |
| 289 intptr_t try_index, |
| 280 const Function& function, | 290 const Function& function, |
| 281 const Array& argument_names, | 291 const Array& argument_names, |
| 282 ZoneGrowableArray<Value*>* arguments) | 292 ZoneGrowableArray<Value*>* arguments) |
| 283 : token_index_(token_index), | 293 : token_index_(token_index), |
| 294 try_index_(try_index), |
| 284 function_(function), | 295 function_(function), |
| 285 argument_names_(argument_names), | 296 argument_names_(argument_names), |
| 286 arguments_(arguments) { | 297 arguments_(arguments) { |
| 287 ASSERT(function.IsZoneHandle()); | 298 ASSERT(function.IsZoneHandle()); |
| 288 ASSERT(argument_names.IsZoneHandle()); | 299 ASSERT(argument_names.IsZoneHandle()); |
| 289 } | 300 } |
| 290 | 301 |
| 291 DECLARE_COMPUTATION(StaticCall) | 302 DECLARE_COMPUTATION(StaticCall) |
| 292 | 303 |
| 293 // Accessors forwarded to the AST node. | 304 // Accessors forwarded to the AST node. |
| 294 const Function& function() const { return function_; } | 305 const Function& function() const { return function_; } |
| 295 const Array& argument_names() const { return argument_names_; } | 306 const Array& argument_names() const { return argument_names_; } |
| 296 intptr_t token_index() const { return token_index_; } | 307 intptr_t token_index() const { return token_index_; } |
| 308 intptr_t try_index() const { return try_index_; } |
| 297 | 309 |
| 298 intptr_t ArgumentCount() const { return arguments_->length(); } | 310 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 299 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 311 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 300 | 312 |
| 301 private: | 313 private: |
| 302 const intptr_t token_index_; | 314 const intptr_t token_index_; |
| 315 const intptr_t try_index_; |
| 303 const Function& function_; | 316 const Function& function_; |
| 304 const Array& argument_names_; | 317 const Array& argument_names_; |
| 305 ZoneGrowableArray<Value*>* arguments_; | 318 ZoneGrowableArray<Value*>* arguments_; |
| 306 | 319 |
| 307 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 320 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 308 }; | 321 }; |
| 309 | 322 |
| 310 | 323 |
| 311 class LoadLocalComp : public Computation { | 324 class LoadLocalComp : public Computation { |
| 312 public: | 325 public: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 343 const LocalVariable& local_; | 356 const LocalVariable& local_; |
| 344 Value* value_; | 357 Value* value_; |
| 345 const intptr_t context_level_; | 358 const intptr_t context_level_; |
| 346 | 359 |
| 347 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); | 360 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); |
| 348 }; | 361 }; |
| 349 | 362 |
| 350 | 363 |
| 351 class NativeCallComp : public Computation { | 364 class NativeCallComp : public Computation { |
| 352 public: | 365 public: |
| 353 explicit NativeCallComp(NativeBodyNode* node) : ast_node_(*node) {} | 366 NativeCallComp(NativeBodyNode* node, intptr_t try_index) |
| 367 : ast_node_(*node), try_index_(try_index) {} |
| 354 | 368 |
| 355 DECLARE_COMPUTATION(NativeCall) | 369 DECLARE_COMPUTATION(NativeCall) |
| 356 | 370 |
| 357 intptr_t token_index() const { return ast_node_.token_index(); } | 371 intptr_t token_index() const { return ast_node_.token_index(); } |
| 372 intptr_t try_index() const { return try_index_; } |
| 358 | 373 |
| 359 const String& native_name() const { | 374 const String& native_name() const { |
| 360 return ast_node_.native_c_function_name(); | 375 return ast_node_.native_c_function_name(); |
| 361 } | 376 } |
| 362 | 377 |
| 363 NativeFunction native_c_function() const { | 378 NativeFunction native_c_function() const { |
| 364 return ast_node_.native_c_function(); | 379 return ast_node_.native_c_function(); |
| 365 } | 380 } |
| 366 | 381 |
| 367 intptr_t argument_count() const { return ast_node_.argument_count(); } | 382 intptr_t argument_count() const { return ast_node_.argument_count(); } |
| 368 | 383 |
| 369 bool has_optional_parameters() const { | 384 bool has_optional_parameters() const { |
| 370 return ast_node_.has_optional_parameters(); | 385 return ast_node_.has_optional_parameters(); |
| 371 } | 386 } |
| 372 | 387 |
| 373 private: | 388 private: |
| 374 const NativeBodyNode& ast_node_; | 389 const NativeBodyNode& ast_node_; |
| 390 const intptr_t try_index_; |
| 375 | 391 |
| 376 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); | 392 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); |
| 377 }; | 393 }; |
| 378 | 394 |
| 379 | 395 |
| 380 class LoadInstanceFieldComp : public Computation { | 396 class LoadInstanceFieldComp : public Computation { |
| 381 public: | 397 public: |
| 382 LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance) | 398 LoadInstanceFieldComp(LoadInstanceFieldNode* ast_node, Value* instance) |
| 383 : ast_node_(*ast_node), instance_(instance) { | 399 : ast_node_(*ast_node), instance_(instance) { |
| 384 ASSERT(instance_ != NULL); | 400 ASSERT(instance_ != NULL); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); | 478 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); |
| 463 }; | 479 }; |
| 464 | 480 |
| 465 | 481 |
| 466 // Not simply an InstanceCall because it has somewhat more complicated | 482 // Not simply an InstanceCall because it has somewhat more complicated |
| 467 // semantics: the value operand is preserved before the call. | 483 // semantics: the value operand is preserved before the call. |
| 468 class StoreIndexedComp : public Computation { | 484 class StoreIndexedComp : public Computation { |
| 469 public: | 485 public: |
| 470 StoreIndexedComp(intptr_t node_id, | 486 StoreIndexedComp(intptr_t node_id, |
| 471 intptr_t token_index, | 487 intptr_t token_index, |
| 488 intptr_t try_index, |
| 472 Value* array, | 489 Value* array, |
| 473 Value* index, | 490 Value* index, |
| 474 Value* value) | 491 Value* value) |
| 475 : node_id_(node_id), | 492 : node_id_(node_id), |
| 476 token_index_(token_index), | 493 token_index_(token_index), |
| 494 try_index_(try_index), |
| 477 array_(array), | 495 array_(array), |
| 478 index_(index), | 496 index_(index), |
| 479 value_(value) { } | 497 value_(value) { } |
| 480 | 498 |
| 481 DECLARE_COMPUTATION(StoreIndexed) | 499 DECLARE_COMPUTATION(StoreIndexed) |
| 482 | 500 |
| 483 intptr_t node_id() const { return node_id_; } | 501 intptr_t node_id() const { return node_id_; } |
| 484 intptr_t token_index() const { return token_index_; } | 502 intptr_t token_index() const { return token_index_; } |
| 503 intptr_t try_index() const { return try_index_; } |
| 485 Value* array() const { return array_; } | 504 Value* array() const { return array_; } |
| 486 Value* index() const { return index_; } | 505 Value* index() const { return index_; } |
| 487 Value* value() const { return value_; } | 506 Value* value() const { return value_; } |
| 488 | 507 |
| 489 private: | 508 private: |
| 490 intptr_t node_id_; | 509 const intptr_t node_id_; |
| 491 intptr_t token_index_; | 510 const intptr_t token_index_; |
| 511 const intptr_t try_index_; |
| 492 Value* array_; | 512 Value* array_; |
| 493 Value* index_; | 513 Value* index_; |
| 494 Value* value_; | 514 Value* value_; |
| 495 | 515 |
| 496 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); | 516 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); |
| 497 }; | 517 }; |
| 498 | 518 |
| 499 | 519 |
| 500 // Not simply an InstanceCall because it has somewhat more complicated | 520 // Not simply an InstanceCall because it has somewhat more complicated |
| 501 // semantics: the value operand is preserved before the call. | 521 // semantics: the value operand is preserved before the call. |
| 502 class InstanceSetterComp : public Computation { | 522 class InstanceSetterComp : public Computation { |
| 503 public: | 523 public: |
| 504 InstanceSetterComp(intptr_t node_id, | 524 InstanceSetterComp(intptr_t node_id, |
| 505 intptr_t token_index, | 525 intptr_t token_index, |
| 526 intptr_t try_index, |
| 506 const String& field_name, | 527 const String& field_name, |
| 507 Value* receiver, | 528 Value* receiver, |
| 508 Value* value) | 529 Value* value) |
| 509 : node_id_(node_id), | 530 : node_id_(node_id), |
| 510 token_index_(token_index), | 531 token_index_(token_index), |
| 532 try_index_(try_index), |
| 511 field_name_(field_name), | 533 field_name_(field_name), |
| 512 receiver_(receiver), | 534 receiver_(receiver), |
| 513 value_(value) { } | 535 value_(value) { } |
| 514 | 536 |
| 515 DECLARE_COMPUTATION(InstanceSetter) | 537 DECLARE_COMPUTATION(InstanceSetter) |
| 516 | 538 |
| 517 intptr_t node_id() const { return node_id_; } | 539 intptr_t node_id() const { return node_id_; } |
| 518 intptr_t token_index() const { return token_index_; } | 540 intptr_t token_index() const { return token_index_; } |
| 541 intptr_t try_index() const { return try_index_; } |
| 519 const String& field_name() const { return field_name_; } | 542 const String& field_name() const { return field_name_; } |
| 520 Value* receiver() const { return receiver_; } | 543 Value* receiver() const { return receiver_; } |
| 521 Value* value() const { return value_; } | 544 Value* value() const { return value_; } |
| 522 | 545 |
| 523 private: | 546 private: |
| 524 const intptr_t node_id_; | 547 const intptr_t node_id_; |
| 525 const intptr_t token_index_; | 548 const intptr_t token_index_; |
| 549 const intptr_t try_index_; |
| 526 const String& field_name_; | 550 const String& field_name_; |
| 527 Value* const receiver_; | 551 Value* const receiver_; |
| 528 Value* const value_; | 552 Value* const value_; |
| 529 | 553 |
| 530 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); | 554 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); |
| 531 }; | 555 }; |
| 532 | 556 |
| 533 | 557 |
| 534 // Not simply a StaticCall because it has somewhat more complicated | 558 // Not simply a StaticCall because it has somewhat more complicated |
| 535 // semantics: the value operand is preserved before the call. | 559 // semantics: the value operand is preserved before the call. |
| 536 class StaticSetterComp : public Computation { | 560 class StaticSetterComp : public Computation { |
| 537 public: | 561 public: |
| 538 StaticSetterComp(intptr_t token_index, | 562 StaticSetterComp(intptr_t token_index, |
| 563 intptr_t try_index, |
| 539 const Function& setter_function, | 564 const Function& setter_function, |
| 540 Value* value) | 565 Value* value) |
| 541 : token_index_(token_index), | 566 : token_index_(token_index), |
| 567 try_index_(try_index), |
| 542 setter_function_(setter_function), | 568 setter_function_(setter_function), |
| 543 value_(value) { } | 569 value_(value) { } |
| 544 | 570 |
| 545 DECLARE_COMPUTATION(StaticSetter) | 571 DECLARE_COMPUTATION(StaticSetter) |
| 546 | 572 |
| 547 intptr_t token_index() const { return token_index_; } | 573 intptr_t token_index() const { return token_index_; } |
| 574 intptr_t try_index() const { return try_index_; } |
| 548 const Function& setter_function() const { return setter_function_; } | 575 const Function& setter_function() const { return setter_function_; } |
| 549 Value* value() const { return value_; } | 576 Value* value() const { return value_; } |
| 550 | 577 |
| 551 private: | 578 private: |
| 552 const intptr_t token_index_; | 579 const intptr_t token_index_; |
| 580 const intptr_t try_index_; |
| 553 const Function& setter_function_; | 581 const Function& setter_function_; |
| 554 Value* const value_; | 582 Value* const value_; |
| 555 | 583 |
| 556 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp); | 584 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp); |
| 557 }; | 585 }; |
| 558 | 586 |
| 559 | 587 |
| 560 // Note overrideable, built-in: value? false : true. | 588 // Note overrideable, built-in: value? false : true. |
| 561 class BooleanNegateComp : public Computation { | 589 class BooleanNegateComp : public Computation { |
| 562 public: | 590 public: |
| 563 explicit BooleanNegateComp(Value* value) : value_(value) {} | 591 explicit BooleanNegateComp(Value* value) : value_(value) {} |
| 564 | 592 |
| 565 DECLARE_COMPUTATION(BooleanNegate) | 593 DECLARE_COMPUTATION(BooleanNegate) |
| 566 | 594 |
| 567 Value* value() const { return value_; } | 595 Value* value() const { return value_; } |
| 568 | 596 |
| 569 private: | 597 private: |
| 570 Value* value_; | 598 Value* value_; |
| 571 | 599 |
| 572 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); | 600 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); |
| 573 }; | 601 }; |
| 574 | 602 |
| 575 | 603 |
| 576 class InstanceOfComp : public Computation { | 604 class InstanceOfComp : public Computation { |
| 577 public: | 605 public: |
| 578 InstanceOfComp(intptr_t node_id, | 606 InstanceOfComp(intptr_t node_id, |
| 579 intptr_t token_index, | 607 intptr_t token_index, |
| 608 intptr_t try_index, |
| 580 Value* value, | 609 Value* value, |
| 581 const AbstractType& type, | 610 const AbstractType& type, |
| 582 bool negate_result) | 611 bool negate_result) |
| 583 : node_id_(node_id), | 612 : node_id_(node_id), |
| 584 token_index_(token_index), | 613 token_index_(token_index), |
| 614 try_index_(try_index), |
| 585 value_(value), | 615 value_(value), |
| 586 type_(type), | 616 type_(type), |
| 587 negate_result_(negate_result) {} | 617 negate_result_(negate_result) {} |
| 588 | 618 |
| 589 DECLARE_COMPUTATION(InstanceOf) | 619 DECLARE_COMPUTATION(InstanceOf) |
| 590 | 620 |
| 591 Value* value() const { return value_; } | 621 Value* value() const { return value_; } |
| 592 bool negate_result() const { return negate_result_; } | 622 bool negate_result() const { return negate_result_; } |
| 593 const AbstractType& type() const { return type_; } | 623 const AbstractType& type() const { return type_; } |
| 594 intptr_t node_id() const { return node_id_; } | 624 intptr_t node_id() const { return node_id_; } |
| 595 intptr_t token_index() const { return token_index_; } | 625 intptr_t token_index() const { return token_index_; } |
| 626 intptr_t try_index() const { return try_index_; } |
| 596 | 627 |
| 597 private: | 628 private: |
| 598 const intptr_t node_id_; | 629 const intptr_t node_id_; |
| 599 const intptr_t token_index_; | 630 const intptr_t token_index_; |
| 631 const intptr_t try_index_; |
| 600 Value* value_; | 632 Value* value_; |
| 601 const AbstractType& type_; | 633 const AbstractType& type_; |
| 602 const bool negate_result_; | 634 const bool negate_result_; |
| 603 | 635 |
| 604 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); | 636 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); |
| 605 }; | 637 }; |
| 606 | 638 |
| 607 | 639 |
| 608 class AllocateObjectComp : public Computation { | 640 class AllocateObjectComp : public Computation { |
| 609 public: | 641 public: |
| 610 AllocateObjectComp(ConstructorCallNode* node, | 642 AllocateObjectComp(ConstructorCallNode* node, |
| 643 intptr_t try_index, |
| 611 ZoneGrowableArray<Value*>* arguments) | 644 ZoneGrowableArray<Value*>* arguments) |
| 612 : ast_node_(*node), arguments_(arguments) { | 645 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { |
| 613 // Either no arguments or one type-argument and one instantiator. | 646 // Either no arguments or one type-argument and one instantiator. |
| 614 ASSERT(arguments->is_empty() || (arguments->length() == 2)); | 647 ASSERT(arguments->is_empty() || (arguments->length() == 2)); |
| 615 } | 648 } |
| 616 | 649 |
| 617 DECLARE_COMPUTATION(AllocateObject) | 650 DECLARE_COMPUTATION(AllocateObject) |
| 618 | 651 |
| 619 const Function& constructor() const { return ast_node_.constructor(); } | 652 const Function& constructor() const { return ast_node_.constructor(); } |
| 620 intptr_t token_index() const { return ast_node_.token_index(); } | 653 intptr_t token_index() const { return ast_node_.token_index(); } |
| 654 intptr_t try_index() const { return try_index_; } |
| 621 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } | 655 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } |
| 622 | 656 |
| 623 private: | 657 private: |
| 624 const ConstructorCallNode& ast_node_; | 658 const ConstructorCallNode& ast_node_; |
| 659 const intptr_t try_index_; |
| 625 ZoneGrowableArray<Value*>* const arguments_; | 660 ZoneGrowableArray<Value*>* const arguments_; |
| 626 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); | 661 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); |
| 627 }; | 662 }; |
| 628 | 663 |
| 629 | 664 |
| 630 class CreateArrayComp : public Computation { | 665 class CreateArrayComp : public Computation { |
| 631 public: | 666 public: |
| 632 CreateArrayComp(ArrayNode* node, ZoneGrowableArray<Value*>* elements) | 667 CreateArrayComp(ArrayNode* node, |
| 633 : ast_node_(*node), elements_(elements) { } | 668 intptr_t try_index, |
| 669 ZoneGrowableArray<Value*>* elements) |
| 670 : ast_node_(*node), try_index_(try_index), elements_(elements) { } |
| 634 | 671 |
| 635 DECLARE_COMPUTATION(CreateArray) | 672 DECLARE_COMPUTATION(CreateArray) |
| 636 | 673 |
| 637 intptr_t token_index() const { return ast_node_.token_index(); } | 674 intptr_t token_index() const { return ast_node_.token_index(); } |
| 675 intptr_t try_index() const { return try_index_; } |
| 638 const AbstractTypeArguments& type_arguments() const { | 676 const AbstractTypeArguments& type_arguments() const { |
| 639 return ast_node_.type_arguments(); | 677 return ast_node_.type_arguments(); |
| 640 } | 678 } |
| 641 intptr_t ElementCount() const { return elements_->length(); } | 679 intptr_t ElementCount() const { return elements_->length(); } |
| 642 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } | 680 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } |
| 643 | 681 |
| 644 private: | 682 private: |
| 645 const ArrayNode& ast_node_; | 683 const ArrayNode& ast_node_; |
| 684 const intptr_t try_index_; |
| 646 ZoneGrowableArray<Value*>* const elements_; | 685 ZoneGrowableArray<Value*>* const elements_; |
| 647 | 686 |
| 648 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); | 687 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); |
| 649 }; | 688 }; |
| 650 | 689 |
| 651 | 690 |
| 652 class CreateClosureComp : public Computation { | 691 class CreateClosureComp : public Computation { |
| 653 public: | 692 public: |
| 654 // 'type_arguments' is null if function() does not require type arguments. | 693 // 'type_arguments' is null if function() does not require type arguments. |
| 655 CreateClosureComp(ClosureNode* node, Value* type_arguments) | 694 CreateClosureComp(ClosureNode* node, |
| 656 : ast_node_(*node), type_arguments_(type_arguments) { } | 695 intptr_t try_index, |
| 696 Value* type_arguments) |
| 697 : ast_node_(*node), |
| 698 try_index_(try_index), |
| 699 type_arguments_(type_arguments) {} |
| 657 | 700 |
| 658 DECLARE_COMPUTATION(CreateClosure) | 701 DECLARE_COMPUTATION(CreateClosure) |
| 659 | 702 |
| 660 intptr_t token_index() const { return ast_node_.token_index(); } | 703 intptr_t token_index() const { return ast_node_.token_index(); } |
| 704 intptr_t try_index() const { return try_index_; } |
| 661 const Function& function() const { return ast_node_.function(); } | 705 const Function& function() const { return ast_node_.function(); } |
| 662 Value* type_arguments() const { return type_arguments_; } | 706 Value* type_arguments() const { return type_arguments_; } |
| 663 | 707 |
| 664 private: | 708 private: |
| 665 const ClosureNode& ast_node_; | 709 const ClosureNode& ast_node_; |
| 710 const intptr_t try_index_; |
| 666 Value* type_arguments_; | 711 Value* type_arguments_; |
| 667 | 712 |
| 668 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); | 713 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); |
| 669 }; | 714 }; |
| 670 | 715 |
| 671 | 716 |
| 672 class NativeLoadFieldComp : public Computation { | 717 class NativeLoadFieldComp : public Computation { |
| 673 public: | 718 public: |
| 674 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes) | 719 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes) |
| 675 : value_(value), offset_in_bytes_(offset_in_bytes) { | 720 : value_(value), offset_in_bytes_(offset_in_bytes) { |
| 676 ASSERT(value != NULL); | 721 ASSERT(value != NULL); |
| 677 } | 722 } |
| 678 | 723 |
| 679 DECLARE_COMPUTATION(NativeLoadField) | 724 DECLARE_COMPUTATION(NativeLoadField) |
| 680 | 725 |
| 681 Value* value() const { return value_; } | 726 Value* value() const { return value_; } |
| 682 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 727 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| 683 | 728 |
| 684 private: | 729 private: |
| 685 Value* value_; | 730 Value* value_; |
| 686 intptr_t offset_in_bytes_; | 731 intptr_t offset_in_bytes_; |
| 687 | 732 |
| 688 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp); | 733 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp); |
| 689 }; | 734 }; |
| 690 | 735 |
| 691 | 736 |
| 692 class ExtractFactoryTypeArgumentsComp : public Computation { | 737 class ExtractFactoryTypeArgumentsComp : public Computation { |
| 693 public: | 738 public: |
| 694 ExtractFactoryTypeArgumentsComp(ConstructorCallNode* ast_node, | 739 ExtractFactoryTypeArgumentsComp(ConstructorCallNode* ast_node, |
| 740 intptr_t try_index, |
| 695 Value* instantiator) | 741 Value* instantiator) |
| 696 : ast_node_(*ast_node), instantiator_(instantiator) { | 742 : ast_node_(*ast_node), |
| 743 try_index_(try_index), |
| 744 instantiator_(instantiator) { |
| 697 ASSERT(instantiator_ != NULL); | 745 ASSERT(instantiator_ != NULL); |
| 698 } | 746 } |
| 699 | 747 |
| 700 DECLARE_COMPUTATION(ExtractFactoryTypeArguments) | 748 DECLARE_COMPUTATION(ExtractFactoryTypeArguments) |
| 701 | 749 |
| 702 Value* instantiator() const { return instantiator_; } | 750 Value* instantiator() const { return instantiator_; } |
| 703 const AbstractTypeArguments& type_arguments() const { | 751 const AbstractTypeArguments& type_arguments() const { |
| 704 return ast_node_.type_arguments(); | 752 return ast_node_.type_arguments(); |
| 705 } | 753 } |
| 706 const Function& factory() const { return ast_node_.constructor(); } | 754 const Function& factory() const { return ast_node_.constructor(); } |
| 707 intptr_t node_id() const { return ast_node_.id(); } | 755 intptr_t node_id() const { return ast_node_.id(); } |
| 708 intptr_t token_index() const { return ast_node_.token_index(); } | 756 intptr_t token_index() const { return ast_node_.token_index(); } |
| 757 intptr_t try_index() const { return try_index_; } |
| 709 | 758 |
| 710 private: | 759 private: |
| 711 const ConstructorCallNode& ast_node_; | 760 const ConstructorCallNode& ast_node_; |
| 761 const intptr_t try_index_; |
| 712 Value* instantiator_; | 762 Value* instantiator_; |
| 713 | 763 |
| 714 DISALLOW_COPY_AND_ASSIGN(ExtractFactoryTypeArgumentsComp); | 764 DISALLOW_COPY_AND_ASSIGN(ExtractFactoryTypeArgumentsComp); |
| 715 }; | 765 }; |
| 716 | 766 |
| 717 | 767 |
| 718 class ExtractConstructorTypeArgumentsComp : public Computation { | 768 class ExtractConstructorTypeArgumentsComp : public Computation { |
| 719 public: | 769 public: |
| 720 ExtractConstructorTypeArgumentsComp(ConstructorCallNode* ast_node, | 770 ExtractConstructorTypeArgumentsComp(ConstructorCallNode* ast_node, |
| 721 Value* instantiator) | 771 Value* instantiator) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 const ConstructorCallNode& ast_node_; | 817 const ConstructorCallNode& ast_node_; |
| 768 Value* instantiator_; | 818 Value* instantiator_; |
| 769 Value* discard_value_; | 819 Value* discard_value_; |
| 770 | 820 |
| 771 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); | 821 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); |
| 772 }; | 822 }; |
| 773 | 823 |
| 774 | 824 |
| 775 class AllocateContextComp : public Computation { | 825 class AllocateContextComp : public Computation { |
| 776 public: | 826 public: |
| 777 AllocateContextComp(intptr_t token_index, intptr_t num_context_variables) | 827 AllocateContextComp(intptr_t token_index, |
| 828 intptr_t try_index, |
| 829 intptr_t num_context_variables) |
| 778 : token_index_(token_index), | 830 : token_index_(token_index), |
| 831 try_index_(try_index), |
| 779 num_context_variables_(num_context_variables) {} | 832 num_context_variables_(num_context_variables) {} |
| 780 | 833 |
| 781 DECLARE_COMPUTATION(AllocateContext); | 834 DECLARE_COMPUTATION(AllocateContext); |
| 782 | 835 |
| 783 intptr_t token_index() const { return token_index_; } | 836 intptr_t token_index() const { return token_index_; } |
| 837 intptr_t try_index() const { return try_index_; } |
| 784 intptr_t num_context_variables() const { return num_context_variables_; } | 838 intptr_t num_context_variables() const { return num_context_variables_; } |
| 785 | 839 |
| 786 private: | 840 private: |
| 787 const intptr_t token_index_; | 841 const intptr_t token_index_; |
| 842 const intptr_t try_index_; |
| 788 const intptr_t num_context_variables_; | 843 const intptr_t num_context_variables_; |
| 789 | 844 |
| 790 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); | 845 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); |
| 791 }; | 846 }; |
| 792 | 847 |
| 793 | 848 |
| 794 class ChainContextComp : public Computation { | 849 class ChainContextComp : public Computation { |
| 795 public: | 850 public: |
| 796 explicit ChainContextComp(Value* context_value) | 851 explicit ChainContextComp(Value* context_value) |
| 797 : context_value_(context_value) { | 852 : context_value_(context_value) { |
| 798 ASSERT(context_value_ != NULL); | 853 ASSERT(context_value_ != NULL); |
| 799 } | 854 } |
| 800 | 855 |
| 801 DECLARE_COMPUTATION(ChainContext) | 856 DECLARE_COMPUTATION(ChainContext) |
| 802 | 857 |
| 803 Value* context_value() const { return context_value_; } | 858 Value* context_value() const { return context_value_; } |
| 804 | 859 |
| 805 private: | 860 private: |
| 806 Value* context_value_; | 861 Value* context_value_; |
| 807 | 862 |
| 808 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); | 863 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); |
| 809 }; | 864 }; |
| 810 | 865 |
| 811 | 866 |
| 812 class CloneContextComp : public Computation { | 867 class CloneContextComp : public Computation { |
| 813 public: | 868 public: |
| 814 CloneContextComp(intptr_t node_id, | 869 CloneContextComp(intptr_t node_id, |
| 815 intptr_t token_index, | 870 intptr_t token_index, |
| 871 intptr_t try_index, |
| 816 Value* context_value) | 872 Value* context_value) |
| 817 : node_id_(node_id), | 873 : node_id_(node_id), |
| 818 token_index_(token_index), | 874 token_index_(token_index), |
| 875 try_index_(try_index), |
| 819 context_value_(context_value) { | 876 context_value_(context_value) { |
| 820 ASSERT(context_value_ != NULL); | 877 ASSERT(context_value_ != NULL); |
| 821 } | 878 } |
| 822 | 879 |
| 823 intptr_t node_id() const { return node_id_; } | 880 intptr_t node_id() const { return node_id_; } |
| 824 intptr_t token_index() const { return token_index_; } | 881 intptr_t token_index() const { return token_index_; } |
| 882 intptr_t try_index() const { return try_index_; } |
| 825 Value* context_value() const { return context_value_; } | 883 Value* context_value() const { return context_value_; } |
| 826 | 884 |
| 827 DECLARE_COMPUTATION(CloneContext) | 885 DECLARE_COMPUTATION(CloneContext) |
| 828 | 886 |
| 829 private: | 887 private: |
| 830 const intptr_t node_id_; | 888 const intptr_t node_id_; |
| 831 const intptr_t token_index_; | 889 const intptr_t token_index_; |
| 890 const intptr_t try_index_; |
| 832 Value* context_value_; | 891 Value* context_value_; |
| 833 | 892 |
| 834 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); | 893 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); |
| 835 }; | 894 }; |
| 836 | 895 |
| 837 | 896 |
| 897 class CatchEntryComp : public Computation { |
| 898 public: |
| 899 CatchEntryComp(const LocalVariable& exception_var, |
| 900 const LocalVariable& stacktrace_var) |
| 901 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} |
| 902 |
| 903 const LocalVariable& exception_var() const { return exception_var_; } |
| 904 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } |
| 905 |
| 906 DECLARE_COMPUTATION(CatchEntry) |
| 907 |
| 908 private: |
| 909 const LocalVariable& exception_var_; |
| 910 const LocalVariable& stacktrace_var_; |
| 911 |
| 912 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp); |
| 913 }; |
| 914 |
| 915 |
| 838 #undef DECLARE_COMPUTATION | 916 #undef DECLARE_COMPUTATION |
| 839 | 917 |
| 840 | 918 |
| 841 // Instructions. | 919 // Instructions. |
| 842 // | 920 // |
| 843 // <Instruction> ::= JoinEntry <Instruction> | 921 // <Instruction> ::= JoinEntry <Instruction> |
| 844 // | TargetEntry <Instruction> | 922 // | TargetEntry <Instruction> |
| 845 // | PickTemp <int> <int> <Instruction> | 923 // | PickTemp <int> <int> <Instruction> |
| 846 // | TuckTemp <int> <int> <Instruction> | 924 // | TuckTemp <int> <int> <Instruction> |
| 847 // | Do <Computation> <Instruction> | 925 // | Do <Computation> <Instruction> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 ZoneGrowableArray<BlockEntryInstr*> predecessors_; | 1075 ZoneGrowableArray<BlockEntryInstr*> predecessors_; |
| 998 Instruction* successor_; | 1076 Instruction* successor_; |
| 999 | 1077 |
| 1000 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 1078 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
| 1001 }; | 1079 }; |
| 1002 | 1080 |
| 1003 | 1081 |
| 1004 class TargetEntryInstr : public BlockEntryInstr { | 1082 class TargetEntryInstr : public BlockEntryInstr { |
| 1005 public: | 1083 public: |
| 1006 TargetEntryInstr() | 1084 TargetEntryInstr() |
| 1007 : BlockEntryInstr(), predecessor_(NULL), successor_(NULL) { } | 1085 : BlockEntryInstr(), |
| 1086 predecessor_(NULL), |
| 1087 successor_(NULL), |
| 1088 try_index_(CatchClauseNode::kInvalidTryIndex) { } |
| 1089 |
| 1090 // Used for exception catch entries. |
| 1091 explicit TargetEntryInstr(intptr_t try_index) |
| 1092 : BlockEntryInstr(), |
| 1093 predecessor_(NULL), |
| 1094 successor_(NULL), |
| 1095 try_index_(try_index) { } |
| 1008 | 1096 |
| 1009 DECLARE_INSTRUCTION(TargetEntry) | 1097 DECLARE_INSTRUCTION(TargetEntry) |
| 1010 | 1098 |
| 1011 virtual intptr_t PredecessorCount() const { | 1099 virtual intptr_t PredecessorCount() const { |
| 1012 return (predecessor_ == NULL) ? 0 : 1; | 1100 return (predecessor_ == NULL) ? 0 : 1; |
| 1013 } | 1101 } |
| 1014 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 1102 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 1015 ASSERT((index == 0) && (predecessor_ != NULL)); | 1103 ASSERT((index == 0) && (predecessor_ != NULL)); |
| 1016 return predecessor_; | 1104 return predecessor_; |
| 1017 } | 1105 } |
| 1018 | 1106 |
| 1019 virtual Instruction* StraightLineSuccessor() const { | 1107 virtual Instruction* StraightLineSuccessor() const { |
| 1020 return successor_; | 1108 return successor_; |
| 1021 } | 1109 } |
| 1022 virtual void SetSuccessor(Instruction* instr) { | 1110 virtual void SetSuccessor(Instruction* instr) { |
| 1023 ASSERT(successor_ == NULL); | 1111 ASSERT(successor_ == NULL); |
| 1024 successor_ = instr; | 1112 successor_ = instr; |
| 1025 } | 1113 } |
| 1026 | 1114 |
| 1027 virtual void DiscoverBlocks( | 1115 virtual void DiscoverBlocks( |
| 1028 BlockEntryInstr* current_block, | 1116 BlockEntryInstr* current_block, |
| 1029 GrowableArray<BlockEntryInstr*>* preorder, | 1117 GrowableArray<BlockEntryInstr*>* preorder, |
| 1030 GrowableArray<BlockEntryInstr*>* postorder, | 1118 GrowableArray<BlockEntryInstr*>* postorder, |
| 1031 GrowableArray<intptr_t>* parent); | 1119 GrowableArray<intptr_t>* parent); |
| 1032 | 1120 |
| 1121 bool HasTryIndex() const { |
| 1122 return try_index_ != CatchClauseNode::kInvalidTryIndex; |
| 1123 } |
| 1124 |
| 1125 intptr_t try_index() const { |
| 1126 ASSERT(HasTryIndex()); |
| 1127 return try_index_; |
| 1128 } |
| 1129 |
| 1033 private: | 1130 private: |
| 1034 BlockEntryInstr* predecessor_; | 1131 BlockEntryInstr* predecessor_; |
| 1035 Instruction* successor_; | 1132 Instruction* successor_; |
| 1133 const intptr_t try_index_; |
| 1036 | 1134 |
| 1037 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); | 1135 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); |
| 1038 }; | 1136 }; |
| 1039 | 1137 |
| 1040 | 1138 |
| 1041 // The non-optimizing compiler assumes that there is exactly one use of | 1139 // The non-optimizing compiler assumes that there is exactly one use of |
| 1042 // every temporary so they can be deallocated at their use. Some AST nodes, | 1140 // every temporary so they can be deallocated at their use. Some AST nodes, |
| 1043 // e.g., expr0[expr1]++, violate this assumption (there are two uses of each | 1141 // e.g., expr0[expr1]++, violate this assumption (there are two uses of each |
| 1044 // of the values expr0 and expr1). | 1142 // of the values expr0 and expr1). |
| 1045 // | 1143 // |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 private: | 1276 private: |
| 1179 Value* value_; | 1277 Value* value_; |
| 1180 intptr_t token_index_; | 1278 intptr_t token_index_; |
| 1181 | 1279 |
| 1182 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 1280 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 1183 }; | 1281 }; |
| 1184 | 1282 |
| 1185 | 1283 |
| 1186 class ThrowInstr : public Instruction { | 1284 class ThrowInstr : public Instruction { |
| 1187 public: | 1285 public: |
| 1188 ThrowInstr(intptr_t node_id, intptr_t token_index, Value* exception) | 1286 ThrowInstr(intptr_t node_id, |
| 1287 intptr_t token_index, |
| 1288 intptr_t try_index, |
| 1289 Value* exception) |
| 1189 : node_id_(node_id), | 1290 : node_id_(node_id), |
| 1190 token_index_(token_index), | 1291 token_index_(token_index), |
| 1292 try_index_(try_index), |
| 1191 exception_(exception), | 1293 exception_(exception), |
| 1192 successor_(NULL) { | 1294 successor_(NULL) { |
| 1193 ASSERT(exception_ != NULL); | 1295 ASSERT(exception_ != NULL); |
| 1194 } | 1296 } |
| 1195 | 1297 |
| 1196 DECLARE_INSTRUCTION(Throw) | 1298 DECLARE_INSTRUCTION(Throw) |
| 1197 | 1299 |
| 1198 intptr_t node_id() const { return node_id_; } | 1300 intptr_t node_id() const { return node_id_; } |
| 1199 intptr_t token_index() const { return token_index_; } | 1301 intptr_t token_index() const { return token_index_; } |
| 1302 intptr_t try_index() const { return try_index_; } |
| 1200 Value* exception() const { return exception_; } | 1303 Value* exception() const { return exception_; } |
| 1201 | 1304 |
| 1202 // Parser can generate a throw within an expression tree. | 1305 // Parser can generate a throw within an expression tree. |
| 1203 virtual Instruction* StraightLineSuccessor() const { | 1306 virtual Instruction* StraightLineSuccessor() const { |
| 1204 return successor_; | 1307 return successor_; |
| 1205 } | 1308 } |
| 1206 virtual void SetSuccessor(Instruction* instr) { | 1309 virtual void SetSuccessor(Instruction* instr) { |
| 1207 ASSERT(successor_ == NULL); | 1310 ASSERT(successor_ == NULL); |
| 1208 successor_ = instr; | 1311 successor_ = instr; |
| 1209 } | 1312 } |
| 1210 | 1313 |
| 1211 private: | 1314 private: |
| 1212 intptr_t node_id_; | 1315 const intptr_t node_id_; |
| 1213 intptr_t token_index_; | 1316 const intptr_t token_index_; |
| 1317 const intptr_t try_index_; |
| 1214 Value* exception_; | 1318 Value* exception_; |
| 1215 Instruction* successor_; | 1319 Instruction* successor_; |
| 1216 | 1320 |
| 1217 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 1321 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 1218 }; | 1322 }; |
| 1219 | 1323 |
| 1220 | 1324 |
| 1221 class ReThrowInstr : public Instruction { | 1325 class ReThrowInstr : public Instruction { |
| 1222 public: | 1326 public: |
| 1223 ReThrowInstr(intptr_t node_id, | 1327 ReThrowInstr(intptr_t node_id, |
| 1224 intptr_t token_index, | 1328 intptr_t token_index, |
| 1329 intptr_t try_index, |
| 1225 Value* exception, | 1330 Value* exception, |
| 1226 Value* stack_trace) | 1331 Value* stack_trace) |
| 1227 : node_id_(node_id), | 1332 : node_id_(node_id), |
| 1228 token_index_(token_index), | 1333 token_index_(token_index), |
| 1334 try_index_(try_index), |
| 1229 exception_(exception), | 1335 exception_(exception), |
| 1230 stack_trace_(stack_trace), | 1336 stack_trace_(stack_trace), |
| 1231 successor_(NULL) { | 1337 successor_(NULL) { |
| 1232 ASSERT(exception_ != NULL); | 1338 ASSERT(exception_ != NULL); |
| 1233 ASSERT(stack_trace_ != NULL); | 1339 ASSERT(stack_trace_ != NULL); |
| 1234 } | 1340 } |
| 1235 | 1341 |
| 1236 DECLARE_INSTRUCTION(ReThrow) | 1342 DECLARE_INSTRUCTION(ReThrow) |
| 1237 | 1343 |
| 1238 intptr_t node_id() const { return node_id_; } | 1344 intptr_t node_id() const { return node_id_; } |
| 1239 intptr_t token_index() const { return token_index_; } | 1345 intptr_t token_index() const { return token_index_; } |
| 1346 intptr_t try_index() const { return try_index_; } |
| 1240 Value* exception() const { return exception_; } | 1347 Value* exception() const { return exception_; } |
| 1241 Value* stack_trace() const { return stack_trace_; } | 1348 Value* stack_trace() const { return stack_trace_; } |
| 1242 | 1349 |
| 1243 // Parser can generate a rethrow within an expression tree. | 1350 // Parser can generate a rethrow within an expression tree. |
| 1244 virtual Instruction* StraightLineSuccessor() const { | 1351 virtual Instruction* StraightLineSuccessor() const { |
| 1245 return successor_; | 1352 return successor_; |
| 1246 } | 1353 } |
| 1247 virtual void SetSuccessor(Instruction* instr) { | 1354 virtual void SetSuccessor(Instruction* instr) { |
| 1248 ASSERT(successor_ == NULL); | 1355 ASSERT(successor_ == NULL); |
| 1249 successor_ = instr; | 1356 successor_ = instr; |
| 1250 } | 1357 } |
| 1251 | 1358 |
| 1252 private: | 1359 private: |
| 1253 intptr_t node_id_; | 1360 const intptr_t node_id_; |
| 1254 intptr_t token_index_; | 1361 const intptr_t token_index_; |
| 1362 const intptr_t try_index_; |
| 1255 Value* exception_; | 1363 Value* exception_; |
| 1256 Value* stack_trace_; | 1364 Value* stack_trace_; |
| 1257 Instruction* successor_; | 1365 Instruction* successor_; |
| 1258 | 1366 |
| 1259 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 1367 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 1260 }; | 1368 }; |
| 1261 | 1369 |
| 1262 | 1370 |
| 1263 class BranchInstr : public Instruction { | 1371 class BranchInstr : public Instruction { |
| 1264 public: | 1372 public: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 const GrowableArray<BlockEntryInstr*>& block_order_; | 1441 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1334 | 1442 |
| 1335 private: | 1443 private: |
| 1336 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1444 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1337 }; | 1445 }; |
| 1338 | 1446 |
| 1339 | 1447 |
| 1340 } // namespace dart | 1448 } // namespace dart |
| 1341 | 1449 |
| 1342 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1450 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |